/* ============================================================
   反向开票 SaaS — 设计系统
   基调：票据档案 · 墨绿账本 + 纸白报表 + 朱砂印章
   ============================================================ */

:root {
  --ink-900: #0E1C19;
  --ink-800: #14251F;
  --ink-700: #1B302A;
  --ink-600: #264039;
  --ink-500: #35544B;

  --paper: #F6F4EE;
  --paper-2: #FBF9F4;
  --card: #FFFFFF;

  --line: #E7E2D6;
  --line-strong: #D6CFBE;

  --text: #1A2622;
  --text-2: #4A5A54;
  --muted: #7C8B85;
  --faint: #A7B2AC;

  --brand: #B23A2E;
  --brand-600: #9A3126;
  --brand-700: #7E271E;
  --brand-soft: #F7E9E5;

  --ok: #1F7A5A;
  --ok-soft: #E4F2EC;
  --warn: #A9741A;
  --warn-soft: #FAF1DD;
  --info: #2A5F8F;
  --info-soft: #E6EEF6;
  --danger: #B23A2E;
  --danger-soft: #FAE9E6;

  --r-sm: 3px;
  --r: 5px;
  --r-lg: 8px;

  --shadow-sm: 0 1px 2px rgba(20, 37, 31, .05);
  --shadow: 0 2px 10px rgba(20, 37, 31, .07);
  --shadow-lg: 0 18px 50px rgba(14, 28, 25, .22);

  --mono: ui-monospace, SFMono-Regular, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
table { border-collapse: collapse; width: 100%; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #CFC8B8; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ============================ 登录 ============================ */
.login-wrap { display: flex; min-height: 100vh; background: var(--paper); }

.login-side {
  width: 52%;
  background: var(--ink-900);
  color: #E8EDE9;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px 60px;
}
.login-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 78% 18%, rgba(178, 58, 46, .30), transparent 46%),
    radial-gradient(circle at 12% 88%, rgba(53, 84, 75, .55), transparent 52%);
  pointer-events: none;
}
.login-side::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.028) 0 1px, transparent 1px 52px);
  pointer-events: none;
}
.login-mark { display: flex; align-items: center; gap: 13px; position: relative; z-index: 1; }
.login-seal {
  width: 38px; height: 38px; border-radius: 4px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 19px; letter-spacing: 0;
  box-shadow: 0 0 0 1px rgba(255,255,255,.18) inset;
}
.login-mark b { font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.login-mark span { display: block; font-size: 11px; color: #8FA69E; letter-spacing: .18em; margin-top: 1px; }

.login-hero { position: relative; z-index: 1; padding-bottom: 8px; }
.login-eyebrow {
  font-size: 11px; letter-spacing: .22em; color: #7E958C; margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.login-eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--brand); }
.login-hero h1 {
  font-size: 42px; line-height: 1.24; font-weight: 600; letter-spacing: -.01em;
  color: #F4F7F3; margin-bottom: 18px;
}
.login-hero h1 em { font-style: normal; color: #D9705F; position: relative; }
.login-hero p { color: #93A8A0; font-size: 13.5px; max-width: 400px; line-height: 1.9; }

.login-stats {
  display: flex; gap: 40px; margin-top: 44px; padding-top: 26px;
  border-top: 1px solid rgba(255,255,255,.09);
  position: relative; z-index: 1;
}
.login-stats div b { display: block; font-family: var(--mono); font-size: 22px; color: #F0F4F0; font-weight: 500; }
.login-stats div span { font-size: 11px; color: #7E958C; letter-spacing: .08em; }

.login-main { flex: 1; display: grid; place-items: center; padding: 40px; }
.login-card { width: 100%; max-width: 352px; }
.login-card h2 { font-size: 23px; font-weight: 600; margin-bottom: 6px; letter-spacing: -.01em; }
.login-card .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 30px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11.5px; color: var(--text-2); margin-bottom: 6px; letter-spacing: .03em; }
.field .hint { font-size: 11px; color: var(--faint); margin-top: 5px; }

.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--r);
  transition: border-color .16s, box-shadow .16s;
  outline: none;
}
.input:hover, .select:hover { border-color: #BFB6A2; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(178, 58, 46, .1);
}
.input::placeholder { color: #B6BDB8; }
.textarea { height: auto; min-height: 76px; padding: 9px 12px; resize: vertical; line-height: 1.7; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237C8B85' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }
.input-lg { height: 44px; font-size: 14px; }

.login-btn {
  width: 100%; height: 44px; margin-top: 10px;
  background: var(--brand); color: #fff; border-radius: var(--r);
  font-size: 14px; font-weight: 500; letter-spacing: .04em;
  transition: background .16s, transform .1s;
}
.login-btn:hover { background: var(--brand-600); }
.login-btn:active { transform: translateY(1px); }
.login-btn:disabled { background: #C9B4AF; cursor: not-allowed; }

.demo-accounts { margin-top: 26px; border-top: 1px dashed var(--line-strong); padding-top: 16px; }
.demo-accounts .t { font-size: 11px; color: var(--faint); letter-spacing: .06em; margin-bottom: 10px; }
.demo-accounts button {
  display: flex; width: 100%; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-radius: var(--r); font-size: 12px; color: var(--text-2);
  transition: background .14s;
}
.demo-accounts button:hover { background: #EFEBE0; }
.demo-accounts button .num { color: var(--muted); font-size: 11.5px; }

.login-legal { margin-top: 28px; font-size: 11px; color: var(--faint); line-height: 1.8; }

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

.sidebar {
  width: 236px; flex: 0 0 236px;
  background: var(--ink-900);
  color: #B9C7C1;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
  transition: width .2s ease, flex-basis .2s ease;
}
.sb-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 19px 18px 19px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  min-height: 64px;
}
.sb-seal {
  width: 30px; height: 30px; border-radius: 3px; background: var(--brand);
  color: #fff; display: grid; place-items: center;
  font-size: 15px; font-weight: 700; flex: 0 0 30px;
}
.sb-brand-t { overflow: hidden; white-space: nowrap; }
.sb-brand-t b { display: block; font-size: 13px; color: #EDF2EE; font-weight: 600; letter-spacing: .02em; }
.sb-brand-t span { display: block; font-size: 10px; color: #6E857C; letter-spacing: .13em; margin-top: 1px; }

.sb-merchant {
  margin: 12px 12px 6px; padding: 10px 11px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r);
}
.sb-merchant .n { font-size: 12px; color: #E2EAE5; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-merchant .c { font-family: var(--mono); font-size: 10px; color: #7B9188; margin-top: 2px; letter-spacing: .04em; }

.sb-nav { flex: 1; overflow-y: auto; padding: 8px 0 20px; }
.sb-nav::-webkit-scrollbar { width: 0; }
.sb-group { padding: 14px 20px 6px; font-size: 10px; letter-spacing: .16em; color: #5E726B; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px 8px 20px; margin: 1px 8px;
  border-radius: var(--r); font-size: 12.5px; color: #A9BBB4;
  position: relative; transition: background .14s, color .14s;
  white-space: nowrap;
}
.sb-item:hover { background: rgba(255,255,255,.055); color: #E8EFEA; }
.sb-item.active { background: rgba(255,255,255,.075); color: #FFF; font-weight: 500; }
.sb-item.active::before {
  content: ""; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 15px; background: var(--brand); border-radius: 0 2px 2px 0;
}
.sb-item svg { width: 15px; height: 15px; flex: 0 0 15px; opacity: .8; }
.sb-item.active svg { opacity: 1; }
.sb-item .tag {
  margin-left: auto; font-size: 10px; font-family: var(--mono);
  background: var(--brand); color: #fff; border-radius: 9px; padding: 0 6px; line-height: 15px;
}

.sb-foot {
  padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 9px;
}
.sb-avatar {
  width: 29px; height: 29px; border-radius: 50%;
  background: #2A4A41; color: #CFE0D7; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; flex: 0 0 29px;
}
.sb-user { overflow: hidden; flex: 1; }
.sb-user b { display: block; font-size: 12px; color: #E4EDE7; font-weight: 500; }
.sb-user span { display: block; font-size: 10px; color: #6E857C; }
.sb-out { color: #7B9188; padding: 4px; border-radius: 4px; transition: .14s; }
.sb-out:hover { color: #E4A79C; background: rgba(178,58,46,.15); }

/* 主区 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 64px; flex: 0 0 64px;
  background: rgba(246,244,238,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 26px; gap: 16px;
  position: sticky; top: 0; z-index: 30;
}
.tb-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.tb-title h1 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.tb-title .crumb { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.balance-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 10px; border-radius: 20px;
  background: #fff; border: 1px solid var(--line);
  font-size: 12px; color: var(--text-2);
}
.balance-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.balance-pill b { font-family: var(--mono); font-weight: 500; color: var(--text); }

.content { padding: 24px 26px 40px; flex: 1; max-width: 1560px; width: 100%; }

/* 页头 */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-head .ph-t { flex: 1; }
.page-head h2 { font-size: 19px; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.page-head h2::before { content: ""; width: 3px; height: 16px; background: var(--brand); border-radius: 1px; }
.page-head p { font-size: 12px; color: var(--muted); margin-top: 5px; padding-left: 13px; }
.page-head .ph-a { display: flex; gap: 8px; align-items: center; }

/* ============================ 卡片 ============================ */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 13.5px; font-weight: 600; letter-spacing: .01em; }
.card-head .sub { font-size: 11.5px; color: var(--muted); }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px 15px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s, transform .18s;
}
.stat:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.stat .k { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; letter-spacing: .02em; }
.stat .k svg { width: 13px; height: 13px; opacity: .55; }
.stat .v { font-family: var(--mono); font-size: 25px; font-weight: 500; letter-spacing: -.02em; margin-top: 9px; line-height: 1.15; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 3px; }
.stat .f { font-size: 11px; color: var(--faint); margin-top: 7px; display: flex; align-items: center; gap: 5px; }
.stat .f .up { color: var(--ok); }
.stat .f .down { color: var(--danger); }
.stat.accent { background: var(--ink-900); border-color: var(--ink-900); }
.stat.accent .k { color: #93A8A0; }
.stat.accent .v { color: #F3F7F3; }
.stat.accent .v small { color: #7E958C; }
.stat.accent .f { color: #7E958C; }
.stat.accent::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px;
  border-radius: 50%; background: radial-gradient(circle, rgba(178,58,46,.5), transparent 68%);
}

/* ============================ 表格 ============================ */
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; color: var(--faint); }
.search-box .input { height: 32px; padding-left: 30px; width: 216px; font-size: 12.5px; background: var(--paper-2); border-color: var(--line); }
.search-box .input:focus { background: #fff; }
.toolbar .select { height: 32px; font-size: 12.5px; width: auto; min-width: 104px; background-color: var(--paper-2); border-color: var(--line); }

.tbl-scroll { overflow-x: auto; }
table.tbl { font-size: 12.5px; }
table.tbl thead th {
  text-align: left; font-weight: 500; color: var(--muted);
  font-size: 11px; letter-spacing: .05em;
  padding: 10px 14px; background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.tbl tbody td {
  padding: 11px 14px; border-bottom: 1px solid #F1EDE3;
  color: var(--text-2); vertical-align: middle;
}
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: #FCFAF3; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .strong { color: var(--text); font-weight: 500; }
table.tbl .r { text-align: right; }
table.tbl .c { text-align: center; }
table.tbl td.num, table.tbl th.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.tbl .col-act { text-align: right; white-space: nowrap; }

.link { color: var(--info); cursor: pointer; }
.link:hover { text-decoration: underline; }
.link-brand { color: var(--brand); cursor: pointer; }
.link-brand:hover { text-decoration: underline; }

.row-act { display: inline-flex; gap: 2px; }
.row-act button {
  padding: 3px 7px; border-radius: 3px; font-size: 12px; color: var(--text-2);
  transition: background .13s, color .13s;
}
.row-act button:hover { background: #EEE9DD; color: var(--text); }
.row-act button.danger:hover { background: var(--danger-soft); color: var(--danger); }
.row-act button.brand { color: var(--brand); }
.row-act button.brand:hover { background: var(--brand-soft); }

/* 状态 */
.st { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.st i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: 0 0 5px; }
.st-ok { color: var(--ok); }
.st-warn { color: var(--warn); }
.st-info { color: var(--info); }
.st-danger { color: var(--danger); }
.st-idle { color: var(--muted); }

.badge {
  display: inline-block; padding: 0 7px; border-radius: 3px;
  font-size: 11px; line-height: 18px; letter-spacing: .02em;
  background: #EFEBE0; color: var(--text-2);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

.pager { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager .info { font-size: 12px; color: var(--muted); }
.pager .pages { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.pager .pg {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 3px;
  border: 1px solid var(--line); background: #fff; font-size: 12px;
  color: var(--text-2); transition: .13s; font-family: var(--mono);
}
.pager .pg:hover:not(:disabled) { border-color: var(--line-strong); color: var(--text); }
.pager .pg.on { background: var(--ink-800); border-color: var(--ink-800); color: #fff; }
.pager .pg:disabled { opacity: .4; cursor: not-allowed; }

/* ============================ 按钮 ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 13px; border-radius: var(--r);
  font-size: 12.5px; font-weight: 400; letter-spacing: .01em;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text-2);
  transition: .14s; white-space: nowrap;
}
.btn:hover { border-color: #C3BAA6; color: var(--text); background: #FCFAF5; }
.btn svg { width: 13px; height: 13px; }
.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-dark { background: var(--ink-800); border-color: var(--ink-800); color: #fff; }
.btn-dark:hover { background: var(--ink-700); border-color: var(--ink-700); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #EFEBE0; border-color: transparent; }
.btn-danger { color: var(--danger); border-color: #E3C9C4; }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-sm { height: 27px; padding: 0 9px; font-size: 12px; }
.btn-lg { height: 38px; padding: 0 18px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ============================ 表单 ============================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-sec {
  grid-column: 1 / -1; font-size: 11px; letter-spacing: .1em; color: var(--muted);
  padding: 16px 0 8px; margin-top: 4px; border-top: 1px dashed var(--line);
  display: flex; align-items: center; gap: 8px;
}
.form-sec:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.form-sec::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.req::after { content: " *"; color: var(--brand); }
.form-tip { font-size: 11px; color: var(--faint); margin-top: 4px; line-height: 1.6; }

.chk { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.chk input { width: 14px; height: 14px; accent-color: var(--brand); }

/* ============================ 抽屉 ============================ */
.mask {
  position: fixed; inset: 0; background: rgba(14, 28, 25, .38);
  backdrop-filter: blur(1.5px); z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .22s;
}
.mask.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 620px; max-width: 96vw;
  background: var(--paper-2); z-index: 101;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .26s cubic-bezier(.32,.72,.28,1);
  box-shadow: var(--shadow-lg);
}
.drawer.show { transform: translateX(0); }
.drawer.narrow { width: 460px; }
.drawer-head {
  padding: 18px 22px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; flex: 0 0 auto;
}
.drawer-head h3 { font-size: 15px; font-weight: 600; }
.drawer-head .sub { font-size: 11.5px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.drawer-head .x {
  margin-left: auto; width: 28px; height: 28px; border-radius: 4px;
  display: grid; place-items: center; color: var(--muted);
}
.drawer-head .x:hover { background: #F0ECE1; color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-foot {
  padding: 14px 22px; background: #fff; border-top: 1px solid var(--line);
  display: flex; gap: 9px; justify-content: flex-end; flex: 0 0 auto;
}

/* 抽屉内的二级面板 */
.sub-panel {
  position: absolute; inset: 0; z-index: 6;
  background: var(--paper-2);
  display: flex; flex-direction: column;
  animation: subin .2s ease;
}
@keyframes subin { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* 详情描述 */
.desc { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.desc > div { background: #fff; padding: 10px 13px; }
.desc .k { font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.desc .v { font-size: 12.5px; color: var(--text); margin-top: 3px; word-break: break-all; }
.desc .full { grid-column: 1 / -1; }
.desc .v.mono { font-family: var(--mono); }

/* 时间轴 */
.timeline { padding-left: 4px; }
.tl-item { position: relative; padding: 0 0 18px 22px; border-left: 1px solid var(--line); }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -4px; top: 4px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--line-strong); border: 2px solid var(--paper-2);
}
.tl-item.done::before { background: var(--ok); }
.tl-item.cur::before { background: var(--brand); box-shadow: 0 0 0 3px rgba(178,58,46,.14); }
.tl-item .t { font-size: 12.5px; color: var(--text); font-weight: 500; }
.tl-item .d { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.tl-item .tm { font-size: 11px; color: var(--faint); font-family: var(--mono); margin-top: 3px; }

/* 发票预览 */
.inv-paper {
  background: #fff; border: 1px solid var(--line-strong); border-radius: 2px;
  padding: 22px 24px; position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.inv-paper::before {
  content: ""; position: absolute; inset: 6px; border: 1px solid #EDE8DC; pointer-events: none; border-radius: 1px;
}
.inv-title { text-align: center; font-size: 15px; letter-spacing: .5em; color: var(--brand); font-weight: 600; padding-bottom: 12px; }
.inv-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-family: var(--mono); padding-bottom: 10px; }
.inv-line { display: flex; font-size: 11.5px; padding: 5px 0; border-bottom: 1px dashed #EDE8DC; }
.inv-line .k { color: var(--muted); width: 82px; flex: 0 0 82px; }
.inv-line .v { color: var(--text); flex: 1; }
.inv-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; margin-top: 6px; border-top: 1px solid var(--line); }
.inv-total .v { font-family: var(--mono); font-size: 18px; color: var(--brand); }
.inv-seal {
  position: absolute; right: 26px; bottom: 22px;
  width: 74px; height: 74px; border: 2px solid rgba(178,58,46,.5); border-radius: 50%;
  display: grid; place-items: center; color: rgba(178,58,46,.62);
  font-size: 10px; text-align: center; line-height: 1.35; letter-spacing: .06em;
  transform: rotate(-11deg);
}
.inv-void { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.inv-void span {
  font-size: 40px; color: rgba(178,58,46,.14); letter-spacing: .3em; font-weight: 700;
  transform: rotate(-14deg); border: 3px solid rgba(178,58,46,.14); padding: 4px 16px; border-radius: 4px;
}

/* ============================ 图表 ============================ */
.chart-wrap { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; gap: 16px; font-size: 11.5px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 8px; height: 2px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--ink-900); color: #fff;
  font-size: 11px; padding: 5px 9px; border-radius: 4px; transform: translate(-50%, -120%);
  opacity: 0; transition: opacity .12s; white-space: nowrap; z-index: 5; font-family: var(--mono);
}
.chart-tip.show { opacity: 1; }

/* 进度条 */
.bar { height: 5px; background: #EDE8DC; border-radius: 5px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 5px; transition: width .4s; }
.bar.ok > span { background: var(--ok); }

/* 空态 */
.empty { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: .28; margin-bottom: 10px; }
.empty p { font-size: 12.5px; }
.empty .sub { font-size: 11.5px; color: var(--faint); margin-top: 4px; }

/* ============================ Toast ============================ */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 8px;
  background: var(--ink-900); color: #EDF3EE; padding: 9px 16px;
  border-radius: 5px; font-size: 12.5px; box-shadow: var(--shadow);
  animation: tin .22s ease; max-width: 460px;
}
.toast.err { background: #6E211A; }
.toast.ok { background: #14523D; }
.toast i { width: 6px; height: 6px; border-radius: 50%; background: #6EDCAE; flex: 0 0 6px; }
.toast.err i { background: #F0A79A; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* 模态确认 */
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -46%) scale(.98); z-index: 120; width: 400px; max-width: 92vw;
  background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: .18s; }
.modal.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal-b { padding: 22px 22px 6px; }
.modal-b h4 { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.modal-b p { font-size: 12.5px; color: var(--text-2); line-height: 1.8; }
.modal-f { padding: 16px 22px 20px; display: flex; justify-content: flex-end; gap: 9px; }

/* 工具 */
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 11.5px; }
.hide { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.nowrap { white-space: nowrap; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 数据条（图表辅助） */
.rank-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.rank-row:last-child { border-bottom: none; }
.rank-no { width: 18px; height: 18px; border-radius: 3px; background: #EFEBE0; color: var(--muted);
  font-size: 10.5px; display: grid; place-items: center; font-family: var(--mono); flex: 0 0 18px; }
.rank-row:nth-child(1) .rank-no, .rank-row:nth-child(2) .rank-no, .rank-row:nth-child(3) .rank-no { background: var(--ink-800); color: #fff; }
.rank-n { flex: 1; min-width: 0; }
.rank-n .n { font-size: 12.5px; color: var(--text); }
.rank-n .c { font-size: 11px; color: var(--faint); font-family: var(--mono); }
.rank-v { font-family: var(--mono); font-size: 12.5px; color: var(--text); }

/* 响应式 */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .login-side { display: none; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .24s; }
  .sidebar.open { transform: none; }
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 0 16px; }
  .menu-toggle { display: grid !important; }
}
@media (max-width: 700px) {
  .stat-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .login-hero h1 { font-size: 32px; }
  .tb-title .crumb { display: none; }
  .desc { grid-template-columns: 1fr; }
}
.menu-toggle { display: none; width: 32px; height: 32px; place-items: center; border-radius: 4px; color: var(--text-2); }
.menu-toggle:hover { background: #EFEBE0; }
