/* ============================================================
   FINORA — DESIGN SYSTEM
   ============================================================ */

:root {
  --bg: #F7F9FC;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --primary: #16A779;
  --primary-dark: #10845F;
  --primary-soft: rgba(22, 167, 121, 0.10);
  --text: #172B3A;
  --text-2: #718096;
  --income: #16A779;
  --expense: #EF6464;
  --warning: #F3AD46;
  --border: #E8EDF2;
  --border-strong: #D9E1E9;

  --shadow-sm: 0 1px 2px rgba(23, 43, 58, 0.04);
  --shadow-md: 0 4px 16px rgba(23, 43, 58, 0.06);
  --shadow-lg: 0 12px 32px rgba(23, 43, 58, 0.10);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  --sidebar-w: 260px;
  --content-max: 1280px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 0.15s;
  --t: 0.25s;

  --c-food: #F3AD46;
  --c-transport: #4A9DEC;
  --c-edu: #8B7DF3;
  --c-fun: #EF6464;
  --c-shop: #EC7FB4;
  --c-health: #52C5B2;
  --c-home: #16A779;
  --c-other: #94A3B8;
}

[data-theme="dark"] {
  --bg: #0F1720;
  --surface: #151F2B;
  --card: #192534;
  --primary: #22C08C;
  --primary-dark: #16A779;
  --primary-soft: rgba(34, 192, 140, 0.14);
  --text: #F5F7FA;
  --text-2: #94A3B8;
  --income: #22C08C;
  --expense: #F87171;
  --border: #22303F;
  --border-strong: #2C3E50;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.45);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}

body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul { list-style: none; padding: 0; margin: 0; }
h1, h2, h3, p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

.app { display: flex; min-height: 100vh; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
  transition: margin var(--t) var(--ease);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 50;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; }

.brand__mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(22,167,121,0.35);
}
.brand__mark svg { width: 19px; height: 19px; }

.brand__name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
}

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }

.nav__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-2);
  padding: 4px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.sidebar__footer {
  display: flex; flex-direction: column; gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.user { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-md); }

.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.user__meta { display: flex; flex-direction: column; min-width: 0; }
.user__name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.user__mail { font-size: 11.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.theme-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--t-fast) var(--ease);
}
.theme-toggle:hover { background: var(--border); }
.theme-toggle svg { width: 17px; height: 17px; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar__title { font-size: 21px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.topbar__sub { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all var(--t-fast) var(--ease);
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }

.icon-btn__dot {
  position: absolute; top: 9px; right: 10px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--expense);
  border: 2px solid var(--surface);
}

.avatar--top { width: 40px; height: 40px; font-size: 13px; }

/* ============================================================
   CONTENT
   ============================================================ */
.content {
  padding: 24px 32px 40px;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.page { animation: pageIn 0.35s var(--ease); }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t) var(--ease), transform var(--t) var(--ease),
              background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.card--hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.card__head--stack { flex-direction: column; align-items: stretch; }
.card__title { font-size: 15.5px; font-weight: 600; color: var(--text); }
.card__sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

/* ============================================================
   MONTH BANNER
   ============================================================ */
.month-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  width: 100%;
  box-sizing: border-box;
  background: linear-gradient(135deg, rgba(22,167,121,0.10), rgba(74,157,236,0.10));
  border: 1.5px solid var(--primary);
  border-radius: var(--r-md);
  animation: bannerIn 0.5s var(--ease);
  position: relative;
  overflow: hidden;
}

.month-banner[hidden] { display: none !important; }

.month-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: bannerShimmer 2.5s infinite;
  pointer-events: none;
}

@keyframes bannerShimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

@keyframes bannerIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.month-banner__icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(22,167,121,0.30);
  z-index: 1;
}
.month-banner__icon svg { width: 20px; height: 20px; }

.month-banner__content {
  flex: 1;
  min-width: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.month-banner__title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.3;
  word-wrap: break-word;
}

.month-banner__desc {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.4;
  word-wrap: break-word;
}

.month-banner__close {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  background: transparent;
  transition: all var(--t-fast) var(--ease);
  flex-shrink: 0;
  z-index: 1;
  cursor: pointer;
  align-self: flex-start;
}
.month-banner__close:hover {
  background: var(--bg);
  color: var(--text);
}
.month-banner__close svg { width: 16px; height: 16px; }

/* ============================================================
   STATS
   ============================================================ */
.stats {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }

.stat-card { position: relative; overflow: hidden; }
.stat-card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

.stat-card__icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--bg);
  color: var(--text-2);
}
.stat-card__icon svg { width: 16px; height: 16px; }

.stat-card__label { font-size: 13px; color: var(--text-2); font-weight: 500; }

.stat-card__value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: keep-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card__meta { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }

.stat-card[data-tone="income"] .stat-card__icon { background: rgba(22,167,121,0.12); color: var(--income); }
.stat-card[data-tone="expense"] .stat-card__icon { background: rgba(239,100,100,0.12); color: var(--expense); }
.stat-card[data-tone="saving"] .stat-card__icon { background: rgba(243,173,70,0.14); color: var(--warning); }
.stat-card[data-tone="income"] .stat-card__value { color: var(--income); }
.stat-card[data-tone="expense"] .stat-card__value { color: var(--expense); }

/* ============================================================
   GRID
   ============================================================ */
.grid-2 {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

/* ============================================================
   SEGMENTED
   ============================================================ */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--bg);
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }

.segmented button {
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: var(--r-pill);
  white-space: nowrap;
  transition: all var(--t-fast) var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.segmented--wide {
  width: 100%;
  max-width: 560px;
  margin-bottom: 20px;
  padding: 5px;
}
.segmented--wide button {
  flex: 1;
  text-align: center;
  padding: 9px 10px;
  font-size: 13px;
}

/* ============================================================
   LEGEND
   ============================================================ */
.legend { display: flex; gap: 16px; margin-bottom: 12px; font-size: 12.5px; color: var(--text-2); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ============================================================
   CHART
   ============================================================ */
.chart-wrap { position: relative; width: 100%; height: 240px; }

.chart {
  width: 100%; height: 100%;
  display: flex; align-items: flex-end; gap: 4px;
  padding: 8px 0 22px;
}

.chart__group {
  flex: 1; min-width: 0;
  height: 100%;
  display: flex; align-items: flex-end; justify-content: center;
  gap: 3px;
  position: relative;
  cursor: pointer;
  border-radius: 6px;
  transition: background var(--t-fast) var(--ease);
}
.chart__group:hover { background: rgba(0,0,0,0.025); }
[data-theme="dark"] .chart__group:hover { background: rgba(255,255,255,0.04); }

.chart__bar {
  width: 45%;
  max-width: 14px;
  min-height: 3px;
  border-radius: 4px 4px 2px 2px;
  transform-origin: bottom;
  animation: barGrow 0.6s var(--ease) backwards;
}
.chart__bar--income  { background: var(--income); }
.chart__bar--expense { background: var(--expense); }

@keyframes barGrow {
  from { transform: scaleY(0); opacity: 0.4; }
  to   { transform: scaleY(1); opacity: 1; }
}

.chart__label {
  position: absolute;
  bottom: -20px; left: 50%;
  transform: translateX(-50%);
  font-size: 10.5px;
  color: var(--text-2);
  white-space: nowrap;
}

.chart__tooltip {
  position: absolute;
  top: 8px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  pointer-events: none;
  z-index: 10;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  animation: tipIn 0.18s var(--ease);
}
[data-theme="dark"] .chart__tooltip { background: #fff; color: #0F1720; }
@keyframes tipIn {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.chart__tooltip .row { display: flex; align-items: center; gap: 6px; }
.chart__tooltip .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* Line chart */
.line-chart {
  width: 100%;
  height: 220px;
  position: relative;
}
.line-chart svg { display: block; width: 100%; height: 100%; }

/* ============================================================
   DONUT
   ============================================================ */
.donut-wrap {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
  align-items: center;
}
.donut { position: relative; width: 180px; height: 180px; }
.donut__svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.donut__svg circle { fill: none; stroke-width: 5; transition: stroke-dasharray 0.8s var(--ease); }

.donut__center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.donut__center-label {
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.donut__center-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.cat-list { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }

.cat-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px;
  border-radius: 10px;
  transition: background var(--t-fast) var(--ease);
}
.cat-item:hover { background: var(--bg); }
.cat-item__dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.cat-item__name {
  flex: 1; font-size: 13px; color: var(--text); font-weight: 500;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cat-item__value { font-size: 12.5px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.cat-item__pct { font-size: 11.5px; color: var(--text-2); min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

/* ============================================================
   TX LIST (dashboard)
   ============================================================ */
.tx-list { display: flex; flex-direction: column; gap: 2px; }

.tx-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 10px;
  border-radius: var(--r-md);
  transition: background var(--t-fast) var(--ease);
}
.tx-item:hover { background: var(--bg); }

.tx-item__icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--bg);
  font-size: 18px;
  flex-shrink: 0;
}
.tx-item__main { flex: 1; min-width: 0; }
.tx-item__name {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tx-item__meta { font-size: 11.5px; color: var(--text-2); margin-top: 1px; }
.tx-item__amount { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-item__amount--income  { color: var(--income); }
.tx-item__amount--expense { color: var(--expense); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }

.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(22,167,121,0.30);
}
.btn--primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(22,167,121,0.35);
}

.btn--ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid transparent;
}
.btn--ghost:hover { background: var(--bg); color: var(--primary); border-color: var(--border); }

.btn--sm { padding: 7px 12px; font-size: 12.5px; }

.btn--danger {
  background: var(--expense);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239,100,100,0.30);
}
.btn--danger:hover {
  background: #d94a4a;
  transform: translateY(-1px);
}

.btn.is-loading { pointer-events: none; opacity: 0.85; }
.btn.is-loading svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   EMPTY
   ============================================================ */
.empty {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  padding: 56px 24px;
  gap: 8px;
}
.empty__icon {
  width: 64px; height: 64px;
  border-radius: 20px;
  display: grid; place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 8px;
}
.empty__icon svg { width: 28px; height: 28px; }
.empty__title { font-size: 16px; font-weight: 600; color: var(--text); }
.empty__desc { font-size: 13.5px; color: var(--text-2); max-width: 320px; }

/* ============================================================
   BOTTOM NAV
   ============================================================ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: center;
}
.bn-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
  padding: 6px 4px;
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 500;
  border-radius: 12px;
  transition: color var(--t-fast) var(--ease);
}
.bn-item svg { width: 20px; height: 20px; }
.bn-item.is-active { color: var(--primary); font-weight: 600; }

.bn-add {
  width: 50px; height: 50px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 6px 20px rgba(22,167,121,0.45);
  transform: translateY(-14px);
  flex-shrink: 0;
}
.bn-add svg { width: 24px; height: 24px; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-stack {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  min-width: 220px;
  pointer-events: auto;
  animation: toastIn 0.3s var(--ease);
}
.toast--out { animation: toastOut 0.28s var(--ease) forwards; }
.toast__icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}
.toast__icon svg { width: 12px; height: 12px; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(24px); }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   PAGE HEAD, FILTERS, TABLE, MODAL, FORM
   ============================================================ */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page-head__title { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.page-head__sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }

.filters { padding: 16px; margin-bottom: 16px; }
.filters__search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.filters__search svg {
  position: absolute;
  left: 14px;
  width: 17px; height: 17px;
  color: var(--text-2);
  pointer-events: none;
}
.filters__search input {
  width: 100%;
  padding: 11px 14px 11px 42px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.filters__search input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.filters__row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}
.filters__clear { height: 40px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field__label .req { color: var(--expense); margin-left: 2px; }
.field__error {
  font-size: 12px;
  color: var(--expense);
  margin: 0;
  animation: shake 0.3s var(--ease);
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-3px); }
  75%     { transform: translateX(3px); }
}

.input, .select, .amount-input input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input:focus, .select:focus, .amount-input input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .amount-input input[aria-invalid="true"] {
  border-color: var(--expense);
  box-shadow: 0 0 0 3px rgba(239,100,100,0.12);
}
.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}

.amount-input { position: relative; display: flex; align-items: center; }
.amount-input input {
  padding-right: 42px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}
.amount-input__suffix {
  position: absolute;
  right: 14px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}

/* TX Table */
.tx-table-wrap { padding: 0; overflow: hidden; }
.tx-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tx-table thead th {
  text-align: left;
  padding: 14px 18px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
.tx-table th.ta-right, .tx-table td.ta-right { text-align: right; }
.tx-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast) var(--ease);
}
.tx-table tbody tr:last-child { border-bottom: none; }
.tx-table tbody tr:hover { background: var(--bg); }
.tx-table td { padding: 12px 18px; color: var(--text); vertical-align: middle; }

.tx-cat { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.tx-cat__icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--bg);
  font-size: 16px;
  flex-shrink: 0;
}
.tx-note { color: var(--text-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-date { color: var(--text-2); font-variant-numeric: tabular-nums; }
.tx-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-amount--income  { color: var(--income); }
.tx-amount--expense { color: var(--expense); }

.tx-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.tx-action {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: var(--text-2);
  background: transparent;
  transition: all var(--t-fast) var(--ease);
}
.tx-action svg { width: 15px; height: 15px; }
.tx-action:hover { background: var(--bg); color: var(--primary); }
.tx-action--delete:hover { color: var(--expense); background: rgba(239,100,100,0.10); }

.tx-cards { display: none; }
.tx-card {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.tx-card:last-child { border-bottom: none; }
.tx-card__icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--bg);
  font-size: 18px;
  flex-shrink: 0;
}
.tx-card__main { flex: 1; min-width: 0; }
.tx-card__name {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tx-card__meta { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }
.tx-card__right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.tx-card__amount { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tx-card__amount--income  { color: var(--income); }
.tx-card__amount--expense { color: var(--expense); }
.tx-card__actions { display: flex; gap: 4px; }

.tx-empty { padding: 48px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(15,23,32,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.22s var(--ease);
}

.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.28s var(--ease);
}
.modal--sm .modal__dialog { max-width: 380px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal__title { font-size: 16px; font-weight: 700; color: var(--text); }

.icon-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.icon-btn--ghost:hover {
  background: var(--bg);
  color: var(--text);
  border-color: transparent;
  transform: none;
}

.modal__body {
  padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
  overflow-y: auto;
}
.modal__foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding-top: 8px;
  margin-top: 4px;
}
.modal__hint {
  font-size: 12.5px;
  color: var(--text-2);
  margin: 0 0 4px;
}

.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  background: var(--bg);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.type-toggle button {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  transition: all var(--t-fast) var(--ease);
}
.type-toggle button svg { width: 16px; height: 16px; }
.type-toggle button:hover { color: var(--text); }
.type-toggle button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.type-toggle button[data-type="expense"].is-active { color: var(--expense); }
.type-toggle button[data-type="income"].is-active  { color: var(--income); }

.confirm {
  align-items: center;
  text-align: center;
  padding: 28px 24px 24px;
  gap: 10px;
}
.confirm__icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(239,100,100,0.12);
  color: var(--expense);
  margin-bottom: 4px;
}
.confirm__icon svg { width: 24px; height: 24px; }
.confirm__title { font-size: 16px; font-weight: 700; color: var(--text); }
.confirm__desc { font-size: 13.5px; color: var(--text-2); max-width: 300px; }
.confirm__actions { display: flex; gap: 10px; margin-top: 12px; width: 100%; }
.confirm__actions .btn { flex: 1; }

body.modal-open { overflow: hidden; }

/* ============================================================
   BUDGET
   ============================================================ */
.month-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
}
.month-switch__btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--bg);
  color: var(--text-2);
  border: 1px solid var(--border);
  transition: all var(--t-fast) var(--ease);
}
.month-switch__btn:hover { color: var(--primary); border-color: var(--primary); }
.month-switch__btn svg { width: 18px; height: 18px; }

.month-switch__center {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
}
.month-switch__label {
  font-size: 11.5px;
  color: var(--text-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.month-switch__value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.budget-overall { margin-bottom: 20px; }

.progress {
  width: 100%;
  height: 8px;
  background: var(--bg);
  border-radius: var(--r-pill);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}
.progress--lg { height: 14px; }

.progress__bar {
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
  transition: width 0.8s var(--ease), background var(--t) var(--ease);
  position: relative;
  overflow: hidden;
}

.progress__bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: shimmer 2.2s infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

.progress__bar--warning { background: var(--warning); }
.progress__bar--danger  { background: var(--expense); }

.progress__legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
}
.badge--warning { background: rgba(243,173,70,0.15); color: var(--warning); }
.badge--danger  { background: rgba(239,100,100,0.13); color: var(--expense); }

.budget-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.budget-item {
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.budget-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.budget-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.budget-item__cat {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.budget-item__icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface);
  font-size: 16px;
  flex-shrink: 0;
}
.budget-item__name {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.budget-item__pct {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.budget-item__pct--warning { color: var(--warning); }
.budget-item__pct--danger  { color: var(--expense); }

.budget-item__amounts {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.budget-item__spent { font-weight: 700; color: var(--text); }
.budget-item__budget { color: var(--text-2); font-weight: 500; }

.budget-item__remain { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }
.budget-item__remain--warning { color: var(--warning); }
.budget-item__remain--danger  { color: var(--expense); font-weight: 600; }

.budget-empty {
  padding: 40px 20px;
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  gap: 8px;
}

.budget-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 4px;
}

.budget-input-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.budget-input-row:focus-within { border-color: var(--primary); }
.budget-input-row__icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface);
  font-size: 15px;
}
.budget-input-row__name {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.budget-input-row__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 140px;
}
.budget-input-row__input {
  width: 100%;
  padding: 8px 30px 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.budget-input-row__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.budget-input-row__suffix {
  position: absolute;
  right: 10px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

.budget-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--primary-soft);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.budget-total-row strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   STATISTICS
   ============================================================ */
.compare-card { margin-bottom: 20px; }

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.compare-item {
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.compare-item__label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.compare-item__value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.compare-item__trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  align-self: flex-start;
  background: var(--bg);
}
.compare-item__trend svg { width: 13px; height: 13px; }
.compare-item__trend--good { background: rgba(22,167,121,0.12); color: var(--income); }
.compare-item__trend--bad  { background: rgba(239,100,100,0.12); color: var(--expense); }
.compare-item__trend--flat { background: var(--bg); color: var(--text-2); }
.compare-item__prev { font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ============================================================
   GOALS
   ============================================================ */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.goal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
  position: relative;
  overflow: hidden;
}
.goal-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.goal-card--done {
  border-color: var(--primary);
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--card) 40%);
}

.goal-card__head { display: flex; align-items: flex-start; gap: 12px; }
.goal-card__icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 22px;
  flex-shrink: 0;
  background: var(--primary-soft);
}
.goal-card__info { flex: 1; min-width: 0; }
.goal-card__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.goal-card__deadline {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 3px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.goal-card__deadline svg { width: 12px; height: 12px; }
.goal-card__deadline--warning { color: var(--warning); }
.goal-card__deadline--danger  { color: var(--expense); font-weight: 600; }

.goal-card__done-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  background: var(--primary);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(22,167,121,0.35);
}
.goal-card__done-badge svg { width: 11px; height: 11px; }

.goal-card__amounts {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
  gap: 10px;
}
.goal-card__amounts > div { display: flex; flex-direction: column; min-width: 0; }
.goal-card__amounts > div:last-child { align-items: flex-end; }
.goal-card__amounts-label {
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 2px;
}
.goal-card__amounts-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.goal-card__amounts-value--primary { color: var(--primary); }

.goal-card__progress-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-2);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.goal-card__progress-text strong { color: var(--text); font-weight: 700; }

.goal-card__actions {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.goal-card__action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: all var(--t-fast) var(--ease);
}
.goal-card__action svg { width: 14px; height: 14px; }
.goal-card__action:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.goal-card__action--danger:hover { color: var(--expense); border-color: var(--expense); background: rgba(239,100,100,0.10); }

.icon-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}
.icon-picker button {
  aspect-ratio: 1;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
  background: var(--bg);
  border: 1.5px solid transparent;
  transition: all var(--t-fast) var(--ease);
  cursor: pointer;
}
.icon-picker button:hover { background: var(--surface); border-color: var(--border-strong); }
.icon-picker button.is-active { background: var(--primary-soft); border-color: var(--primary); transform: scale(1.05); }

.color-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.color-picker button {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.color-picker button:hover { transform: scale(1.1); }
.color-picker button.is-active { border-color: var(--text); transform: scale(1.1); }

.update-goal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  margin-bottom: 4px;
}
.update-goal-head__icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px;
  background: var(--surface);
  flex-shrink: 0;
}
.update-goal-head__name { font-size: 14px; font-weight: 700; color: var(--text); }
.update-goal-head__meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.update-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.update-actions .btn { width: 100%; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-card { margin-bottom: 16px; padding: 0; overflow: hidden; }
.settings-card:last-child { margin-bottom: 0; }

.settings-card__head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.settings-card__icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}
.settings-card__icon svg { width: 19px; height: 19px; }

.settings-card__title { font-size: 15px; font-weight: 700; color: var(--text); }
.settings-card__desc { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

.settings-card__body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-card__body--col { gap: 16px; }

.theme-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  background: var(--bg);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  max-width: 320px;
}
.theme-segmented button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  transition: all var(--t-fast) var(--ease);
}
.theme-segmented button svg { width: 16px; height: 16px; }
.theme-segmented button:hover { color: var(--text); }
.theme-segmented button.is-active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.settings-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-align: left;
  border-radius: var(--r-md);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: all var(--t-fast) var(--ease);
  cursor: pointer;
}
.settings-action:hover {
  background: var(--surface);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.settings-action > svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--primary); }
.settings-action > div { flex: 1; min-width: 0; }
.settings-action__title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.settings-action__desc { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }

.settings-action--danger > svg { color: var(--expense); }
.settings-action--danger:hover { border-color: var(--expense); }
.settings-action--danger .settings-action__title { color: var(--expense); }

.settings-meta {
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-meta__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-2);
}
.settings-meta__row strong {
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
/* ============================================================
   MONTH BANNER — Nút Xem lịch sử
   ============================================================ */
.month-banner__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--r-pill);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: all var(--t-fast) var(--ease);
}
.month-banner__btn:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}
.month-banner__btn svg { width: 14px; height: 14px; }

/* ============================================================
   HISTORY CARD
   ============================================================ */
.history-card { margin-top: 20px; }

.history-panel {
  animation: panelIn 0.3s var(--ease);
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: all var(--t-fast) var(--ease);
}
.history-item:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.history-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
  flex-wrap: wrap;
}

.history-item__month {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  color: var(--text);
}
.history-item__month svg {
  width: 16px; height: 16px;
  color: var(--primary);
}
.history-item__month strong { font-weight: 700; }

.history-item__count {
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
}

.history-item__saving {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.history-item__saving--income  { color: var(--income); }
.history-item__saving--expense { color: var(--expense); }

.history-item__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.history-item__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.history-item__stat-label {
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.history-item__stat-value {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.history-item__stat-value--income  { color: var(--income); }
.history-item__stat-value--expense { color: var(--expense); }

.history-item__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.history-item__cat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-2);
  font-weight: 500;
}

.btn.is-open svg { transform: rotate(180deg); }
.btn.is-open svg { transition: transform var(--t-fast) var(--ease); }

/* Mobile */
@media (max-width: 640px) {
  .month-banner__btn { font-size: 11.5px; padding: 5px 10px; }

  .history-item { padding: 14px; }
  .history-item__head { gap: 8px; }
  .history-item__month { font-size: 13.5px; }
  .history-item__saving { font-size: 14px; }
  .history-item__stats {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .history-item__stat {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}