/* ==========================================================================
   Titan — 样式
   色彩:港口海军蓝(信任)+ 黄铜色(只用于 Titan 标志和"当前位置")
   状态用"印章"表现:像海关章一样的描边小章
   ========================================================================== */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f5f7f9;
  --ink: #16233a;
  --ink-2: #56667b;
  --line: #dbe2ea;
  --primary: #2a5d8f;
  --primary-hover: #224d77;
  --primary-ink: #ffffff;
  --primary-soft: #e4edf6;
  --brass: #b8862b;
  --navy: #16233a;
  --ok: #1d6b45;
  --ok-soft: #ddf1e5;
  --warn: #965800;
  --warn-soft: #fcefd3;
  --bad: #a33131;
  --bad-soft: #fbe3e3;
  --info: #2a5d8f;
  --info-soft: #e4edf6;
  --shadow: 0 1px 2px rgba(22, 35, 58, 0.06), 0 10px 28px -18px rgba(22, 35, 58, 0.4);
  --radius: 12px;
  --radius-s: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC",
    "Microsoft YaHei", "Noto Sans Arabic", "Geeza Pro", "Segoe UI Arabic", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
  color-scheme: light dark;
}
/* 深色主题:跟随系统(没有手动选浅色时),或手动选了深色 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1520;
    --surface: #172131;
    --surface-2: #1c283a;
    --ink: #e7edf5;
    --ink-2: #9db0c6;
    --line: #2a3a50;
    --primary: #6ea6dc;
    --primary-hover: #8ab8e5;
    --primary-ink: #0e1520;
    --primary-soft: #1f3350;
    --brass: #d4a54a;
    --ok: #6fcf9c;
    --ok-soft: #173527;
    --warn: #f0b75a;
    --warn-soft: #3a2c12;
    --bad: #f08a8a;
    --bad-soft: #3d1c1e;
    --info: #8ab8e5;
    --info-soft: #1f3350;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -18px rgba(0, 0, 0, 0.8);  color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1520;
  --surface: #172131;
  --surface-2: #1c283a;
  --ink: #e7edf5;
  --ink-2: #9db0c6;
  --line: #2a3a50;
  --primary: #6ea6dc;
  --primary-hover: #8ab8e5;
  --primary-ink: #0e1520;
  --primary-soft: #1f3350;
  --brass: #d4a54a;
  --ok: #6fcf9c;
  --ok-soft: #173527;
  --warn: #f0b75a;
  --warn-soft: #3a2c12;
  --bad: #f08a8a;
  --bad-soft: #3d1c1e;
  --info: #8ab8e5;
  --info-soft: #1f3350;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -18px rgba(0, 0, 0, 0.8);color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
html.i18n-pending body { visibility: hidden; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.num, .amt { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); font-size: 14px; }
.small { font-size: 13px; }
svg.i { width: 22px; height: 22px; flex: none; }
.spacer { flex: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-s); border: 1px solid var(--primary);
  background: var(--primary); color: var(--primary-ink); font-weight: 600; cursor: pointer;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.secondary { background: transparent; color: var(--primary); font-weight: 500; }
.btn.secondary:hover { background: var(--primary-soft); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.link { background: none; border: 0; padding: 4px 0; cursor: pointer; font-size: 14px; color: var(--primary); }
.link.danger { color: var(--bad); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }
.field input:not([type="checkbox"]):not([type="file"]), .field select, .field textarea, .input {
  width: 100%; min-height: 46px; padding: 0 12px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-s);
}
.field textarea { padding: 10px 12px; min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--primary); outline: none;
  box-shadow: 0 0 0 3px var(--primary-soft); }
.field small { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.field small.hint { display: none; color: var(--warn); }
.field.warn input, .field.warn select { background: var(--warn-soft); border-color: var(--warn); }
.field.warn small.hint { display: block; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; color: var(--ink); min-height: 32px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.err { color: var(--bad); font-size: 14px; min-height: 1.3em; margin: 6px 0 0; }
.ok-msg { color: var(--ok); font-size: 14px; }
details.more { margin: 2px 0 10px; border-top: 1px solid var(--line); padding-top: 8px; }
details.more summary { cursor: pointer; color: var(--primary); padding: 6px 0; font-size: 15px; }
.file-field { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ---------- 印章(状态) ---------- */
.stamp {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; line-height: 20px;
  border: 1.5px solid currentColor; border-radius: 4px; font-size: 12px; font-weight: 700;
  transform: rotate(-2deg); white-space: nowrap; background: transparent;
}
.stamp.pending, .stamp.unpaid { color: var(--warn); }
.stamp.confirmed, .stamp.settled, .stamp.paid, .stamp.reimbursed { color: var(--ok); }
.stamp.rejected { color: var(--bad); }
.stamp.open { color: var(--info); }
.stamp.inactive { color: var(--ink-2); }

/* ---------- 提示、空状态 ---------- */
.notice { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius);
  background: var(--warn-soft); color: var(--warn); margin: 12px 0; font-size: 15px; }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.empty { color: var(--ink-2); padding: 28px 12px; text-align: center; }
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px); transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 15px; z-index: 60;
  max-width: calc(100% - 32px); box-shadow: var(--shadow); }

/* ---------- 登录页 ---------- */
body.login-body { background: var(--navy); min-height: 100vh; }
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(56px + var(--safe-top)) 16px calc(24px + var(--safe-bottom)); gap: 16px; }
.login-top { position: absolute; top: calc(12px + var(--safe-top)); inset-inline-end: 12px; }
.login-top select { background: transparent; color: #dbe4ef; border: 1px solid rgba(219, 228, 239, 0.35);
  border-radius: 20px; padding: 6px 12px; min-height: 36px; }
.login-top select option { color: #16233a; background: #fff; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 16px; padding: 28px 24px 22px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6); }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.brand img { width: 52px; height: 52px; border-radius: 12px; }
.brand-name { font-size: 28px; font-weight: 800; letter-spacing: 0.04em; line-height: 1; }
.brand-sub { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.login-card .btn { width: 100%; min-height: 50px; font-size: 17px; margin-top: 6px; }
.login-card .foot { color: var(--ink-2); font-size: 13px; margin: 16px 0 0; text-align: center; }
.install-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 20px;
  border-radius: 24px; border: 1px solid rgba(201, 154, 62, 0.6); background: transparent; color: #e6c27d;
  cursor: pointer; font-size: 15px; }
.install-btn:hover { background: rgba(201, 154, 62, 0.12); }

/* ---------- 记账人 App ---------- */
body.app { padding-bottom: calc(var(--nav-h) + var(--safe-bottom)); }
.appbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-top)) 16px 10px; background: var(--navy); color: #fff; }
.appbar img { width: 30px; height: 30px; border-radius: 8px; }
.appbar .title { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.appbar .title strong { font-size: 18px; letter-spacing: 0.04em; }
.appbar .title span { font-size: 12px; color: #aebcd0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .who { font-size: 14px; color: #cfd9e6; white-space: nowrap; }
.app-main { max-width: 620px; margin: 0 auto; padding: 14px 14px 24px; }
.trip-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.trip-bar select { flex: 1; min-width: 0; min-height: 46px; padding: 0 12px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--surface); }
.capture { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-bottom: 14px; }
.capture-main { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: var(--radius);
  background: var(--primary); color: var(--primary-ink); cursor: pointer; box-shadow: var(--shadow); }
.capture-main:hover { background: var(--primary-hover); }
.capture-main svg { width: 34px; height: 34px; }
.capture-main strong { display: block; font-size: 18px; }
.capture-main span { font-size: 13px; opacity: 0.85; }
.capture-alt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-width: 92px; padding: 10px; border-radius: var(--radius); border: 1px dashed var(--primary);
  background: var(--surface); color: var(--primary); cursor: pointer; font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#file:focus-visible + .capture-main { outline: 3px solid var(--brass); outline-offset: 2px; }

.sheet { background: var(--surface); border-radius: var(--radius); padding: 18px 16px 16px; margin-bottom: 18px;
  box-shadow: var(--shadow); border-top: 4px solid var(--primary); }
.sheet img.preview { display: block; max-width: 100%; max-height: 240px; margin: 0 auto 12px; border-radius: var(--radius-s); }
.status { margin: 0 0 14px; font-size: 14px; color: var(--ink-2); }
.status.bad { color: var(--warn); }
.sheet-actions { display: flex; gap: 10px; border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 4px; }
.sheet-actions .btn { flex: 1; }
.sheet-actions .btn:last-child { flex: 2; }

.list-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 18px 0 8px; }
.list-head h2 { white-space: nowrap; flex-shrink: 0; }
.totals { font-size: 14px; color: var(--ink-2); text-align: end; }
.totals strong { color: var(--ink); font-variant-numeric: tabular-nums; }
ul.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
ul.items li { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; }
.row-main { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.row-title { font-weight: 650; overflow-wrap: anywhere; }
.row-amt { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 6px; font-size: 14px; color: var(--ink-2); }
.row-times { margin-top: 6px; font-size: 13px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 2px 14px; }
.row-actions { margin-inline-start: auto; display: flex; gap: 16px; }
.reject-note { margin-top: 8px; padding: 8px 10px; border-radius: var(--radius-s); background: var(--bad-soft); color: var(--bad); font-size: 14px; }

.bottom-nav { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: var(--surface); border-top: 1px solid var(--line); }
.bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: none; color: var(--ink-2); font-size: 12px; cursor: pointer; position: relative; }
.bottom-nav button.active { color: var(--primary); font-weight: 600; }
.bottom-nav button.active::before { content: ""; position: absolute; top: 0; width: 32px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brass); }
.bottom-nav .dot { position: absolute; top: 8px; inset-inline-start: calc(50% + 8px); min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; font-weight: 700; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 14px; }
.panel h3 { margin-bottom: 12px; }
.panel .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.panel .row:first-of-type { border-top: 0; }
.panel .row select { min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }

/* ---------- 统计 ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin: 4px 0 10px; scrollbar-width: none; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); cursor: pointer; white-space: nowrap; font-size: 14px; }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); } }
:root[data-theme="dark"] .chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.stat-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 4px; }
.stat-head .cur { color: var(--brass); font-weight: 700; }
.stat-head .big { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat h4 { margin: 16px 0 8px; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.bar-row { display: grid; grid-template-columns: 88px 1fr auto; gap: 10px; align-items: center; margin-bottom: 7px; font-size: 14px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--primary); border-radius: 5px; }
.bar-val { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-val small { color: var(--ink-2); }

/* ---------- 管理后台 ---------- */
body.console { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: calc(18px + var(--safe-top)) 12px 16px; background: var(--navy); color: #cfd9e6; }
.sidebar .brand-row { display: flex; align-items: center; gap: 10px; padding: 0 8px 16px; }
.sidebar .brand-row img { width: 34px; height: 34px; border-radius: 9px; }
.sidebar .brand-row strong { display: block; color: #fff; font-size: 19px; letter-spacing: 0.04em; line-height: 1.1; }
.sidebar .brand-row span { display: block; font-size: 12px; color: #9fb0c5; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-s); border: 0;
  background: none; color: #cfd9e6; cursor: pointer; text-align: start; font-size: 15px; position: relative; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, 0.1); color: #fff; font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; inset-inline-start: -12px; top: 8px; bottom: 8px; width: 4px;
  border-start-end-radius: 4px; border-end-end-radius: 4px; background: var(--brass); }
.nav-item .count { margin-inline-start: auto; min-width: 22px; padding: 0 7px; border-radius: 11px; background: #e6c27d;
  color: #16233a; font-size: 12px; font-weight: 800; text-align: center; line-height: 20px; }
.sidebar .me { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 14px; }
.sidebar .me .name { color: #fff; font-weight: 600; }
.sidebar .me .role { color: #9fb0c5; }
.sidebar .me .link { color: #e6c27d; }
.content { min-width: 0; padding: calc(22px + var(--safe-top)) 28px 48px; }
.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.page-head h1 { margin-inline-end: auto; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 8px 0 12px; }
.toolbar label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--ink-2); }
.toolbar input:not([type="checkbox"]), .toolbar select { min-height: 40px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: var(--radius-s); background: var(--surface); color: var(--ink); min-width: 130px; }
.toolbar label.check { flex-direction: row; align-self: center; font-size: 14px; color: var(--ink); }
.summary-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 8px 0 12px; font-size: 14px; color: var(--ink-2); }
.summary-line strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.summary-line .spacer { min-width: 4px; }
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: start; white-space: nowrap; vertical-align: top; }
th { background: var(--surface-2); color: var(--ink-2); font-weight: 600; position: sticky; top: 0; z-index: 1; }
tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; min-width: 150px; max-width: 300px; overflow-wrap: anywhere; }
th.num, td.num { text-align: end; font-variant-numeric: tabular-nums; }
tr.dim td { color: var(--ink-2); }
td .sub { display: block; font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.ops { display: flex; gap: 14px; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin: 12px 0 8px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-head .cur { font-size: 20px; font-weight: 800; color: var(--brass); letter-spacing: 0.03em; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 15px; }
.card dt { color: var(--ink-2); }
.card dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; }
.card dt.bal, .card dd.bal { border-top: 1px solid var(--line); padding-top: 6px; }
.card dd.bal { font-weight: 800; font-size: 17px; }
.card dt.minor, .card dd.minor { font-size: 14px; }
.neg { color: var(--bad); }
.section-title { margin: 26px 0 10px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.readonly-note { padding: 10px 12px; border-radius: var(--radius-s); background: var(--info-soft); color: var(--info); font-size: 14px; margin-bottom: 12px; }

.nav-list { display: contents; }
.nav-toggle { display: none; }
@media (max-width: 980px) {
  body.console { display: block; }
  .sidebar { position: sticky; top: 0; z-index: 40; height: auto; display: grid; grid-template-columns: auto 1fr;
    align-items: center; gap: 8px; padding: calc(8px + var(--safe-top)) 12px 8px; }
  .sidebar .brand-row { padding: 0; }
  .sidebar .brand-row span { display: none; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; justify-self: end;
    min-height: 40px; padding: 0 12px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06); color: #fff; font-size: 15px; cursor: pointer; }
  .nav-toggle-icon, .nav-toggle-icon::before, .nav-toggle-icon::after { display: block; width: 16px; height: 2px;
    background: #e6c27d; border-radius: 1px; position: relative; content: ""; }
  .nav-toggle-icon::before { position: absolute; top: -5px; }
  .nav-toggle-icon::after { position: absolute; top: 5px; }
  .nav-list { display: none; grid-column: 1 / -1; flex-direction: column; gap: 2px; padding: 6px 0 4px;
    max-height: calc(100vh - 80px); overflow-y: auto; }
  .sidebar.open .nav-list { display: flex; }
  .nav-item { padding: 12px; font-size: 16px; }
  .nav-item.active::before { inset-inline-start: 0; }
  .sidebar .me { display: none; grid-column: 1 / -1; margin: 0; padding: 10px 4px 4px; }
  .sidebar.open .me { display: block; }
  .content { padding: 16px 14px 40px; }
  #toast { bottom: calc(16px + var(--safe-bottom)); }
}

/* ---------- 弹窗(手机上是底部抽屉) ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: calc(100% - 24px); max-width: 540px; color: var(--ink);
  background: var(--surface); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5); }
dialog::backdrop { background: rgba(14, 21, 32, 0.55); }
.dlg-body { padding: 22px 20px 6px; max-height: 74vh; overflow: auto; }
.dlg-body h3 { font-size: 19px; margin-bottom: 14px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--line); }
.secret { font: 700 22px/1.4 ui-monospace, Menlo, Consolas, monospace; background: var(--surface-2); padding: 10px 14px;
  border-radius: var(--radius-s); user-select: all; letter-spacing: 0.06em; margin: 4px 0 12px; direction: ltr; }
.steps { padding-inline-start: 20px; margin: 8px 0; }
.steps li { margin-bottom: 8px; }
@media (max-width: 600px) {
  dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .dlg-body { max-height: 80vh; }
  .dlg-actions .btn { flex: 1; }
}

/* ---------- 打印 ---------- */
.print-title { display: none; }
@media print {
  body, body.console { background: #fff; color: #000; display: block; }
  .sidebar, .no-print, .toolbar, .bottom-nav, .ops, .col-check, #toast, .page-head .btn, .chips { display: none !important; }
  .content { padding: 0; }
  .table-wrap { overflow: visible; }
  th { position: static; background: #eee; }
  .print-title { display: block; margin: 0 0 10px; }
  .stamp { transform: none; }
}

/* 金额在阿拉伯语(从右到左)里保持完整、不被打乱 */
.totals strong, .summary-line strong, .row-amt, td.num, .bar-val, .card dd { unicode-bidi: isolate; }
.list-head { flex-wrap: wrap; }

/* ---------- 字体大小(个人设置) ---------- */
html[data-font="small"] body { zoom: 0.92; }
html[data-font="large"] body { zoom: 1.12; }
html[data-font="xlarge"] body { zoom: 1.25; }

/* ---------- 紧凑模式(个人设置):表格和列表更密 ---------- */
html[data-density="compact"] th, html[data-density="compact"] td { padding: 6px 9px; }
html[data-density="compact"] ul.items { gap: 5px; }
html[data-density="compact"] ul.items li { padding: 9px 12px; }
html[data-density="compact"] .card, html[data-density="compact"] .stat, html[data-density="compact"] .panel { padding: 12px 14px; }
html[data-density="compact"] .field { margin-bottom: 10px; }

/* ---------- 头像 ---------- */
.avatar { width: var(--s, 36px); height: var(--s, 36px); border-radius: 50%; flex: none; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700;
  font-size: calc(var(--s, 36px) * 0.38); letter-spacing: 0.02em; vertical-align: middle; background: var(--surface-2); }
.user-cell { display: inline-flex; align-items: center; gap: 8px; }
.appbar .avatar, .sidebar .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25); }
.me-row { display: flex; align-items: center; gap: 10px; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.profile-head .who-big { font-size: 18px; font-weight: 700; }
.profile-head .avatar-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- 设置页:分段选择 ---------- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: var(--surface); color: var(--ink-2); padding: 8px 12px; cursor: pointer; font-size: 14px;
  border-inline-start: 1px solid var(--line); min-height: 38px; }
.seg button:first-child { border-inline-start: 0; }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); font-weight: 600; }
.panel .row > :first-child { min-width: 0; }
.row-label small { display: block; color: var(--ink-2); font-size: 13px; }
.device { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.device:first-child { border-top: 0; }
.device .info { flex: 1; min-width: 0; }
.device .info small { display: block; color: var(--ink-2); font-size: 13px; }
.tag { display: inline-block; font-size: 12px; padding: 0 6px; border-radius: 4px; background: var(--ok-soft); color: var(--ok); margin-inline-start: 6px; }
.about { font-size: 14px; color: var(--ink-2); line-height: 1.7; }

/* ---------- 票据上传(手动记账) ---------- */
.receipt-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 14px;
  border: 1px dashed var(--line); border-radius: var(--radius-s); background: var(--surface-2); font-size: 14px; }
.receipt-box .spacer { min-width: 4px; }
.receipt-box.required { border-color: var(--warn); }
.trip-bar .icon-btn { min-width: 44px; min-height: 46px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.trip-bar .icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.trip-bar .icon-btn.danger:hover { color: var(--bad); border-color: var(--bad); }
.mode-link { color: #e6c27d; font-size: 14px; text-decoration: none; white-space: nowrap; }
a.nav-item { text-decoration: none; }
.me .avatar { margin-inline-end: 2px; }
.ops .muted.small { white-space: normal; display: inline-block; max-width: 150px; line-height: 1.35; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
/* 日期快捷按钮等:放不下时换行,不再藏在右边需要滑动 */
.chips { flex-wrap: wrap; overflow-x: visible; }
