:root {
  color-scheme: light;
  --bg: #f2f5f4;
  --panel: #ffffff;
  --panel-soft: #f7f9f8;
  --ink: #18201e;
  --muted: #68746f;
  --line: #dce4e1;
  --brand: #0d6755;
  --brand-dark: #08493d;
  --brand-soft: #e2f2ed;
  --orange: #df722c;
  --orange-soft: #fff0e5;
  --danger: #c6403a;
  --danger-soft: #fff0ef;
  --blue: #2f6f9f;
  --blue-soft: #e9f2f8;
  --success: #2b7b54;
  --success-soft: #e7f4ec;
  --shadow: 0 14px 40px rgba(23, 42, 36, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(13, 103, 85, 0.08), transparent 28rem),
    var(--bg);
  font-family:
    "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(13, 103, 85, 0.22);
  outline-offset: 2px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 460px);
  padding: 34px;
  border: 1px solid rgba(13, 103, 85, 0.12);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.logo-mark {
  display: inline-grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin-bottom: 20px;
  border-radius: 16px;
  color: #fff;
  background: var(--brand);
  font-size: 26px;
  font-weight: 800;
  box-shadow: 0 12px 22px rgba(13, 103, 85, 0.22);
}

.login-card h1 {
  margin: 0;
  font-size: clamp(25px, 6vw, 34px);
  letter-spacing: -0.04em;
}

.login-card > p {
  margin: 10px 0 26px;
  color: var(--muted);
  line-height: 1.7;
}

.field {
  display: grid;
  gap: 8px;
}

.field + .field {
  margin-top: 16px;
}

.field label,
.field-label {
  color: #44504c;
  font-size: 14px;
  font-weight: 700;
}

.field input,
.field select,
.search-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cfd9d5;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}

.field input:focus,
.field select:focus,
.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(13, 103, 85, 0.08);
}

.primary-button,
.secondary-button,
.ghost-button,
.tiny-button,
.action-button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  padding: 0 16px;
  font-weight: 750;
  transition:
    transform 0.14s,
    filter 0.14s,
    background 0.14s;
}

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

.primary-button:hover {
  background: var(--brand-dark);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.tiny-button:active,
.action-button:active {
  transform: translateY(1px);
}

.login-button {
  width: 100%;
  margin-top: 22px;
}

.demo-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #705738;
  background: #fff7e8;
  font-size: 13px;
  line-height: 1.6;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 96px;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 10px clamp(16px, 4vw, 34px);
  border-bottom: 1px solid rgba(207, 217, 213, 0.85);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: var(--brand);
  font-weight: 850;
}

.brand-copy strong,
.brand-copy span {
  display: block;
}

.brand-copy strong {
  font-size: 16px;
}

.brand-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 9px;
}

.user-pill {
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-size: 13px;
  font-weight: 750;
}

.ghost-button {
  color: #48534f;
  background: #edf1ef;
}

.page {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding-top: 28px;
}

.welcome-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.welcome-row h1 {
  margin: 0;
  font-size: clamp(25px, 4vw, 38px);
  letter-spacing: -0.04em;
}

.welcome-row p {
  margin: 7px 0 0;
  color: var(--muted);
}

.source-chip {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid #d7e1dd;
  border-radius: 999px;
  color: #53605b;
  background: rgba(255, 255, 255, 0.74);
  font-size: 12px;
}

.excel-sync-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid #bfd7cf;
  border-radius: 16px;
  background: linear-gradient(135deg, #eff8f5, #ffffff);
}

.excel-sync-panel h2 {
  margin: 0;
  font-size: 17px;
}

.excel-sync-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.import-button {
  flex: 0 0 auto;
  min-height: 44px;
  border: 0;
  border-radius: 11px;
  padding: 0 16px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
}

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

.sync-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
}

.backup-button {
  min-height: 44px;
  border: 1px solid #a9ccc0;
  border-radius: 11px;
  padding: 0 14px;
  color: var(--brand-dark);
  background: #fff;
  font-weight: 800;
}

.sync-indicator {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

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

.stat-card {
  min-height: 98px;
  padding: 18px;
  border: 1px solid rgba(216, 225, 222, 0.9);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

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

.stat-card.urgent strong {
  color: var(--danger);
}

.search-panel {
  padding: 20px;
  border: 1px solid rgba(207, 217, 213, 0.9);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 10px 32px rgba(30, 48, 42, 0.06);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 19px;
}

.panel-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.sample-button {
  min-height: 38px;
  border: 1px solid #bfd7cf;
  border-radius: 10px;
  padding: 0 12px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-size: 13px;
  font-weight: 750;
}

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

.search-grid .field {
  margin-top: 0;
}

.search-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 15px;
}

.button-group {
  display: flex;
  gap: 9px;
}

.secondary-button {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.search-message {
  color: var(--muted);
  font-size: 13px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  margin-top: 18px;
}

.results-panel,
.activity-panel {
  min-width: 0;
  border: 1px solid rgba(207, 217, 213, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.order-list-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 14px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 249, 248, 0.78);
}

.list-tab {
  min-height: 43px;
  border: 0;
  border-radius: 11px 11px 0 0;
  padding: 0 16px;
  color: #55615c;
  background: transparent;
  font-weight: 800;
}

.list-tab span {
  display: inline-grid;
  min-width: 23px;
  min-height: 23px;
  place-items: center;
  margin-left: 5px;
  border-radius: 999px;
  background: #e5ebe8;
  font-size: 11px;
}

.list-tab.is-active {
  color: var(--brand-dark);
  background: #fff;
  box-shadow: inset 0 3px 0 var(--brand);
}

.list-tab.is-active span {
  color: #fff;
  background: var(--brand);
}

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

.results-title strong {
  display: block;
  font-size: 16px;
}

.results-title span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.filters {
  display: flex;
  gap: 8px;
}

.filters select {
  min-height: 38px;
  max-width: 138px;
  border: 1px solid #d5deda;
  border-radius: 10px;
  background: #fff;
  padding: 0 10px;
  color: #46514d;
  font-size: 13px;
}

.order-list {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.order-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}

.order-card:hover {
  border-color: #bdd2ca;
  box-shadow: 0 8px 24px rgba(27, 47, 40, 0.06);
}

.order-card.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 103, 85, 0.08);
}

.select-box {
  padding-top: 2px;
}

.select-box input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
}

.order-main {
  min-width: 0;
}

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

.order-identity {
  min-width: 0;
}

.customer-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.customer-name {
  font-size: 18px;
  font-weight: 850;
}

.order-ref {
  color: var(--blue);
  font-size: 13px;
  font-weight: 750;
}

.item-name {
  margin-top: 6px;
  color: #3f4a46;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.badges {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 800;
}

.progress-纸板已下单 {
  color: #255f8a;
  background: var(--blue-soft);
}

.progress-生产中 {
  color: #985016;
  background: var(--orange-soft);
}

.progress-已完成 {
  color: #246a47;
  background: var(--success-soft);
}

.priority-正常 {
  color: #53615c;
  background: #edf1ef;
}

.priority-等通知 {
  color: #665f57;
  background: #eeeae5;
}

.priority-加急 {
  color: #a8342f;
  background: var(--danger-soft);
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.spec {
  min-width: 0;
  padding: 10px 11px;
  border-radius: 10px;
  background: var(--panel-soft);
}

.spec span,
.meta-row span {
  color: var(--muted);
  font-size: 11px;
}

.spec strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 11px;
  color: #4f5a56;
  font-size: 12px;
}

.meta-row b {
  color: #38433f;
  font-weight: 750;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px dashed #dbe3e0;
}

.action-button {
  min-height: 35px;
  padding: 0 11px;
  color: #48534f;
  background: #eef2f0;
  font-size: 12px;
}

.action-button:hover {
  filter: brightness(0.97);
}

.action-button.is-active {
  color: #fff;
  background: var(--brand);
}

.action-button.danger.is-active {
  background: var(--danger);
}

.action-divider {
  width: 1px;
  background: var(--line);
}

.activity-panel {
  align-self: start;
  overflow: hidden;
}

.activity-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px 12px 17px;
  border-bottom: 1px solid var(--line);
}

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

.activity-list {
  display: grid;
  gap: 0;
}

.activity-item {
  padding: 13px 16px;
  border-bottom: 1px solid #e7ecea;
}

.activity-item:last-child {
  border-bottom: 0;
}

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

.activity-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.empty-state {
  padding: 46px 20px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 16px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 22px;
}

.empty-state h3 {
  margin: 0;
  font-size: 17px;
}

.empty-state p {
  max-width: 430px;
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.batch-bar {
  position: fixed;
  z-index: 30;
  right: 50%;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(720px, calc(100% - 28px));
  padding: 10px 12px 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  color: #fff;
  background: rgba(24, 32, 30, 0.96);
  box-shadow: 0 18px 44px rgba(16, 26, 23, 0.24);
  transform: translateX(50%);
}

.batch-bar strong {
  margin-right: auto;
  white-space: nowrap;
  font-size: 14px;
}

.batch-bar button {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  padding: 0 12px;
  font-weight: 800;
}

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

.batch-secondary {
  color: #eef5f2;
  background: rgba(255, 255, 255, 0.12);
}

.batch-danger {
  color: #fff;
  background: var(--danger);
}

.tiny-button {
  min-height: 32px;
  padding: 0 10px;
  color: #55615c;
  background: #eef2f0;
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 24px;
  max-width: min(92vw, 480px);
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  background: #1d2824;
  box-shadow: 0 12px 30px rgba(18, 32, 27, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.import-overlay {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 25, 22, 0.46);
  backdrop-filter: blur(4px);
}

.import-overlay[hidden] {
  display: none;
}

.import-overlay-card {
  display: grid;
  justify-items: center;
  width: min(100%, 410px);
  padding: 30px 26px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(13, 30, 24, 0.24);
  text-align: center;
}

.import-overlay-card strong {
  margin-top: 14px;
  font-size: 18px;
}

.import-overlay-card span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.admin-dialog {
  position: fixed;
  z-index: 45;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 36, 30, 0.48);
  backdrop-filter: blur(5px);
}

.admin-dialog[hidden] {
  display: none;
}

.admin-dialog-card {
  width: min(100%, 400px);
  padding: 24px;
  border: 1px solid #c4dbd3;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(6, 42, 34, 0.24);
}

.admin-dialog-card h2 {
  margin: 14px 0 4px;
  font-size: 22px;
}

.admin-dialog-card p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.admin-logo {
  width: 44px;
  height: 44px;
  font-size: 20px;
}

.admin-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.loading-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid #d9ebe5;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .activity-panel {
    order: 2;
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 60px;
    padding-inline: 13px;
  }

  .brand-copy span,
  .source-chip {
    display: none;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .user-pill {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page {
    width: min(100% - 20px, 1180px);
    padding-top: 19px;
  }

  .welcome-row {
    align-items: flex-start;
  }

  .excel-sync-panel {
    align-items: stretch;
    flex-direction: column;
    gap: 13px;
  }

  .sync-actions {
    width: 100%;
  }

  .sync-actions > button {
    flex: 1 1 0;
  }

  .import-button {
    min-width: 0;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat-card {
    min-height: 82px;
    padding: 14px;
  }

  .stat-card strong {
    font-size: 23px;
  }

  .search-panel {
    padding: 15px;
    border-radius: 16px;
  }

  .panel-heading {
    display: grid;
  }

  .sample-button {
    justify-self: start;
  }

  .search-grid {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

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

  .button-group {
    width: 100%;
  }

  .button-group button {
    flex: 1;
  }

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

  .order-list-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding-inline: 9px;
  }

  .list-tab {
    padding-inline: 8px;
    font-size: 13px;
  }

  .filters {
    width: 100%;
  }

  .filters select {
    flex: 1;
    max-width: none;
  }

  .order-list {
    padding: 9px;
  }

  .order-card {
    gap: 8px;
    padding: 14px 12px;
  }

  .order-topline {
    display: grid;
  }

  .badges {
    justify-content: flex-start;
  }

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

  .action-divider {
    display: none;
  }

  .batch-bar {
    bottom: 8px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px;
  }

  .batch-bar strong {
    width: 100%;
    margin: 0;
    text-align: center;
  }

  .batch-bar button {
    flex: 1;
    min-width: 92px;
  }

  .login-card {
    padding: 26px 20px;
  }
}
