:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #66736b;
  --line: #d8ded8;
  --paper: #f6f4ee;
  --surface: #ffffff;
  --panel: #eef3ee;
  --primary: #28745a;
  --primary-dark: #19523f;
  --accent: #d99b3d;
  --danger: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea { font: inherit; }

button {
  min-height: 40px;
  padding: 0 14px;
  color: #fff;
  background: var(--ink);
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
}

button:hover { filter: brightness(0.97); }
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible { outline: 3px solid rgba(217, 155, 61, 0.35); outline-offset: 2px; }

.primary { background: var(--primary); }
.ghost { color: var(--ink); background: #fff; border-color: var(--line); }
.danger-text { color: var(--danger); }
.download {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  border-radius: 7px;
}
.hidden { display: none !important; }
.subline { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }

.shell { min-height: 100vh; }

.beian-footer {
  width: 100%;
  padding: 14px 18px 18px;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.beian-footer a {
  color: var(--muted);
  text-decoration: none;
}

.beian-footer a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.login {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: center;
  gap: 42px;
  width: min(1040px, calc(100vw - 40px));
  margin: 0 auto;
}

.login h1 {
  margin: 8px 0 0;
  font-size: clamp(36px, 6vw, 72px);
  line-height: 1;
}

.login p {
  max-width: 560px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.login-card {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 18px 45px rgba(23, 33, 27, 0.08);
}

.login-card img {
  width: 280px;
  height: 280px;
  object-fit: contain;
  background: var(--panel);
}

#loginStatus { margin-top: 14px; color: var(--muted); }

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: #17211b;
  color: #fff;
}

.brand {
  display: grid;
  gap: 6px;
  margin-bottom: 28px;
}

.brand span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: #17211b;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 900;
}

.brand strong { font-size: 18px; }
.nav { display: grid; gap: 8px; }
.nav-item { justify-content: flex-start; width: 100%; color: #dfe7df; background: transparent; border-color: rgba(255,255,255,0.12); text-align: left; }
.nav-item.active { color: #17211b; background: var(--accent); border-color: var(--accent); }

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar,
.panel-head,
.job-head,
.order-head,
.user-row,
.toolbar,
.header-actions,
.order-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar,
.panel-head,
.job-head,
.order-head,
.user-row { justify-content: space-between; }

h1,
h2 { margin: 0; line-height: 1.18; }
h1 { font-size: 30px; }
h2 { font-size: 19px; }

.stats {
  margin: 22px 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
}

.stat {
  min-height: 92px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat span { display: block; font-size: 30px; font-weight: 900; }
.stat label { color: var(--muted); font-size: 13px; }

.toolbar {
  align-items: stretch;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar input { width: min(360px, 100%); }

input,
select,
textarea {
  min-height: 40px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

textarea {
  width: 100%;
  min-height: 160px;
  padding: 12px;
  resize: vertical;
}

.orders,
.jobs,
.users { display: grid; gap: 14px; }

.panel,
.order-card,
.job,
.user-row {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(23, 33, 27, 0.05);
}

.order-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(40, 116, 90, 0.14); }
.order-title { display: grid; gap: 5px; }
.goods { font-size: 20px; font-weight: 900; }
.progress { color: var(--muted); font-size: 13px; }
.order-actions { flex-wrap: wrap; justify-content: flex-end; }
.order-actions button { min-height: 34px; padding: 0 10px; font-size: 13px; }

.stage-track {
  margin: 14px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 6px;
}

.stage-pill {
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 0 8px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
  text-align: center;
}

.stage-pill.done { color: #fff; background: var(--primary); border-color: var(--primary); }
.stage-pill.current { color: var(--ink); background: var(--accent); border-color: var(--accent); font-weight: 800; }

.order-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.field {
  padding: 10px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 7px;
  min-width: 0;
}

.field label { display: block; color: var(--muted); font-size: 12px; }
.field span { display: block; margin-top: 3px; overflow-wrap: anywhere; font-weight: 700; }
.order-desc { margin: 10px 0 0; color: var(--muted); line-height: 1.6; }

.detail-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-panel {
  padding: 12px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-panel h3 { margin: 0 0 10px; font-size: 15px; }
.action-list,
.inspection-list { display: grid; gap: 8px; }
.action-row,
.inspection-row { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.action-row strong,
.inspection-row strong { color: var(--ink); }
a { color: var(--primary-dark); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.tpl {
  min-height: 116px;
  padding: 13px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tpl.done { background: #eef9f2; border-color: #8bc9a5; }
.tpl-title { font-weight: 800; }
.tpl-meta { margin-top: 6px; color: var(--muted); font-size: 13px; }
.records { margin-top: 10px; display: grid; gap: 7px; font-size: 13px; }
.records strong { color: var(--muted); }
.records span { overflow-wrap: anywhere; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb { position: relative; width: 66px; height: 66px; overflow: hidden; background: var(--panel); border-radius: 7px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; right: 2px; top: 2px; min-height: 20px; width: 20px; padding: 0; font-size: 12px; background: rgba(23, 33, 27, 0.82); }
.thumb .adjust-photo { left: 4px; right: auto; top: auto; bottom: 4px; width: auto; padding: 0 7px; border-radius: 10px; color: #fff; background: rgba(37, 99, 235, 0.9); }

.role {
  min-width: 62px;
  padding: 6px 10px;
  text-align: center;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 900;
}
.role.admin { color: #854d0e; background: #fef3c7; }
.role.user { color: #166534; background: #dcfce7; }
.user-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel);
}

.avatar-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
}

.user-actions { display: flex; gap: 8px; align-items: center; }

.archive-list { display: grid; gap: 10px; margin: 12px 0; }
.archive-day {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.archive-day summary {
  display: flex;
  justify-content: space-between;
  padding: 13px 15px;
  cursor: pointer;
  background: #f7f9f6;
}
.archive-day summary span,
.archive-row small { color: var(--muted); }
.archive-rows { display: grid; }
.archive-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 15px;
  border-top: 1px solid var(--line);
}
.archive-row:first-child { border-top: 0; }
.archive-row > div:first-child { display: grid; gap: 4px; min-width: 0; }
.archive-row strong,
.archive-row small { overflow-wrap: anywhere; }
.archive-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.panel.compact { padding: 12px 15px; }

dialog {
  width: min(720px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(23, 33, 27, 0.28);
}

.dialog-card { padding: 22px; }
.dialog-card h2 { margin-bottom: 14px; }
.form-grid,
.tool-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-grid label,
.full-label,
.tool-fields label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 800; }
.full-label { margin-top: 10px; }
.tool-fields .full-label { grid-column: 1 / -1; }
.dialog-actions { justify-content: flex-end; margin-top: 14px; }

@media (max-width: 900px) {
  .login,
  .app,
  .detail-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .stats { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
}

@media (max-width: 640px) {
  .workspace { padding: 18px; }
  .topbar,
  .panel-head,
  .job-head,
  .order-head,
  .user-row,
  .header-actions,
  .toolbar,
  .order-actions,
  .archive-row,
  .archive-actions,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .form-grid,
  .tool-fields,
  .stats { grid-template-columns: 1fr; }
  .toolbar input,
  .toolbar button,
  .toolbar select,
  .order-actions button,
  .header-actions button { width: 100%; }
}

/* 2026 visual refresh: preserve the existing app structure and behavior. */
:root {
  --ink: #0f172a;
  --muted: #526077;
  --line: #dce3ec;
  --paper: #f4f7fb;
  --surface: #ffffff;
  --panel: #edf3f9;
  --primary: #075f9e;
  --primary-dark: #064b7a;
  --accent: #e8b44f;
  --danger: #c82921;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.08);
  --radius-sm: 10px;
  --radius-md: 16px;
}

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

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 85% 5%, rgba(7, 95, 158, 0.07), transparent 28rem),
    var(--paper);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.5;
}

button,
.download,
input,
select { min-height: 44px; }

button,
.download {
  border-radius: var(--radius-sm);
  font-weight: 700;
  touch-action: manipulation;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

button:hover,
.download:hover { filter: none; box-shadow: 0 5px 14px rgba(15, 23, 42, 0.12); }
button:active,
.download:active { box-shadow: var(--shadow-sm); }
button:disabled { cursor: not-allowed; opacity: 0.55; box-shadow: none; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(7, 95, 158, 0.3);
  outline-offset: 3px;
}

.primary,
.download.primary { background: var(--primary); }
.primary:hover,
.download.primary:hover { background: var(--primary-dark); }
.ghost { background: rgba(255, 255, 255, 0.92); }

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.login {
  position: relative;
  min-height: calc(100vh - 52px);
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 400px);
  gap: clamp(48px, 8vw, 112px);
  width: min(1180px, calc(100vw - 64px));
  padding: 64px 0;
}

.login::before {
  content: "BSM";
  position: absolute;
  top: 32px;
  left: 0;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 15px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.06em;
  box-shadow: var(--shadow-md);
}

.login-copy { max-width: 670px; }
.login h1 {
  max-width: 8em;
  margin: 14px 0 0;
  font-size: clamp(46px, 7vw, 82px);
  letter-spacing: -0.045em;
}

.login p {
  max-width: 600px;
  margin: 24px 0 0;
  color: #46536a;
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.85;
}

.login-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.login-meta span {
  padding: 7px 12px;
  color: #334155;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.login-card {
  position: relative;
  padding: 28px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.14);
}

.login-card::before {
  content: "安全登录";
  display: block;
  margin-bottom: 18px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  text-align: left;
}

.login-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 14px;
}

#loginStatus { min-height: 24px; margin-top: 16px; }
.beian-footer { padding-bottom: 20px; }

.app { grid-template-columns: 252px minmax(0, 1fr); }

.sidebar {
  padding: 24px 18px;
  background: linear-gradient(180deg, #0f172a 0%, #172238 100%);
  box-shadow: 8px 0 28px rgba(15, 23, 42, 0.08);
}

.brand { gap: 10px; margin-bottom: 34px; }
.brand span {
  width: 54px;
  height: 54px;
  color: var(--ink);
  border-radius: 15px;
  letter-spacing: 0.04em;
}
.brand strong { font-size: 17px; }
.nav { gap: 6px; }
.nav-item {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-color: transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, 0.08); box-shadow: none; }
.nav-item.active { color: var(--ink); background: var(--accent); }

.workspace { padding: clamp(22px, 3vw, 42px); }
.topbar { min-height: 64px; }
h1 { font-size: clamp(27px, 3vw, 36px); letter-spacing: -0.025em; }
h2 { font-size: 20px; }
.subline { color: var(--muted); font-size: 14px; }

.stats { margin: 28px 0; gap: 14px; }
.stat {
  min-height: 108px;
  padding: 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.stat span { color: var(--ink); font-size: 34px; letter-spacing: -0.04em; }
.stat label { margin-top: 4px; font-size: 13px; }

.panel,
.order-card,
.job,
.user-row {
  border-color: rgba(203, 213, 225, 0.8);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.order-card:hover,
.job:hover { border-color: #b8c6d8; box-shadow: var(--shadow-md); }

input,
select,
textarea {
  border-color: #cbd5e1;
  border-radius: var(--radius-sm);
}
input:hover,
select:hover,
textarea:hover { border-color: #94a3b8; }

.stage-pill,
.field,
.detail-panel,
.tpl,
.archive-day { border-radius: var(--radius-sm); }
.field,
.detail-panel,
.tpl { background: #f8fafc; }
.archive-day { box-shadow: var(--shadow-sm); }

dialog {
  border-radius: 20px;
  box-shadow: 0 32px 90px rgba(15, 23, 42, 0.28);
}
dialog::backdrop { background: rgba(15, 23, 42, 0.56); backdrop-filter: blur(3px); }

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; width: min(680px, calc(100vw - 40px)); padding: 120px 0 44px; }
  .login-card { width: min(400px, 100%); }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; padding: 16px; }
  .brand { display: flex; align-items: center; margin-bottom: 16px; }
  .brand span { width: 44px; height: 44px; }
  .nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .nav-item { flex: 0 0 auto; width: auto; white-space: nowrap; }
}

@media (max-width: 640px) {
  .login { width: min(100% - 32px, 520px); gap: 36px; padding-top: 106px; }
  .login::before { top: 26px; }
  .login h1 { font-size: clamp(40px, 13vw, 56px); }
  .login p { margin-top: 18px; }
  .login-meta { margin-top: 22px; }
  .login-card { padding: 20px; border-radius: 18px; }
  .workspace { padding: 20px 16px 32px; }
  .topbar,
  .panel-head,
  .job-head,
  .order-head,
  .user-row,
  .header-actions,
  .toolbar,
  .order-actions,
  .archive-row,
  .archive-actions,
  .dialog-actions { gap: 10px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { min-height: 94px; }
  .dialog-card { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
