/* =========================================================
   清账 · Apple-style Minimalist Bookkeeping PWA Stylesheet
   ========================================================= */

:root {
  --bg: #F2F2F7;
  --sheet-bg: #F2F2F7;
  --surface: #FFFFFF;
  --surface-secondary: #F2F2F7;
  --surface-elevated: rgba(255, 255, 255, 0.86);
  --text: #111111;
  --text-secondary: #6E6E73;
  --text-tertiary: #8E8E93;
  --divider: rgba(0, 0, 0, 0.06);
  --border-subtle: rgba(0, 0, 0, 0.05);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.03), 0 4px 16px rgba(0, 0, 0, 0.025);
  --shadow-nav: 0 8px 30px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  --accent: #007AFF;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --income: #34C759;
  --income-soft: rgba(52, 199, 89, 0.13);
  --danger: #FF3B30;
  --primary-btn-bg: #111111;
  --primary-btn-fg: #FFFFFF;
  --seg-bg: rgba(118, 118, 128, 0.12);
  --seg-active: #FFFFFF;
  --seg-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(0, 0, 0, 0.04);
  --key-bg: #FFFFFF;
  --key-muted-bg: #E9E9EE;
  --key-active: #E5E5EA;
  --bar-muted: #E5E5EA;
  --backdrop: rgba(0, 0, 0, 0.36);
  --radius-card: 22px;
  --radius-sheet: 28px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --sheet-bg: #161618;
    --surface: #1C1C1E;
    --surface-secondary: #2C2C2E;
    --surface-elevated: rgba(28, 28, 30, 0.86);
    --text: #F5F5F7;
    --text-secondary: #98989D;
    --text-tertiary: #636366;
    --divider: rgba(255, 255, 255, 0.09);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-nav: 0 10px 32px rgba(0, 0, 0, 0.5), 0 0 0 0.5px rgba(255, 255, 255, 0.1);
    --accent: #0A84FF;
    --accent-soft: rgba(10, 132, 255, 0.2);
    --income: #30D158;
    --income-soft: rgba(48, 209, 88, 0.18);
    --danger: #FF453A;
    --primary-btn-bg: #FFFFFF;
    --primary-btn-fg: #000000;
    --seg-bg: rgba(118, 118, 128, 0.24);
    --seg-active: #3A3A3C;
    --seg-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    --key-bg: #2C2C2E;
    --key-muted-bg: #1C1C1E;
    --key-active: #3A3A3C;
    --bar-muted: #2C2C2E;
    --backdrop: rgba(0, 0, 0, 0.62);
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --sheet-bg: #161618;
  --surface: #1C1C1E;
  --surface-secondary: #2C2C2E;
  --surface-elevated: rgba(28, 28, 30, 0.86);
  --text: #F5F5F7;
  --text-secondary: #98989D;
  --text-tertiary: #636366;
  --divider: rgba(255, 255, 255, 0.09);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-nav: 0 10px 32px rgba(0, 0, 0, 0.5), 0 0 0 0.5px rgba(255, 255, 255, 0.1);
  --accent: #0A84FF;
  --accent-soft: rgba(10, 132, 255, 0.2);
  --income: #30D158;
  --income-soft: rgba(48, 209, 88, 0.18);
  --danger: #FF453A;
  --primary-btn-bg: #FFFFFF;
  --primary-btn-fg: #000000;
  --seg-bg: rgba(118, 118, 128, 0.24);
  --seg-active: #3A3A3C;
  --seg-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  --key-bg: #2C2C2E;
  --key-muted-bg: #1C1C1E;
  --key-active: #3A3A3C;
  --bar-muted: #2C2C2E;
  --backdrop: rgba(0, 0, 0, 0.62);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  min-height: 100%;
}

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

button {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

.tabular {
  font-variant-numeric: tabular-nums;
}

/* ==================== App Shell ==================== */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  position: relative;
}

/* ==================== Top Bar ==================== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 6px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(to bottom, var(--bg) 75%, transparent);
}

.app-brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.92);
  opacity: 0.8;
}

/* ==================== Main Content ==================== */
.main-content {
  flex: 1;
  padding: 10px 16px calc(104px + var(--safe-bottom));
}

.view-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==================== Cards ==================== */
.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

/* Hero Balance Card */
.hero-card {
  padding: 20px 20px 18px;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.text-action-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  padding: 4px 10px;
  margin: -4px -10px -4px 0;
  border-radius: 999px;
  transition: background-color 0.15s ease;
}

.text-action-btn:active {
  background-color: var(--accent-soft);
}

.hero-amount {
  margin-top: 6px;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
  word-break: break-all;
}

.hero-amount.is-negative {
  color: var(--danger);
}

.hero-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent);
}

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

.hero-metrics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.metric-sep {
  width: 1px;
  height: 24px;
  background: var(--divider);
  flex-shrink: 0;
}

.metric-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.metric-value {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.is-income {
  color: var(--income);
}

.is-danger {
  color: var(--danger) !important;
}

/* ==================== Toolbar & Month Switcher ==================== */
.list-toolbar,
.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}

.month-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border-radius: 999px;
  padding: 4px;
  box-shadow: var(--shadow-card);
}

.month-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background-color 0.15s ease;
}

.month-nav-btn:active {
  background: var(--surface-secondary);
}

.month-label {
  font-size: 13px;
  font-weight: 600;
  padding: 0 6px;
  letter-spacing: -0.01em;
}

.filter-pills {
  display: inline-flex;
  align-items: center;
  background: var(--seg-bg);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.filter-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: 999px;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.filter-pill.is-active {
  background: var(--seg-active);
  color: var(--text);
  box-shadow: var(--seg-shadow);
}

/* ==================== Daily Grouped Ledger ==================== */
.ledger-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.day-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.day-title {
  font-weight: 600;
}

.day-totals {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.day-card {
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.record-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  text-align: left;
  position: relative;
  transition: background-color 0.14s ease;
}

.record-row:active {
  background-color: var(--surface-secondary);
}

.record-row + .record-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 64px;
  right: 16px;
  height: 1px;
  background: var(--divider);
}

.record-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.record-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.record-info {
  min-width: 0;
  flex: 1;
}

.record-title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-amount {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

/* Empty State */
.empty-state {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 44px 24px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.empty-icon {
  font-size: 32px;
  margin-bottom: 10px;
}

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

.empty-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==================== Stats View ==================== */
.stats-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-mini-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-big-num {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.stat-net-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-net-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.stat-net-val {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-net-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  padding-top: 8px;
  border-top: 1px solid var(--divider);
}

.chart-card,
.breakdown-card {
  padding: 18px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
}

.chart-readout {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Daily Bar Chart */
.daily-chart-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.daily-chart-scroll::-webkit-scrollbar { display: none; }

.daily-bars-wrap {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding-top: 12px;
  min-width: 100%;
}

.daily-bar-col {
  flex: 1 0 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  cursor: pointer;
}

.daily-bar-track {
  width: 100%;
  max-width: 18px;
  flex: 1;
  display: flex;
  align-items: flex-end;
}

.daily-bar-fill {
  width: 100%;
  border-radius: 6px 6px 3px 3px;
  background: var(--bar-muted);
  transition: height 0.3s cubic-bezier(0.32, 0.72, 0, 1), background-color 0.2s ease;
  min-height: 4px;
}

.daily-bar-col.has-value .daily-bar-fill {
  background: var(--text);
  opacity: 0.78;
}

.daily-bar-col.is-income-mode.has-value .daily-bar-fill {
  background: var(--income);
  opacity: 0.85;
}

.daily-bar-col.is-selected .daily-bar-fill {
  background: var(--accent) !important;
  opacity: 1 !important;
}

.daily-bar-label {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1;
}

.daily-bar-col.is-selected .daily-bar-label,
.daily-bar-col.is-today .daily-bar-label {
  color: var(--accent);
  font-weight: 600;
}

/* Category Breakdown */
.category-breakdown {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cat-stat-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cat-stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.cat-stat-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
}

.cat-stat-count {
  font-size: 12px;
  color: var(--text-tertiary);
}

.cat-stat-vals {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cat-stat-amt {
  font-weight: 600;
}

.cat-stat-pct {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 34px;
  text-align: right;
}

.cat-bar-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-secondary);
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

/* 6 Month Chart */
.six-month-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  height: 136px;
  padding-top: 10px;
}

.month-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.month-bars-pair {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}

.month-bar-out,
.month-bar-in {
  width: 12px;
  border-radius: 5px 5px 2px 2px;
  min-height: 3px;
  transition: height 0.3s ease;
}

.month-bar-out {
  background: var(--text);
  opacity: 0.75;
}

.month-bar-in {
  background: var(--income);
  opacity: 0.85;
}

.month-col.is-active-month .month-bar-out {
  background: var(--accent);
  opacity: 1;
}

.month-col-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.month-col.is-active-month .month-col-label {
  color: var(--accent);
  font-weight: 600;
}

/* ==================== Floating Bottom Navigation ==================== */
.floating-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(14px + var(--safe-bottom));
  width: calc(100% - 32px);
  max-width: 448px;
  height: 62px;
  padding: 0 10px;
  border-radius: 26px;
  background: var(--surface-elevated);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  box-shadow: var(--shadow-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 40;
}

.nav-tab {
  flex: 1;
  height: 44px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color 0.18s ease, color 0.18s ease;
}

.nav-tab.is-active {
  color: var(--text);
  background: var(--seg-bg);
}

.nav-add-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-btn-bg);
  color: var(--primary-btn-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  flex-shrink: 0;
  transition: transform 0.15s cubic-bezier(0.32, 0.72, 0, 1);
}

.nav-add-btn:active {
  transform: scale(0.9);
}

/* ==================== Bottom Sheets ==================== */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.24s ease;
}

.sheet-backdrop.is-open {
  opacity: 1;
}

.sheet {
  width: 100%;
  max-width: 480px;
  background-color: var(--sheet-bg);
  border-top: 1px solid var(--border-subtle);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  padding: 10px 18px calc(18px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 92dvh;
  overflow-y: auto;
  position: relative;
  z-index: 101;
}

.sheet-backdrop.is-open .sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--text-tertiary);
  opacity: 0.35;
  margin: 0 auto 12px;
}

.entry-top-row,
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sheet-text-btn {
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  min-width: 42px;
  text-align: left;
}

.sheet-text-btn.is-danger {
  text-align: right;
}

.sheet-top-spacer {
  min-width: 42px;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-desc {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Segmented Control */
.segmented-control {
  display: inline-flex;
  background: var(--seg-bg);
  padding: 3px;
  border-radius: 12px;
  gap: 2px;
}

.segmented-control.full-width {
  display: flex;
  width: 100%;
  margin-bottom: 16px;
}

.seg-btn {
  flex: 1;
  min-width: 66px;
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.seg-btn.is-active {
  background: var(--seg-active);
  color: var(--text);
  box-shadow: var(--seg-shadow);
}

/* Entry Amount Box */
.entry-amount-box {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  padding: 8px 8px 2px;
}

.entry-sign {
  font-size: 26px;
  font-weight: 600;
  color: var(--text-secondary);
}

.entry-sign.is-income {
  color: var(--income);
}

.entry-currency {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-secondary);
}

.entry-amount-text {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.entry-expr-preview {
  min-height: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* Category Strip */
.category-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  scrollbar-width: none;
}
.category-strip::-webkit-scrollbar { display: none; }

.cat-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: var(--shadow-card);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.cat-chip:active {
  transform: scale(0.95);
}

.cat-chip.is-selected {
  background: var(--primary-btn-bg);
  color: var(--primary-btn-fg);
}

/* Note & Date Row */
.entry-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.entry-note-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: none;
  background: var(--surface);
  font-size: 14px;
  outline: none;
  box-shadow: var(--shadow-card);
}

.entry-note-input::placeholder {
  color: var(--text-tertiary);
}

.entry-date-pill {
  position: relative;
  height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  box-shadow: var(--shadow-card);
  flex-shrink: 0;
  cursor: pointer;
}

.entry-date-native {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Custom Numeric Keypad */
.keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.key-btn {
  height: 52px;
  border-radius: 14px;
  background: var(--key-bg);
  font-size: 21px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform 0.08s ease, background-color 0.08s ease;
  user-select: none;
}

.key-btn:active {
  transform: scale(0.95);
  background: var(--key-active);
}

.key-muted {
  background: var(--key-muted-bg);
  color: var(--text-secondary);
  font-size: 20px;
}

.key-clear {
  background: var(--key-muted-bg);
  color: var(--text-secondary);
  font-size: 17px;
  font-weight: 600;
}

.key-submit {
  background: var(--primary-btn-bg);
  color: var(--primary-btn-fg);
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.08s ease;
}

.key-submit:active {
  background: var(--primary-btn-bg);
  opacity: 0.88;
}

.key-submit.is-income-submit {
  background: var(--income);
  color: #FFFFFF;
}

.key-submit.is-income-submit:active {
  background: var(--income);
  opacity: 0.88;
}

/* Balance Sheet Inputs */
.input-group {
  margin-bottom: 18px;
}

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.currency-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border-radius: 16px;
  padding: 4px 16px;
  box-shadow: var(--shadow-card);
}

.currency-prefix {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 6px;
}

.currency-input {
  width: 100%;
  height: 52px;
  border: none;
  background: transparent;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  outline: none;
}

.input-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.primary-full-btn {
  width: 100%;
  height: 50px;
  border-radius: 16px;
  background: var(--primary-btn-bg);
  color: var(--primary-btn-fg);
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.primary-full-btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}

/* Settings Sheet */
.settings-section {
  margin-bottom: 18px;
}

.settings-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 4px 8px;
}

.settings-list {
  background: var(--surface);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.settings-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  position: relative;
  transition: background-color 0.14s ease;
}

.settings-row:active {
  background: var(--surface-secondary);
}

.settings-row + .settings-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: var(--divider);
}

.settings-row-sub {
  font-size: 13px;
  color: var(--text-tertiary);
}

.settings-footer {
  margin: 4px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* Toast */
.toast {
  position: fixed;
  top: calc(16px + var(--safe-top));
  left: 50%;
  transform: translate(-50%, -20px);
  background: rgba(24, 24, 26, 0.92);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
  white-space: nowrap;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
