/* ============================================================
   光初经营台 — 设计系统
   ============================================================ */
:root {
  --bg: #f1f3f5;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --ink: #0d1720;
  --ink-2: #344054;
  --muted: #697586;
  --muted-2: #98a2b3;
  --line: #e1e6ea;
  --line-2: #edf0f3;
  --nav: #0f1b24;
  --nav-2: #16252f;
  --brand: #14655a;
  --brand-2: #0f7a68;
  --brand-soft: #e7f3ef;
  --gold: #a8791f;
  --gold-soft: #fbf3e2;
  --pos: #0d8a5f;
  --pos-soft: #e6f5ef;
  --neg: #c0392b;
  --neg-soft: #fdecea;
  --warn: #b4710b;
  --warn-soft: #fdf3e2;
  --shadow-s: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-m: 0 2px 6px rgba(16, 24, 40, .06), 0 12px 28px -12px rgba(16, 24, 40, .12);
  --shadow-l: 0 24px 60px -20px rgba(9, 20, 28, .28);
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 14px;
  --sidebar-w: 226px;
  --ff: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ff-num: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ff);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4, p { margin: 0; }
.num, .tbl td.num, .kpi-value, .mono { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.mono { font-family: var(--ff-num); }

/* ---------- boot / login ---------- */
.boot-screen {
  position: fixed; inset: 0; display: grid; place-content: center; gap: 14px;
  background: var(--nav); color: #fff; text-align: center;
}
.boot-mark { font-size: 30px; letter-spacing: .3em; color: #e8c56a; font-weight: 600; }
.boot-text { color: rgba(255,255,255,.5); font-size: 13px; letter-spacing: .08em; }

.login-screen {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--nav);
}
.login-hero {
  position: relative; padding: 56px 64px; color: #fff; display: flex; flex-direction: column;
  justify-content: space-between; overflow: hidden;
}
.login-hero::after {
  content: ""; position: absolute; width: 520px; height: 520px; right: -160px; bottom: -220px;
  background: radial-gradient(circle at 30% 30%, rgba(20,101,90,.55), rgba(20,101,90,0) 62%);
  border-radius: 50%;
}
.login-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 52px 52px; mask-image: linear-gradient(to bottom, #000, transparent 78%);
}
.login-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.login-logo {
  width: 40px; height: 40px; border-radius: 10px; background: #e8c56a; color: #0f1b24;
  display: grid; place-content: center; font-weight: 800; font-size: 17px;
}
.login-brand-text b { display: block; font-size: 17px; letter-spacing: .04em; }
.login-brand-text span { font-size: 12px; color: rgba(255,255,255,.5); letter-spacing: .14em; }
.login-pitch { position: relative; z-index: 1; max-width: 520px; }
.login-pitch h1 { font-size: 34px; line-height: 1.32; font-weight: 600; letter-spacing: -.01em; margin-bottom: 18px; }
.login-pitch h1 em { font-style: normal; color: #e8c56a; }
.login-pitch p { color: rgba(255,255,255,.62); font-size: 14px; line-height: 1.9; }
.login-rules { position: relative; z-index: 1; display: grid; gap: 10px; margin-top: 34px; }
.login-rule { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: rgba(255,255,255,.72); }
.login-rule i { color: #38b28f; font-style: normal; margin-top: 1px; }
.login-foot { position: relative; z-index: 1; font-size: 12px; color: rgba(255,255,255,.36); }

.login-panel { background: var(--surface); display: grid; place-items: center; padding: 40px; }
.login-card { width: 100%; max-width: 348px; }
.login-card h2 { font-size: 21px; font-weight: 600; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.login-error {
  background: var(--neg-soft); color: var(--neg); border-radius: var(--r-s);
  padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}
.demo-accounts { margin-top: 26px; border-top: 1px dashed var(--line); padding-top: 16px; }
.demo-accounts .cap { font-size: 12px; color: var(--muted-2); margin-bottom: 8px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.demo-acc {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-s);
  padding: 7px 9px; cursor: pointer; text-align: left; transition: .14s;
}
.demo-acc:hover { border-color: var(--brand); background: var(--brand-soft); }
.demo-acc b { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.demo-acc span { font-size: 11px; color: var(--muted-2); }

/* ---------- shell ---------- */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.sidebar { background: var(--nav); color: #fff; padding: 0 0 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 18px; }
.side-brand .logo {
  width: 34px; height: 34px; border-radius: 9px; background: #e8c56a; color: #0f1b24;
  display: grid; place-content: center; font-weight: 800; font-size: 14px; flex: none;
}
.side-brand b { font-size: 14.5px; letter-spacing: .06em; font-weight: 600; display: block; }
.side-brand span { font-size: 10.5px; color: rgba(255,255,255,.42); letter-spacing: .12em; }
.side-role {
  margin: 0 14px 14px; padding: 8px 10px; border-radius: 8px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07);
  font-size: 11.5px; color: rgba(255,255,255,.62); display: flex; justify-content: space-between; align-items: center;
}
.side-role b { color: #e8c56a; font-weight: 600; }
.side-nav { padding: 0 10px; overflow-y: auto; flex: 1; }
.side-nav::-webkit-scrollbar { width: 0; }
.nav-group { font-size: 10.5px; letter-spacing: .16em; color: rgba(255,255,255,.3); padding: 16px 12px 7px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: rgba(255,255,255,.7); font-size: 13.2px; cursor: pointer; transition: .14s; position: relative;
  border: 0; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(20,101,90,.55); color: #fff; box-shadow: inset 0 0 0 1px rgba(56,178,143,.28); }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px;
  background: #38b28f; border-radius: 0 3px 3px 0;
}
.nav-item .dot { width: 5px; height: 5px; border-radius: 50%; background: #f0b429; margin-left: auto; }
.side-foot { padding: 12px 16px 0; font-size: 11px; color: rgba(255,255,255,.3); line-height: 1.7; border-top: 1px solid rgba(255,255,255,.06); margin: 8px 14px 0; }

.topbar {
  height: 60px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px;
  padding: 0 26px; position: sticky; top: 0; z-index: 30;
}
.tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-title { font-size: 15px; font-weight: 600; letter-spacing: .01em; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 9px;
  border-radius: 100px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.chip .k { color: var(--muted-2); }
.chip.solid { background: var(--nav); color: #fff; border-color: transparent; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.cash-flag { display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 10px; border-radius: 100px; background: var(--pos-soft); border: 1px solid #cfeade; }
.cash-flag.warn { background: var(--warn-soft); border-color: #f2dfb6; }
.cash-flag.danger { background: var(--neg-soft); border-color: #f6d3ce; }
.cash-flag .lbl { font-size: 11px; color: var(--muted); }
.cash-flag .val { font-size: 13.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 3px rgba(13,138,95,.15); }
.pulse.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(180,113,11,.16); }
.pulse.danger { background: var(--neg); box-shadow: 0 0 0 3px rgba(192,57,43,.15); }
.user-chip { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 6px 4px 4px; border-radius: 100px; border: 1px solid transparent; background: none; }
.user-chip:hover { background: var(--surface-2); border-color: var(--line); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--nav); color: #e8c56a; display: grid; place-content: center; font-size: 12.5px; font-weight: 600; }
.user-chip .nm { font-size: 13px; font-weight: 550; line-height: 1.2; }
.user-chip .rl { font-size: 11px; color: var(--muted-2); line-height: 1.2; }

.main { padding: 22px 26px 60px; max-width: 1560px; width: 100%; margin: 0 auto; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 21px; font-weight: 650; letter-spacing: -.01em; }
.page-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- grid & cards ---------- */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }
.g-3-2 { grid-template-columns: 3fr 2fr; }
.section { margin-top: 16px; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; }
.section-head h3 { font-size: 14.5px; font-weight: 600; }
.section-head .hint { font-size: 12px; color: var(--muted-2); }
.section-head .spacer { flex: 1; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow-s); overflow: hidden; }
.card-head { padding: 14px 16px 0; display: flex; align-items: flex-start; gap: 10px; }
.card-head h3 { font-size: 13.5px; font-weight: 600; }
.card-head .sub { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }
.card-head .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 14px 16px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--line-2); background: var(--surface-2); font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 15px 16px 14px; position: relative; overflow: hidden;
}
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line); }
.kpi.tone-brand::after { background: var(--brand); }
.kpi.tone-pos::after { background: var(--pos); }
.kpi.tone-warn::after { background: var(--warn); }
.kpi.tone-neg::after { background: var(--neg); }
.kpi.tone-gold::after { background: #c99b3f; }
.kpi-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 27px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; margin-top: 8px; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); margin-top: 7px; flex-wrap: wrap; }
.kpi-foot b { color: var(--ink-2); font-weight: 600; }
.delta-up { color: var(--pos); }
.delta-down { color: var(--neg); }

/* ---------- hero (dark cash panel) ---------- */
.hero {
  background: linear-gradient(135deg, #0f1b24 0%, #142a31 58%, #123b36 100%);
  color: #fff; border-radius: var(--r-l); padding: 20px 22px; position: relative; overflow: hidden;
  border: 1px solid rgba(255,255,255,.06);
}
.hero::after {
  content: ""; position: absolute; width: 340px; height: 340px; right: -120px; top: -150px;
  background: radial-gradient(circle, rgba(56,178,143,.28), transparent 66%); border-radius: 50%;
}
.hero .hero-top { display: flex; align-items: center; gap: 10px; font-size: 12px; color: rgba(255,255,255,.55); position: relative; z-index: 1; }
.hero .hero-cash { font-size: 36px; font-weight: 650; letter-spacing: -.025em; margin-top: 6px; position: relative; z-index: 1; font-variant-numeric: tabular-nums; }
.hero .hero-cash span { font-size: 17px; color: rgba(255,255,255,.45); margin-right: 4px; }
.hero .hero-meta { display: flex; gap: 26px; margin-top: 16px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero .hero-meta div { font-size: 11.5px; color: rgba(255,255,255,.5); }
.hero .hero-meta b { display: block; font-size: 16px; color: #fff; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hero .hero-meta b.ok { color: #5fd3ad; }
.hero .hero-meta b.bad { color: #f19a92; }

/* ---------- table ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.8px; }
.tbl thead th {
  text-align: left; font-weight: 550; color: var(--muted); font-size: 11.5px; letter-spacing: .03em;
  padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.tbl thead th.num { text-align: right; }
.tbl tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); vertical-align: middle; }
.tbl tbody td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tbody tr:hover td { background: #fbfcfd; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .strong { color: var(--ink); font-weight: 600; }
.tbl .sub { color: var(--muted-2); font-size: 11.5px; }
.tbl.compact tbody td { padding: 7px 10px; }
.tbl.compact thead th { padding: 7px 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- badges / tags ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 7px;
  border-radius: 4px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
  white-space: nowrap; line-height: 1.6;
}
.badge.pos { background: var(--pos-soft); color: var(--pos); border-color: #cdeade; }
.badge.neg { background: var(--neg-soft); color: var(--neg); border-color: #f5d5d1; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: #f2e0bc; }
.badge.brand { background: var(--brand-soft); color: var(--brand); border-color: #cbe4dd; }
.badge.gold { background: var(--gold-soft); color: var(--gold); border-color: #efe0c0; }
.badge.dark { background: var(--nav); color: #fff; border-color: transparent; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font-size: 12.8px; font-weight: 500;
  cursor: pointer; transition: .14s; white-space: nowrap;
}
.btn:hover { border-color: #c9d2da; background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.dark { background: var(--nav); border-color: var(--nav); color: #fff; }
.btn.dark:hover { background: #1b2c38; }
.btn.danger { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn.danger:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn.block { width: 100%; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 550; margin-bottom: 6px; }
.field .req { color: var(--neg); margin-left: 2px; }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--ink); font-size: 13.2px; font-family: inherit; transition: .14s;
  appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23697586' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20,101,90,.1); }
input::placeholder { color: var(--muted-2); }
input:disabled, select:disabled { background: var(--surface-2); color: var(--muted); }
textarea { height: auto; min-height: 70px; padding: 9px 11px; resize: vertical; line-height: 1.6; }
.help { font-size: 11.5px; color: var(--muted-2); margin-top: 5px; }
.help.err { color: var(--neg); }
.help.ok { color: var(--pos); }
.inline { display: flex; gap: 10px; align-items: flex-end; }
.inline > .field { flex: 1; margin-bottom: 0; }
.switch-row { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink-2); }

/* ---------- bars / progress ---------- */
.bar { height: 6px; border-radius: 100px; background: #eef1f4; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 100px; background: var(--brand); transition: width .3s; }
.bar.pos > i { background: var(--pos); }
.bar.warn > i { background: #d99a1f; }
.bar.neg > i { background: var(--neg); }
.bar-lg { height: 9px; }
.bar-label { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.bar-label b { color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- radar ---------- */
.radar { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.radar-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.radar-bar-wrap { height: 92px; display: flex; align-items: flex-end; }
.radar-bar { width: 100%; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, #cfe9e1, #a9d8cb); min-height: 6px; position: relative; }
.radar-bar.safe { background: linear-gradient(180deg, #cfe9e1, #a9d8cb); }
.radar-bar.warn { background: linear-gradient(180deg, #f6dfb4, #ecc57e); }
.radar-bar.critical { background: linear-gradient(180deg, #f3c3bd, #e08c82); }
.radar-month { font-size: 10.5px; color: var(--muted-2); text-align: center; letter-spacing: .02em; }
.radar-val { font-size: 10.5px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.radar-flag { font-size: 9px; text-align: center; color: var(--warn); }

/* ---------- misc ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.neg-text { color: var(--neg); }
.pos-text { color: var(--pos); }
.warn-text { color: var(--warn); }
.stack { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.divider { height: 1px; background: var(--line-2); margin: 12px 0; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted-2); font-size: 12.5px; }
.empty b { display: block; color: var(--ink-2); font-size: 13.5px; margin-bottom: 4px; font-weight: 550; }
.timeline { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding-bottom: 14px; position: relative; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: 0; width: 1px; background: var(--line); }
.tl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin: 6px 0 0 3px; box-shadow: 0 0 0 3px var(--brand-soft); }
.tl-body b { font-size: 12.5px; font-weight: 550; }
.tl-body p { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.list-plain { margin: 0; padding: 0; list-style: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.hint-box {
  background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--r-s);
  padding: 10px 12px; font-size: 12px; color: var(--muted); line-height: 1.7;
}
.hint-box b { color: var(--ink-2); }
.hint-box.alert { background: var(--warn-soft); border-color: #f0ddb4; color: #7c5a15; }
.hint-box.alert b { color: #6b4c0e; }
.hint-box.ok { background: var(--pos-soft); border-color: #cdeade; color: #22614c; }

/* ---------- tabs ---------- */
.tabs { display: inline-flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.tab { border: 0; background: transparent; padding: 5px 12px; font-size: 12.5px; color: var(--muted); border-radius: 6px; cursor: pointer; }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-s); font-weight: 550; }
.tab .ct { font-size: 11px; color: var(--muted-2); margin-left: 4px; }

/* ---------- drawer / modal ---------- */
.drawer-mask, .modal-mask {
  position: fixed; inset: 0; background: rgba(13, 23, 32, .42); z-index: 80;
  animation: fade .18s ease; backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 96vw); background: var(--surface);
  z-index: 81; display: flex; flex-direction: column; box-shadow: var(--shadow-l); animation: slideIn .22s cubic-bezier(.2,.8,.2,1);
}
.drawer.wide { width: min(760px, 96vw); }
.drawer-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 12px; }
.drawer-head h3 { font-size: 15.5px; font-weight: 600; }
.drawer-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.drawer-head .x { margin-left: auto; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; background: var(--surface-2); }
.drawer-foot .spacer { flex: 1; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(480px, 94vw);
  background: var(--surface); border-radius: var(--r-l); z-index: 82; box-shadow: var(--shadow-l);
  animation: pop .18s ease; overflow: hidden;
}
.modal .m-head { padding: 16px 20px 0; font-size: 15px; font-weight: 600; }
.modal .m-body { padding: 14px 20px 18px; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.modal .m-foot { padding: 12px 20px; background: var(--surface-2); border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }
@keyframes slideIn { from { transform: translateX(28px); opacity: .6; } }
@keyframes pop { from { transform: translate(-50%, -46%) scale(.97); opacity: 0; } }

/* ---------- toast ---------- */
.toast-root { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 100; }
.toast {
  background: var(--nav); color: #fff; border-radius: 8px; padding: 10px 14px; font-size: 12.8px;
  box-shadow: var(--shadow-l); animation: toastIn .2s ease; max-width: 380px; line-height: 1.5;
  border-left: 3px solid #38b28f;
}
.toast.err { border-left-color: #e07a70; }
.toast.warn { border-left-color: #e8c56a; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }

/* ---------- login / split views ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr); gap: 14px; align-items: start; }
.sticky-side { position: sticky; top: 76px; }
.list-item { padding: 11px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; transition: .12s; }
.list-item:hover { background: var(--surface-2); }
.list-item.active { background: var(--brand-soft); border-left: 2px solid var(--brand); padding-left: 12px; }
.list-item .li-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.list-item .li-title { font-size: 12.8px; font-weight: 550; color: var(--ink); }
.list-item .li-sub { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.amount.pos { color: var(--pos); }
.amount.neg { color: var(--neg); }

/* ---------- item table (invoice lines) ---------- */
.lines { border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; }
.lines table { width: 100%; border-collapse: collapse; font-size: 12.3px; }
.lines th { background: var(--surface-2); color: var(--muted); font-weight: 550; font-size: 11px; padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--line); }
.lines td { padding: 6px 9px; border-bottom: 1px solid var(--line-2); }
.lines tr:last-child td { border-bottom: 0; }
.lines input, .lines select { height: 30px; font-size: 12.2px; padding: 0 8px; border-radius: 5px; }
.lines .row-actions { display: flex; gap: 4px; }
.icon-btn { width: 24px; height: 24px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; display: grid; place-content: center; font-size: 13px; line-height: 1; }
.icon-btn:hover { color: var(--neg); border-color: #f0cfca; background: var(--neg-soft); }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .sticky-side { position: static; }
}
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; width: var(--sidebar-w); transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-l); }
  .g-2-1, .g-1-2, .g-3-2 { grid-template-columns: 1fr; }
  .login-screen { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-panel { min-height: 100vh; }
  .main { padding: 16px 14px 48px; }
  .topbar { padding: 0 14px; }
  .cash-flag .lbl { display: none; }
}
@media (max-width: 720px) {
  .kpi-grid, .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .radar { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .page-title { font-size: 18px; }
  .user-chip .nm, .user-chip .rl { display: none; }
}

/* 布局补丁 */
.content-col { display: flex; flex-direction: column; min-width: 0; }
input.err, input.err:focus { border-color: var(--neg); box-shadow: 0 0 0 3px rgba(192,57,43,.1); }
.q-item:last-child { border-bottom: 0 !important; }
.user-menu a:hover, .user-menu button:hover { background: var(--surface-2); }

/* 雷达图：零基线 */
.radar-plot { position: relative; height: 96px; }
.radar-zero { position: absolute; left: -2px; right: -2px; height: 1px; background: var(--line); display: block; }
.radar-bar { position: absolute; left: 0; right: 0; min-height: 3px; border-radius: 3px; }
.radar-bar.safe { background: linear-gradient(180deg, #a9d8cb, #7fc4b3); }
.radar-bar.warn { background: linear-gradient(180deg, #ecc57e, #dda93f); }
.radar-bar.critical { background: linear-gradient(180deg, #e08c82, #cd6a5e); }

/* 雷达图微调 */
.radar { align-items: end; }
.radar-col { gap: 4px; }
.radar-month { font-size: 11px; color: var(--ink-2); font-weight: 550; }
.radar-plot { height: 118px; }
.radar-val { font-size: 10.5px; font-variant-numeric: tabular-nums; }
.radar-bar { border-radius: 3px 3px 2px 2px; }

/* 资金雷达：月份刻度条 */
.radar-strip { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; }
.radar-tile {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 8px 7px; background: var(--surface);
  border-top: 3px solid var(--line); text-align: center;
}
.radar-tile.safe { border-top-color: #7fc4b3; background: #f4faf8; }
.radar-tile.warn { border-top-color: #dda93f; background: #fdf8ee; }
.radar-tile.critical { border-top-color: #cd6a5e; background: #fdf3f2; }
.rt-month { font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.rt-bal { font-size: 19px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.rt-unit { font-size: 9.5px; color: var(--muted-2); margin-top: -2px; }
.rt-flow { font-size: 10px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.rt-flag { font-size: 9.5px; color: var(--warn); margin-top: 2px; min-height: 13px; }
@media (max-width: 1280px) { .radar-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 720px) { .radar-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* 移动端：侧栏开关与发票明细横向滚动 */
.menu-btn { display: none; font-size: 15px; line-height: 1; padding: 0 9px; }
.side-mask { position: fixed; inset: 0; background: rgba(13,23,32,.42); z-index: 55; }
@media (max-width: 1024px) {
  .menu-btn { display: inline-flex; }
  .lines { overflow-x: auto; }
  .lines table { min-width: 620px; }
  .tbl-wrap { -webkit-overflow-scrolling: touch; }
}
@media (max-width: 720px) {
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; margin-left: 0; }
  .page-actions .tabs { width: 100%; overflow-x: auto; }
  .kpi-value { font-size: 23px; }
  .drawer { width: 100vw; }
  .card-head .right .btn { height: 28px; }
}

/* ============================================================
   生产增强：导入、上传、移动端
   ============================================================ */
.dropzone {
  border: 1.5px dashed #c9d3dc; border-radius: var(--r-m); background: var(--surface-2);
  padding: 26px 18px; text-align: center; cursor: pointer; transition: .16s;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dz-icon { font-size: 26px; color: var(--brand); line-height: 1; }
.dz-title { font-size: 13.5px; font-weight: 600; margin-top: 8px; }
.dz-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.dz-link { color: var(--brand); text-decoration: underline; }
.fake-input {
  height: 36px; display: flex; align-items: center; padding: 0 11px; border: 1px solid var(--line);
  border-radius: 7px; background: var(--surface-2); color: var(--muted); font-size: 12.5px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.mini-stat {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--surface);
}
.mini-stat span { font-size: 11px; color: var(--muted); display: block; }
.mini-stat b { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.section-label { font-size: 12px; color: var(--muted-2); letter-spacing: .08em; margin-bottom: 8px; }
.upload-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
  padding: 10px 12px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--r-s);
}
.upload-bar .help { margin: 0; }

/* ---------- 移动端（≤768px）---------- */
@media (max-width: 768px) {
  body { font-size: 14.5px; }
  .topbar { height: 52px; padding: 0 12px; gap: 8px; }
  .tb-title { font-size: 14px; }
  .cash-flag { padding: 4px 8px; }
  .cash-flag .val { font-size: 12.5px; }
  .main { padding: 14px 12px 80px; }
  .page-title { font-size: 19px; }
  .page-sub { font-size: 12px; }
  .grid, .kpi-grid, .g2, .g3, .g4, .g-2-1, .g-1-2, .g-3-2 { grid-template-columns: 1fr !important; }
  .kpi { padding: 13px 14px; }
  .kpi-value { font-size: 24px; }
  .btn { height: 44px; padding: 0 14px; font-size: 14px; border-radius: 9px; }
  .btn.sm { height: 38px; padding: 0 12px; font-size: 13px; }
  .btn-group { width: 100%; }
  input[type=text], input[type=number], input[type=password], input[type=date], input[type=search], select {
    height: 46px; font-size: 15px; border-radius: 9px;
  }
  .field > label { font-size: 13.5px; margin-bottom: 8px; }
  .drawer { width: 100vw; }
  .drawer-head { padding: 14px 16px; }
  .drawer-body { padding: 14px 16px 24px; }
  .drawer-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); position: sticky; bottom: 0; }
  .drawer-foot .btn { flex: 1; }
  .tbl-wrap { margin: 0 -16px; padding: 0 16px; }
  .upload-bar { padding: 10px; }
  .upload-bar .btn { flex: 1 1 100%; justify-content: center; }
  .upload-bar .help { flex: 1 1 100%; }
  .lines { overflow-x: auto; }
  .lines table { min-width: 640px; }
  .section-head { flex-wrap: wrap; gap: 8px; }

  /* CEO 拍板中心：卡片化 + 大按钮 */
  .q-item { padding: 14px 0 !important; }
  .q-item .btn-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
  .q-item .btn-group .btn { width: 100%; height: 46px; font-size: 14.5px; }
  .card-body[style*="max-height"] { max-height: none !important; }

  /* 报销单：提交按钮吸底 */
  .submit-bar {
    position: sticky; bottom: 0; z-index: 20; background: var(--surface);
    border-top: 1px solid var(--line); padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
    display: flex; gap: 10px; align-items: center;
  }
  .submit-bar .btn { flex: 1; height: 50px; font-size: 15.5px; }
  .submit-bar .tot { font-size: 13px; }
  .radar-strip { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .rt-bal { font-size: 17px; }
  .user-menu { min-width: 220px !important; }
}

/* ---------- 移动端：明细行卡片化 + 顶栏收紧 ---------- */
@media (max-width: 768px) {
  .topbar .chip { display: none; }
  .tb-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
  .cash-flag { max-width: 44vw; overflow: hidden; }
  .cash-flag .val { white-space: nowrap; }
  .submit-bar > span:first-child { display: none; }
  .submit-bar .tot { flex: 1; font-size: 13.5px; }

  .lines table { min-width: 0 !important; }
  .lines thead { display: none; }
  .lines tbody, .lines tr, .lines td { display: block; width: 100%; }
  .lines tr {
    border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
    margin: 0 0 10px; background: var(--surface);
  }
  .lines td { border: 0; padding: 5px 0; }
  .lines td::before {
    content: attr(data-label); display: inline-block; width: 62px; flex: none;
    font-size: 12px; color: var(--muted);
  }
  .lines td[data-label=""]::before { content: none; }
  .lines td > input, .lines td > select { width: calc(100% - 66px); }
  .lines td.row-actions { display: flex; justify-content: flex-end; padding-top: 2px; }
  .lines td .help { margin-left: 66px; }
}

@media (max-width: 768px) {
  .tbl-wrap > table.tbl { min-width: 620px; }
  .tbl-wrap > table.tbl.compact { min-width: 520px; }
  .card-head .right .btn.sm { height: 34px; }
}
