/* =====================================================================
   CMB Ledger — 现代浅色 + 玻璃 (Glassmorphism) 主题
   ===================================================================== */

:root {
  /* ——— 基础色板 (现代浅色) ——— */
  --bg: #f8fafc;
  --bg-gradient: radial-gradient(at 0% 0%, rgba(224, 231, 255, 0.45) 0px, transparent 50%),
                 radial-gradient(at 100% 0%, rgba(243, 232, 255, 0.4) 0px, transparent 50%),
                 #f8fafc;
  --card: #ffffff;
  --card-border: rgba(226, 232, 240, 0.95);
  --card-strong: #ffffff;
  --text: #0f172a;
  --text-soft: #475569;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* ——— 主题色 ——— */
  --primary: #4a73f0;              /* 主色:明快的靛蓝 */
  --primary-soft: #7393f5;
  --primary-glow: rgba(74, 115, 240, 0.35);
  --primary-hover: #3658d8;
  --primary-gradient: linear-gradient(135deg, #5b85f5 0%, #6a6df0 100%);

  --in: #16a34a;
  --in-soft: rgba(22, 163, 74, 0.12);
  --in-gradient: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);

  --out: #e11d48;
  --out-soft: rgba(225, 29, 72, 0.12);
  --out-gradient: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);

  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --ok: #16a34a;
  --ok-soft: rgba(22, 163, 74, 0.12);

  /* ——— 阴影 + 玻璃配置 ——— */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow:    0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.03);
  --shadow-xl: 0 20px 32px -6px rgba(15, 23, 42, 0.12), 0 8px 12px -4px rgba(15, 23, 42, 0.04);

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --tap: 44px;

  /* ——— 动画 ——— */
  --t-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --t-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============= 全局 ============= */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* 背景渐变 + 装饰色块 (固定, 不动) */
body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  min-height: 100vh;
  position: relative;
}
body::before, body::after {
  content: "";
  position: fixed;
  width: 520px; height: 520px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.55;
  pointer-events: none;
  z-index: -1;
}
body::before {
  background: radial-gradient(circle, #a5b4fc 0%, transparent 70%);
  top: -180px; left: -120px;
}
body::after {
  background: radial-gradient(circle, #fbcfe8 0%, transparent 70%);
  bottom: -200px; right: -160px;
}

a { color: var(--primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--primary-hover); }

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

/* ============= 顶部导航 (桌面) ============= */
.top-nav {
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.02);
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0.7rem 1.5rem;
  display: flex; align-items: center; gap: 1.5rem;
}
.brand {
  font-weight: 700; font-size: 1.1rem; color: var(--text);
  display: inline-flex; align-items: center; gap: 0.4rem;
  letter-spacing: -0.01em;
}

.nav-links { display: flex; gap: 0.25rem; flex: 1; }
.nav-links a {
  padding: 0.4rem 0.85rem; border-radius: 8px;
  color: var(--text-soft); font-size: 0.9rem; font-weight: 600;
  min-height: 36px;
  display: inline-flex; align-items: center;
  transition: all var(--t-fast);
}
.nav-links a:hover {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
}
.nav-links a.active {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.stats-pill {
  display: flex; gap: 0.7rem; font-size: 0.85rem; font-weight: 500;
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  padding: 0.4rem 0.85rem; border-radius: 999px;
}
.stats-pill .stat-out { color: var(--out); font-weight: 700; }
.stats-pill .stat-in  { color: var(--in); font-weight: 700; }

.logout-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
  color: var(--muted); font-size: 1.2rem; text-decoration: none;
  transition: all var(--t-fast);
}
.logout-btn:hover { background: var(--out-soft); color: var(--out); border-color: var(--out); }

/* ============= 底部 Tab Bar (移动) ============= */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 24px rgba(60, 80, 130, 0.08);
}
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0.5rem 0.2rem;
  font-size: 0.7rem;
  color: var(--muted); text-decoration: none;
  min-height: 56px;
  position: relative;
  transition: color var(--t-fast);
}
.bottom-nav a .icon { font-size: 1.35rem; line-height: 1; margin-bottom: 0.2rem; transition: transform var(--t-spring); }
.bottom-nav a:hover .icon { transform: translateY(-2px); }
.bottom-nav a.active { color: var(--primary); font-weight: 600; }
.bottom-nav a.active::before {
  content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; border-radius: 99px;
  background: var(--primary-gradient);
}

/* ============= 主容器 ============= */
.container {
  max-width: 1280px; margin: 0 auto; padding: 1.5rem;
}
main { padding-bottom: 1rem; }

/* ============= 玻璃卡片 ============= */
.card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.5rem 1.8rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.card:hover { box-shadow: var(--shadow-lg); }

.card h2 { margin: 0 0 1rem; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.card h3 { margin: 0 0 0.8rem; font-size: 1rem; color: var(--text); font-weight: 700; }
.muted { color: var(--muted); font-size: 0.85rem; }
.muted.block { display: block; margin-top: 0.2rem; }

/* ============= 工具栏 / 筛选 ============= */
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap;
}
.filter-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.filter-form input, .filter-form select, .upload-form input[type=file] {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: #ffffff;
  color: var(--text);
  min-height: 38px;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-sm);
}
.filter-form input:focus, .filter-form select:focus, .upload-form input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  background: rgba(255, 255, 255, 0.95);
}
.filter-form input { width: 220px; }
.link-clear {
  color: var(--muted); font-size: 0.85rem;
  padding: 0.55rem 0.6rem;
  min-height: var(--tap);
  display: inline-flex; align-items: center;
}

button, .btn-primary {
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  border: 0;
  background: var(--primary-gradient);
  color: #fff; cursor: pointer; font-size: 0.95rem; font-weight: 600;
  transition: all var(--t-fast);
  min-height: var(--tap);
  box-shadow: 0 4px 14px var(--primary-glow);
  letter-spacing: 0.01em;
}
button:hover, .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px var(--primary-glow);
}
button:active, .btn-primary:active { transform: translateY(0); }
.btn-primary { font-weight: 700; }

.result-info { font-size: 0.85rem; color: var(--muted); font-weight: 500; }

/* ============= 桌面表格 ============= */
.desktop-table { display: block; }
.mobile-cards  { display: none; }

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.tx-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: transparent; font-size: 0.9rem;
}
.tx-table th {
  background: #f8fafc;
  padding: 0.75rem 0.85rem;
  font-weight: 700; text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  color: #64748b;
  position: sticky; top: 0;
}
.tx-table td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid rgba(140, 152, 178, 0.10);
  vertical-align: middle;
  transition: background var(--t-fast);
}
.tx-table tr:hover td { background: rgba(74, 115, 240, 0.04); }
.tx-table tr:last-child td { border-bottom: 0; }
.tx-table .th-check { width: 36px; }
.tx-table .th-date  { width: 110px; }
.tx-table .th-amt   { width: 110px; }
.tx-table .th-act   { width: 70px; text-align: center; }

.td-remark { max-width: 320px; word-break: break-word; }
.td-date { white-space: nowrap; }
.td-amt  { white-space: nowrap; }
.td-act  { text-align: center; }

.amt-in  { color: var(--in); font-weight: 700; font-variant-numeric: tabular-nums; }
.amt-out { color: var(--out); font-weight: 700; font-variant-numeric: tabular-nums; }

.tx-row.tx-in td:first-child  { box-shadow: inset 3px 0 0 var(--in); }
.tx-row.tx-out td:first-child { box-shadow: inset 3px 0 0 var(--out); }

.cat-select, .note-input {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  min-height: 36px;
  transition: all var(--t-fast);
}
.cat-select:focus, .note-input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.note-input { min-width: 120px; }

.tx-table.simple th, .tx-table.simple td { padding: 0.6rem 0.8rem; }
.tx-table.simple tbody tr:hover td { background: rgba(74, 115, 240, 0.03); }

.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.02em;
}
.tag-type { background: rgba(74, 115, 240, 0.12); color: var(--primary); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-ok   { background: var(--ok-soft); color: var(--ok); }

.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }

/* ============= 操作列按钮 ============= */
.btn-icon {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border-strong);
  width: 34px; height: 34px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted); font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}
.btn-icon:hover {
  background: var(--out-soft); color: var(--out); border-color: var(--out);
  transform: translateY(-1px);
}
.btn-del-card {
  width: 100%;
  margin-top: 0.5rem;
  background: rgba(255, 255, 255, 0.5);
  border: 1px dashed var(--border-strong);
  color: var(--muted);
  padding: 0.45rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--t-fast);
}
.btn-del-card:hover {
  background: var(--out-soft); color: var(--out); border-color: var(--out); border-style: solid;
}

/* ============= 移动卡片 ============= */
.tx-card {
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 0.95rem 1.05rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 0.8rem;
  align-items: center;
  position: relative;
  overflow: hidden;
  transition: all var(--t-base);
}
.tx-card:active { transform: scale(0.99); }
.tx-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--in-gradient);
}
.tx-card.tx-out::before { background: var(--out-gradient); }
.tx-card.tx-manual::before {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
}

.tx-card .row1 {
  grid-column: 1 / -1;
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 0.5rem;
}
.tx-card .row1 .date { font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.tx-card .row1 .amt { font-size: 1.2rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tx-card .row2 {
  grid-column: 1 / -1;
  font-size: 0.95rem;
  word-break: break-word;
  color: var(--text);
  font-weight: 500;
}
.tx-card .row3 {
  grid-column: 1 / -1;
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
  font-size: 0.78rem;
}
.tx-card .row3 .meta { color: var(--muted); }
.tx-card .row3 .tag-type { flex-shrink: 0; }
.tx-card .row4 {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
}
.tx-card .cat-select, .tx-card .note-input { font-size: 0.85rem; }

/* ============= 分页 ============= */
.pager {
  display: flex; justify-content: center; gap: 0.5rem; margin: 1rem 0;
}
.pager a {
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text); font-weight: 500;
  min-height: var(--tap);
  display: inline-flex; align-items: center;
  transition: all var(--t-fast);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.pager a:hover { background: rgba(255, 255, 255, 0.95); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* ============= 批量栏 ============= */
.bulk-bar {
  display: flex; gap: 0.5rem; align-items: center;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  margin-top: 0.75rem;
  box-shadow: var(--shadow);
}
.bulk-bar select {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  min-height: var(--tap);
}

/* ============= 闪现提示 ============= */
.flashes { margin-bottom: 1rem; }
.flash {
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
}
.flash-ok    {
  background: var(--ok-soft); color: var(--ok); border-color: rgba(22, 163, 74, 0.25);
}
.flash-error {
  background: var(--out-soft); color: var(--out); border-color: rgba(225, 29, 72, 0.25);
}

/* ============= 上传 / hint ============= */
.upload-form {
  display: flex; gap: 0.75rem; align-items: center;
  margin: 1rem 0; flex-wrap: wrap;
}
.upload-form input[type=file] {
  flex: 1; min-width: 220px; min-height: var(--tap);
  background: rgba(255, 255, 255, 0.65);
}

.hint {
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1.1rem;
  margin-top: 1rem;
}
.hint summary { cursor: pointer; color: var(--primary); font-weight: 600; padding: 0.3rem 0; }
.hint ol { margin: 0.5rem 0; padding-left: 1.5rem; }

.meta-line {
  display: flex; gap: 1.25rem; flex-wrap: wrap;
  padding: 0.85rem 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  margin-bottom: 1rem;
  font-size: 0.86rem;
}
.meta-line .warn { color: var(--warn); font-weight: 700; }
.meta-line .ok { color: var(--ok); font-weight: 700; }

.tx-table.preview tr.dup td { background: rgba(217, 119, 6, 0.08); }
.tx-table.preview tr.new td { background: rgba(22, 163, 74, 0.06); }

/* ============= 报表 ============= */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.echart-box { width: 100%; height: 360px; }

/* ============= FAB ============= */
.fab {
  display: none;
  position: fixed;
  right: 1.25rem;
  bottom: calc(76px + env(safe-area-inset-bottom, 0));
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff; font-size: 1.9rem; font-weight: 300;
  align-items: center; justify-content: center;
  border: 0; cursor: pointer;
  box-shadow:
    0 10px 28px var(--primary-glow),
    0 4px 10px rgba(74, 115, 240, 0.25);
  z-index: 90;
  transition: all var(--t-spring);
}
.fab:hover { transform: translateY(-2px) rotate(90deg); box-shadow: 0 14px 36px var(--primary-glow); }
.fab:active { transform: translateY(0) rotate(90deg) scale(0.94); }
.fab::after {
  content: ""; position: absolute; inset: -6px;
  border-radius: 50%;
  background: var(--primary); opacity: 0.25; z-index: -1;
  animation: fab-pulse 2.4s ease-out infinite;
}
@keyframes fab-pulse {
  0%   { transform: scale(1);   opacity: 0.4; }
  70%  { transform: scale(1.6); opacity: 0;  }
  100% { transform: scale(1.6); opacity: 0;  }
}

/* ============= 页脚 ============= */
.footer {
  text-align: center; padding: 2.5rem 0 1.5rem; color: var(--muted);
  font-size: 0.8rem;
}

code {
  background: rgba(255, 255, 255, 0.6);
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  font-size: 0.85em;
  color: var(--primary);
  font-weight: 500;
}

/* ============= 手动来源标签 ============= */
.tag-source {
  background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
  color: #c2410c;
  font-size: 0.68rem; font-weight: 700;
}
.tx-manual { background: linear-gradient(135deg, rgba(255,237,213,0.4), rgba(254,215,170,0.4)); }

/* ============= Modal ============= */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal[hidden] { display: none; }
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: overlayIn var(--t-base);
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal-panel {
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 460px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalIn var(--t-spring);
}
@keyframes modalIn {
  from { transform: scale(0.94) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  z-index: 1;
}
.modal-header h3 { margin: 0; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.modal-close {
  background: rgba(140, 152, 178, 0.12);
  border: 0;
  font-size: 1.5rem; line-height: 1;
  color: var(--muted);
  width: 34px; height: 34px;
  min-height: auto;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  box-shadow: none;
  transition: all var(--t-fast);
}
.modal-close:hover { background: var(--out-soft); color: var(--out); transform: rotate(90deg); }

#quick-add-form { padding: 1.4rem; }
#quick-add-form .form-field { margin-bottom: 0.95rem; }
#quick-add-form .form-field label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--text-soft); margin-bottom: 0.35rem;
}
#quick-add-form input, #quick-add-form select {
  width: 100%; padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  font-size: 16px;
  min-height: var(--tap);
  transition: all var(--t-fast);
  color: var(--text);
}
#quick-add-form input:focus, #quick-add-form select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  background: #fff;
}
#quick-add-form .amt-input {
  font-size: 1.6rem; font-weight: 700;
  text-align: center;
  padding: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.form-row-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
}

.seg-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  margin-bottom: 1rem;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(140, 152, 178, 0.10);
  border: 1px solid var(--border);
}
.seg-opt {
  position: relative;
  text-align: center;
  padding: 0.7rem;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-soft);
  background: transparent;
  transition: all var(--t-fast);
}
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt:hover { background: rgba(255, 255, 255, 0.5); }
.seg-opt:has(input:checked) { color: #fff; }
.seg-exp:has(input:checked) { background: var(--out-gradient); }
.seg-inc:has(input:checked) { background: var(--in-gradient); }

.form-actions {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}
.btn-secondary {
  padding: 0.55rem 1.1rem;
  background: rgba(255, 255, 255, 0.6);
  color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 10px; cursor: pointer;
  font-size: 0.95rem; font-weight: 600;
  min-height: var(--tap);
  box-shadow: none;
  transition: all var(--t-fast);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.95); transform: translateY(-1px); }

/* ============= 工具栏右侧 ============= */
.toolbar-right { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.btn-quick { white-space: nowrap; }
.btn-quick-block {
  display: block; width: 100%;
  padding: 0.95rem;
  font-size: 1.05rem; font-weight: 700;
  border-radius: 12px;
  letter-spacing: 0.02em;
}

/* ============= 移动端断点 ============= */
@media (max-width: 768px) {
  body { font-size: 16px; }
  .container { padding: 0.75rem; padding-bottom: 90px; }

  .top-nav { display: none; }
  .bottom-nav { display: flex; }

  .desktop-table { display: none; }
  .mobile-cards { display: block; }

  .toolbar { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .filter-form { gap: 0.4rem; }
  .filter-form input { width: 100%; }
  .filter-form select, .filter-form button { flex: 1; }
  .result-info { text-align: center; }

  .card {
    padding: 1.1rem; border-radius: var(--radius);
    margin-bottom: 0.85rem;
    box-shadow: 0 2px 8px rgba(60, 80, 130, 0.06);
  }

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

  .bulk-bar {
    position: sticky;
    bottom: calc(56px + env(safe-area-inset-bottom, 0));
    z-index: 60;
    margin: 0.75rem -0.75rem;
    border-radius: 0;
    box-shadow: 0 -4px 20px rgba(60, 80, 130, 0.10);
    padding: 0.65rem 1rem;
  }

  .grid-2 { grid-template-columns: 1fr; gap: 0.85rem; }
  .echart-box { height: 280px; }
  .fab { display: inline-flex; }

  .filter-form input, .filter-form select, button, .btn-primary {
    font-size: 1rem;
  }
  .flash { font-size: 0.95rem; }
  .meta-line { font-size: 0.8rem; gap: 0.85rem; }
  .tx-table.preview { font-size: 0.85rem; }
  input, select, textarea { font-size: 16px !important; }
  .footer { padding: 1rem 0 5rem; font-size: 0.75rem; }

  /* Modal: 移动端底部抽屉 */
  .modal { padding: 0; align-items: flex-end; }
  .modal-panel {
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 92vh;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .modal-panel { animation: modalSlideUp var(--t-spring); }
  @keyframes modalSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
}

@media (min-width: 769px) {
  .bottom-nav, .fab { display: none; }
}

/* ============= 密码可见切换 (全站) ============= */
.input-with-eye {
  position: relative;
  display: block;
}
.input-with-eye input[type="password"],
.input-with-eye input[type="text"] {
  padding-right: 44px; /* 给眼睛按钮留位置 */
  width: 100%;
}
.eye-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-height: auto;
  box-shadow: none;
  transition: color var(--t-fast), background var(--t-fast);
}
.eye-toggle:hover { background: var(--bg); color: var(--primary); }
.eye-toggle:active { transform: translateY(-50%) scale(0.9); }
.eye-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.eye-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
  pointer-events: none;
}
.eye-toggle .eye-open,
.eye-toggle .eye-closed {
  display: none;
}
.eye-toggle.is-hidden .eye-open { display: block; }    /* 当前隐藏密码 -> 显示"睁眼"提示可点看 */
.eye-toggle.is-visible .eye-closed { display: block; } /* 当前可见 -> 显示"闭眼/隐藏" */

/* ============= Settings 页面 ============= */
.settings-card { max-width: 580px; margin-left: auto; margin-right: auto; }
.settings-card h2 { font-size: 1.3rem; }
.settings-card .section-h {
  margin: 1.6rem 0 0.8rem;
  font-size: 0.95rem;
  color: var(--text-soft);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border);
}
.settings-card .form-field label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-soft); margin-bottom: 0.4rem; }
.settings-card .form-field input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  font-size: 0.95rem;
  min-height: var(--tap);
  transition: all var(--t-fast);
}
.settings-card .form-field input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  background: #fff;
}
.settings-card .form-field input:disabled {
  background: rgba(140, 152, 178, 0.08);
  color: var(--muted);
  cursor: not-allowed;
}
.settings-card .form-field small { display: block; margin-top: 0.3rem; font-size: 0.78rem; }
.settings-card .form-field small.required { color: var(--out); font-weight: 600; }

.form-error {
  background: var(--out-soft);
  border: 1px solid rgba(225, 29, 72, 0.3);
  color: var(--out);
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-top: 1rem;
  animation: fadeUp var(--t-base);
}

.info-card {
  max-width: 580px;
  margin-left: auto; margin-right: auto;
  background: linear-gradient(135deg, rgba(74, 115, 240, 0.04), rgba(106, 109, 240, 0.04));
}
.info-card h3 { font-size: 1rem; }
.info-card ul { margin: 0.5rem 0 0; padding-left: 1.5rem; line-height: 1.85; color: var(--text-soft); font-size: 0.9rem; }
.info-card code { background: rgba(255, 255, 255, 0.7); padding: 0.1rem 0.4rem; border-radius: 5px; font-size: 0.85em; }

/* ============= 报表推送设置页 ============= */
.seg-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-bottom: 1rem;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(140, 152, 178, 0.10);
  border: 1px solid var(--border);
}
.seg-4 .seg-opt {
  position: relative;
  text-align: center;
  padding: 0.65rem 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-soft);
  background: transparent;
  transition: all var(--t-fast);
  display: flex; align-items: center; justify-content: center;
}
.seg-4 .seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-4 .seg-opt:hover { background: rgba(255, 255, 255, 0.5); }
.seg-4 .seg-opt:has(input:checked) {
  color: #fff;
  background: var(--primary-gradient);
  box-shadow: 0 2px 8px var(--primary-glow);
}
.form-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
}
.form-ok {
  background: var(--ok-soft);
  border: 1px solid rgba(22, 163, 74, 0.3);
  color: var(--ok);
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-top: 1rem;
  animation: fadeUp var(--t-base);
}
.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.status-v {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 0.3rem;
  word-break: break-word;
}
@media (max-width: 600px) {
  .seg-4 { grid-template-columns: 1fr 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: 1fr; }
}

/* ============= 滚动条美化 (Webkit) ============= */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(140, 152, 178, 0.25);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(140, 152, 178, 0.4); background-clip: padding-box; }

/* ============= 进入动画 ============= */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tx-card, .card, .pager a, .stats-pill, .hint, .flash {
  animation: fadeUp var(--t-slow) backwards;
}
.tx-card:nth-child(1)  { animation-delay: 0.02s; }
.tx-card:nth-child(2)  { animation-delay: 0.04s; }
.tx-card:nth-child(3)  { animation-delay: 0.06s; }
.tx-card:nth-child(4)  { animation-delay: 0.08s; }
.tx-card:nth-child(5)  { animation-delay: 0.10s; }
.tx-card:nth-child(n+6){ animation-delay: 0.12s; }

/* ============= 兼容旧浏览器 (无 backdrop-filter) ============= */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .top-nav, .bottom-nav, .card, .modal-overlay, .modal-panel, .modal-header,
  .bulk-bar, .stats-pill, .btn-secondary, .filter-form input,
  .filter-form select, .upload-form input, .table-wrap, .hint, .flash,
  .tx-card, .pager a, #quick-add-form input, #quick-add-form select,
  .cat-select, .note-input {
    background: rgba(255, 255, 255, 0.96);
  }
}


/* ============= 商户名称清洗与渠道徽章 ============= */
.merchant-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  line-height: 1.35;
  margin-bottom: 2px;
}
.merchant-name {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.94rem;
  letter-spacing: -0.01em;
}
.badge-channel {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.42rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}
.badge-alipay {
  background: rgba(22, 119, 255, 0.12);
  color: #1677ff;
  border: 1px solid rgba(22, 119, 255, 0.25);
}
.badge-wechat {
  background: rgba(7, 193, 96, 0.12);
  color: #07c160;
  border: 1px solid rgba(7, 193, 96, 0.25);
}
.badge-unionpay {
  background: rgba(225, 29, 72, 0.10);
  color: #e11d48;
  border: 1px solid rgba(225, 29, 72, 0.2);
}
.remark-raw-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  max-width: 380px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acc-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ============= 分类选择框轻量化与徽章感 ============= */
.cat-select {
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  min-height: 28px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.cat-select:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.cat-select:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ============= 备注输入框微交互 ============= */
.note-input {
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font-size: 0.82rem;
  background: transparent;
  border: 1px solid transparent;
  color: #334155;
  min-height: 28px;
  transition: all 0.15s ease;
}
.note-input:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.note-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ============= 顶部次级功能按钮 ============= */
.btn-secondary {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}
