/* ==========================================================================
   层压钢板全链路台账 · 视觉系统
   关键词：钢卷、锌白、墨蓝、安全橙、账本横线、宋体标题、DIN 数字
   ========================================================================== */

:root {
  --ink: #17252c;
  --ink-2: #20343d;
  --slate: #36505b;
  --steel: #5f7883;
  --steel-2: #8aa0a8;
  --mist: #e4ecec;
  --mist-2: #eef3f2;
  --paper: #f5f8f7;
  --white: #fcfdfc;
  --line: #d5dfe0;
  --line-dark: #b8c7ca;
  --orange: #e85d2a;
  --orange-dark: #c4491b;
  --orange-soft: #fbe9e1;
  --green: #2e6a50;
  --green-soft: #e4efe9;
  --amber: #a66a17;
  --amber-soft: #f7edd9;
  --red: #b23a2e;
  --red-soft: #f8e5e1;
  --display: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Heiti SC", sans-serif;
  --data: "DIN Alternate", "Bahnschrift", "Arial Narrow", "PingFang SC", sans-serif;
  --rail: 238px;
  --radius: 2px;
  --shadow: 0 24px 70px rgba(13, 27, 34, .24);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 47px, rgba(23, 37, 44, .022) 47px 48px);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
svg.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
::selection { background: var(--orange); color: #fff; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ---------------------------------------------------------------- 启动 */
.boot { min-height: 100vh; display: grid; place-items: center; gap: 18px; color: var(--steel); }
.boot-coil {
  width: 46px; height: 46px; border: 2px solid var(--orange); border-radius: 50%;
  border-right-color: transparent; animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- 布局 */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; z-index: 30;
  display: flex; flex-direction: column;
  background: var(--ink);
  color: #d9e4e5;
  border-right: 1px solid #0d171c;
}
.rail::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, var(--orange), rgba(232, 93, 42, 0) 38%, rgba(232, 93, 42, 0));
  opacity: .95;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 24px 20px 20px 22px; }
.brand-mark {
  width: 34px; height: 34px; color: var(--orange); display: grid; place-items: center;
  border: 1px solid rgba(232, 93, 42, .45); background: rgba(232, 93, 42, .08);
}
.brand-mark svg { width: 23px; height: 23px; }
.brand-cn { font-family: var(--display); font-size: 17px; letter-spacing: .08em; color: #f4f8f7; line-height: 1.25; }
.brand-en { font-family: var(--data); font-size: 9px; letter-spacing: .22em; color: #789099; margin-top: 3px; }
.rail-scroll { flex: 1; overflow: auto; padding: 4px 12px 16px; }
.nav-group { margin: 15px 0 4px; padding: 0 10px; font-size: 10px; letter-spacing: .12em; color: #69818a; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 38px; padding: 8px 10px; margin: 2px 0;
  color: #b9c8cc; background: transparent; border: 0; border-left: 2px solid transparent;
  text-align: left; font-family: inherit; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .045); color: #f1f6f5; }
.nav-item.active { background: rgba(255, 255, 255, .07); color: #fff; border-left-color: var(--orange); }
.nav-item.active .nav-icon { color: var(--orange); }
.nav-icon { color: #81959c; display: grid; place-items: center; width: 18px; }
.nav-text { flex: 1; font-size: 12.5px; letter-spacing: .02em; }
.nav-step { font-family: var(--data); font-size: 9px; color: #6b8189; letter-spacing: .08em; }
.nav-item.active .nav-step { color: #d7a28d; }
.rail-foot { padding: 14px 16px 18px; border-top: 1px solid rgba(255, 255, 255, .08); }
.cutover { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: #7e939a; margin-bottom: 12px; }
.cutover b { color: #c9d6d8; font-weight: 500; font-family: var(--data); letter-spacing: .04em; }
.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar { width: 28px; height: 28px; display: grid; place-items: center; background: #2b424b; color: #e8f0f0; font-family: var(--display); font-size: 12px; border: 1px solid #3c565f; }
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: 12px; color: #e6eeee; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: #789099; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; background: transparent; color: #8fa3a9; cursor: pointer; }
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .07); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 62px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 0 34px; background: rgba(245, 248, 247, .93);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-btn { display: none; }
.crumb { font-family: var(--display); font-size: 19px; letter-spacing: .04em; white-space: nowrap; }
.crumb-sub { font-size: 11px; color: var(--steel); border-left: 1px solid var(--line-dark); padding-left: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.global-search { position: relative; }
.global-search input {
  width: 230px; height: 34px; padding: 0 12px 0 32px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 12px; color: var(--ink);
}
.global-search input::placeholder { color: #91a4aa; }
.global-search svg { position: absolute; left: 9px; top: 8px; width: 16px; height: 16px; color: #84999f; }
.top-date { font-family: var(--data); font-size: 11px; color: var(--steel); letter-spacing: .05em; }
.notice-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 34px; background: var(--orange-soft); border-bottom: 1px solid #f0c6b4; color: #7d3a1f; font-size: 11.5px; }
.notice-bar .link-btn { color: var(--orange-dark); font-weight: 600; }
.notice-bar.lock { background: var(--amber-soft); border-bottom-color: #ead7ae; color: #6f5320; }
.notice-bar.lock .link-btn { color: #7a4f13; }
.main-body { padding: 26px 34px 64px; max-width: 1560px; width: 100%; margin: 0 auto; }
.page-enter { animation: pageIn .38s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- 页头 */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-head h1 { font-family: var(--display); font-size: 29px; font-weight: 600; letter-spacing: .04em; line-height: 1.15; }
.page-desc { margin-top: 7px; font-size: 12px; color: var(--steel); max-width: 760px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.page-actions .btn { height: 34px; }
.head-rule { height: 1px; background: var(--line); margin: 0 0 22px; }

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border: 1px solid var(--line-dark);
  background: var(--white); color: var(--ink); border-radius: var(--radius);
  font-size: 12px; cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--steel); background: #f1f6f5; }
.btn-primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--slate); }
.btn-ghost:hover { background: var(--mist); border-color: transparent; }
.btn-danger { color: var(--red); border-color: #e5c1bb; }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link-btn { border: 0; background: none; padding: 0; color: var(--orange-dark); cursor: pointer; font-size: 12px; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- 标签 / 状态 */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; font-size: 10.5px; line-height: 20px; border: 1px solid var(--line); color: var(--slate); background: #f8faf9; white-space: nowrap; border-radius: 1px; }
.badge::before { content: ""; width: 5px; height: 5px; background: currentColor; border-radius: 50%; opacity: .75; }
.badge.ok { color: var(--green); border-color: #c9dfd3; background: var(--green-soft); }
.badge.warn { color: var(--amber); border-color: #ead7ae; background: var(--amber-soft); }
.badge.bad { color: var(--red); border-color: #e8c6c0; background: var(--red-soft); }
.badge.info { color: var(--slate); border-color: #cfdcde; background: #edf3f3; }
.badge.orange { color: var(--orange-dark); border-color: #f0c6b4; background: var(--orange-soft); }
.badge.muted { color: #84999f; border-color: var(--line); background: #f4f7f6; }
.badge.plain::before { display: none; }
.tag { display: inline-block; padding: 1px 6px; font-family: var(--data); font-size: 9.5px; letter-spacing: .05em; border: 1px solid var(--line); color: var(--steel); background: #f7faf9; }
.tag.sh { color: #2c5d75; border-color: #c2d7df; background: #eaf2f5; }
.tag.cq { color: #7b4f1d; border-color: #e3d1b6; background: #f8f0e3; }

/* ---------------------------------------------------------------- 基础块 */
.section { border-top: 1px solid var(--line); padding-top: 17px; margin-top: 26px; }
.section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-title { font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: .03em; }
.section-sub { font-size: 11px; color: var(--steel); }
.panel { background: var(--white); border: 1px solid var(--line); border-top: 2px solid var(--slate); padding: 18px 20px; }
.panel.flat { border-top-width: 1px; }
.panel-title { font-family: var(--display); font-size: 17px; margin-bottom: 4px; }
.panel-desc { font-size: 11.5px; color: var(--steel); }
.muted { color: var(--steel); }
.small { font-size: 11px; }
.tiny { font-size: 10px; }
.num { font-family: var(--data); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.mono { font-family: var(--data); letter-spacing: .02em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.strong { font-weight: 600; }
.hr { height: 1px; background: var(--line); border: 0; margin: 16px 0; }
.empty { padding: 38px 20px; text-align: center; color: var(--steel); }
.empty svg { width: 30px; height: 30px; color: var(--steel-2); margin-bottom: 8px; }
.empty p { font-size: 12px; }
.empty b { display: block; font-family: var(--display); font-size: 16px; color: var(--ink); margin-bottom: 4px; font-weight: 600; }

/* ---------------------------------------------------------------- 钢带流程 */
.chain {
  position: relative; overflow: hidden; margin: 2px 0 0;
  border-top: 1px solid #b7c6c9; border-bottom: 1px solid #b7c6c9;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .42) 0 1px, rgba(255, 255, 255, 0) 1px 3px),
    linear-gradient(180deg, #d3dee0 0%, #eef3f3 42%, #dbe4e5 100%);
}
.chain::before, .chain::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: rgba(255, 255, 255, .9); }
.chain::before { top: 3px; }
.chain::after { bottom: 3px; }
.chain-stages { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stage { position: relative; padding: 19px 16px 17px 20px; border-left: 1px solid rgba(23, 37, 44, .13); min-width: 0; }
.stage:first-child { border-left: 0; }
.stage.current { background: rgba(255, 255, 255, .4); }
.stage.current::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--orange); }
.stage-no { font-family: var(--data); font-size: 9px; letter-spacing: .12em; color: var(--orange-dark); display: block; margin-bottom: 8px; }
.stage-label { font-size: 11.5px; color: var(--slate); letter-spacing: .03em; }
.stage-value { font-family: var(--data); font-size: 27px; line-height: 1.1; margin-top: 4px; color: var(--ink); white-space: nowrap; }
.stage-value span { font-size: 11px; color: var(--steel); margin-left: 3px; letter-spacing: .02em; }
.stage-sub { font-size: 10.5px; color: var(--steel); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chain-note { display: flex; justify-content: space-between; gap: 14px; padding: 8px 2px 0; font-size: 10px; color: var(--steel); }
.chain-note .dash { flex: 1; border-bottom: 1px dashed var(--line-dark); transform: translateY(-4px); }

/* ---------------------------------------------------------------- KPI 条 */
.kpi-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 16px; background: rgba(255, 255, 255, .45); }
.kpi-strip.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi-strip.six .kpi { padding-left: 12px; padding-right: 12px; }
.kpi-strip.six .kpi-value { font-size: 20px; }
.kpi { padding: 13px 16px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi-label { font-size: 10.5px; color: var(--steel); letter-spacing: .03em; }
.kpi-value { font-family: var(--data); font-size: 22px; line-height: 1.2; margin-top: 3px; }
.kpi-value span { font-size: 10px; color: var(--steel); margin-left: 3px; }
.kpi-sub { font-size: 10px; color: var(--steel); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .up { color: var(--green); }
.kpi .down { color: var(--red); }

/* ---------------------------------------------------------------- 网格 */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(310px, .8fr); gap: 30px; margin-top: 26px; align-items: start; }
.dash-col { min-width: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }

/* ---------------------------------------------------------------- 表格 */
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.filters { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.input, .select, textarea {
  height: 34px; padding: 0 10px; background: var(--white); border: 1px solid var(--line-dark);
  border-radius: var(--radius); font-size: 12px; color: var(--ink); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(232, 93, 42, .1); }
.input::placeholder { color: #96a8ad; }
.select { padding-right: 26px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, #6f858c 50%), linear-gradient(135deg, #6f858c 50%, transparent 50%); background-position: calc(100% - 12px) 14px, calc(100% - 8px) 14px; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat; }
.search-box { position: relative; }
.search-box .input { padding-left: 30px; width: 220px; }
.search-box svg { position: absolute; left: 9px; top: 9px; width: 15px; height: 15px; color: var(--steel-2); }
.table-count { font-family: var(--data); font-size: 10.5px; color: var(--steel); letter-spacing: .04em; }
.table-wrap { width: 100%; overflow: auto; border-top: 1px solid var(--line-dark); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .55); }
.table { width: 100%; border-collapse: collapse; min-width: 680px; }
.table th {
  position: sticky; top: 0; z-index: 2; text-align: left; padding: 9px 12px;
  font-size: 10.5px; font-weight: 500; color: var(--steel); letter-spacing: .04em;
  background: #eef3f2; border-bottom: 1px solid var(--line-dark); white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid #e5eded; font-size: 12px; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.row-click { cursor: pointer; }
.table tbody tr.row-click:hover { background: #f2f7f6; }
.table tbody tr.is-selected { background: #fdf2ec; }
.table td.num, .table th.num { text-align: right; font-family: var(--data); font-variant-numeric: tabular-nums; }
.table td.tight, .table th.tight { padding-left: 7px; padding-right: 7px; }
.table .doc { font-family: var(--data); font-size: 11.5px; letter-spacing: .02em; font-weight: 600; }
.table .sub { display: block; font-size: 10px; color: var(--steel); margin-top: 2px; }
.table .cell-actions { white-space: nowrap; text-align: right; }
.table .cell-actions .link-btn { margin-left: 9px; }
.table.compact td { padding: 7px 9px; }
.table.compact th { padding: 7px 9px; }
.table-wrap.no-border { border-bottom: 0; }

/* 进度 */
.bar { height: 4px; background: var(--mist); position: relative; overflow: hidden; min-width: 54px; }
.bar > i { display: block; height: 100%; background: var(--steel); }
.bar > i.orange { background: var(--orange); }
.bar > i.green { background: var(--green); }
.bar > i.red { background: var(--red); }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-row .bar { flex: 1; }
.bar-pct { font-family: var(--data); font-size: 10px; color: var(--steel); width: 34px; text-align: right; }

/* ---------------------------------------------------------------- 标签页 */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: 4px 0 18px; overflow-x: auto; }
.tab { position: relative; border: 0; background: transparent; padding: 8px 0 11px; color: var(--steel); font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--orange); }
.tab .count { font-family: var(--data); font-size: 9.5px; color: var(--steel); margin-left: 4px; }

/* ---------------------------------------------------------------- 对账列表 */
.alert-list { border-top: 1px solid var(--line); }
.alert-item { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 12px; padding: 11px 0; border-bottom: 1px solid #e6eded; align-items: center; }
.alert-stripe { align-self: stretch; background: var(--steel-2); }
.alert-stripe.high { background: var(--red); }
.alert-stripe.medium { background: var(--amber); }
.alert-stripe.info { background: var(--steel-2); }
.alert-title { font-size: 12.5px; }
.alert-desc { font-size: 10.5px; color: var(--steel); margin-top: 2px; }
.alert-count { font-family: var(--data); font-size: 19px; text-align: right; }
.alert-count span { display: block; font-family: var(--sans); font-size: 9.5px; color: var(--steel); }

/* ---------------------------------------------------------------- 库存分布 */
.stock-bars { display: flex; flex-direction: column; gap: 12px; }
.stock-bar-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) 58px; gap: 9px; align-items: center; font-size: 11.5px; }
.stock-bar-row .name { color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-bar-row .val { font-family: var(--data); text-align: right; font-size: 11px; }
.stock-track { height: 12px; background: #e9efee; position: relative; overflow: hidden; }
.stock-track i { display: block; height: 100%; background: linear-gradient(90deg, #36505b, #6d8993); }
.stock-track i.orange { background: linear-gradient(90deg, #c94a1c, #e85d2a); }
.focus-number { font-family: var(--data); font-size: 28px; line-height: 1.1; color: var(--ink); }
.focus-number span { font-size: 11px; color: var(--steel); }

/* ---------------------------------------------------------------- 图表 */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; gap: 14px; font-size: 10px; color: var(--steel); margin-top: 6px; }
.chart-legend i { display: inline-block; width: 9px; height: 3px; margin-right: 4px; vertical-align: middle; }
.chart-axis { font-family: var(--data); font-size: 9px; fill: #7e939a; }
.chart-grid { stroke: #e2eaea; stroke-width: 1; }

/* ---------------------------------------------------------------- 最近单据 */
.recent-list { display: flex; flex-direction: column; }
.recent-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid #e6eded; align-items: center; }
.recent-icon { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); color: var(--slate); background: #f5f8f7; }
.recent-icon svg { width: 15px; height: 15px; }
.recent-title { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-sub { font-size: 10px; color: var(--steel); margin-top: 1px; }
.recent-amount { font-family: var(--data); font-size: 12px; text-align: right; }

/* ---------------------------------------------------------------- 抽屉 */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(12, 24, 30, .42); opacity: 0; transition: opacity .2s ease; }
.overlay.open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(780px, 94vw);
  background: var(--white); box-shadow: var(--shadow); display: flex; flex-direction: column;
  transform: translateX(102%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.drawer.open { transform: none; }
.drawer.wide { width: min(1080px, 96vw); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 15px; border-bottom: 1px solid var(--line); background: #f7faf9; }
.drawer-kicker { font-family: var(--data); font-size: 9.5px; letter-spacing: .12em; color: var(--orange-dark); margin-bottom: 4px; }
.drawer-title { font-family: var(--display); font-size: 21px; letter-spacing: .03em; line-height: 1.25; }
.drawer-sub { font-size: 11px; color: var(--steel); margin-top: 4px; }
.drawer-body { flex: 1; overflow: auto; padding: 20px 24px 26px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 24px; border-top: 1px solid var(--line); background: #f7faf9; }
.drawer-close { border: 0; background: transparent; color: var(--steel); cursor: pointer; padding: 4px; }
.drawer-close:hover { color: var(--ink); }

.kv-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 18px; }
.kv { min-width: 0; }
.kv-label { font-size: 10px; color: var(--steel); letter-spacing: .04em; }
.kv-value { font-size: 12.5px; margin-top: 3px; word-break: break-word; }
.kv-value.num { font-size: 13px; }
.drawer-section { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.drawer-section:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.drawer-section h3 { font-family: var(--display); font-size: 16px; margin-bottom: 10px; font-weight: 600; }
.mini-table { width: 100%; border-collapse: collapse; }
.mini-table th { font-size: 10px; color: var(--steel); font-weight: 500; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mini-table td { font-size: 11.5px; padding: 7px 8px; border-bottom: 1px solid #e8eeee; }
.mini-table td.num, .mini-table th.num { text-align: right; font-family: var(--data); }
.attach-list { display: flex; flex-direction: column; gap: 6px; }
.attach { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--line); background: #f7faf9; font-size: 11.5px; }
.attach svg { width: 14px; height: 14px; color: var(--orange-dark); }
.attach a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach .link-btn { font-size: 10px; }
.upload-zone { display: flex; align-items: center; gap: 8px; border: 1px dashed var(--line-dark); padding: 10px; color: var(--steel); font-size: 11px; cursor: pointer; }
.upload-zone:hover { border-color: var(--orange); color: var(--ink); background: #fdf6f2; }

/* ---------------------------------------------------------------- 弹窗 / 表单 */
.modal-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(12, 24, 30, .46); }
.modal {
  width: min(700px, 100%); max-height: 90vh; background: var(--white); box-shadow: var(--shadow);
  display: flex; flex-direction: column; border-top: 3px solid var(--orange);
}
.modal.wide { width: min(920px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 22px 13px; border-bottom: 1px solid var(--line); }
.modal-title { font-family: var(--display); font-size: 20px; letter-spacing: .03em; }
.modal-sub { font-size: 11px; color: var(--steel); margin-top: 3px; }
.modal-body { padding: 18px 22px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--line); background: #f7faf9; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 16px; }
.form-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
.form-label { font-size: 11px; color: var(--slate); }
.form-label em { color: var(--orange-dark); font-style: normal; margin-left: 3px; }
.form-field .input, .form-field .select, .form-field textarea { width: 100%; }
.form-field textarea { height: 72px; padding: 8px 10px; resize: vertical; }
.form-hint { font-size: 10px; color: var(--steel); }
.form-error { color: var(--red); font-size: 11px; min-height: 16px; margin-top: 8px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 6px 0; }
.check-row input { accent-color: var(--orange); }
.radio-row { display: flex; gap: 14px; }
.radio-row label { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.radio-row input { accent-color: var(--orange); }

/* ---------------------------------------------------------------- 提示 */
.toast-host { position: fixed; right: 22px; bottom: 22px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { min-width: 220px; max-width: 420px; display: flex; align-items: flex-start; gap: 9px; padding: 11px 14px; background: var(--ink); color: #eef5f4; box-shadow: 0 14px 36px rgba(12, 24, 30, .28); font-size: 12px; animation: toastIn .2s ease both; }
.toast svg { width: 15px; height: 15px; color: var(--orange); margin-top: 1px; }
.toast.ok svg { color: #7bd0a6; }
.toast.bad svg { color: #f28b7d; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- 登录 */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(400px, .85fr); }
.login-visual { position: relative; overflow: hidden; background: var(--ink); color: #e9f1f0; padding: 46px 54px; display: flex; flex-direction: column; justify-content: space-between; }
.login-visual::before {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,.03) 0 1px, transparent 1px 6px);
  pointer-events: none;
}
.login-brand { position: relative; display: flex; align-items: center; gap: 11px; }
.login-brand .brand-mark { width: 38px; height: 38px; }
.login-brand .brand-cn { font-size: 18px; }
.login-coil { position: absolute; right: -100px; bottom: -140px; width: 340px; height: 340px; opacity: .5; pointer-events: none; }
.login-coil circle { fill: none; stroke: #56717a; }
.login-coil .hot { stroke: var(--orange); }
.login-copy { position: relative; max-width: 560px; margin-top: 40px; }
.login-copy h1 { font-family: var(--display); font-size: clamp(34px, 3.4vw, 52px); line-height: 1.18; letter-spacing: .06em; font-weight: 600; }
.login-copy h1 span { color: var(--orange); }
.login-copy p { margin-top: 18px; max-width: 440px; color: #9fb2b7; font-size: 13px; line-height: 1.8; }
.login-stages { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 42px; max-width: 560px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.1); }
.login-stage { background: rgba(23, 37, 44, .82); padding: 13px 14px; }
.login-stage b { display: block; font-family: var(--data); font-size: 9px; letter-spacing: .1em; color: #d19a83; font-weight: 400; }
.login-stage span { display: block; font-size: 12px; color: #c7d4d5; margin-top: 3px; }
.login-foot { position: relative; display: flex; justify-content: flex-start; gap: 22px; font-size: 10px; color: #6f878e; }
.login-form-wrap { display: grid; place-items: center; padding: 36px 28px; background: var(--paper); }
.login-card { width: min(372px, 100%); }
.login-card h2 { font-family: var(--display); font-size: 26px; letter-spacing: .04em; }
.login-card .lede { font-size: 12px; color: var(--steel); margin-top: 6px; margin-bottom: 26px; }
.login-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.login-field label { font-size: 11px; color: var(--slate); }
.login-field input { height: 42px; padding: 0 12px; background: var(--white); border: 1px solid var(--line-dark); font-size: 13px; outline: none; }
.login-field input:focus { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(232,93,42,.1); }
.login-submit { width: 100%; height: 42px; margin-top: 6px; background: var(--orange); border: 1px solid var(--orange); color: #fff; font-size: 13px; cursor: pointer; }
.login-submit:hover { background: var(--orange-dark); }
.login-error { color: var(--red); font-size: 11.5px; min-height: 18px; margin-top: 8px; }
.demo-box { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; font-size: 11px; color: var(--steel); }
.demo-box summary { cursor: pointer; color: var(--slate); }
.demo-table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 10.5px; }
.demo-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.demo-table td:first-child { font-family: var(--data); color: var(--ink); }
.demo-fill { border: 1px solid var(--line); background: #f7faf9; padding: 1px 5px; cursor: pointer; font-size: 9.5px; color: var(--orange-dark); margin-left: 4px; }

/* ---------------------------------------------------------------- 时间线 */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 5px; bottom: 8px; width: 1px; background: var(--line-dark); }
.tl-item { position: relative; display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 13px; padding: 0 0 18px; min-height: 44px; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--white); border: 2px solid var(--steel-2); }
.tl-item[data-kind="sales_contract"]::before, .tl-item[data-kind="purchase_contract"]::before { border-color: var(--orange); }
.tl-item[data-kind="payment_in"]::before, .tl-item[data-kind="payment_out"]::before { border-color: var(--green); background: var(--green); }
.tl-item[data-kind="invoice_out"]::before, .tl-item[data-kind="invoice_in"]::before { border-color: var(--slate); }
.tl-date { font-family: var(--data); font-size: 10px; color: var(--steel); padding-top: 3px; letter-spacing: .02em; }
.tl-title { font-size: 12.5px; font-weight: 500; line-height: 1.4; }
.tl-sub { font-size: 10.5px; color: var(--steel); margin-top: 2px; }
.tl-amount { font-family: var(--data); font-size: 12px; text-align: right; color: var(--ink); }
.tl-amount small { display: block; font-family: var(--sans); font-size: 9.5px; color: var(--steel); }
.tl-attach a { color: var(--orange-dark); }
.trace-search { display: flex; gap: 8px; margin-bottom: 8px; }
.trace-search .input { flex: 1; height: 44px; font-size: 14px; }
.trace-search .btn { height: 44px; padding: 0 20px; }
.trace-hint { font-size: 11px; color: var(--steel); }
.match-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 2px; }
.match { border: 1px solid var(--line); background: var(--white); padding: 5px 9px; font-size: 11px; cursor: pointer; }
.match:hover { border-color: var(--orange); }
.match.active { border-color: var(--orange); background: var(--orange-soft); }
.gap-box { border-left: 3px solid var(--amber); background: #fbf6ec; padding: 10px 13px; font-size: 11.5px; color: #6f5320; margin: 12px 0 4px; }
.gap-box b { font-weight: 600; }
.trace-empty { padding: 50px 0; }

/* ---------------------------------------------------------------- 设置 / 用户 */
.user-row { display: flex; align-items: center; gap: 10px; }
.role-tag { font-size: 10px; color: var(--steel); border: 1px solid var(--line); padding: 1px 5px; }
.data-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.audit-detail { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--steel); }
.callout { border: 1px solid var(--line); border-left: 3px solid var(--slate); background: #f7faf9; padding: 11px 14px; font-size: 11.5px; color: var(--slate); }
.callout b { color: var(--ink); }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1180px) {
  :root { --rail: 214px; }
  .main-body { padding: 24px 24px 56px; }
  .topbar { padding: 0 24px; }
  .dash-grid { grid-template-columns: 1fr; gap: 22px; }
  .kpi-strip.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .global-search input { width: 180px; }
  .stage { padding-left: 14px; }
  .stage-value { font-size: 23px; }
  .kv-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .rail.open { transform: none; }
  .rail-scrim { position: fixed; inset: 0; z-index: 29; background: rgba(12, 24, 30, .38); }
  .menu-btn { display: inline-grid; }
  .notice-bar { padding: 8px 16px; font-size: 11px; }
  .main-body { padding: 18px 16px 50px; }
  .topbar { padding: 0 16px; min-height: 58px; }
  .crumb { font-size: 17px; }
  .crumb-sub { display: none; }
  .top-date { display: none; }
  .global-search input { width: 150px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .page-head h1 { font-size: 24px; }
  .page-actions { justify-content: flex-start; }
  .chain-stages { grid-template-columns: repeat(6, 150px); overflow-x: auto; }
  .chain { overflow-x: auto; }
  .kpi-strip, .kpi-strip.six { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(odd) { border-left: 0; }
  .kpi:not(:nth-last-child(-n+2)) { border-bottom: 1px solid var(--line); }
  .two-col, .three-col { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-visual { min-height: 280px; padding: 28px 24px; }
  .login-copy { margin-top: 18px; }
  .login-copy h1 { font-size: 30px; }
  .login-stages { display: none; }
  .login-foot { display: none; }
  .login-coil { width: 260px; height: 260px; right: -80px; bottom: -100px; opacity: .5; }
  .login-form-wrap { padding: 32px 20px 48px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: auto; }
  .drawer { width: 100vw; }
  .modal-wrap { padding: 0; align-items: end; }
  .modal { max-height: 94vh; width: 100%; }
  .tl-item { grid-template-columns: 72px minmax(0, 1fr); }
  .tl-amount { grid-column: 2; text-align: left; }
}
@media (max-width: 560px) {
  .global-search { display: none; }
  .page-head h1 { font-size: 22px; }
  .kpi { padding: 10px 12px; }
  .kpi-value { font-size: 19px; }
  .stage { padding: 15px 12px 14px 15px; }
  .stage-value { font-size: 21px; }
  .table th, .table td { padding: 8px 8px; }
  .table { min-width: 620px; }
  .search-box .input { width: 160px; }
  .login-copy h1 { font-size: 25px; }
  .login-visual { min-height: 230px; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
}

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