:root {
  --line: #d9dde3;
  --text: #1f2937;
  --muted: #6b7280;
  --blue: #2f6fed;
  --orange: #d97706;
  --red: #dc2626;
  --green: #15803d;
  --brand: #111827;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    linear-gradient(rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.86)),
    url("../assets/quickshow-pattern-board.png") center top / cover no-repeat fixed,
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  color: var(--text);
}

body.auth-locked .frame {
  display: none;
}

.login-screen {
  min-height: 100vh;
  padding: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.90)),
    url("../assets/quickshow-pattern-board.png") center / cover no-repeat,
    #f8fafc;
}

body.auth-locked .login-screen {
  display: flex;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.12);
  padding: 24px;
}

.login-logo {
  width: 240px;
  height: 52px;
  margin-bottom: 18px;
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.login-card h1 {
  margin: 0;
  font-size: 24px;
}

.login-card p {
  margin: 6px 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.login-field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.login-field span {
  font-size: 12px;
  color: var(--muted);
}

.login-field input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
}

.login-button {
  width: 100%;
}

.login-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.login-message {
  min-height: 20px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.login-message.error {
  color: var(--red);
}

.logout-button {
  cursor: pointer;
}

.user-chip {
  font-weight: 600;
}

.frame {
  width: 100%;
  min-height: 100vh;
  padding: 22px clamp(14px, 1.6vw, 32px) 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  width: 290px;
  height: 58px;
  flex: 0 0 290px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 24, 39, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  padding: 0 12px;
}

.logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.1;
  white-space: nowrap;
}

.brand-copy p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  min-height: 36px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  padding: 9px 12px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

.tabs {
  display: inline-flex;
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
  margin-bottom: 14px;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.06);
}

.tab {
  min-width: 180px;
  height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-right: 1px solid rgba(17, 24, 39, 0.10);
  font-size: 14px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.tab:last-child {
  border-right: 0;
}

.tab.active {
  background: linear-gradient(180deg, #111827 0%, #374151 100%);
  color: #fff;
  font-weight: 600;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(17, 24, 39, 0.10);
  border-radius: 10px;
  padding: 16px;
  min-height: 92px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
}

.stat span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.stat p {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 24, 39, 0.10);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.06);
}

.panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
}

.panel-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.panel-count {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f3f4f6;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.panel-body {
  padding: 16px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 300px);
  overflow: auto;
}

.order-card {
  border: 1px solid rgba(17, 24, 39, 0.10);
  background: rgba(255, 255, 255, 0.76);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  grid-template-columns: 92px 1fr 150px;
  gap: 14px;
  align-items: center;
}

.order-card.overdue {
  border-left: 4px solid var(--red);
}

.order-card.ship {
  border-left: 4px solid var(--blue);
}

.thumb {
  width: 92px;
  height: 92px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, 0.10);
  background: #f8fafc;
  display: grid;
  place-items: center;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb.missing span {
  font-size: 12px;
  color: var(--muted);
  padding: 8px;
  text-align: center;
}

.order-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.order-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.order-no {
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}

.order-sub,
.remark,
.amount small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.feige-order-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.feige-order-link:hover {
  text-decoration: underline;
}

.remark {
  color: #4b5563;
}

.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.tag {
  font-size: 11px;
  border-radius: 999px;
  padding: 4px 8px;
  background: #f3f4f6;
  color: #374151;
  white-space: nowrap;
}

.tag.blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.tag.red {
  background: #fee2e2;
  color: #b91c1c;
}

.tag.orange {
  background: #ffedd5;
  color: #c2410c;
}

.tag.green {
  background: #dcfce7;
  color: #166534;
}

.amount {
  text-align: right;
}

.amount strong {
  display: block;
  font-size: 20px;
}

.amount small {
  display: block;
  margin-top: 4px;
}

.footer-note {
  margin: 0;
  padding: 0 16px 16px;
  font-size: 12px;
  color: var(--muted);
}

.tabpanel {
  display: none;
}

.tabpanel.active {
  display: flex;
}

.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
}

.empty.compact {
  padding: 18px;
}

.drawer {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 40;
}

.drawer.open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(560px, 100%);
  height: 100%;
  background: #fff;
  border-left: 1px solid rgba(17, 24, 39, 0.10);
  box-shadow: -18px 0 50px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
}

.drawer-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.drawer-head h2,
.drawer-section-title {
  margin: 0;
  font-size: 16px;
}

.drawer-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.drawer-body {
  padding: 16px 20px 20px;
  display: grid;
  gap: 14px;
  overflow: auto;
}

.drawer-section {
  border: 1px solid rgba(17, 24, 39, 0.10);
  border-radius: 10px;
  padding: 14px;
  background: #fff;
  display: grid;
  gap: 12px;
}

.drawer-section.attention {
  border-left: 4px solid var(--orange);
}

.drawer-order-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.drawer-order-no {
  font-size: 18px;
  font-weight: 700;
}

.drawer-order-meta,
.drawer-order-status {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.drawer-order-status {
  text-align: right;
  color: var(--red);
  font-weight: 600;
}

.drawer-image {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  overflow: hidden;
  min-height: 220px;
  display: grid;
  place-items: center;
}

.drawer-image-button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.drawer-image img {
  width: 100%;
  height: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

.drawer-image-empty {
  display: none;
  width: 100%;
  min-height: 220px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.drawer-order-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.drawer-order-grid span,
.node-grid span,
.field span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.drawer-order-grid strong,
.node-grid strong {
  font-size: 14px;
}

.node-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.node-progress {
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
}

.field {
  display: grid;
}

.field textarea,
.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.field textarea {
  resize: vertical;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
}

.primary-button {
  background: var(--brand);
  color: #fff;
}

.secondary-button {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.drawer-warning {
  display: none;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-day {
  margin: 4px 0 -2px;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fafafa;
}

.history-item strong {
  display: block;
  font-size: 13px;
}

.history-item p,
.history-item small {
  display: block;
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.thumb-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.image-viewer.open {
  display: block;
}

.image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.86);
}

.image-viewer-panel {
  position: absolute;
  inset: 22px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.image-viewer-head {
  min-height: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: #fff;
}

.image-viewer-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.image-viewer-close {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.image-viewer-body {
  min-height: 0;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0 0 24px;
  overscroll-behavior: contain;
}

.image-viewer-body img {
  width: min(100%, 920px);
  height: auto;
  max-height: none;
  display: block;
  background: #fff;
}

.admin-page .frame {
  max-width: 100%;
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-filters {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 180px 180px minmax(220px, 1fr) 180px;
  gap: 12px;
  background: rgba(248, 250, 252, 0.72);
}

.admin-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 360px);
}

.admin-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.94);
  font-size: 12px;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #374151;
  font-weight: 700;
  white-space: nowrap;
}

.admin-table td:nth-child(8),
.admin-table td:nth-child(9) {
  min-width: 220px;
}

.admin-empty {
  display: none;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border-top: 1px dashed var(--line);
}

@media (max-width: 900px) {
  .frame {
    padding: 14px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .logo {
    width: 220px;
    flex-basis: 58px;
  }

  .brand-copy h1 {
    font-size: 23px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-card {
    grid-template-columns: 76px 1fr;
  }

  .thumb {
    width: 76px;
    height: 76px;
  }

  .amount {
    grid-column: 2;
    text-align: left;
  }

  .drawer-panel {
    width: 100%;
  }

  .image-viewer-panel {
    inset: 12px;
  }

  .field-row,
  .drawer-order-grid,
  .node-grid,
  .admin-filters {
    grid-template-columns: 1fr;
  }

  .admin-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-actions,
  .admin-actions button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .controls,
  .tabs {
    width: 100%;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tab {
    min-width: 0;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .order-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-body {
    max-height: none;
  }

  .order-card {
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: flex-start;
  }
}
