/* ============================================================================
   app.css — 佛山美合生物科技有限公司 · GSP 进销存
   配色：米白底 + 深海军蓝文字 + 金（与 React 版一致）
   ========================================================================== */

:root {
  --gold: #cea84e;
  --gold-deep: #af915f;
  --gold-soft: #fce1b6;
  --navy: #0e2b46;
  --navy-2: #143a5e;
  --cream: #f8f7f4;

  --ink: #0e2b46;
  --ink-2: #33475c;
  --muted: #64748b;
  --line: #e8e1d2;
  --line-2: #efe9dc;
  --card: #ffffff;
  --th: #f3eee3;
  --row-alt: #fbfaf7;

  --ok: #1c6b39;
  --ok-bg: #e9f6ee;
  --ok-line: #bfe3cb;
  --warn: #8a5a12;
  --warn-bg: #fdf3de;
  --warn-line: #f0d9a8;
  --bad: #a52a2a;
  --bad-bg: #fdeceb;
  --bad-line: #f3c9c9;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(14, 43, 70, .04), 0 6px 18px rgba(14, 43, 70, .05);
  --shadow-lg: 0 14px 40px rgba(14, 43, 70, .16);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Microsoft YaHei", "Source Han Sans SC", "Hiragino Sans GB", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
table { border-collapse: collapse; }
img, svg { display: block; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* --------------------------------- 图标尺寸 -------------------------------- */
.ico { width: 16px; height: 16px; flex: none; }
.ico-lg { width: 26px; height: 26px; }
.nav-ico { width: 17px; height: 17px; flex: none; }
.card-ico { width: 15px; height: 15px; color: var(--gold-deep); flex: none; }
.todo-ico { width: 19px; height: 19px; color: var(--gold-deep); }

/* --------------------------------- 布局 ----------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex: none;
  background: linear-gradient(180deg, #0e2b46 0%, #0b2136 100%);
  color: #dbe3ec;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 60;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 3px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand-mark {
  width: 38px; height: 38px; flex: none;
  border-radius: 9px;
  background: linear-gradient(150deg, #e3c778, var(--gold) 55%, var(--gold-deep));
  color: #0b2136;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(206, 168, 78, .3);
}
.brand-name { font-family: var(--serif); font-size: 16px; font-weight: 700; color: #fff; letter-spacing: .06em; }
.brand-sub { font-size: 11px; color: rgba(255, 255, 255, .5); letter-spacing: .16em; }

.nav { padding: 14px 12px 20px; flex: 1; }
.nav-group { margin-bottom: 16px; }
.nav-group-title {
  font-size: 10.5px;
  letter-spacing: .22em;
  color: rgba(206, 168, 78, .78);
  padding: 0 10px 6px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  color: rgba(255, 255, 255, .74);
  font-size: 13.5px;
  position: relative;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(206, 168, 78, .22), rgba(206, 168, 78, .06));
  color: var(--gold-soft);
  font-weight: 600;
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gold);
}
.nav-item.is-active .nav-ico { color: var(--gold); }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  background: rgba(0, 0, 0, .16);
}
.avatar {
  width: 32px; height: 32px; flex: none;
  border-radius: 50%;
  background: rgba(206, 168, 78, .2);
  color: var(--gold-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.who { flex: 1; min-width: 0; }
.who-name { font-size: 12.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-role { font-size: 11px; color: rgba(255, 255, 255, .45); }
.sidebar-foot .icon-btn { color: rgba(255, 255, 255, .6); }
.sidebar-foot .icon-btn:hover { color: var(--gold); background: rgba(255, 255, 255, .08); }

.main {
  flex: 1;
  min-width: 0;
  padding: 26px 32px 56px;
}

.mobile-bar { display: none; }
.sidebar-mask { display: none; }

/* --------------------------------- 页面 ----------------------------------- */
.page { max-width: 1320px; margin: 0 auto; }
.page-narrow { max-width: 620px; }
.page-doc { max-width: 1000px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gold-deep);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .34em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.eyebrow::before {
  content: "";
  width: 44px; height: 1px;
  background: var(--gold);
  flex: none;
}
.eyebrow-block { margin: 26px 0 12px; }

.page-title {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--navy);
  line-height: 1.25;
}
.page-desc { font-size: 13px; color: var(--muted); margin-top: 6px; max-width: 760px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* --------------------------------- 卡片 ----------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card-body { padding: 16px 18px; }
.card-flush { overflow: visible; }
.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-2);
  background: linear-gradient(180deg, #fdfcf9, #faf8f3);
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-title { font-size: 13.5px; font-weight: 700; color: var(--navy); letter-spacing: .02em; }
.card-hint { font-size: 11.5px; color: var(--muted); margin-left: 2px; }

.form-card { padding-bottom: 4px; }
.form-card > .form-grid { padding: 16px 18px 6px; }
.form-card > form > .form-actions { padding: 0 18px 16px; }

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.empty.small { padding: 22px 18px; font-size: 12.5px; }

/* --------------------------------- 按钮 ----------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: linear-gradient(180deg, #dcbb68, var(--gold));
  color: #16283c;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .15s, box-shadow .15s, background .15s;
  box-shadow: 0 1px 2px rgba(175, 145, 95, .3);
}
.btn:hover { filter: brightness(1.04); box-shadow: 0 3px 10px rgba(206, 168, 78, .32); }
.btn:active { filter: brightness(.97); }

.btn-ghost {
  background: #fff;
  border-color: #e2d9c6;
  color: var(--navy);
  box-shadow: none;
}
.btn-ghost:hover { background: #fdfaf2; border-color: var(--gold); box-shadow: none; }

.btn-danger {
  background: linear-gradient(180deg, #c94a4a, #b03a3a);
  color: #fff;
  box-shadow: 0 1px 2px rgba(160, 40, 40, .28);
}
.btn-danger:hover { box-shadow: 0 3px 10px rgba(176, 58, 58, .32); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }

.btn-disabled {
  background: #f2efe8;
  color: #a8a49a;
  border-color: #e6e1d5;
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-ghost.danger { color: var(--bad); }
.btn-ghost.danger:hover { border-color: var(--bad-line); background: var(--bad-bg); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: #f1ede3; color: var(--navy); }
.icon-btn.ghost:hover { background: var(--bad-bg); color: var(--bad); }

.link { color: var(--navy); font-weight: 600; border-bottom: 1px solid rgba(206, 168, 78, .5); }
.link:hover { color: var(--gold-deep); border-color: var(--gold); }
.link-muted { font-size: 12.5px; color: var(--muted); }
.link-muted:hover { color: var(--navy); }
.link-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: var(--bad);
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
}
.link-danger:hover { text-decoration: underline; }

.inline-form { display: inline-flex; align-items: center; gap: 4px; margin: 0; }

/* --------------------------------- 表单 ----------------------------------- */
.input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #ded5c2;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select.input { padding-right: 6px; cursor: pointer; }
.input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(206, 168, 78, .2);
}
.input:disabled { background: #f5f3ee; color: var(--muted); cursor: not-allowed; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 16px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label {
  font-size: 12px;
  color: #4d5b6a;
  font-weight: 600;
  letter-spacing: .02em;
}
.span-2 { grid-column: span 2; }
.span-4 { grid-column: span 4; }
.req { color: #c0392b; font-weight: 700; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.form-divider {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-deep);
  letter-spacing: .06em;
  padding: 8px 0 2px;
  border-top: 1px dashed var(--line);
  margin-top: 4px;
}

.search-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.search-bar .input { max-width: 460px; }

.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 13px;
  border: 1px solid #e2d9c6;
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
}
.chip:hover { border-color: var(--gold); color: var(--navy); }
.chip.is-on {
  background: linear-gradient(180deg, #dcbb68, var(--gold));
  border-color: var(--gold);
  color: #16283c;
  font-weight: 600;
}
.filter-count { margin-left: auto; font-size: 12px; color: var(--muted); }

.tabs {
  display: flex;
  gap: 2px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.tab {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--navy); }
.tab.is-on { color: var(--navy); font-weight: 700; border-bottom-color: var(--gold); }

.pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #5c4413;
  font-size: 12.5px;
  font-weight: 600;
}

.checkline { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }

.hint { font-size: 12px; color: var(--muted); }

/* --------------------------------- 表格 ----------------------------------- */
.table-scroll { overflow-x: auto; }

.tbl { width: 100%; font-size: 13px; }
.tbl th {
  background: var(--th);
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid #e6dcc6;
  white-space: nowrap;
  letter-spacing: .02em;
}
.tbl td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.tbl tbody tr:nth-child(even) td { background: var(--row-alt); }
.tbl tbody tr:hover td { background: #fdf8ec; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tfoot td {
  background: #f7f3ea;
  border-top: 1px solid #e6dcc6;
  font-weight: 600;
  padding: 9px 12px;
}
.tbl.compact th { padding: 7px 12px; font-size: 12px; }
.tbl.compact td { padding: 7px 12px; font-size: 12.5px; }

.card-flush .tbl th:first-child { border-top-left-radius: var(--radius); }
.card-flush .tbl th:last-child { border-top-right-radius: var(--radius); }

.items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 8px;
}
.items-table { border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.items-table td { padding: 7px 8px; }
.items-table .input { height: 30px; font-size: 12.5px; }
.card > form > .form-grid { padding: 16px 18px 0; }
.card > form > .form-actions { padding: 14px 18px 18px; }
.card > form > .items-head { padding-left: 18px; padding-right: 18px; }
.card > form > .table-scroll { margin: 0; }
.card > form > .form-grid.mt-3 { padding-top: 14px; }
.mt-3 { margin-top: 14px; }

.item-lines { display: flex; flex-direction: column; gap: 2px; }
.item-line { display: flex; gap: 10px; font-size: 12.5px; flex-wrap: wrap; }

.row-warn td { background: #fdf6e8 !important; }

/* --------------------------------- 徽章 ----------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge-bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.badge-muted { background: #f1efe9; color: #6b7280; border-color: #e2ddd0; }

/* --------------------------------- 提示条 --------------------------------- */
.flashes { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid;
}
.flash-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.flash-err { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fbf7ec;
  border: 1px solid #e8dcc0;
  font-size: 12.5px;
  margin-bottom: 14px;
}
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.notice .ico { color: var(--gold-deep); }

/* --------------------------------- 工作台 --------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 6px;
}
.stat-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 16px;
  overflow: hidden;
}
.stat-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft) 60%, transparent);
}
.stat-label { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.stat-value {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
  margin: 2px 0;
}
.stat-sub { font-size: 11.5px; color: #9aa3ad; }

.todo-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.todo-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 13px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.todo-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 8px 22px rgba(206, 168, 78, .18);
}
.todo-num {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}
.todo-num.is-hot { color: #b8860b; }
.todo-label { font-size: 11.5px; color: var(--muted); }

.dash-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
  align-items: start;
}
.dash-col { display: flex; flex-direction: column; }

.mini-list { padding: 6px 0; }
.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 18px;
  font-size: 12.5px;
  border-bottom: 1px dashed var(--line-2);
}
.mini-row:last-child { border-bottom: 0; }
.mini-tag { color: var(--gold-deep); font-weight: 700; margin-right: 6px; }

.pending-list { padding: 4px 0; }
.pending-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line-2);
}
.pending-row:last-child { border-bottom: 0; }
.pending-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }

/* --------------------------------- 上传 ----------------------------------- */
.upload-card {
  background: linear-gradient(135deg, #fffdf7, #fbf6e9);
  border: 1px dashed #ddc998;
}
.upload-form {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  flex-wrap: wrap;
}
.upload-icon {
  width: 52px; height: 52px; flex: none;
  border-radius: 50%;
  background: rgba(206, 168, 78, .16);
  color: var(--gold-deep);
  display: flex; align-items: center; justify-content: center;
}
.upload-body { flex: 1; min-width: 260px; }
.upload-title { font-size: 14.5px; font-weight: 700; color: var(--navy); }
.upload-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.upload-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.file-input { font-size: 12.5px; color: var(--ink-2); max-width: 320px; }
.file-input::file-selector-button {
  height: 30px;
  margin-right: 10px;
  padding: 0 12px;
  border: 1px solid #e2d9c6;
  border-radius: 6px;
  background: #fff;
  color: var(--navy);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.file-input::file-selector-button:hover { border-color: var(--gold); }

/* -------------------------------- 明细单 ---------------------------------- */
.review-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 12px;
  border: 1px dashed #e2c98c;
  border-radius: 9px;
  background: #fffaef;
}
.review-label { font-size: 12.5px; font-weight: 700; color: var(--navy); }
.review-input {
  flex: 1;
  min-width: 200px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #e0d6c0;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  background: #fff;
}
.review-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(206, 168, 78, .18); }

.export-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.export-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy);
  margin-right: 4px;
}
.export-label .ico { color: var(--gold-deep); }

.danger-zone {
  margin: 4px 0 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

/* 单据本体 */
.doc-sheet {
  background: #fff;
  border: 1px solid #ddd5c4;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(14, 43, 70, .06);
  padding: 24px 26px 22px;
  font-size: 12.5px;
  color: #111;
}
.doc-title-row { position: relative; margin-bottom: 12px; }
.doc-title {
  font-family: var(--serif);
  font-size: 18.5px;
  font-weight: 700;
  text-align: center;
  letter-spacing: .02em;
  padding: 0 90px;
  line-height: 1.4;
}
.doc-pages {
  position: absolute;
  right: 0; bottom: 2px;
  font-size: 11px;
  color: #555;
}

.doc-meta { margin-bottom: 8px; }
.doc-meta-row {
  display: flex;
  gap: 18px;
  align-items: baseline;
  padding: 2px 0;
  flex-wrap: wrap;
}
.doc-meta-cell { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.doc-meta-cell.grow { flex: 1; }
.doc-meta-label { font-weight: 600; white-space: nowrap; }

.doc-table-wrap { overflow-x: auto; }
.doc-table {
  width: 100%;
  min-width: 780px;
  table-layout: fixed;
  border: 1px solid #333;
  font-size: 11.5px;
}
.doc-table th,
.doc-table td {
  border: 1px solid #333;
  padding: 3px 4px;
  vertical-align: middle;
  word-break: break-all;
  line-height: 1.35;
}
.doc-table th {
  background: #f3eee3;
  font-weight: 700;
  text-align: center;
  height: 21px;
  font-size: 11px;
}
.doc-table td { height: 24px; }
.doc-table .cell-input {
  width: 100%;
  border: 1px dashed #cbbf9f;
  background: #fffdf5;
  padding: 1px 3px;
  font-family: inherit;
  font-size: 11.5px;
  color: #111;
  outline: none;
}
.doc-table .cell-input:focus { border-color: var(--gold); background: #fff; }
.doc-table tr.doc-tail td { background: #faf7f0; font-size: 11.5px; }

.doc-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.doc-remark { flex: 1; min-width: 220px; display: flex; align-items: baseline; gap: 4px; }
.doc-remark .cell-input {
  flex: 1;
  border: 1px dashed #cbbf9f;
  background: #fffdf5;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
}
.doc-sign { display: flex; gap: 34px; }
.doc-sign > div { display: flex; align-items: baseline; gap: 4px; }
.doc-sign .cell-input {
  width: 110px;
  border: 1px dashed #cbbf9f;
  background: #fffdf5;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
}

.w-110 { width: 110px; }
.w-130 { width: 130px; }
.cell-input.w-110, .cell-input.w-130 { width: auto; }
.doc-meta-cell .cell-input {
  border: 1px dashed #cbbf9f;
  background: #fffdf5;
  padding: 1px 4px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
}
.doc-meta-cell .cell-input:focus { border-color: var(--gold); }

/* --------------------------------- 追溯 ----------------------------------- */
.trace-card { padding-bottom: 14px; }
.trace-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 18px;
  padding: 14px 18px;
  border-bottom: 1px dashed var(--line-2);
}
.trace-facts > div { display: flex; flex-direction: column; gap: 1px; }
.trace-facts .k { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.trace-facts .v { font-size: 13px; }
.trace-flow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px 18px 4px;
}
.trace-col { background: #fbf9f4; border: 1px solid var(--line-2); border-radius: 8px; padding: 12px 14px; }
.trace-col-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-deep);
  letter-spacing: .12em;
  margin-bottom: 8px;
}
.trace-item { border-left: 2px solid var(--gold); padding-left: 10px; margin-bottom: 10px; }
.trace-item:last-child { margin-bottom: 0; }

/* --------------------------------- 弹层 ----------------------------------- */
.pop { position: relative; display: inline-block; }
.pop > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.pop > summary::-webkit-details-marker { display: none; }
.pop[open] > summary { border-color: var(--gold); background: #fdf8ec; }
.pop-body {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  width: 268px;
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #fff;
  border: 1px solid #e2d9c6;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  text-align: left;
}
.pop-title { font-size: 12.5px; font-weight: 700; color: var(--navy); }
.pop-body .btn { justify-self: start; }

/* --------------------------------- 登录 ----------------------------------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: radial-gradient(1200px 600px at 15% 0%, #173d63 0%, #0e2b46 45%, #091b2c 100%);
  overflow: hidden;
  position: relative;
}
.login-deco { position: absolute; inset: 0; pointer-events: none; }
.ring {
  position: absolute;
  border: 1px solid rgba(206, 168, 78, .22);
  border-radius: 50%;
}
.ring-1 { width: 620px; height: 620px; top: -240px; right: -180px; }
.ring-2 { width: 420px; height: 420px; bottom: -180px; left: -140px; border-color: rgba(206, 168, 78, .16); }
.ring-3 { width: 860px; height: 860px; bottom: -520px; right: -320px; border-color: rgba(206, 168, 78, .09); }

.login-form {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 392px;
  padding: 34px 32px 30px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .38);
  display: flex;
  flex-direction: column;
}
.login-head { text-align: center; margin-bottom: 22px; }
.login-mark {
  width: 52px; height: 52px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: linear-gradient(150deg, #e3c778, var(--gold) 55%, var(--gold-deep));
  color: #0b2136;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(206, 168, 78, .34);
}
.login-company {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: .03em;
}
.login-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; letter-spacing: .04em; }
.login-rule {
  width: 46px; height: 2px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.login-label { font-size: 12px; font-weight: 600; color: #4d5b6a; margin-bottom: 5px; }
.login-input {
  height: 38px;
  padding: 0 12px;
  margin-bottom: 14px;
  border: 1px solid #ded5c2;
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(206, 168, 78, .2); }
.login-error {
  padding: 9px 12px;
  margin-bottom: 12px;
  border-radius: 7px;
  background: var(--bad-bg);
  border: 1px solid var(--bad-line);
  color: var(--bad);
  font-size: 12.5px;
}
.login-btn {
  height: 40px;
  margin-top: 4px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #dcbb68, var(--gold));
  color: #16283c;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .3em;
  text-indent: .3em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(206, 168, 78, .34);
  transition: filter .15s;
}
.login-btn:hover { filter: brightness(1.05); }
.login-tip { margin-top: 16px; text-align: center; font-size: 11.5px; color: #9aa3ad; }

/* --------------------------------- 错误页 --------------------------------- */
.error-box {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  padding: 38px 32px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .38);
  text-align: center;
}
.error-code {
  font-family: var(--serif);
  font-size: 54px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.error-title { font-size: 16px; font-weight: 700; color: var(--navy); margin-top: 8px; }
.error-msg { font-size: 13px; color: var(--muted); margin: 8px 0 22px; }

/* --------------------------------- 工具类 --------------------------------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ta-r { text-align: right; }
.ta-c { text-align: center; }
.ellipsis { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-bad { color: var(--bad); }
.text-ok { color: var(--ok); }
.text-warn { color: #a9711a; }
.grow { flex: 1; }

/* --------------------------------- 打印 ----------------------------------- */
@media print {
  @page { size: A4 portrait; margin: 8mm; }

  html, body {
    background: #fff !important;
    font-size: 10.5pt;
  }
  .sidebar, .sidebar-mask, .mobile-bar, .flashes, .no-print { display: none !important; }
  .app { display: block; }
  .main { padding: 0 !important; }
  .page, .page-doc { max-width: none !important; margin: 0 !important; padding: 0 !important; }

  .print-area {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }
  .doc-table-wrap { overflow: visible !important; }
  .doc-table { width: 100% !important; min-width: 0 !important; font-size: 9pt; }
  .doc-table th { font-size: 8.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-table td { height: auto; }
  .doc-table .cell-input,
  .doc-remark .cell-input,
  .doc-sign .cell-input,
  .doc-meta-cell .cell-input {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
  }
  .doc-title { font-size: 14pt; }
  .doc-sheet { color: #000; }
}

/* --------------------------------- 响应式 --------------------------------- */
@media (max-width: 1180px) {
  .todo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr; }
  .trace-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .main { padding: 18px 16px 48px; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .3);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(9, 20, 32, .45);
    z-index: 55;
  }
  .sidebar-mask:not([hidden]) { display: block; }
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }
  .mobile-title { font-size: 14px; font-weight: 700; color: var(--navy); }
  .stat-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-4 { grid-column: span 2; }
  .doc-title { padding: 0; font-size: 15px; }
  .doc-pages { position: static; text-align: right; margin-top: 4px; }
  .trace-flow { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
}

@media (max-width: 620px) {
  .todo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .span-2, .span-4 { grid-column: span 1; }
  .search-bar { flex-wrap: wrap; }
  .search-bar .input { max-width: none; }
  .doc-sheet { padding: 14px 12px; }
  .trace-facts { grid-template-columns: 1fr; }
}
