:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #6b7a90;
  --line: #e6ecf5;
  --line-2: #eef2f8;
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-soft: #eaf1ff;
  --green: #0f9f6e;
  --green-soft: #e6f7f0;
  --amber: #d97706;
  --amber-soft: #fff5e6;
  --red: #dc2626;
  --red-soft: #fdecec;
  --violet: #7c3aed;
  --violet-soft: #f2ebff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -16px rgba(15, 23, 42, .18);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .35);
  --sidebar-w: 236px;
  --tab-h: 62px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
h1, h2, h3, h4, p { margin: 0; }
svg { display: block; }

.app { display: flex; min-height: 100vh; }

/* ---------------- sidebar ---------------- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, #0b1220 0%, #101c33 60%, #0d1728 100%);
  color: #cbd5e1;
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 6px; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 17px;
  box-shadow: 0 8px 20px -8px rgba(59, 130, 246, .9);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { color: #f8fafc; font-size: 15px; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: #7f8ea6; font-size: 11px; letter-spacing: 1px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; scrollbar-width: none; }
.side-nav::-webkit-scrollbar { width: 0; height: 0; }
.nav-group { margin: 8px 10px 2px; font-size: 10.5px; letter-spacing: 1.5px; color: #5d6c84; }
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 11px; border-radius: 10px;
  color: #aebbd0; font-size: 13px;
  transition: background .15s, color .15s;
}
.side-link svg { width: 17px; height: 17px; opacity: .9; }
.side-link:hover { background: rgba(148, 163, 184, .1); color: #f1f5f9; }
.side-link.active { background: linear-gradient(135deg, #2563eb, #1e53c9); color: #fff; box-shadow: 0 8px 18px -10px rgba(37, 99, 235, .9); }
.side-foot { border-top: 1px solid rgba(148, 163, 184, .14); padding-top: 9px; display: flex; flex-direction: column; gap: 4px; }
.side-stat { font-size: 11px; color: #6d7d95; }
.side-tip { font-size: 11px; color: #52627a; }

/* ---------------- main ---------------- */
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px 14px;
  background: rgba(244, 247, 251, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(230, 236, 245, .7);
}
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.page-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.app-main { padding: 22px 28px 40px; max-width: 1440px; width: 100%; margin: 0 auto; flex: 1; }

/* ---------------- layout bits ---------------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.bold { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }

/* ---------------- card ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card-title { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 17px; height: 17px; color: var(--brand); }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }

/* ---------------- hero ---------------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 24px 26px;
  color: #fff;
  background:
    radial-gradient(700px 240px at 100% -10%, rgba(96, 165, 250, .55), transparent 60%),
    linear-gradient(125deg, #0b1730 0%, #17346b 55%, #1d4ed8 100%);
  box-shadow: 0 24px 50px -30px rgba(29, 78, 216, .9);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -70px; width: 260px; height: 260px;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .16);
}
.hero::before {
  content: ""; position: absolute; right: 10px; top: 30px; width: 150px; height: 150px;
  border-radius: 50%; border: 1px dashed rgba(255, 255, 255, .16);
}
.hero-top { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.hero-date { font-size: 12.5px; color: #bfdbfe; letter-spacing: .6px; }
.hero h2 { font-size: 24px; margin: 6px 0 4px; letter-spacing: .4px; }
.hero-sub { color: #c7d6ef; font-size: 13px; }
.hero-quick { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.hero .btn-glass {
  background: rgba(255, 255, 255, .14);
  color: #fff; border: 1px solid rgba(255, 255, 255, .28);
  backdrop-filter: blur(6px);
}
.hero .btn-glass:hover { background: rgba(255, 255, 255, .24); }
.hero-stats { display: flex; gap: 34px; margin-top: 22px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-stat span { display: block; font-size: 12px; color: #b9cbea; margin-bottom: 2px; }
.hero-stat strong { font-size: 22px; font-weight: 700; letter-spacing: .3px; }

/* ---------------- stats ---------------- */
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: .3px; margin-top: 7px; font-variant-numeric: tabular-nums; }
.stat-foot { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-icon {
  position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
}
.stat-icon svg { width: 17px; height: 17px; }
.stat.green .stat-icon { background: var(--green-soft); color: var(--green); }
.stat.amber .stat-icon { background: var(--amber-soft); color: var(--amber); }
.stat.violet .stat-icon { background: var(--violet-soft); color: var(--violet); }
.delta { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--green-soft); color: var(--green); }
.delta.down { background: var(--red-soft); color: var(--red); }
.delta.flat { background: #eef2f8; color: var(--muted); }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: 10px;
  border: 1px solid transparent; background: var(--brand); color: #fff;
  font-size: 13.5px; font-weight: 550; cursor: pointer; text-decoration: none;
  transition: transform .06s, background .15s, box-shadow .15s;
  white-space: nowrap; user-select: none;
}
.stack > a.btn { align-self: flex-start; }
.btn:hover { background: var(--brand-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink-2); box-shadow: 0 1px 2px rgba(15, 23, 42, .03); }
.btn.ghost:hover { background: #f8fafc; border-color: #d8e2f0; }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.soft:hover { background: #dfe9ff; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #b91c1c; }
.btn.danger.ghost { background: #fff; color: var(--red); border-color: #f3c9c9; }
.btn.green { background: var(--green); }
.btn.green:hover { background: #0b8a5f; }
.btn.sm { height: 31px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: #f8fafc; }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------------- forms ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font-size: 14px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { border-color: #9dbcff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.input::placeholder, .textarea::placeholder { color: #9aa8bd; }
.input.sm { height: 34px; font-size: 13px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7a90' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.seg { display: inline-flex; padding: 3px; background: #eef2f8; border-radius: 10px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 6px 13px; border-radius: 8px;
  font-size: 12.5px; color: var(--muted); cursor: pointer;
}
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); font-weight: 600; }

/* ---------------- badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 550; line-height: 18px;
  background: #eef2f8; color: var(--muted);
}
.badge.blue { background: var(--brand-soft); color: var(--brand); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.gray { background: #f1f5f9; color: #64748b; }
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag-sn { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--brand); background: var(--brand-soft); border-radius: 6px; padding: 1px 6px; }

/* ---------------- tables / lists ---------------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 550; color: var(--muted); font-size: 11.5px;
  letter-spacing: .5px; padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: #fbfcfe;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfdff; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 600; }
.table .clickable { cursor: pointer; }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 20px; border-bottom: 1px solid var(--line-2);
}
.list-item:last-child { border-bottom: 0; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: #fbfdff; }
.list-avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 40px;
  display: grid; place-items: center; font-size: 13px; font-weight: 650;
  background: var(--brand-soft); color: var(--brand);
}
.list-avatar.green { background: var(--green-soft); color: var(--green); }
.list-avatar.amber { background: var(--amber-soft); color: var(--amber); }
.list-avatar.red { background: var(--red-soft); color: var(--red); }
.list-avatar.violet { background: var(--violet-soft); color: var(--violet); }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 13.8px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-side { text-align: right; flex: 0 0 auto; }
.list-amount { font-weight: 650; font-variant-numeric: tabular-nums; font-size: 14px; }

/* doc card list */
.doc-list { display: flex; flex-direction: column; }
.doc-item {
  display: flex; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line-2);
  cursor: pointer; transition: background .12s;
}
.doc-item:hover { background: #fbfdff; }
.doc-item:last-child { border-bottom: 0; }
.doc-date {
  flex: 0 0 52px; text-align: center; border-radius: 10px; background: #f6f9fe;
  border: 1px solid var(--line); padding: 6px 0; align-self: flex-start;
}
.doc-date b { display: block; font-size: 17px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.doc-date span { font-size: 10.5px; color: var(--muted); }
.doc-body { flex: 1; min-width: 0; }
.doc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-no { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.doc-title { font-size: 13.8px; font-weight: 600; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-side { flex: 0 0 auto; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.doc-amount { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.doc-amount.out { color: var(--ink); }
.doc-amount.in { color: var(--green); }
.doc-amount.ret { color: var(--amber); }
.doc-sortbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 0 20px 12px; }
.doc-sortbar button {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: 12px; cursor: pointer; transition: background .12s, border-color .12s;
}
.doc-sortbar button:hover { background: #f8fafd; }
.doc-sortbar button.active { background: var(--brand-soft); border-color: #c7d9ff; color: var(--brand); font-weight: 600; }
.doc-sortbar .sort-mark { font-size: 11px; opacity: .9; }

/* ---------------- tabs / toolbar ---------------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .grow { min-width: 180px; }
.search {
  position: relative; flex: 1; min-width: 160px;
}
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: #93a3b8; pointer-events: none; }
.search .input { padding-left: 35px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 4px; overflow-x: auto; }
.tabs button {
  border: 0; background: transparent; padding: 12px 13px 11px; cursor: pointer;
  font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip-group { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: #fff;
  font-size: 12px; color: var(--muted); cursor: pointer;
}
.chip.active { background: var(--brand-soft); border-color: #c7d9ff; color: var(--brand); font-weight: 600; }

/* ---------------- empty / skeleton ---------------- */
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; margin: 0 auto 10px; color: #c3cede; }
.empty p { font-size: 13px; }
.empty .btn { margin-top: 14px; }
.skeleton { background: linear-gradient(90deg, #eff3f9 25%, #f7faff 37%, #eff3f9 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------- modal ---------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 18, 32, .45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .14s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 520px; max-height: 88vh; overflow: hidden;
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: pop .16s ease;
}
.modal.lg { max-width: 760px; }
.modal.xs { max-width: 400px; }
@keyframes pop { from { transform: translateY(10px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 17px 20px 12px; }
.modal-head h3 { font-size: 16px; font-weight: 650; }
.modal-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.modal-body { padding: 4px 20px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fcfdff; }
.modal-x { border: 0; background: #f1f5f9; width: 30px; height: 30px; border-radius: 9px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.modal-x:hover { background: #e6ecf5; }
.modal-x svg { width: 15px; height: 15px; }
.modal-close-x { flex: 0 0 auto; }

/* ---------------- toast ---------------- */
.toast-root {
  position: fixed; z-index: 200; top: 18px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
  width: min(92vw, 420px);
}
.toast {
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 11px;
  font-size: 13px; box-shadow: 0 12px 30px -12px rgba(15, 23, 42, .6);
  animation: toastIn .18s ease; max-width: 100%;
  display: flex; align-items: center; gap: 8px;
}
.toast svg { width: 15px; height: 15px; flex: 0 0 15px; }
.toast.ok { background: #065f46; }
.toast.error { background: #991b1b; }
.toast.warn { background: #92400e; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.out { animation: toastOut .18s ease forwards; }
@keyframes toastOut { to { transform: translateY(-8px); opacity: 0; } }

/* ---------------- scan ---------------- */
.scan-card { border: 1px solid #c7d9ff; background: linear-gradient(180deg, #f5f9ff, #ffffff); }
.scan-input-wrap { position: relative; }
.scan-input-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: var(--brand); }
.scan-input {
  width: 100%; height: 50px; padding: 0 14px 0 44px; font-size: 15px;
  border: 1.5px solid #b6cdfb; border-radius: 13px; background: #fff; outline: none;
  font-variant-numeric: tabular-nums; letter-spacing: .3px;
}
.scan-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(37, 99, 235, .1); }
.scan-hint { font-size: 11.5px; color: var(--muted); margin-top: 7px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.scan-hint > svg { width: 14px; height: 14px; flex: 0 0 14px; }
.scan-results {
  position: absolute; left: 0; right: 0; top: 56px; z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow-lg);
  overflow: hidden; max-height: 300px; overflow-y: auto;
}
.scan-result {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--line-2);
}
.scan-result:last-child { border-bottom: 0; }
.scan-result:hover { background: #f6f9ff; }
.scan-result .nm { font-weight: 550; font-size: 13.5px; }
.scan-result .mt { font-size: 11.5px; color: var(--muted); }
.scan-result .go { margin-left: auto; font-size: 11.5px; color: var(--brand); }

/* ---------------- document editor ---------------- */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.editor-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 14px; }
.doc-head-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.line {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
}
.line:last-child { border-bottom: 0; }
.line-main { flex: 1; min-width: 0; }
.line-name { font-size: 13.8px; font-weight: 600; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.line-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.line-fields { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.line-field { display: flex; flex-direction: column; gap: 3px; }
.line-field label { font-size: 10.5px; color: var(--muted); }
.line-field .input { height: 34px; width: 92px; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.line-field .input.qty { width: 66px; }
.line-amount { width: 88px; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.line-del { border: 0; background: transparent; color: #b3c0d1; cursor: pointer; padding: 6px; border-radius: 8px; }
.line-del:hover { background: var(--red-soft); color: var(--red); }
.line-del svg { width: 16px; height: 16px; }
.sn-btn {
  border: 1px dashed #a9c3f8; background: #f5f9ff; color: var(--brand);
  border-radius: 8px; padding: 5px 10px; font-size: 11.5px; cursor: pointer; white-space: nowrap;
}
.sn-btn.ok { border-style: solid; border-color: #bfe6d7; background: var(--green-soft); color: var(--green); }
.sn-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sn-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 6px 4px 9px;
  background: #f3f7ff; border: 1px solid #d5e4ff; border-radius: 8px;
  font-size: 12px; font-variant-numeric: tabular-nums;
}
.sn-chip button { border: 0; background: transparent; color: #94a3b8; cursor: pointer; padding: 2px; display: grid; place-items: center; }
.sn-chip button:hover { color: var(--red); }
.sn-chip svg { width: 12px; height: 12px; }
.sum-box { display: flex; flex-direction: column; gap: 2px; }
.sum-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 13px; }
.sum-row .lbl { color: var(--muted); }
.sum-row .val { font-variant-numeric: tabular-nums; font-weight: 550; }
.sum-row.total { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 11px; }
.sum-row.total .lbl { color: var(--ink); font-weight: 600; }
.sum-row.total .val { font-size: 22px; font-weight: 700; color: var(--brand); }
.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pay-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 9px; height: 34px;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.pay-btn.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* ---------------- serial trace ---------------- */
.trace { display: flex; flex-direction: column; }
.trace-item { display: flex; gap: 12px; padding-bottom: 18px; position: relative; }
.trace-item:last-child { padding-bottom: 0; }
.trace-item::before {
  content: ""; position: absolute; left: 14px; top: 30px; bottom: 0; width: 1px; background: var(--line);
}
.trace-item:last-child::before { display: none; }
.trace-dot {
  width: 29px; height: 29px; flex: 0 0 29px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
  position: relative; z-index: 1;
}
.trace-dot svg { width: 14px; height: 14px; }
.trace-dot.green { background: var(--green-soft); color: var(--green); }
.trace-dot.amber { background: var(--amber-soft); color: var(--amber); }
.trace-dot.red { background: var(--red-soft); color: var(--red); }
.trace-body { flex: 1; padding-top: 2px; }
.trace-title { font-size: 13.5px; font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.trace-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------------- reports ---------------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding: 8px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar-track { width: 100%; max-width: 34px; flex: 1; display: flex; align-items: flex-end; }
.bar-fill {
  width: 100%; border-radius: 7px 7px 3px 3px; min-height: 3px;
  background: linear-gradient(180deg, #60a5fa, #2563eb); transition: height .3s;
}
.bar-fill.zero { background: #e8eef7; }
.bar-label { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.bar-value { font-size: 10.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rank { display: flex; flex-direction: column; gap: 12px; }
.rank-row { display: flex; align-items: center; gap: 11px; }
.rank-no {
  width: 21px; height: 21px; border-radius: 7px; background: #f1f5f9; color: var(--muted);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: 0 0 21px;
}
.rank-row:nth-child(1) .rank-no { background: #fff2d9; color: #b45309; }
.rank-row:nth-child(2) .rank-no { background: #eef2f7; color: #475569; }
.rank-row:nth-child(3) .rank-no { background: #fbeee2; color: #9a3412; }
.rank-main { flex: 1; min-width: 0; }
.rank-name { font-size: 12.8px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-bar { height: 5px; border-radius: 4px; background: #eef3fb; margin-top: 6px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #60a5fa, #2563eb); }
.rank-val { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------- receipt / print ---------------- */
.print-root { display: none; }
.receipt {
  width: 76mm; padding: 4mm 3mm; background: #fff; color: #000;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 11px; line-height: 1.55;
}
.receipt .r-shop { text-align: center; font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.receipt .r-sub { text-align: center; font-size: 10px; color: #333; margin-top: 1mm; }
.receipt .r-hr { border-top: 1px dashed #000; margin: 2.5mm 0; }
.receipt .r-meta { display: flex; justify-content: space-between; font-size: 10px; }
.receipt table { width: 100%; border-collapse: collapse; font-size: 10px; }
.receipt th { text-align: left; font-weight: 600; border-bottom: 1px solid #000; padding: 1mm 0; }
.receipt td { padding: 1.3mm 0; vertical-align: top; border-bottom: 1px dotted #bbb; }
.receipt td.num, .receipt th.num { text-align: right; }
.receipt .r-item-name { font-size: 10.5px; }
.receipt .r-sn { font-size: 9.5px; color: #333; word-break: break-all; }
.receipt .r-total { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-top: 2mm; }
.receipt .r-line { display: flex; justify-content: space-between; font-size: 10px; margin-top: 1mm; }
.receipt .r-thanks { text-align: center; font-size: 9.5px; margin-top: 3mm; color: #444; }
.receipt .r-warranty { font-size: 9px; color: #333; margin-top: 2mm; border-top: 1px dashed #000; padding-top: 2mm; }

@media print {
  body { background: #fff; }
  .app, .toast-root, .modal-overlay { display: none !important; }
  .print-root { display: block; }
  .receipt { margin: 0; }
  @page { margin: 4mm; }
}

/* ---------------- tabbar (mobile) ---------------- */
.tabbar { display: none; }

/* ---------------- responsive ---------------- */
@media (max-width: 1100px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .editor-side { position: static; }
  .doc-head-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .app-main { padding: 14px 14px calc(var(--tab-h) + 26px); }
  .topbar { padding: 12px 14px 10px; }
  .topbar h1 { font-size: 18px; }
  .page-sub { font-size: 11.5px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .tab-link {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; color: #8593a8; font-size: 10.5px;
  }
  .tab-link svg { width: 21px; height: 21px; }
  .tab-link.active { color: var(--brand); }
  .tab-link.active svg { stroke-width: 2.2; }
  .hero { padding: 18px; border-radius: 16px; }
  .hero h2 { font-size: 20px; }
  .hero-stats { gap: 22px; margin-top: 16px; }
  .hero-stat strong { font-size: 18px; }
  .grid-4, .grid-2, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 13px 14px; }
  .stat-value { font-size: 20px; }
  .stat-icon { width: 28px; height: 28px; border-radius: 8px; right: 10px; top: 10px; }
  .stat-icon svg { width: 14px; height: 14px; }
  .stat-label { font-size: 11.5px; }
  .card-pad { padding: 14px; }
  .card-head { padding: 14px 14px 0; }
  .list-item { padding: 12px 14px; }
  .doc-item { padding: 13px 14px; gap: 10px; }
  .doc-sortbar { padding: 0 14px 10px; gap: 5px; }
  .doc-sortbar button { height: 28px; padding: 0 9px; font-size: 11.5px; }
  .doc-date { flex: 0 0 44px; }
  .doc-date b { font-size: 15px; }
  .doc-amount { font-size: 14px; }
  .line { padding: 12px 14px; flex-wrap: wrap; }
  .line-fields { width: 100%; justify-content: space-between; padding-left: 0; }
  .line-amount { width: auto; min-width: 66px; }
  .doc-head-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; animation: sheet .2s ease; }
  .modal.xs, .modal.lg { max-width: 100%; }
  @keyframes sheet { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .hero-quick { width: 100%; }
  .hero-quick .btn { flex: 1; }
  .tabs { padding: 0; }
  .empty { padding: 34px 16px; }
  .table-wrap { border-radius: 0 0 var(--radius) var(--radius); }
  .toast-root { top: 10px; width: calc(100vw - 28px); }
  .sum-row.total .val { font-size: 20px; }
}

@media (max-width: 480px) {
  .doc-sortbar .sort-tip { display: none; }
}

@media (max-width: 420px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-value { font-size: 18px; }
  .doc-head-grid { grid-template-columns: 1fr; }
  .pay-grid { grid-template-columns: repeat(3, 1fr); }
}

/* misc */
.divider { height: 1px; background: var(--line); margin: 4px 0; }
.pill-note { font-size: 11.5px; color: var(--muted); background: #f6f9fe; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; }
.pill-note:has(> svg) { display: flex; gap: 8px; align-items: flex-start; line-height: 1.6; }
.pill-note > svg { width: 15px; height: 15px; flex: 0 0 15px; margin-top: 1px; }
.tag-sn svg { width: 12px; height: 12px; }
.list-item > svg { width: 18px; height: 18px; flex: 0 0 18px; color: #9aa8bd; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 550; text-align: right; }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }

/* ============================================================
 * 账号 / 登录 / 权限 / 日志
 * ============================================================ */
.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 7px; border-radius: 11px; cursor: pointer;
  transition: background .15s;
}
.side-user:hover { background: rgba(148, 163, 184, .1); }
.side-avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff; display: grid; place-items: center;
  font-size: 14px; font-weight: 650;
}
.side-user-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.side-user-info strong { color: #f1f5f9; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-info small { color: #7f8ea6; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-actions { display: flex; gap: 6px; margin: 6px 0 2px; }
.side-mini {
  flex: 1; height: 28px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(148, 163, 184, .2);
  background: rgba(148, 163, 184, .08); color: #aebbd0; font-size: 11.5px;
}
.side-mini:hover { background: rgba(148, 163, 184, .18); color: #fff; }

.login-mode .app { display: none; }
#loginRoot { position: fixed; inset: 0; z-index: 300; pointer-events: none; }
#loginRoot:not(:empty) { pointer-events: auto; }
.login-screen {
  min-height: 100%; height: 100%; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 26px 18px;
  background:
    radial-gradient(900px 480px at 85% 0%, #dbeafe, transparent 62%),
    radial-gradient(700px 420px at 0% 100%, #e8efff, transparent 60%),
    linear-gradient(165deg, #f2f7ff 0%, #f8fafd 55%, #eef3fa 100%);
}
.login-card {
  width: 100%; max-width: 392px; background: #fff;
  border: 1px solid var(--line); border-radius: 22px;
  padding: 30px 28px 24px;
  box-shadow: 0 32px 70px -34px rgba(15, 23, 42, .45);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-mark {
  width: 48px; height: 48px; flex: 0 0 48px; border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: grid; place-items: center; color: #fff;
  font-size: 22px; font-weight: 700;
  box-shadow: 0 10px 24px -12px rgba(37, 99, 235, .9);
}
.login-brand h2 { font-size: 20px; letter-spacing: .5px; }
.login-brand p { color: var(--muted); font-size: 12px; margin-top: 2px; }
.login-field { display: block; margin-bottom: 14px; }
.login-field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.login-field input {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 11px;
  background: #fbfdff; color: var(--ink); font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus { border-color: #9dbcff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); background: #fff; }
.login-pwd { position: relative; }
.login-pwd input { padding-right: 58px; }
.login-eye {
  position: absolute; right: 6px; top: 6px; height: 32px;
  border: 0; border-radius: 8px; padding: 0 9px; cursor: pointer;
  background: #eef3fb; color: #64748b; font-size: 11.5px;
}
.login-remember { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); margin: 4px 0 16px; }
.login-error { min-height: 18px; color: var(--red); font-size: 12px; margin-top: 10px; text-align: center; }
.login-hint {
  margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line);
  font-size: 11px; line-height: 1.85; color: var(--muted); text-align: center;
}
.login-hint b { color: var(--ink-2); }
.login-foot { color: #8593a8; font-size: 11.5px; }
.login-card.shake { animation: shake .3s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.account-head { display: flex; align-items: center; gap: 14px; padding: 4px 0 14px; }
.account-avatar {
  width: 54px; height: 54px; flex: 0 0 54px; border-radius: 16px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff;
  display: grid; place-items: center; font-size: 22px; font-weight: 700;
}
.account-name { font-size: 17px; font-weight: 650; }
.mini-avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px;
  display: grid; place-items: center; font-size: 13px; font-weight: 650;
  background: var(--brand-soft); color: var(--brand);
}
.perm-group { margin-top: 6px; }
.perm-group h4 { font-size: 12px; color: var(--muted); letter-spacing: .6px; margin: 14px 0 8px; }
.perm-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 6px; cursor: pointer; transition: background .12s;
}
.perm-item:hover { background: #f8fafd; }
.perm-item input { margin-top: 2px; width: 16px; height: 16px; flex: 0 0 16px; }
.perm-item strong { display: block; font-size: 13px; font-weight: 550; }
.perm-item small { color: var(--muted); font-size: 11.5px; }
.perm-row { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.perm-row:last-child { border-bottom: 0; }
.perm-row strong { font-size: 12.5px; font-weight: 550; min-width: 150px; }
.perm-row span { color: var(--muted); font-size: 11.5px; }
.log-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-detail { max-width: 520px; white-space: normal; word-break: break-word; color: var(--ink-2); }

/* 资金财务 */
.stat-click { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.stat-click:hover { border-color: #c7d9ff; box-shadow: 0 10px 28px -18px rgba(37, 99, 235, .45); }
.fin-account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 12px; margin-top: 14px; }
.fin-account { border: 1px solid var(--line); border-radius: 13px; padding: 14px; background: #fbfdff; }
.fin-account.disabled { opacity: .55; }
.fin-account-top { display: flex; align-items: center; gap: 10px; }
.fin-account-icon { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.fin-account-icon svg { width: 18px; height: 18px; }
.fin-account-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.fin-account-balance { font-size: 23px; font-weight: 700; margin: 12px 0 8px; font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.fin-account-balance.negative { color: var(--red); }
.fin-account-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.fin-amount { font-variant-numeric: tabular-nums; }
.fin-amount.fin-in { color: var(--green); font-weight: 650; }
.fin-amount.fin-out { color: var(--red); font-weight: 650; }
.fin-tabs { background: transparent; }

@media (max-width: 900px) {
  .fin-account-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .fin-account { padding: 12px; }
  .fin-account-balance { font-size: 19px; }
  .fin-account-foot { flex-direction: column; align-items: flex-start; }
}


@media (max-width: 900px) {
  .login-screen { padding: 8vh 14px 20px; justify-content: flex-start; }
  .login-card { padding: 24px 20px 20px; border-radius: 18px; }
  .login-hint { font-size: 10.5px; line-height: 1.75; }
  .login-foot { font-size: 10.5px; }
  .perm-row { flex-direction: column; gap: 2px; }
  .perm-row strong { min-width: 0; }
  .account-avatar { width: 46px; height: 46px; flex: 0 0 46px; font-size: 18px; border-radius: 13px; }
  .log-detail { min-width: 220px; }
}


.mobile-only { display: none; }
@media (max-width: 900px) { .mobile-only { display: inline-flex; } .desktop-only { display: none !important; } }
