:root {
  --brand: #0f4c45;
  --brand-2: #146b5d;
  --brand-3: #dff0e9;
  --accent: #d99a35;
  --accent-soft: #fbf0dc;
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --line: #e1e8e5;
  --line-strong: #cdd9d5;
  --text: #172522;
  --muted: #6c7f79;
  --danger: #b53b32;
  --danger-soft: #fbe9e7;
  --ok: #25745a;
  --ok-soft: #e4f3ec;
  --warn: #9a6412;
  --warn-soft: #fbf1df;
  --shadow: 0 8px 28px rgba(20, 55, 47, .07);
  --radius: 14px;
  --font: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Source Han Sans SC", sans-serif;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.icon.fill { fill: currentColor; stroke: none; }

.app-loading { min-height: 100vh; display: grid; place-content: center; justify-items: center; color: var(--muted); gap: 14px; }
.loader { width: 34px; height: 34px; border: 3px solid #d7e4df; border-top-color: var(--brand-2); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 登录 ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-brand {
  position: relative; overflow: hidden; color: #fff; padding: 64px;
  background: radial-gradient(circle at 80% 10%, rgba(217, 154, 53, .28), transparent 32%),
              linear-gradient(145deg, #0b3833, #115a4f 62%, #0c3d37);
  display: flex; flex-direction: column; justify-content: space-between;
}
.login-brand::after {
  content: ""; position: absolute; width: 520px; height: 520px; border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%; right: -190px; bottom: -240px; box-shadow: 0 0 0 70px rgba(255,255,255,.035), 0 0 0 150px rgba(255,255,255,.025);
}
.login-logo { display: flex; align-items: center; gap: 12px; font-size: 18px; letter-spacing: .04em; }
.logo-mark { width: 42px; height: 42px; border-radius: 12px; background: var(--accent); color: #17352f; display: grid; place-items: center; font-size: 23px; font-weight: 700; font-family: serif; }
.login-brand h1 { font-size: clamp(32px, 4vw, 56px); line-height: 1.18; margin: 0 0 22px; font-weight: 650; letter-spacing: -.02em; }
.login-brand h1 em { color: #f0c779; font-style: normal; }
.login-brand p { max-width: 520px; color: #c9ddd8; font-size: 15px; margin: 0; }
.login-points { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 30px; color: #dcebe7; font-size: 13px; }
.login-points span::before { content: "·"; color: var(--accent); margin-right: 8px; }
.login-side { display: grid; place-items: center; background: #fbfcfc; padding: 32px; }
.login-card { width: 100%; max-width: 390px; animation: fadeUp .45s ease both; }
.login-card h2 { margin: 0 0 8px; font-size: 26px; }
.login-card .sub { color: var(--muted); margin: 0 0 28px; }
.login-card .field { margin-bottom: 16px; }
.login-card .btn { width: 100%; padding: 12px; margin-top: 8px; }
.login-hint { margin-top: 22px; font-size: 12px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.login-foot { margin-top: 28px; color: #9aaba6; font-size: 12px; }

/* ---------- 布局 ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 238px; z-index: 40;
  background: linear-gradient(180deg, #0d3f39, #0b332e);
  color: #d8e8e4; display: flex; flex-direction: column; transition: transform .24s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 22px 20px 18px; }
.sidebar-brand .logo-mark { width: 38px; height: 38px; border-radius: 10px; font-size: 21px; }
.brand-text strong { display: block; color: #fff; font-size: 16px; letter-spacing: .03em; }
.brand-text small { color: #89aaa2; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-company { margin: 0 14px 12px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; color: #a9c6be; font-size: 11px; line-height: 1.5; background: rgba(255,255,255,.025); }
.nav-group-label { padding: 15px 22px 7px; font-size: 10px; letter-spacing: .14em; color: #779a91; }
.nav { padding: 0 10px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin: 2px 0;
  color: #b9d2cc; border-radius: 9px; font-size: 13.5px; transition: .15s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: #f0c779; color: #17352f; font-weight: 600; box-shadow: 0 5px 16px rgba(0,0,0,.14); }
.nav a .icon { width: 17px; height: 17px; }
.sidebar-foot { margin-top: auto; padding: 14px 18px 18px; border-top: 1px solid rgba(255,255,255,.07); color: #7f9f97; font-size: 11px; }
.sidebar-foot b { color: #b8d1ca; font-weight: 500; }
.main { margin-left: 238px; min-height: 100vh; }
.topbar {
  height: 64px; background: rgba(255,255,255,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: 14px; padding: 0 26px; position: sticky; top: 0; z-index: 30;
}
.menu-btn { display: none; }
.crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.crumb b { color: var(--text); font-weight: 600; }
.topbar-spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 8px 5px 5px; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-3); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.user-chip small { color: var(--muted); display: block; line-height: 1.15; font-size: 10px; }
.user-chip strong { font-size: 12px; font-weight: 600; line-height: 1.2; }
.user-menu-wrap { position: relative; }
.user-menu { position: absolute; right: 0; top: 44px; width: 190px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: none; }
.user-menu.open { display: block; animation: fadeUp .15s ease; }
.user-menu button { width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 7px; color: var(--text); }
.user-menu button:hover { background: var(--surface-2); }
.content { padding: 26px 30px 44px; max-width: 1560px; }

/* ---------- 通用 ---------- */
.page-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 23px; letter-spacing: -.01em; }
.page-head p { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16,40,34,.03); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }
.card-head .sub { color: var(--muted); font-size: 12px; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.hidden { display: none !important; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 9px; font-size: 13px; line-height: 1.3;
  transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #aabdb7; background: #fbfcfc; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .icon { width: 15px; height: 15px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #2a2110; }
.btn-accent:hover { background: #c98a27; border-color: #c98a27; }
.btn-danger { color: var(--danger); border-color: #e7c3bf; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.btn-sm .icon { width: 13px; height: 13px; }
.icon-btn { width: 30px; height: 30px; padding: 0; border-radius: 8px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: #fff; color: var(--muted); }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); border-color: #e7c3bf; }
.btn-link { border: 0; background: none; color: var(--brand-2); padding: 3px 4px; font-size: 12.5px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 11.5px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: #c6e5d7; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: #efd9ae; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: #efc9c5; }
.badge.info { background: #e8f1f8; color: #2d6387; border-color: #cfe2ef; }
.badge.gold { background: var(--accent-soft); color: #815816; border-color: #eed7ab; }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-weight: 500; color: #71847e; background: #f7faf9;
  padding: 10px 13px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 11.5px;
  letter-spacing: .02em; position: sticky; top: 0; z-index: 1;
}
table.data td { padding: 11px 13px; border-bottom: 1px solid #edf1ef; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fbfdfc; }
table.data .actions { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
table.data .prod { display: flex; flex-direction: column; gap: 1px; }
table.data .prod b { font-weight: 500; }
table.data .prod small { color: var(--muted); font-size: 11px; }
table.data tfoot td { background: #f8faf9; font-weight: 600; border-top: 1px solid var(--line); }
.table-empty { padding: 42px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.table-empty .icon { width: 28px; height: 28px; margin-bottom: 6px; color: #a9bbb5; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12px; color: #526660; font-weight: 500; }
.field > label .req { color: var(--danger); margin-left: 2px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  border-radius: 8px; padding: 8px 10px; min-height: 36px; outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(20,107,93,.11); }
input::placeholder, textarea::placeholder { color: #a4b3ae; }
input[readonly] { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; min-height: 70px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #75908a 50%), linear-gradient(135deg, #75908a 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: span 4; }
.form-section { padding: 18px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 13px; color: var(--brand); font-weight: 600; }
.form-section-title::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--accent); }
.form-actions { display: flex; align-items: center; gap: 8px; padding: 14px 18px; background: #fbfcfc; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.inline-fields { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-fields .field { min-width: 130px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: #455a54; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }

/* ---------- 筛选条 ---------- */
.filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.filters .field { min-width: 120px; }
.filters .field.grow { flex: 1; min-width: 200px; }
.filters .btn { height: 36px; }
.filter-note { margin-left: auto; color: var(--muted); font-size: 12px; align-self: center; }

/* ---------- 工作台 ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 16px; padding: 24px 26px;
  color: #fff; background: linear-gradient(120deg, #0d443d, #146b5d 70%, #1a7c6c);
  display: flex; align-items: center; gap: 26px; margin-bottom: 18px;
}
.hero::after { content: ""; position: absolute; right: -60px; top: -130px; width: 340px; height: 340px; border-radius: 50%; border: 1px solid rgba(255,255,255,.14); box-shadow: 0 0 0 45px rgba(255,255,255,.04), 0 0 0 100px rgba(255,255,255,.025); }
.hero h2 { margin: 0 0 7px; font-size: 21px; font-weight: 600; }
.hero p { margin: 0; color: #c6ded8; font-size: 12.5px; }
.hero .hero-actions { margin-left: auto; display: flex; gap: 8px; z-index: 1; }
.hero .btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.18); color: #fff; backdrop-filter: blur(4px); }
.hero .btn:hover { background: rgba(255,255,255,.2); }
.hero .btn-accent { background: var(--accent); border-color: var(--accent); color: #2a2110; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 17px; position: relative; overflow: hidden; }
.kpi .kpi-label { color: var(--muted); font-size: 11.5px; display: flex; align-items: center; gap: 6px; }
.kpi .kpi-value { font-size: 25px; font-weight: 650; letter-spacing: -.02em; margin-top: 7px; font-variant-numeric: tabular-nums; }
.kpi .kpi-sub { color: var(--muted); font-size: 11px; margin-top: 4px; }
.kpi .kpi-icon { position: absolute; right: 14px; top: 14px; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-3); color: var(--brand); }
.kpi .kpi-icon .icon { width: 17px; height: 17px; }
.kpi.alert .kpi-icon { background: var(--danger-soft); color: var(--danger); }
.kpi.gold .kpi-icon { background: var(--accent-soft); color: #9a6412; }
.dash-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 16px; }
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.alert-item .ai-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--warn-soft); color: var(--warn); flex: 0 0 auto; }
.alert-item .ai-icon.danger { background: var(--danger-soft); color: var(--danger); }
.alert-item .ai-icon.ok { background: var(--ok-soft); color: var(--ok); }
.alert-item b { font-size: 13px; font-weight: 600; }
.alert-item small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.alert-item .right { margin-left: auto; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.quick { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 11px 12px; color: var(--text); font-size: 12.5px; text-align: left; }
.quick:hover { border-color: #b8cbc4; background: #fbfdfc; }
.quick .icon { color: var(--brand-2); }
.mini-timeline { display: flex; flex-direction: column; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #edf1ef; }
.mini-row:last-child { border-bottom: 0; }
.mini-row .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }

/* ---------- 单据明细 ---------- */
.doc-lines { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.doc-lines th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11px; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.doc-lines td { padding: 6px 5px; border-bottom: 1px solid #eef2f0; vertical-align: top; }
.doc-lines input, .doc-lines select { min-height: 32px; padding: 5px 7px; font-size: 12.5px; border-radius: 7px; }
.doc-lines td.line-amount { text-align: right; padding-top: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-lines .row-actions { padding-top: 8px; }
.doc-total { display: grid; grid-template-columns: 1fr auto; gap: 6px 30px; justify-content: end; margin-left: auto; width: min(360px, 100%); padding: 13px 4px; font-size: 12.5px; }
.doc-total .label { color: var(--muted); }
.doc-total .value { text-align: right; font-variant-numeric: tabular-nums; }
.doc-total .grand { font-size: 17px; font-weight: 650; color: var(--brand); border-top: 1px solid var(--line); padding-top: 9px; margin-top: 4px; }
.total-bar { display: flex; justify-content: flex-end; gap: 28px; padding: 14px 0 2px; font-size: 13px; flex-wrap: wrap; }
.total-bar b { font-size: 20px; color: var(--brand); }
.stock-hint { font-size: 10px; color: var(--muted); margin-top: 2px; }
.stock-hint.negative { color: var(--danger); }
.warn-box { background: var(--warn-soft); border: 1px solid #eed7ab; color: #78541c; border-radius: 9px; padding: 10px 12px; font-size: 12px; display: flex; gap: 9px; align-items: flex-start; }
.warn-box .icon { color: var(--warn); margin-top: 1px; }
.info-box { background: #edf6f2; border: 1px solid #cfe7de; color: #285f50; border-radius: 9px; padding: 10px 12px; font-size: 12px; }

/* ---------- 详情 ---------- */
.detail-top { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
.detail-title h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.detail-title .meta { color: var(--muted); font-size: 12px; margin-top: 5px; display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.detail-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: 1.4fr .85fr; gap: 16px; align-items: start; }
.party-box { display: flex; flex-direction: column; gap: 3px; }
.party-box b { font-size: 14px; }
.party-box small { color: var(--muted); }
.dl { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 12.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.pill-progress { height: 7px; border-radius: 99px; background: #edf1ef; overflow: hidden; }
.pill-progress span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-2), #27a088); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 18px; overflow: auto; }
.tabs button { border: 0; background: none; padding: 12px 12px 10px; color: var(--muted); font-size: 12.5px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab-panel { padding: 18px; }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.summary-strip .ss { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.summary-strip .ss small { color: var(--muted); font-size: 11px; display: block; }
.summary-strip .ss b { font-size: 18px; font-variant-numeric: tabular-nums; }

/* ---------- 模态框 ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(8, 31, 27, .45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 22px; animation: fadeUp .18s ease; }
.modal { background: #fff; border-radius: 15px; width: 100%; max-width: 620px; max-height: calc(100vh - 44px); display: flex; flex-direction: column; box-shadow: 0 24px 80px rgba(0,0,0,.22); overflow: hidden; }
.modal.wide { max-width: 1040px; }
.modal.xwide { max-width: 1240px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-head .sub { color: var(--muted); font-size: 11.5px; margin-left: 4px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 18px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--line); background: #fbfcfc; flex: 0 0 auto; position: sticky; bottom: 0; z-index: 2; }
.modal-foot .left { margin-right: auto; }
.modal-narrow { max-width: 460px; }
.confirm-text { font-size: 13.5px; line-height: 1.7; }
.confirm-text b { color: var(--danger); }

/* ---------- 空状态 / 提示 ---------- */
.empty-state { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty-state .empty-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--brand-3); color: var(--brand); display: grid; place-items: center; margin: 0 auto 12px; }
.empty-state .empty-icon .icon { width: 24px; height: 24px; }
.empty-state h3 { margin: 0 0 5px; color: var(--text); font-size: 15px; }
.empty-state p { margin: 0 0 16px; font-size: 12.5px; }

.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; align-items: flex-end; pointer-events: none; }
.toast { background: #17352f; color: #fff; border-radius: 10px; padding: 10px 14px; font-size: 12.5px; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: fadeUp .2s ease; max-width: 360px; pointer-events: auto; display: flex; gap: 8px; align-items: flex-start; }
.toast.error { background: #7d2822; }
.toast.success { background: #1e5c48; }
.toast .icon { width: 15px; height: 15px; margin-top: 1px; }

/* ---------- 标签 / 打印 ---------- */
.label-preview-wrap { background: #eef2f0; border: 1px solid var(--line); border-radius: 12px; padding: 18px; overflow: auto; }
.label-sheet { display: flex; flex-wrap: wrap; gap: 8px; }
.label-card {
  width: 50mm; height: 30mm; background: #fff; color: #111; border: 1px solid #bfcbc6;
  padding: 2.2mm 2.6mm; display: flex; flex-direction: column; overflow: hidden;
  font-family: var(--font); page-break-inside: avoid;
}
.label-card .lc-company { font-size: 6.5pt; color: #333; letter-spacing: .02em; display: flex; justify-content: space-between; gap: 4px; }
.label-card .lc-name { font-size: 9.5pt; font-weight: 700; margin-top: .6mm; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label-card .lc-spec { font-size: 6.5pt; color: #333; line-height: 1.25; }
.label-card .lc-batch { font-size: 6.5pt; margin-top: .4mm; display: flex; justify-content: space-between; gap: 4px; }
.label-card .lc-code { font-family: Consolas, monospace; font-size: 7pt; letter-spacing: .04em; }
.label-card .lc-barcode { margin-top: auto; height: 7.2mm; }
.label-card .lc-barcode svg { width: 100%; height: 100%; display: block; }
.label-card .lc-foot { display: flex; justify-content: space-between; font-size: 5.8pt; color: #222; margin-top: .3mm; }
.print-doc { background: #fff; color: #111; padding: 10mm; max-width: 210mm; margin: 0 auto; font-family: var(--font); }
.print-doc h1 { text-align: center; font-size: 18pt; letter-spacing: .1em; margin: 0 0 2mm; }
.print-doc .print-sub { text-align: center; font-size: 8pt; color: #555; margin-bottom: 5mm; }
.print-doc .print-meta { display: flex; justify-content: space-between; font-size: 8.5pt; border-bottom: 1px solid #333; padding-bottom: 2mm; margin-bottom: 3mm; }
.print-doc table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
.print-doc th, .print-doc td { border: 1px solid #555; padding: 1.6mm 2mm; }
.print-doc th { background: #f1f1f1; text-align: left; font-weight: 600; }
.print-doc .r { text-align: right; font-variant-numeric: tabular-nums; }
.print-doc .signs { display: flex; justify-content: space-between; margin-top: 9mm; font-size: 8.5pt; gap: 10mm; }
.print-doc .signs span { border-bottom: 1px solid #333; min-width: 40mm; display: inline-block; }
.print-doc .foot { margin-top: 5mm; font-size: 7.5pt; color: #666; text-align: center; }
.report-doc .report-head { text-align: center; border-bottom: 2px solid #1c3c35; padding-bottom: 3mm; margin-bottom: 4mm; }
.report-doc .report-head h1 { margin: 0; font-size: 18pt; letter-spacing: .08em; }
.report-doc .report-head p { margin: 1mm 0 0; font-size: 8pt; color: #555; }
.report-doc .report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5mm 8mm; font-size: 9pt; margin: 3mm 0; }
.report-doc .report-grid div { display: flex; gap: 2mm; }
.report-doc .report-grid label { color: #555; min-width: 20mm; }
.report-doc .conclusion { margin-top: 4mm; padding: 2.5mm 3mm; border: 1px solid #999; font-size: 9.5pt; }
.report-doc .conclusion b { font-size: 11pt; }

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .toast-root, .modal-backdrop { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  .print-doc { padding: 0; }
  .label-preview-wrap { border: 0; padding: 0; background: #fff; }
  .label-sheet { gap: 0; }
  .label-card { border: 0; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-grid, .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .span-3, .form-grid .span-4 { grid-column: span 2; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: 12px 0 40px rgba(0,0,0,.2); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .content { padding: 18px 16px 34px; }
  .topbar { padding: 0 14px; height: 58px; }
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-side { min-height: 100vh; }
  .page-head { flex-wrap: wrap; }
  .page-actions { margin-left: 0; width: 100%; }
  .hero { flex-wrap: wrap; padding: 20px; }
  .hero .hero-actions { margin-left: 0; width: 100%; }
  .grid-2, .grid-3, .grid-4, .summary-strip { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3, .form-grid .span-4 { grid-column: span 1; }
  .filters .field { flex: 1 1 140px; }
  .modal { max-height: calc(100vh - 20px); }
  .modal-backdrop { padding: 10px; }
  .crumb { display: none; }
  .user-chip small { display: none; }
  table.data { min-width: 620px; }
  table.data th, table.data td { padding: 9px 10px; }
  .doc-lines { min-width: 780px; }
  .doc-lines-wrap { overflow-x: auto; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 20px; }
  .topbar .btn span { display: none; }
}
