/* ==========================================================
   账日历 BillCal —— 样式表
   移动优先，>=900px 切换为侧栏布局；支持浅色 / 深色
   ========================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

:root {
  /* ---- 中性色阶：整体偏冷，靠对比度而不是色相撑起层次 ---- */
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --surface-3: #F1F3F6;
  --border: #E9ECF0;
  --border-2: #DCE0E6;
  --text: #0E1319;
  --text-2: #5A6472;
  --text-3: #8E97A5;

  /* ---- 强调色：靛蓝。只用在主按钮、选中态、链接和图表主色上 ---- */
  --primary: #1E50C8;
  --primary-d: #17409F;
  --primary-soft: #EDF2FD;

  --danger: #D0322A;
  --danger-soft: #FDF1F0;
  --warning: #C77400;
  --warning-soft: #FFF8EC;
  --success: #07794A;
  --success-soft: #ECFAF2;
  --info: #1B7FD4;
  --info-soft: #EEF6FD;

  /* ---- 形状与投影：投影一律多层极淡，靠叠加出「浮起来一点」而不是描黑边 ---- */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-xs: 0 1px 2px rgba(14, 19, 25, .04);
  --shadow: 0 1px 2px rgba(14, 19, 25, .04), 0 4px 10px -2px rgba(14, 19, 25, .05);
  --shadow-lg: 0 10px 20px -6px rgba(14, 19, 25, .10), 0 28px 48px -16px rgba(14, 19, 25, .18);
  --ring: 0 0 0 3px rgba(30, 80, 200, .16);

  --ease: cubic-bezier(.2, .7, .3, 1);

  --sidebar-w: 236px;
  --tabbar-h: 62px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0F1216;
  --surface: #171B21;
  --surface-2: #1D222A;
  --surface-3: #252B34;
  --border: #262C35;
  --border-2: #333A45;
  --text: #E9ECF1;
  --text-2: #9AA3AF;
  --text-3: #6C7683;

  --primary: #5B8DF0;
  --primary-d: #7BA6F5;
  --primary-soft: #16233C;

  --danger: #F0726A;
  --danger-soft: #2C1917;
  --warning: #E9A24A;
  --warning-soft: #2C2113;
  --success: #3EC08A;
  --success-soft: #10291F;
  --info: #5AAEF5;
  --info-soft: #132434;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .28);
  --shadow: 0 1px 2px rgba(0, 0, 0, .30), 0 4px 12px -2px rgba(0, 0, 0, .34);
  --shadow-lg: 0 12px 24px -6px rgba(0, 0, 0, .46), 0 32px 56px -16px rgba(0, 0, 0, .56);
  --ring: 0 0 0 3px rgba(91, 141, 240, .22);
}

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

/* 标题略微收紧字距，中文在大字号下会显得松 */
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.35; letter-spacing: -.011em; }

/* 所有数字等宽，金额上下对齐才不跳 */
body { font-variant-numeric: tabular-nums; }

a { color: var(--primary); text-decoration: none; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

table { border-collapse: collapse; width: 100%; }

::selection { background: var(--primary); color: #fff; }

/* 键盘聚焦统一用光环，鼠标点击不出现——比 outline 干净，也不影响无障碍 */
:focus-visible { outline: none; box-shadow: var(--ring); }

/* 细滚动条：桌面端不抢视线，移动端本来就隐藏 */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ===================== 登录页 ===================== */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  position: relative;
  background:
    radial-gradient(880px 440px at 50% -14%, color-mix(in srgb, var(--primary) 9%, transparent), transparent 66%),
    radial-gradient(620px 420px at 92% 110%, color-mix(in srgb, var(--primary) 7%, transparent), transparent 72%),
    var(--bg);
}

/* 极淡的点阵纹理，只在视口中部透出来。
   没有它，大面积的纯色背景会显得空；点太密又会显脏，所以配了一层径向遮罩。 */
.auth-body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--border-2) 1px, transparent 0);
  background-size: 26px 26px;
  opacity: .85;
  -webkit-mask-image: radial-gradient(700px 540px at 50% 42%, #000 0%, transparent 76%);
  mask-image: radial-gradient(700px 540px at 50% 42%, #000 0%, transparent 76%);
}

.auth-wrap { width: 100%; max-width: 404px; position: relative; z-index: 1; }

.auth-brand { text-align: center; margin-bottom: 26px; }

.auth-logo {
  width: 58px; height: 58px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 25px; font-weight: 600; color: #fff;
  background: var(--primary);
  background: linear-gradient(150deg, color-mix(in srgb, var(--primary) 78%, #fff) 0%, var(--primary) 52%, var(--primary-d) 100%);
  border-radius: 18px;
  box-shadow: 0 10px 24px -8px rgba(30, 80, 200, .42), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.auth-brand h1 { font-size: 22px; letter-spacing: .02em; }
.auth-brand p { margin: 7px 0 0; font-size: 13px; color: var(--text-2); }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 1px 2px rgba(14, 19, 25, .04), 0 14px 36px -14px rgba(14, 19, 25, .16);
}

.auth-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}

.auth-tab {
  flex: 1; padding: 8px 0; border: 0; background: transparent;
  border-radius: 6px; font-size: 14px; color: var(--text-2); cursor: pointer;
}
.auth-tab.is-active { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: var(--shadow); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.auth-msg {
  display: none; margin-top: 14px; padding: 10px 12px;
  border-radius: var(--radius-sm); font-size: 13px;
}
.auth-msg.is-show { display: block; }
.auth-msg.is-ok { background: var(--success-soft); color: var(--success); }
.auth-msg.is-err { background: var(--danger-soft); color: var(--danger); }

.auth-tip { margin-top: 14px; font-size: 12px; color: var(--text-3); text-align: center; }
.auth-foot { margin-top: 20px; text-align: center; font-size: 12px; color: var(--text-3); }

/* ===================== 表单控件 ===================== */

.field { display: flex; flex-direction: column; gap: 6px; }

.field > span {
  font-size: 13px; color: var(--text-2); font-weight: 500;
  display: flex; align-items: baseline; gap: 8px;
}
.field > span i { font-style: normal; font-size: 11px; color: var(--text-3); font-weight: 400; }

.field input,
.field select,
.field textarea,
.input {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field textarea { min-height: 72px; resize: vertical; font-size: 14px; line-height: 1.6; }

.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field input::placeholder { color: var(--text-3); }
.field input:disabled { background: var(--surface-3); color: var(--text-3); }

/* 带前置图标的输入框（搜索） */
.input-icon { position: relative; display: flex; align-items: center; min-width: 0; }
.input-icon > svg {
  position: absolute; left: 11px; z-index: 1;
  color: var(--text-3); pointer-events: none;
}
.input-icon > .input { padding-left: 34px; }
.input-icon:focus-within > svg { color: var(--primary); }

/* ===================== 机构选择（可搜索下拉） =====================
 * 发卡行 / 放款机构原来都是自由输入，同一个「招商银行」会被打成
 * 「招行」「招商」好几种，统计时对不上。这里升级成带候选词库的下拉，
 * 但**仍然允许自由输入** —— 词库里没有的机构不影响正常填写。
 *
 * 候选面板挂在 body 上（position: fixed），因为模态框的 .modal-body
 * 有 overflow-y:auto，绝对定位的子元素会被裁掉。
 */

.combo-wrap { position: relative; width: 100%; }
.combo-wrap > input { padding-right: 34px; }

.combo-caret {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; color: var(--text-3);
  cursor: pointer; pointer-events: auto;
}
.combo-wrap:focus-within .combo-caret { color: var(--primary); }

.combo-list {
  position: fixed; z-index: 250;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 5px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.combo-group {
  padding: 7px 10px 4px;
  font-size: 11px; font-weight: 600;
  color: var(--text-3);
  letter-spacing: .02em;
}
.combo-group:first-child { padding-top: 3px; }

.combo-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px; color: var(--text);
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo-item:hover { background: var(--surface-2); }
.combo-item.is-active { background: var(--primary-soft); color: var(--primary); }

.combo-name { overflow: hidden; text-overflow: ellipsis; }
.combo-alias { font-size: 12px; color: var(--text-3); flex: none; }
.combo-item.is-active .combo-alias { color: var(--primary); opacity: .75; }

.combo-item mark {
  background: transparent;
  color: var(--primary);
  font-weight: 600;
}
.combo-item.is-active mark { color: var(--primary); }

.combo-empty { padding: 14px 10px; font-size: 13px; color: var(--text-3); text-align: center; }
.combo-tip { padding: 0 10px 10px; font-size: 12px; color: var(--text-3); text-align: center; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field-hint { font-size: 12px; color: var(--text-3); line-height: 1.5; }

.checkbox {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none;
}
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }

/* ===================== 按钮 ===================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  font-size: 14px; font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background .16s var(--ease), border-color .16s var(--ease),
              box-shadow .16s var(--ease), transform .12s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--border-2); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.btn svg { flex: none; }

.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 1px 2px rgba(14, 19, 25, .12), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); box-shadow: 0 2px 6px rgba(14, 19, 25, .16); }

.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); box-shadow: none; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); border-color: transparent; box-shadow: none; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 9px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===================== 布局 ===================== */

.app-body { display: block; }

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

.sidebar { display: none; }

.main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-title { font-size: 17px; font-weight: 600; flex: 1; min-width: 0; }
.topbar-title small { display: block; font-size: 12px; font-weight: 400; color: var(--text-3); margin-top: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  color: var(--text-2); background: transparent;
  border: 0; border-radius: var(--radius-sm); cursor: pointer;
  position: relative;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.icon-btn .dot-badge {
  position: absolute; top: 5px; right: 5px;
  min-width: 15px; height: 15px; padding: 0 4px;
  font-size: 10px; line-height: 15px; text-align: center;
  color: #fff; background: var(--danger); border-radius: 8px;
}

/* 底部留白 = FAB 高度 + 上下间距，避免悬浮按钮压住最后一张卡片的内容 */
.content { flex: 1; padding: 18px 16px 84px; max-width: 1240px; width: 100%; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.5) blur(18px);
  -webkit-backdrop-filter: saturate(1.5) blur(18px);
  border-top: 1px solid var(--border);
}

.tabbar a {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10px; color: var(--text-3); text-decoration: none;
  overflow: hidden;
  transition: color .18s var(--ease);
}
.tabbar a span {
  max-width: 100%; padding: 0 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: font-weight .1s;
}
.tabbar a svg {
  width: 21px; height: 21px; flex: none;
  transition: transform .18s var(--ease);
}
.tabbar a.is-active { color: var(--primary); }
.tabbar a.is-active span { font-weight: 600; }
.tabbar a.is-active svg { transform: translateY(-1px); stroke-width: 2.1; }
.tabbar a:active svg { transform: scale(.92); }

/* 项数多时进一步收紧，保证 8 项在 360px 小屏上也不挤 */
.tabbar.is-dense a { font-size: 9px; gap: 2px; }
.tabbar.is-dense a svg { width: 19px; height: 19px; }

.fab {
  position: fixed; right: 16px; z-index: 45;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px));
  width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; background: var(--primary);
  border: 0; border-radius: 50%;
  box-shadow: 0 6px 18px -2px rgba(30, 80, 200, .42), 0 2px 4px rgba(14, 19, 25, .14);
  box-shadow: 0 6px 16px -2px color-mix(in srgb, var(--primary) 46%, transparent),
              0 2px 4px rgba(14, 19, 25, .14);
  cursor: pointer;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease);
}
.fab:hover {
  box-shadow: 0 10px 26px -4px rgba(30, 80, 200, .5);
  box-shadow: 0 10px 24px -4px color-mix(in srgb, var(--primary) 52%, transparent);
}
.fab:active { transform: scale(.93); }

@media (min-width: 900px) {
  .sidebar {
    display: flex; flex-direction: column;
    width: var(--sidebar-w); flex: none;
    position: sticky; top: 0; height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 22px 14px 18px;
    overflow-y: auto;
  }

  .main { padding-bottom: 0; }
  .topbar { padding: 15px 32px; }
  .topbar-title { font-size: 19px; }
  .content { padding: 26px 32px 96px; }
  .tabbar { display: none; }

  .fab { right: 32px; bottom: 32px; width: 56px; height: 56px; }
}

/* ===================== 侧栏 ===================== */

.side-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 0 10px 20px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.side-brand .logo {
  width: 36px; height: 36px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 600; color: #fff;
  background: var(--primary);
  background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 82%, #fff) 0%, var(--primary) 55%, var(--primary-d) 100%);
  border-radius: 11px;
  box-shadow: 0 2px 6px -1px rgba(14, 19, 25, .18);
  box-shadow: 0 2px 6px -1px color-mix(in srgb, var(--primary) 40%, transparent);
}
.side-brand b { font-size: 15px; display: block; letter-spacing: -.01em; }
.side-brand small { font-size: 11px; color: var(--text-3); }

.side-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 14px; }

.side-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px;
  font-size: 14px; color: var(--text-2);
  border-radius: var(--radius-sm);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.side-nav a svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.side-nav a:hover { background: var(--surface-3); color: var(--text); }
.side-nav a.is-active {
  background: var(--primary-soft); color: var(--primary); font-weight: 600;
}
.side-nav a.is-active svg { stroke-width: 2.1; opacity: 1; }

.side-foot {
  margin-top: auto; padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 3px;
}
.side-foot a,
.side-foot button {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; width: 100%;
  font-size: 14px; color: var(--text-2);
  background: transparent; border: 0; border-radius: var(--radius-sm);
  cursor: pointer; text-align: left;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.side-foot a:hover, .side-foot button:hover { background: var(--surface-3); color: var(--text); }
.side-foot svg { width: 18px; height: 18px; }

/* ===================== 卡片 ===================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; flex: 1; min-width: 0; letter-spacing: -.01em; }
.card-head .sub { font-size: 12px; color: var(--text-3); font-weight: 400; }

.card-body { padding: 18px; }
.card-body.tight { padding: 14px; }
.card-body.flush { padding: 0; }

.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(2, minmax(0, 1fr)); }

@media (min-width: 700px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
}

/* ===================== 数值卡 ===================== */

.stat {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.stat .label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.stat .value {
  font-size: 24px; font-weight: 600; margin-top: 7px;
  font-variant-numeric: tabular-nums; letter-spacing: -.022em;
  /* 用 anywhere 而不是 break-all：金额够放就不换行，
     实在放不下才在任意位置断，避免出现「¥15,000.」/「00」这种断法。 */
  overflow-wrap: anywhere;
}
.stat .value.sm { font-size: 19px; }
.stat .foot { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.stat.is-danger .value { color: var(--danger); }
.stat.is-success .value { color: var(--success); }
.stat.is-warning .value { color: var(--warning); }
.stat.is-primary .value { color: var(--primary); }

/* 窄屏：三列统计卡每列只有 ~110px，22px 的金额必被断行。
   收紧内边距 + 降字号，让「¥15,000.00」这类常见金额能整行放下。 */
@media (max-width: 560px) {
  .grid-3 .stat { padding: 12px 10px; }
  .grid-3 .stat .value,
  .grid-3 .stat .value.sm {
    font-size: 15px;
    letter-spacing: -.02em;
  }
}

/* ===================== 徽标 / 状态 ===================== */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  font-size: 12px; font-weight: 500; line-height: 1.6;
  border-radius: 20px;
  background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.badge-pending { background: var(--info-soft); color: var(--info); }
.badge-paid    { background: var(--success-soft); color: var(--success); }
.badge-partial { background: var(--warning-soft); color: var(--warning); }
.badge-overdue { background: var(--danger-soft); color: var(--danger); }
.badge-skipped { background: var(--surface-3); color: var(--text-3); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }

.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; }
.dot-pending { background: var(--info); }
.dot-paid    { background: var(--success); }
.dot-partial { background: var(--warning); }
.dot-overdue { background: var(--danger); }
.dot-skipped { background: var(--text-3); }

/* ===================== 列表项 ===================== */

.list { display: flex; flex-direction: column; }

.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
.list-item.is-click { cursor: pointer; }
.list-item.is-click:hover { background: var(--surface-2); }

.list-icon {
  width: 38px; height: 38px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  background: var(--surface-3); border-radius: 10px;
}
.list-main { flex: 1; min-width: 0; }
.list-title {
  font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-side { text-align: right; flex: none; }
.list-amount { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.list-amount.is-danger { color: var(--danger); }
.list-amount.is-success { color: var(--success); }
.list-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* 列表底部「加载更多」 */
.load-more {
  padding: 14px; text-align: center;
  border-top: 1px solid var(--border);
}
.load-more.t3 { padding: 12px; }

/* ===================== 表格 ===================== */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { font-size: 13px; min-width: 520px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
.table td { font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .nowrap { white-space: nowrap; }

/* ===================== 进度条 ===================== */

.progress {
  height: 8px; background: var(--surface-3);
  border-radius: 99px; overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(14, 19, 25, .05);
}
.progress > i {
  display: block; height: 100%;
  background: var(--primary); border-radius: 99px;
  transition: width .4s var(--ease);
}
.progress.is-success > i { background: var(--success); }
.progress.is-warning > i { background: var(--warning); }
.progress.is-danger  > i { background: var(--danger); }

.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-row .pct { font-size: 12px; color: var(--text-2); min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

/* ===================== 分段控件 ===================== */

.segmented {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-3); border-radius: 10px;
  overflow-x: auto; max-width: 100%;
}
.segmented button {
  padding: 6px 12px; font-size: 13px; white-space: nowrap;
  color: var(--text-2); background: transparent;
  border: 0; border-radius: 7px; cursor: pointer;
}
.segmented button.is-active { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: var(--shadow); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; font-size: 13px;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border-2); border-radius: 20px; cursor: pointer;
}
.chip.is-active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ===================== 日历 ===================== */

.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px; }
.cal-head span { text-align: center; font-size: 12px; color: var(--text-3); padding: 3px 0; }
.cal-head span.is-weekend { color: var(--danger); opacity: .8; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }

.cal-cell {
  position: relative;
  min-height: 60px;
  padding: 5px 5px 4px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  overflow: hidden;
}
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.is-out { opacity: .34; }
.cal-cell.is-out:hover { opacity: .6; }
.cal-cell.is-today { border-color: var(--primary); }
.cal-cell.is-sel { background: var(--primary-soft); border-color: var(--primary); }
.cal-cell.is-gap { background: var(--danger-soft); }

.cal-cell .d { font-size: 12px; font-weight: 500; color: var(--text-2); line-height: 1.2; }
.cal-cell.is-today .d { color: var(--primary); font-weight: 600; }
.cal-cell.is-weekend .d { color: var(--danger); }

.cal-cell .amt {
  font-size: 11px; font-weight: 500; line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-cell .amt.s-overdue { color: var(--danger); }
.cal-cell .amt.s-pending { color: var(--info); }
.cal-cell .amt.s-partial { color: var(--warning); }
.cal-cell .amt.s-paid    { color: var(--success); }

.cal-cell .dots { display: flex; gap: 3px; flex-wrap: wrap; margin-top: auto; }
.cal-cell .dots i { width: 5px; height: 5px; border-radius: 50%; display: block; }

/* 月份标题：点击唤起原生年月选择器 */
.month-pick { position: relative; display: inline-flex; align-items: center; }
.month-pick b {
  font-size: 16px; font-weight: 600;
  min-width: 108px; text-align: center;
  padding: 4px 8px; border-radius: var(--radius-sm);
  cursor: pointer;
}
.month-pick:hover b { background: var(--surface-3); }
.month-pick input[type="month"] {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
  border: 0; padding: 0; margin: 0;
  -webkit-appearance: none; appearance: none;
}

@media (min-width: 900px) {
  .cal-cell { min-height: 96px; padding: 8px; }
  .cal-cell .d { font-size: 13px; }
  .cal-cell .amt { font-size: 12px; }
}

/* ===================== 弹层 ===================== */

.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(16, 24, 40, .45);
  backdrop-filter: blur(2px);
  animation: fadeIn .16s ease;
}

@media (min-width: 700px) {
  .modal-mask { align-items: center; padding: 24px; }
}

.modal {
  width: 100%; max-width: 520px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s cubic-bezier(.32, .72, 0, 1);
  overflow: hidden;
}

@media (min-width: 700px) {
  .modal { border-radius: var(--radius-lg); animation: popIn .16s ease; }
}

.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15px; flex: 1; }
.modal-head .sub { font-size: 12px; color: var(--text-3); font-weight: 400; }

.modal-body { padding: 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-body > .field + .field,
.modal-body > .field + .field-row,
.modal-body > .field-row + .field { margin-top: 14px; }
.modal-body > .field-row + .field-row { margin-top: 14px; }

.modal-foot {
  display: flex; gap: 10px;
  padding: 13px 18px;
  padding-bottom: calc(13px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.modal-foot .btn { flex: 1; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(24px); } to { transform: translateY(0); } }
@keyframes popIn { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ===================== 提示 ===================== */

.toast-root {
  position: fixed; left: 50%; top: 18px; z-index: 200;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px);
}

.toast {
  padding: 10px 18px;
  font-size: 14px;
  color: #fff;
  background: rgba(16, 24, 40, .92);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn .16s ease;
  word-break: break-all;
  /* 父级是 pointer-events:none，这里显式恢复，让「撤销」按钮可点 */
  pointer-events: auto;
}
.toast.is-ok  { background: var(--success); }
.toast.is-err { background: var(--danger); }

/* 带操作按钮的提示（如「已删除 · 撤销」） */
.toast.has-action {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 10px 8px 18px;
}
.toast .toast-btn {
  flex: none;
  padding: 4px 12px;
  font: inherit; font-size: 13px; font-weight: 500;
  color: #fff; background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 14px; cursor: pointer;
  transition: background .15s;
}
.toast .toast-btn:hover { background: rgba(255, 255, 255, .32); }

/* ===================== 空态 / 加载 ===================== */

.empty { padding: 44px 20px; text-align: center; color: var(--text-3); }
.empty .ico { font-size: 30px; opacity: .5; margin-bottom: 10px; }
.empty p { margin: 0; font-size: 13px; }
.empty .btn { margin-top: 14px; }

/* 卡片内的紧凑空态 */
.empty.is-sm { padding: 20px 16px; }
.empty.is-sm .ico { font-size: 24px; margin-bottom: 6px; }
.empty.is-sm .btn { margin-top: 10px; }

/* ===================== 新手引导 ===================== */

.guide-steps { display: flex; flex-direction: column; }
.guide-step {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.guide-step:first-child { padding-top: 0; }
.guide-step:last-child { padding-bottom: 0; border-bottom: 0; }

.guide-step .n {
  flex: none; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  color: var(--primary); background: var(--primary-soft);
  border-radius: 50%;
}
.guide-step .t { flex: 1; min-width: 0; }
.guide-step .t b { display: block; font-size: 13px; font-weight: 600; }
.guide-step .t span { display: block; font-size: 12px; color: var(--text-3); line-height: 1.5; margin-top: 2px; }
.guide-step > .btn { flex: none; }

.loading {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 48px 20px; color: var(--text-3); font-size: 13px;
}

.spinner {
  width: 16px; height: 16px; flex: none;
  border: 2px solid var(--border-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== 图表 ===================== */

.chart-box { position: relative; width: 100%; height: 220px; }
.chart-box.tall { height: 260px; }
.chart-box.short { height: 170px; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.legend span { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: block; }

/* ===================== 工具类 ===================== */

.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }

.t2 { color: var(--text-2); }
.t3 { color: var(--text-3); }
.fs12 { font-size: 12px; }
.fs13 { font-size: 13px; }
.fw6 { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.danger { color: var(--danger); }
.success { color: var(--success); }
.warning { color: var(--warning); }
.primary { color: var(--primary); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius);
  font-size: 13px; line-height: 1.6;
  margin-bottom: 14px;
}
.alert-danger  { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info    { background: var(--info-soft); color: var(--info); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert b { font-weight: 600; }
.alert .ico { flex: none; font-size: 15px; line-height: 1.4; }

.divider { height: 1px; background: var(--border); margin: 14px 0; border: 0; }

/* ==========================================================
   后台管理
   ========================================================== */

.admin-nav {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-nav-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2);
  font-size: 13px; font-family: inherit; cursor: pointer;
  transition: background .15s, color .15s;
}
.admin-nav-item:hover { background: var(--surface-3); color: var(--text); }
.admin-nav-item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.admin-nav-item svg { flex: none; }

.admin-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.admin-search {
  flex: 1; min-width: 180px; height: 38px;
  padding: 0 12px; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 13px; font-family: inherit;
}
.admin-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.admin-user-cell { display: flex; flex-direction: column; gap: 2px; }
.admin-user-cell b { font-weight: 600; }
.admin-user-cell small { font-size: 12px; color: var(--text-3); }

.admin-pager {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--border);
}

/* 用户详情 */
.detail-head { display: flex; align-items: center; gap: 12px; }
.detail-avatar {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
  font-size: 19px; font-weight: 600;
}
.detail-id { min-width: 0; }
.detail-name {
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}

/* 运维：数据概况 */
.ops-grid { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ops-cell {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm);
  font-size: 13px;
}
.ops-cell b { font-weight: 600; }
@media (min-width: 700px) {
  .ops-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 数据：备份列表脚注 */
.bk-note { padding: 12px 16px; border-top: 1px solid var(--border); }

/* 开关行 */
.switch-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.switch-row:last-of-type { border-bottom: 0; }
.switch-main { flex: 1; min-width: 0; }
.switch-title { font-size: 13px; font-weight: 600; }
.switch-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; line-height: 1.5; }

.switch { position: relative; flex: none; width: 44px; height: 24px; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--border-2); transition: background .18s;
}
.switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .2);
  transition: transform .18s;
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }

@media print {
  .sidebar, .tabbar, .fab, .topbar-actions { display: none !important; }
}

/* ==========================================================
   v1.6 —— 票据附件
   ========================================================== */

.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }

.att-cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface-3);
  border: 1px solid var(--border);
}
.att-cell img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.att-cell.is-missing { display: flex; align-items: center; justify-content: center; }
.att-cell.is-missing::after { content: '文件已丢失'; font-size: 11px; color: var(--text-3); }

.att-del {
  position: absolute; top: 3px; right: 3px;
  width: 21px; height: 21px; border-radius: 50%; border: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(16, 24, 40, .62); color: #fff; cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.att-cell:hover .att-del, .att-cell:focus-within .att-del { opacity: 1; }
@media (hover: none) { .att-del { opacity: 1; } }

.att-add {
  aspect-ratio: 1 / 1; border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border-2); background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-3); font-size: 11.5px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.att-add:hover, .att-add:focus-visible {
  border-color: var(--primary); color: var(--primary); background: var(--primary-soft);
}
.att-add.is-busy { pointer-events: none; opacity: .6; }
.att-add input[type=file] { display: none; }

/* 列表里的回形针角标 */
.att-badge {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 11px; color: var(--text-3); margin-left: 5px;
}

.att-viewer { text-align: center; }
.att-viewer img { max-width: 100%; max-height: 72vh; border-radius: var(--radius-sm); display: block; margin: 0 auto; }
.att-viewer .meta { margin-top: 10px; font-size: 12px; color: var(--text-3); }

/* ==========================================================
   v1.6 —— 常用模板 chips
   ========================================================== */

.tpl-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.tpl-row::-webkit-scrollbar { height: 4px; }
.tpl-row::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

.tpl-chip {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  font-size: 13px; line-height: 1.4; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); transition: border-color .15s, background .15s;
}
.tpl-chip:hover { border-color: var(--primary); background: var(--primary-soft); }
.tpl-chip .amt { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tpl-chip .ico { font-size: 13px; }

.tpl-manage {
  flex: none; padding: 6px 10px; border-radius: 999px; cursor: pointer;
  font-size: 12.5px; border: 1px dashed var(--border-2);
  background: transparent; color: var(--text-3);
}
.tpl-manage:hover { border-color: var(--primary); color: var(--primary); }

/* ==========================================================
   v1.6 —— 全局搜索面板
   ========================================================== */

.sp-mask {
  position: fixed; inset: 0; z-index: 230;
  background: rgba(16, 24, 40, .38);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 16px;
  animation: spFade .14s ease-out;
}
@keyframes spFade { from { opacity: 0; } to { opacity: 1; } }

.sp-box {
  width: 100%; max-width: 620px; max-height: 78vh;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
  display: flex; flex-direction: column;
  animation: spRise .16s ease-out;
}
@keyframes spRise { from { transform: translateY(-8px); opacity: .6; } to { transform: none; opacity: 1; } }

.sp-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.sp-head svg { color: var(--text-3); flex: none; }
.sp-head input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 16px; color: var(--text); min-width: 0;
}
.sp-head input::placeholder { color: var(--text-3); }
.sp-close {
  flex: none; border: 0; background: transparent; color: var(--text-3);
  font-size: 12px; cursor: pointer; padding: 3px 6px; border-radius: 5px;
}
.sp-close:hover { background: var(--surface-3); color: var(--text); }

.sp-body { overflow-y: auto; padding: 6px 0 10px; }
.sp-hint { padding: 26px 18px; text-align: center; color: var(--text-3); font-size: 13px; line-height: 1.9; }
.sp-hint kbd {
  display: inline-block; padding: 1px 5px; margin: 0 1px;
  border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 4px;
  font-family: var(--mono); font-size: 11px; color: var(--text-2); background: var(--surface-2);
}

.sp-group-hd {
  padding: 10px 16px 5px; font-size: 11.5px; font-weight: 600;
  color: var(--text-3); letter-spacing: .05em;
  display: flex; align-items: center; gap: 6px;
}
.sp-group-hd .n { font-weight: 400; }

.sp-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; cursor: pointer; border-left: 2px solid transparent;
}
.sp-item:hover, .sp-item.is-active { background: var(--primary-soft); border-left-color: var(--primary); }
.sp-item .ico {
  flex: none; width: 20px; height: 20px; color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
}
.sp-item:hover .ico, .sp-item.is-active .ico { color: var(--primary); }
.sp-item .main { min-width: 0; flex: 1; }
.sp-item .t1 { font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-item .t2 { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-item .go { flex: none; color: var(--text-3); }

.sp-foot {
  padding: 8px 16px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-3);
  display: flex; gap: 14px; flex-wrap: wrap; background: var(--surface-2);
}

/* ==========================================================
   v1.6 —— 日历订阅卡片
   ========================================================== */

.ics-url {
  display: flex; gap: 6px; align-items: stretch;
  margin-top: 10px;
}
.ics-url input {
  flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-2);
}
.ics-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ics-steps { margin: 12px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.85; }
.ics-steps li { margin-bottom: 2px; }


/* ============================================================
   账单导入向导（支付宝 / 微信 / 银行 CSV）
   ============================================================ */

.imp-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 9px 12px; margin-bottom: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 12px; color: var(--text-3);
}
.imp-bar span { white-space: nowrap; }
.imp-bar span.is-on { color: var(--primary); font-weight: 600; }
.imp-bar span.is-done { color: var(--success); }
.imp-bar i { font-style: normal; color: var(--border); }

.imp-tip {
  background: var(--info-soft); color: var(--text-2);
  border-radius: var(--radius); padding: 11px 13px;
  font-size: 12.5px; line-height: 1.9;
}
.imp-tip b { display: block; color: var(--text); font-size: 13px; margin-bottom: 2px; }

.imp-file {
  width: 100%; padding: 9px 10px; font-size: 13px;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text-2); cursor: pointer;
}
.imp-file:hover { border-color: var(--primary); }
.imp-file::file-selector-button {
  margin-right: 10px; padding: 5px 11px; font: inherit; font-size: 12.5px;
  border: 0; border-radius: 6px; cursor: pointer;
  background: var(--primary); color: #fff;
}

.imp-meta {
  display: flex; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 4px;
  font-size: 12px; color: var(--text-3);
}
.imp-meta span {
  padding: 3px 8px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.imp-meta span.imp-file-name {
  color: var(--text); font-weight: 500;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.imp-h {
  margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: var(--text);
}
.imp-h:first-of-type { margin-top: 10px; }

.imp-map {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px;
}
.imp-map .field { gap: 4px; }
.imp-map .field > span { font-size: 12px; }
.imp-map .field select { font-size: 12.5px; padding: 7px 9px; }

.imp-chk {
  display: flex; align-items: flex-start; gap: 8px; margin-top: 12px;
  font-size: 13px; color: var(--text-2); cursor: pointer; line-height: 1.6;
}
.imp-chk input { margin-top: 3px; flex: none; }
.imp-chk i { font-style: normal; color: var(--text-3); font-size: 12px; }

.imp-tb { font-size: 12.5px; min-width: 560px; }
.imp-tb th, .imp-tb td { padding: 8px 10px; }
.imp-tb .imp-cell {
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.imp-none {
  padding: 18px; text-align: center; font-size: 12.5px; color: var(--text-3);
  background: var(--surface-2); border-radius: var(--radius);
}

.imp-kpi {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.imp-kpi-item {
  padding: 12px 13px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2);
}
.imp-kpi-item.is-ok { border-color: var(--success); background: var(--success-soft); }
.imp-kpi-item.is-warn { border-color: var(--warning); background: var(--warning-soft); }
.imp-kpi-num {
  font-size: 21px; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1.25;
}
.imp-kpi-num i { font-style: normal; font-size: 11.5px; font-weight: 400; color: var(--text-3); margin-left: 3px; }
.imp-kpi-label { margin-top: 2px; font-size: 12px; color: var(--text-3); }

.imp-range { margin-top: 8px; font-size: 12px; color: var(--text-3); }

.imp-done { padding: 22px 12px 6px; text-align: center; }
.imp-done-ico {
  width: 52px; height: 52px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--success-soft); color: var(--success);
}
.imp-done-t { font-size: 17px; font-weight: 600; color: var(--text); }
.imp-done-s { margin-top: 5px; font-size: 12.5px; color: var(--text-3); }

.imp-batches { display: flex; flex-direction: column; gap: 8px; }
.imp-batch {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2);
}
.imp-batch-main { flex: 1; min-width: 0; }
.imp-batch-name {
  font-size: 13px; color: var(--text); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.imp-batch-sub { margin-top: 2px; font-size: 11.5px; color: var(--text-3); }
.imp-batch-side { text-align: right; flex: none; }
.imp-batch-amt {
  font-size: 13px; color: var(--text-2); font-weight: 500;
  font-variant-numeric: tabular-nums; margin-bottom: 4px;
}

@media (max-width: 640px) {
  .imp-map { grid-template-columns: 1fr; }
  .imp-kpi { grid-template-columns: 1fr 1fr; }
  .imp-bar { font-size: 11px; gap: 4px; }
}

/* ============================================================
   v1.8 —— 视觉精修层
   ------------------------------------------------------------
   这一层只做质感与移动端手感，不改变任何布局规则。
   放在文件最后，是为了能覆盖上面的基础样式，
   而不是把改动散落回几十处 —— 以后要回退只删这一段即可。
   ============================================================ */

/* ---- 表头：从「灰底块」变回「轻标签」，视线先落在数字上 ---- */
.table th {
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.table tbody tr { transition: background .14s var(--ease); }
.table tbody tr:last-child td { border-bottom: 0; }

/* ---- 列表项 ---- */
.list-item { transition: background .14s var(--ease); }

/* ---- 弹层：遮罩加深一点、模糊加强一点，前后层次更分明 ---- */
.modal-mask {
  background: rgba(14, 19, 25, .52);
  backdrop-filter: blur(4px) saturate(1.1);
  -webkit-backdrop-filter: blur(4px) saturate(1.1);
}
.modal { box-shadow: var(--shadow-lg); }

/* ---- 分段控件：选中块的浮起更轻 ---- */
.segmented { border-radius: 11px; }
.segmented button {
  border-radius: 8px;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.segmented button.is-active { box-shadow: var(--shadow); }

/* ---- 移动端：可点区域不小于 44px，间距略收 ----
 * 桌面端保留紧凑尺寸（鼠标精度高，44px 反而显得松散）；
 * 手机上一个按钮高 32px 是「点不准」的常见来源。
 */
@media (max-width: 899px) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .btn-xs { min-height: 32px; }

  .content { padding: 16px 14px 82px; }
  .card { margin-bottom: 14px; }
  .card-head { padding: 13px 15px; }
  .card-body { padding: 15px; }
  .card-body.tight { padding: 13px; }
  .grid { gap: 13px; }
  .stat { padding: 14px 15px; }

  .modal { border-radius: 18px 18px 0 0; }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }

  .icon-btn { width: 40px; height: 40px; }
}

/* 超窄屏（360 / 320）再收一档，避免金额被挤断成两行 */
@media (max-width: 380px) {
  .content { padding: 14px 11px 80px; }
  .card-head { padding: 12px 13px; }
  .card-body { padding: 13px; }
  .stat { padding: 13px 12px; }
  .stat .value { font-size: 21px; }
}

/* ---- 尊重系统「减少动效」设置 ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- 深色下表单控件抬一层底色 ----
 * 深色主题里卡片和输入框同为 --surface，只靠 1px 边框区分容易「糊在一起」。
 * 给输入框换 --surface-2，形成「凹进去」的层次，暗环境下更容易看清可输入区域。
 */
[data-theme="dark"] .field input,
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .input {
  background: var(--surface-2);
  border-color: var(--border-2);
}
[data-theme="dark"] .field input:focus,
[data-theme="dark"] .field select:focus,
[data-theme="dark"] .field textarea:focus,
[data-theme="dark"] .input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: var(--ring);
}
[data-theme="dark"] .field input:disabled { background: var(--surface-3); }

/* 浅色下输入框聚焦也统一用光环，跟按钮/图标保持一套 */
.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus { box-shadow: var(--ring); }

/* 深色下点阵要压暗：--border-2 在暗底上比在浅底上「亮」得多，
   同样的 opacity 会显得脏 */
[data-theme="dark"] .auth-body::before { opacity: .38; }

/* ---- 记账页日期区间：桌面按内容宽，手机两端对齐占满一行 ----
 * Chrome 的 input[type=date] 有约 150px 的内容最小宽度，
 * 两个挤在一起就会换行，把筛选区顶成 4 行、首屏看不到流水。
 * 小屏改成 flex 均分 + min-width:0，才能真正压到一行。
 */
.tx-range .input { width: auto; padding: 7px 10px; }

@media (max-width: 699px) {
  .tx-range { flex: 1 1 100%; }
  .tx-range .input { flex: 1 1 0; min-width: 0; width: 100%; padding: 8px 6px; font-size: 14px; }
  .tx-range > span { font-size: 12px; flex: none; }
}

/* ============================================================
   v1.8 —— 提前还款试算
   ============================================================ */

.pp-before { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pp-mini {
  padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.pp-mini-l { font-size: 11.5px; color: var(--text-3); }
.pp-mini-v {
  font-size: 14px; font-weight: 600; margin-top: 3px;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}

.pp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.pp-card {
  position: relative; padding: 15px 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
}
.pp-card.is-best {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary) inset;
}
.pp-tag {
  position: absolute; top: -9px; right: 12px;
  padding: 2px 9px; font-size: 10.5px; font-weight: 600;
  color: #fff; background: var(--primary); border-radius: 99px;
  letter-spacing: .01em;
}
.pp-card-t { font-size: 13px; font-weight: 600; margin-bottom: 8px; }

.pp-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; padding: 4px 0; font-size: 12.5px;
}
.pp-row span { color: var(--text-2); flex: none; }
.pp-row b {
  font-weight: 600; font-variant-numeric: tabular-nums;
  text-align: right; min-width: 0;
}
.pp-row b i {
  font-style: normal; font-weight: 400;
  font-size: 11px; color: var(--text-3); margin-left: 4px;
}

.pp-save {
  margin-top: 9px; padding-top: 9px;
  border-top: 1px dashed var(--border);
  font-size: 13.5px; font-weight: 600; color: var(--success);
  font-variant-numeric: tabular-nums;
}
.pp-save i { font-style: normal; font-size: 11.5px; opacity: .8; margin-left: 3px; }

.pp-rate { margin-top: 4px; font-size: 11.5px; color: var(--text-3); line-height: 1.55; }
.pp-now { margin-top: 12px; font-size: 12.5px; color: var(--text-2); line-height: 1.6; }

.pp-hint {
  padding: 18px 14px; text-align: center; font-size: 12.5px; color: var(--text-3);
  background: var(--surface-2); border-radius: var(--radius);
}
.pp-done {
  padding: 26px 18px; text-align: center;
  background: var(--success-soft); border-radius: var(--radius);
}
.pp-done-t { font-size: 15px; font-weight: 600; color: var(--success); }
.pp-done-s { margin-top: 7px; font-size: 13px; color: var(--text-2); }

@media (max-width: 640px) {
  .pp-before { grid-template-columns: 1fr 1fr; }
  .pp-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   v1.9 —— 分期真实年化
   ------------------------------------------------------------
   这块只服务于一个认知差：银行报「月费率 0.6%」听起来 7.2%，
   真实年化 13% 左右。所以视觉上把两个数并排放、用条形长度直接
   比，比写一段解释文字有效得多。真实值用告警色，因为它才是
   用户真正要付的成本。
   ============================================================ */

.ins-hero { text-align: center; padding: 4px 0 0; }
.ins-hero-l { font-size: 12.5px; color: var(--text-3); }
.ins-hero-v {
  font-size: 40px; font-weight: 700; line-height: 1.12;
  letter-spacing: -.03em;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}
.ins-hero-v i { font-style: normal; font-size: 19px; font-weight: 600; margin-left: 1px; }
.ins-hero-s { font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.ins-hero-s b { color: var(--danger); font-variant-numeric: tabular-nums; }

.ins-compare { display: flex; flex-direction: column; gap: 9px; margin: 16px 0 2px; }
.ins-bar-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--text-3);
}
.ins-bar-label { width: 58px; flex: none; }
.ins-bar {
  flex: 1; height: 10px; border-radius: 99px;
  background: var(--surface-3);
  box-shadow: inset 0 1px 2px rgba(14, 19, 25, .05);
  overflow: hidden;
}
.ins-bar > i {
  display: block; height: 100%; border-radius: 99px;
  transition: width .35s var(--ease);
}
.ins-bar-row.is-nominal .ins-bar > i { background: var(--border-2); }
.ins-bar-row.is-real .ins-bar > i { background: var(--danger); }
.ins-bar-val {
  width: 66px; flex: none; text-align: right;
  font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.ins-bar-row.is-real .ins-bar-val { color: var(--danger); }

.ins-note { margin-top: 12px; font-size: 11.5px; color: var(--text-3); line-height: 1.6; }

@media (max-width: 380px) {
  .ins-hero-v { font-size: 34px; }
  .ins-bar-label { width: 50px; }
  .ins-bar-val { width: 58px; }
}

/* 弹层里当二选一用时撑满一行：两个分支各占一半，比挤在左边更容易点中 */
.segmented.is-block { display: flex; width: 100%; }
.segmented.is-block button { flex: 1; }

/* ==========================================================
   v2.0 · 资产负债总览
   ----------------------------------------------------------
   一段独立追加的样式块，与上面的结构性样式无耦合。
   要回退 v2.0 只删本段即可（另需删 api/networth.php、
   assets/js/view-networth.js、app.js 里的导航项）。
   ========================================================== */

/* 底部导航 9 项（管理员）时的极窄档：360px 屏每项仅 40px */
.tabbar.is-xdense a { font-size: 8.5px; gap: 1px; }
.tabbar.is-xdense a svg { width: 17px; height: 17px; }
.tabbar.is-xdense a span { padding: 0; }

.nw-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 16px;
}
.nw-toolbar .segmented { flex: none; }

/* ---------------- 净资产主卡 ---------------- */

.nw-hero .card-body { padding: 22px; }

.nw-hero-grid {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.nw-hero-main { min-width: 0; flex: 1 1 240px; }

.nw-hero-label {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-2);
}

.nw-badge {
  display: inline-flex; align-items: center;
  padding: 1px 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 500; line-height: 1.7;
  background: var(--surface-3); color: var(--text-2);
}
.nw-badge.is-good   { background: var(--success-soft); color: var(--success); }
.nw-badge.is-normal { background: var(--warning-soft); color: var(--warning); }
.nw-badge.is-warn   { background: var(--danger-soft);  color: var(--danger); }

.nw-hero-v {
  margin-top: 6px;
  font-size: 40px; font-weight: 700; line-height: 1.12;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  overflow-wrap: anywhere;
}
.nw-hero-v.is-neg { color: var(--danger); }

.nw-hero-sub { margin-top: 6px; font-size: 12.5px; color: var(--text-3); }
.nw-hero-sub b { font-variant-numeric: tabular-nums; font-weight: 600; }
.nw-hero-sub b.is-up   { color: var(--success); }
.nw-hero-sub b.is-down { color: var(--danger); }

.nw-hero-side {
  display: flex; gap: 26px; flex: none;
  padding-left: 20px;
  border-left: 1px solid var(--border);
}
.nw-hero-cell { display: flex; flex-direction: column; gap: 3px; }
.nw-hero-cell span { font-size: 12px; color: var(--text-3); }
.nw-hero-cell b {
  font-size: 15px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.nw-hero-cell b.is-liab { color: var(--danger); }

/* 资产 / 负债 对比条：以两者最大值归一，长的那条占满，短的眼睛就能判断差距 */
.nw-cmp { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.nw-cmp-row {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center; gap: 10px;
}
.nw-cmp-k { font-size: 12px; color: var(--text-3); }
.nw-cmp-track {
  height: 10px; border-radius: 99px;
  background: var(--surface-3);
  box-shadow: inset 0 1px 2px rgba(14, 19, 25, .05);
  overflow: hidden;
}
.nw-cmp-track > i {
  display: block; height: 100%; border-radius: 99px;
  transition: width .4s var(--ease);
}
.nw-cmp-track > i.is-asset { background: var(--primary); }
.nw-cmp-track > i.is-liab  { background: var(--danger); }
.nw-cmp-v {
  font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 92px; text-align: right;
}
.nw-cmp-v.is-liab { color: var(--danger); }

/* ---------------- 走势图 ---------------- */

.nw-chart-wrap { position: relative; height: 230px; }
.nw-chart-empty {
  margin-top: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12px; color: var(--text-3); line-height: 1.6;
}

/* ---------------- 资产 / 负债 结构 ---------------- */

.nw-split { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .nw-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.nw-part { padding: 2px 0 10px; }
.nw-part + .nw-part { border-top: 1px dashed var(--border); padding-top: 12px; }
.nw-part-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 6px;
}
.nw-part-n { font-size: 13px; color: var(--text); }
.nw-part-a {
  font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.nw-part-bar {
  height: 8px; border-radius: 99px;
  background: var(--surface-3);
  box-shadow: inset 0 1px 2px rgba(14, 19, 25, .05);
  overflow: hidden;
}
.nw-part-bar > i {
  display: block; height: 100%; border-radius: 99px;
  transition: width .4s var(--ease);
}
.nw-part-bot {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-top: 5px;
  font-size: 11.5px; color: var(--text-3);
}
.nw-part-bot span:last-child {
  font-variant-numeric: tabular-nums; color: var(--text-2);
}

.nw-part-foot {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-3); line-height: 1.7;
}
.nw-none {
  padding: 18px 0; text-align: center;
  font-size: 13px; color: var(--text-3);
}

/* 整页空态：这里的一句话决定了用户要不要继续用下去，
   不能沿用 .empty 默认的 --text-3（深色模式下属实看不清）。
   把正文提到 --text-2、限宽居中，读起来才像句话而不是一行灰字。 */
.nw-empty .empty { padding: 52px 20px 46px; }
.nw-empty .empty p {
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.85;
  max-width: 520px;
  margin: 0 auto;
  /* 文案里用 \n 手动断行：「录入」这类词被自动折行拆到两行会读得很别扭 */
  white-space: pre-line;
}
.nw-empty .empty .ico { font-size: 34px; opacity: .55; margin-bottom: 12px; }
.nw-empty .empty .btn { margin-top: 16px; }

/* ---------------- 偿债能力 ---------------- */

.nw-inds {
  display: grid; gap: 12px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 760px) {
  .nw-inds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.nw-ind {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-2);
}
.nw-ind.is-good   { border-left-color: var(--success); }
.nw-ind.is-normal { border-left-color: var(--warning); }
.nw-ind.is-warn   { border-left-color: var(--danger); }

.nw-ind-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.nw-ind-k { font-size: 12.5px; color: var(--text-2); }
.nw-ind-lv {
  font-size: 11px; font-weight: 500;
  padding: 1px 7px; border-radius: 99px;
  background: var(--surface-3); color: var(--text-3);
  flex: none;
}
.nw-ind.is-good   .nw-ind-lv { background: var(--success-soft); color: var(--success); }
.nw-ind.is-normal .nw-ind-lv { background: var(--warning-soft); color: var(--warning); }
.nw-ind.is-warn   .nw-ind-lv { background: var(--danger-soft);  color: var(--danger); }

.nw-ind-v {
  margin-top: 6px;
  font-size: 24px; font-weight: 700;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
}
.nw-ind-v i { font-style: normal; font-size: 13px; font-weight: 500; margin-left: 2px; color: var(--text-2); }
.nw-ind.is-good   .nw-ind-v { color: var(--success); }
.nw-ind.is-normal .nw-ind-v { color: var(--warning); }
.nw-ind.is-warn   .nw-ind-v { color: var(--danger); }
.nw-ind.is-none   .nw-ind-v { color: var(--text-3); }

.nw-ind-d { margin-top: 5px; font-size: 11.5px; color: var(--text-3); line-height: 1.55; }
.nw-ind-h {
  margin-top: 6px; font-size: 11.5px; line-height: 1.55;
  color: var(--warning);
}

/* 手机：一行标题 + 右侧数值，说明文字独占下一行，比三列小卡片省一半高度 */
@media (max-width: 759px) {
  .nw-ind {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 10px;
    align-items: center;
    padding: 12px 14px;
  }
  .nw-ind-top { grid-column: 1; grid-row: 1; }
  .nw-ind-v {
    grid-column: 2; grid-row: 1;
    margin-top: 0; font-size: 20px; text-align: right;
  }
  .nw-ind-d { grid-column: 1 / -1; grid-row: 2; margin-top: 4px; }
  .nw-ind-h { grid-column: 1 / -1; grid-row: 3; margin-top: 2px; }
}

/* ---------------- 负债明细 ---------------- */

.nw-list { padding: 4px 0; }
.nw-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
}
.nw-item + .nw-item { border-top: 1px solid var(--border); }

.nw-item-tag {
  flex: none;
  padding: 1px 7px; border-radius: 6px;
  font-size: 11px; font-weight: 500; line-height: 1.7;
  background: var(--surface-3); color: var(--text-2);
}
.nw-item-tag.is-credit_card   { background: var(--danger-soft);  color: var(--danger); }
.nw-item-tag.is-loan          { background: var(--primary-soft); color: var(--primary); }
.nw-item-tag.is-personal_debt { background: var(--warning-soft); color: var(--warning); }

.nw-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.nw-item-main b {
  font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nw-item-due { font-size: 11.5px; color: var(--text-3); }

.nw-item-a {
  flex: none;
  font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------------- 口径说明 ---------------- */

.nw-note {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px dashed var(--border-2);
  font-size: 11.5px; color: var(--text-3); line-height: 1.75;
}
.nw-note b { display: block; margin-bottom: 4px; color: var(--text-2); font-size: 12px; }
.nw-note p { margin: 0; }
.nw-note p + p { margin-top: 6px; }
.nw-note strong { color: var(--text-2); font-weight: 600; }

/* ---------------- 窄屏收敛 ---------------- */

@media (max-width: 560px) {
  .nw-hero .card-body { padding: 18px 16px; }
  .nw-hero-v { font-size: 30px; letter-spacing: -.03em; }
  .nw-hero-side {
    padding-left: 0; border-left: 0;
    gap: 20px; width: 100%;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    justify-content: space-between;
  }
  .nw-hero-cell b { font-size: 14px; }
  .nw-cmp { margin-top: 16px; }
  .nw-cmp-v { min-width: 78px; font-size: 12px; }
  .nw-cmp-row { grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; }
  .nw-chart-wrap { height: 196px; }
  .nw-item { padding: 11px 14px; gap: 8px; }
  .nw-item-a { font-size: 12.5px; }
}

@media (max-width: 380px) {
  .nw-hero-v { font-size: 26px; }
  .nw-cmp-v { min-width: 68px; font-size: 11px; }
  .nw-ind-v { font-size: 18px; }
}

/* 四列指标卡在手机上是两列，每列内容宽仅约 135px，
   24px 的「¥1,210,032.00」必断成「¥1,210,032.」+「00」两行 —— 数字断行看着像出错。
   这个修正对首页、统计、后台的 grid-4 同样生效。 */
@media (max-width: 560px) {
  .grid-4 .stat { padding: 13px 12px; }
  .grid-4 .stat .value,
  .grid-4 .stat .value.sm {
    font-size: 17px;
    letter-spacing: -.02em;
  }
}

/* 尊重系统的「减少动态效果」：条与曲线不做过渡 */
@media (prefers-reduced-motion: reduce) {
  .nw-cmp-track > i,
  .nw-part-bar > i { transition: none; }
}
