/* ==========================================================================
   jh.ibee.uk 记账网站样式系统
   清爽现代金融面板风格 · 支持桌面表格与移动端自适应卡片
   ========================================================================== */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-subtle: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;

  --accent: #c8102e;
  --accent-hover: #a90d26;
  --accent-soft: #fef2f2;
  --accent-border: #fecaca;

  --refund: #059669;
  --refund-soft: #ecfdf5;
  --refund-border: #a7f3d0;

  --danger: #dc2626;
  --danger-hover: #b91c1c;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-sm: 0 2px 8px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 18px 42px rgba(17, 24, 39, 0.14);

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.muted {
  color: var(--text-muted);
}

.text-right {
  text-align: right;
}

.text-expense {
  color: var(--text);
}

.text-refund {
  color: var(--refund);
}

/* 加载占位 */
.boot-loader {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
}

.boot-spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 按钮体系 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(0.5px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-subtle);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--surface-subtle);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: #fecaca;
}

.btn-danger-ghost:hover {
  background: #fef2f2;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 13px;
}

.btn-lg {
  padding: 11px 18px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.link-btn:hover {
  text-decoration: underline;
}

/* 表单控件 */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 8px 11px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
}

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

.form-error {
  padding: 9px 12px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
}

.notice-banner {
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
  font-size: 13px;
  line-height: 1.5;
}

/* 认证界面 */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top right, #fde8ec 0%, #f5f6f8 46%, #eef2f7 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-brand p {
  margin: 2px 0 0;
  font-size: 13px;
}

/* 顶部导航 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ledger-switcher-wrap,
.export-menu-wrap {
  position: relative;
}

.ledger-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  max-width: 280px;
}

.ledger-switcher-btn:hover {
  background: var(--surface-subtle);
  border-color: var(--border);
}

.ledger-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  color: var(--text-muted);
  flex-shrink: 0;
}

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

/* 下拉菜单 */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
}

.dropdown-menu-right {
  left: auto;
  right: 0;
}

.dropdown-header {
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dropdown-list {
  max-height: 260px;
  overflow-y: auto;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--surface-subtle);
}

.dropdown-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.dropdown-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.dropdown-item-accent {
  color: var(--accent);
  font-weight: 600;
}

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

/* 主容器 */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 周期提示条 */
.cycle-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.cycle-banner-text {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dot-accent {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.divider-pipe {
  color: var(--border-strong);
}

/* KPI 5 卡片网格 */
.kpi-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(4, 1fr);
  gap: 12px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.kpi-primary {
  border-color: var(--accent-border);
  background: linear-gradient(180deg, #fffafa 0%, #ffffff 100%);
}

.kpi-primary .kpi-value {
  color: var(--accent);
}

.kpi-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-sub {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.month-nav {
  display: flex;
  gap: 4px;
}

.mini-nav-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mini-nav-btn:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.month-select-wrap {
  margin-top: 6px;
}

.month-select {
  font-size: 16px;
  font-weight: 700;
  padding: 5px 8px;
  border-color: var(--border);
  background: var(--surface-subtle);
  cursor: pointer;
}

/* 通用卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

/* 图表区 */
.charts-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 14px;
}

.chart-card {
  padding: 16px 18px;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.card-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.badge-soft {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.chart-canvas-wrap {
  position: relative;
  height: 230px;
}

.category-chart-layout {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 16px;
  align-items: center;
  min-height: 230px;
}

.doughnut-wrap {
  position: relative;
  width: 170px;
  height: 170px;
  margin: 0 auto;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

.category-legend {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 220px;
  overflow-y: auto;
}

.cat-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
}

.cat-legend-item:hover {
  background: var(--surface-subtle);
}

.cat-legend-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.cat-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-legend-val {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* 快速记一笔 */
.quick-add-card {
  padding: 14px 16px 16px;
}

.quick-add-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.quick-add-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.cycle-pill {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  font-variant-numeric: tabular-nums;
}

.quick-tip {
  font-size: 12px;
  color: var(--text-muted);
}

.quick-add-grid {
  display: grid;
  grid-template-columns: 142px minmax(160px, 1.5fr) 128px 124px 118px minmax(120px, 1fr) 92px;
  gap: 10px;
  align-items: end;
}

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

.qa-field label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* 分段选择器（消费 / 退款） */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
  height: 36px;
}

.segmented input {
  display: none;
}

.segmented label {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.segmented input[value="expense"]:checked + label {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-xs);
}

.segmented input[value="refund"]:checked + label {
  background: var(--surface);
  color: var(--refund);
  box-shadow: var(--shadow-xs);
}

/* 工具栏与表格 */
.table-card {
  overflow: hidden;
}

.toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

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

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  position: relative;
  width: 230px;
}

.search-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  padding-left: 32px;
  height: 34px;
}

.select-sm {
  width: auto;
  height: 34px;
  padding: 4px 10px;
  font-size: 13px;
}

.batch-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filtered-summary {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.ledger-table thead th {
  padding: 10px 12px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
}

.ledger-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.ledger-table tbody tr:hover {
  background: #fafbfc;
}

.ledger-table tbody tr.selected {
  background: #fff5f6;
}

.col-check {
  width: 38px;
  text-align: center !important;
}

.col-date {
  width: 112px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.col-cycle {
  width: 100px;
  white-space: nowrap;
}

.col-cat {
  width: 108px;
  white-space: nowrap;
}

.col-type {
  width: 84px;
  white-space: nowrap;
}

.col-amount {
  width: 126px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.col-actions {
  width: 104px;
  white-space: nowrap;
}

.tx-title-main {
  font-weight: 500;
  color: var(--text);
}

.tx-note-cell {
  color: var(--text-muted);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.pill-cycle {
  background: #f3f4f6;
  color: #374151;
  font-variant-numeric: tabular-nums;
}

.pill-expense {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill-refund {
  background: var(--refund-soft);
  color: var(--refund);
}

.pill-cat {
  background: #eef2ff;
  color: #3730a3;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.row-action-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}

.row-action-btn:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.row-action-btn.del:hover {
  background: #fef2f2;
  color: var(--danger);
}

/* 空状态与底部小计 */
.empty-state {
  padding: 52px 20px;
  text-align: center;
}

.empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.empty-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.table-footer {
  padding: 12px 16px;
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.footer-totals {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-variant-numeric: tabular-nums;
}

/* 移动端卡片列表（桌面隐藏） */
.mobile-list {
  display: none;
}

.mobile-tx-card {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-tx-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mobile-tx-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

.mobile-tx-amount {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mobile-tx-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.mobile-tx-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mobile-tx-note {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 移动端悬浮记账按钮 */
.mobile-fab {
  display: none;
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(200, 16, 46, 0.36);
  cursor: pointer;
  z-index: 45;
  align-items: center;
  justify-content: center;
}

/* 弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 80;
}

.modal-box {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-lg {
  max-width: 780px;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
}

.modal-scroll {
  padding: 0;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.modal-footer-between {
  justify-content: space-between;
}

.modal-footer-right {
  display: flex;
  gap: 8px;
}

/* 周期对照表 & 导入预览表 */
.cycles-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cycles-table th {
  padding: 10px 14px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.cycles-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.cycles-table tbody tr.clickable {
  cursor: pointer;
}

.cycles-table tbody tr.clickable:hover {
  background: var(--accent-soft);
}

.cycles-table tbody tr.active-cycle {
  background: var(--accent-soft);
  font-weight: 600;
}

/* 导入拖拽区 */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 28px 18px;
  text-align: center;
  background: var(--surface-subtle);
  transition: border-color 0.15s, background 0.15s;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-title {
  margin: 0 0 4px;
  font-weight: 600;
}

.dropzone-sub {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.import-preview {
  margin-top: 14px;
}

.import-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
}

.preview-table-wrap {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Toast 提示 */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 120;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  animation: toastIn 0.2s ease forwards;
}

.toast.toast-error {
  background: #b91c1c;
}

.toast.toast-success {
  background: #065f46;
}

@keyframes toastIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   响应式适配
   ========================================================================== */

@media (max-width: 1080px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi-month-card {
    grid-column: 1 / -1;
  }
  .quick-add-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .qa-submit {
    grid-column: 1 / -1;
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .topbar-inner {
    padding: 8px 14px;
  }
  .container {
    padding: 12px 12px 92px;
    gap: 12px;
  }
  .hide-sm {
    display: none;
  }
  .ledger-switcher-btn {
    font-size: 15px;
    max-width: 175px;
    padding: 5px 6px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .kpi-card {
    padding: 12px 13px;
  }
  .kpi-value {
    font-size: 20px;
  }
  .quick-add-card {
    display: none;
  }
  .mobile-fab {
    display: flex;
  }
  .table-wrap {
    display: none;
  }
  .mobile-list {
    display: block;
  }
  .search-box {
    width: 100%;
  }
  .toolbar-left {
    width: 100%;
  }
  .select-sm {
    flex: 1;
    min-width: 100px;
  }
  .category-chart-layout {
    grid-template-columns: 1fr;
  }
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .hide-xs {
    display: none;
  }
}
