:root {
  --ink: #111827;
  --ink-soft: #243047;
  --muted: #596579;
  --muted-2: #667085;
  --paper: #f3f5f9;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --line: #e3e7ef;
  --line-strong: #d2d8e5;
  --sidebar: #0b1120;
  --sidebar-soft: #121a2c;
  --primary: #2457d6;
  --primary-2: #4779ed;
  --primary-soft: #eaf0ff;
  --income: #087f6b;
  --income-soft: #e7f8f3;
  --expense: #bf5039;
  --expense-soft: #fff0eb;
  --violet: #8b5dd9;
  --violet-soft: #f2ebff;
  --blue: #3488d8;
  --blue-soft: #eaf4ff;
  --amber: #b87918;
  --amber-soft: #fff4dc;
  --red: #b84a45;
  --red-soft: #fff0ee;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 8px 24px rgba(25, 35, 58, .055);
  --shadow-md: 0 20px 50px rgba(22, 31, 52, .09);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
}

* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% -10%, rgba(36,87,214,.10), transparent 28%),
    radial-gradient(circle at 10% 90%, rgba(15,159,130,.05), transparent 24%),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid rgba(36,87,214,.24);
  outline-offset: 2px;
}

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 270px;
  padding: 28px 20px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f7f8fc;
  background:
    radial-gradient(circle at 10% 0%, rgba(36,87,214,.30), transparent 28%),
    linear-gradient(180deg, #0b1120 0%, #0d1424 70%, #10182a 100%);
  border-right: 1px solid rgba(255,255,255,.06);
  z-index: 20;
}
.sidebar::after {
  content: "";
  position: absolute;
  right: -110px;
  bottom: 6%;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(15,159,130,.09);
  filter: blur(1px);
  pointer-events: none;
}
.brand { position: relative; display: flex; align-items: center; gap: 13px; padding: 0 8px 34px; z-index: 1; }
.brand-mark, .loading-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: white;
  background: linear-gradient(145deg, var(--primary-2), #123b9f);
  box-shadow: 0 10px 24px rgba(36,87,214,.32), inset 0 1px 0 rgba(255,255,255,.25);
  font-weight: 850;
  letter-spacing: -.04em;
}
.brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand span { display: block; margin-top: 2px; color: #8f99ad; font-size: 11px; letter-spacing: .02em; }

.sidebar nav { position: relative; display: grid; gap: 6px; z-index: 1; }
.sidebar nav button {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #9ea8bb;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: 160ms ease;
}
.sidebar nav button:hover { color: white; background: rgba(255,255,255,.055); }
.sidebar nav button.active {
  color: white;
  background: linear-gradient(90deg, rgba(36,87,214,.25), rgba(36,87,214,.08));
  border-color: rgba(142,136,255,.22);
  box-shadow: inset 3px 0 0 var(--primary-2);
}
.nav-symbol { width: 24px; height: 24px; display: grid; place-items: center; color: #8791a8; font-size: 18px; line-height: 1; }
.sidebar nav button.active .nav-symbol { color: #b9b5ff; }
.sidebar nav em {
  min-width: 29px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #b8c0cf;
  background: rgba(255,255,255,.07);
  font-size: 10px;
  font-style: normal;
  text-align: center;
}
.sidebar nav .warning-count { color: #ffd99d; background: rgba(184,121,24,.2); }

.review-progress {
  position: relative;
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  background: rgba(255,255,255,.035);
  backdrop-filter: blur(10px);
  z-index: 1;
}
.review-progress > div:first-child { display: flex; justify-content: space-between; gap: 12px; color: #9da8bb; font-size: 12px; }
.review-progress strong { color: #9df1d8; }
.progress-track { height: 7px; margin: 13px 0 10px; overflow: hidden; border-radius: 20px; background: rgba(255,255,255,.08); }
.progress-track span { display: block; width: var(--pct, 0%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary-2), #53d8b7); transition: width .35s ease; }
.review-progress p { margin: 0; color: #778297; font-size: 11px; }
.sidebar-note { position: relative; padding: 22px 8px 0; color: #7d879a; z-index: 1; }
.sidebar-note > span { display: block; color: #9df1d8; font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.sidebar-note strong { display: block; margin-top: 6px; color: #cbd2df; font-size: 11px; }
.sidebar-note p { margin: 7px 0 0; font-size: 10px; line-height: 1.55; }

.workspace { min-height: 100vh; margin-left: 270px; padding: 34px clamp(24px, 3vw, 50px) 70px; }
.topbar { display: flex; justify-content: space-between; gap: 32px; align-items: flex-start; margin-bottom: 25px; }
.eyebrow { margin: 0 0 6px; color: var(--primary); font-size: 10px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.topbar h1 { margin: 0; color: var(--ink); font-size: clamp(32px, 3vw, 45px); line-height: 1.08; font-weight: 690; letter-spacing: -.045em; }
.subtitle { margin: 9px 0 0; color: var(--muted); font-size: 14px; }
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 9px; padding-top: 5px; }
.save-state { margin-right: 7px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.save-state span { width: 7px; height: 7px; border-radius: 50%; background: var(--income); box-shadow: 0 0 0 4px var(--income-soft); }
.save-state.sync-loading span { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.save-state.sync-error { color: var(--red); }
.save-state.sync-error span { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }

.primary-button, .secondary-button, .compact-button, .filter-toggle, .clear-button, .pagination button, .row-action, .text-button, .similar-button, .danger-ghost, .period-detail-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: 150ms ease;
}
.primary-button { padding: 10px 16px; color: white; background: linear-gradient(135deg, var(--primary), #1748b8); box-shadow: 0 8px 18px rgba(36,87,214,.22); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 11px 24px rgba(36,87,214,.28); }
.secondary-button { padding: 9px 14px; border-color: var(--line-strong); background: rgba(255,255,255,.82); box-shadow: var(--shadow-xs); }
.secondary-button:hover { border-color: #bfc6d4; background: white; }
.primary-button:disabled, .secondary-button:disabled, button:disabled { cursor: not-allowed; opacity: .5; transform: none; }

.more-menu { position: relative; }
.more-menu summary { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 11px; background: rgba(255,255,255,.82); cursor: pointer; list-style: none; font-weight: 850; letter-spacing: .08em; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu > div { position: absolute; top: 49px; right: 0; width: 245px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow-md); z-index: 30; }
.more-menu button { width: 100%; min-height: 40px; padding: 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; cursor: pointer; }
.more-menu button:hover { background: var(--surface-soft); }
.more-menu .danger-text { color: var(--red); }

.alert { margin: -10px 0 20px; padding: 13px 15px; display: flex; justify-content: space-between; align-items: center; border: 1px solid #efc2bd; border-radius: 12px; color: #8d3732; background: var(--red-soft); }
.alert button { border: 0; background: transparent; cursor: pointer; font-size: 20px; }

.period-toolbar {
  margin-bottom: 15px;
  padding: 13px 14px 13px 18px;
  display: grid;
  grid-template-columns: minmax(180px, auto) auto minmax(390px, 1fr) auto;
  align-items: center;
  gap: 13px;
  border: 1px solid rgba(36,87,214,.14);
  border-radius: 18px;
  background: rgba(255,255,255,.76);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}
.period-summary { display: grid; }
.period-kicker { color: var(--muted-2); font-size: 9px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.period-summary strong { margin-top: 1px; font-size: 15px; letter-spacing: -.01em; }
.period-summary small { color: var(--muted); font-size: 11px; }
.year-select { min-height: 44px; padding: 7px 10px; display: grid; grid-template-columns: auto auto; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: var(--surface-soft); font-size: 11px; font-weight: 750; }
.year-select select { border: 0; color: var(--ink); background: transparent; outline: 0; font-weight: 800; }
.month-switcher { min-width: 0; display: flex; gap: 3px; overflow-x: auto; padding: 3px; border-radius: 12px; background: #eef1f7; scrollbar-width: none; }
.month-switcher::-webkit-scrollbar { display: none; }
.month-switcher button { min-width: 44px; height: 44px; padding: 0 9px; border: 0; border-radius: 9px; color: #697386; background: transparent; font-size: 11px; font-weight: 750; cursor: pointer; }
.month-switcher button:hover { color: var(--ink); background: rgba(255,255,255,.65); }
.month-switcher button.active { color: white; background: var(--primary); box-shadow: 0 5px 13px rgba(36,87,214,.24); }
.period-detail-button { min-width: 105px; padding: 9px 12px; border-color: var(--line); color: var(--ink-soft); background: white; font-size: 12px; white-space: nowrap; }
.period-detail-button:hover { border-color: #bfc6d5; transform: translateY(-1px); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 17px; }
.kpi-card { position: relative; min-height: 146px; padding: 18px 19px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; border: 1px solid var(--line); border-radius: 19px; background: rgba(255,255,255,.91); box-shadow: var(--shadow-sm); }
.kpi-card::after { content: ""; position: absolute; width: 100px; height: 100px; right: -42px; bottom: -56px; border-radius: 50%; background: var(--primary-soft); opacity: .72; }
.kpi-income::after { background: var(--income-soft); }
.kpi-expense::after { background: var(--expense-soft); }
.kpi-committed::after { background: var(--violet-soft); }
.kpi-topline { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 750; z-index: 1; }
.kpi-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); font-size: 15px; }
.kpi-income .kpi-icon { color: var(--income); background: var(--income-soft); }
.kpi-expense .kpi-icon { color: var(--expense); background: var(--expense-soft); }
.kpi-committed .kpi-icon { color: var(--violet); background: var(--violet-soft); }
.kpi-card > strong { position: relative; margin: 13px 0; color: var(--ink); font-size: clamp(24px, 2vw, 31px); line-height: 1; font-weight: 720; letter-spacing: -.045em; font-variant-numeric: tabular-nums; z-index: 1; }
.kpi-foot { position: relative; min-height: 24px; display: flex; align-items: center; justify-content: space-between; gap: 8px; z-index: 1; }
.kpi-foot small { color: var(--muted-2); font-size: 11px; text-align: right; }
.trend { padding: 4px 7px; display: inline-flex; align-items: center; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.trend.good { color: #08715d; background: var(--income-soft); }
.trend.bad { color: #a14633; background: var(--expense-soft); }
.trend.neutral { color: var(--muted); background: #eef1f6; }
.kpi-card.balance-card { color: white; border-color: #171f34; background: linear-gradient(145deg, #121a2d 0%, #202a46 70%, #2d3464 100%); box-shadow: 0 18px 38px rgba(16,24,43,.2); }
.kpi-card.balance-card::after { width: 170px; height: 170px; right: -75px; bottom: -95px; background: rgba(36,87,214,.38); }
.kpi-card.balance-card .kpi-topline, .kpi-card.balance-card > strong { color: white; }
.kpi-card.balance-card .kpi-icon { color: #d9d7ff; background: rgba(255,255,255,.1); }
.kpi-card.balance-card .kpi-foot small { color: #aeb6c8; }
.kpi-card.negative-card { color: #732f2a; border-color: #efc2bd; background: var(--red-soft); }

.overview-grid, .analysis-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(350px, .82fr); gap: 15px; }
.chart-card, .analysis-card, .activity-card, .ledger-panel, .review-callout { border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255,255,255,.94); box-shadow: var(--shadow-sm); }
.chart-card, .analysis-card, .activity-card { padding: 22px; }
.card-heading, .section-heading, .results-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.card-heading h2, .section-heading h2, .results-heading h2, .review-callout h2 { margin: 0; color: var(--ink); font-size: 20px; line-height: 1.15; font-weight: 690; letter-spacing: -.025em; }
.legend { display: flex; align-items: center; gap: 13px; color: var(--muted); font-size: 10px; }
.legend span::before { content: ""; width: 8px; height: 8px; margin-right: 6px; display: inline-block; border-radius: 3px; }
.legend-income::before { background: var(--income); }
.legend-expense::before { background: var(--expense); }
.muted-label { color: var(--muted); font-size: 11px; }

.monthly-card { min-width: 0; }
.monthly-chart { height: 246px; margin-top: 22px; display: grid; grid-template-columns: repeat(12, minmax(34px, 1fr)); gap: clamp(4px, .7vw, 9px); align-items: end; }
.month-column { height: 100%; min-width: 0; padding: 0 2px 5px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 11px; background: transparent; cursor: pointer; transition: 150ms ease; }
.month-column:hover { background: #f7f8fc; }
.month-column.active { border-color: rgba(36,87,214,.25); background: var(--primary-soft); }
.month-column.no-data { opacity: .42; }
.month-column > span { color: var(--muted); font-size: 10px; font-weight: 750; }
.month-column.active > span { color: var(--primary); }
.bar-value { min-height: 15px; color: transparent; font-size: 8px; font-weight: 750; white-space: nowrap; transition: color 150ms ease; }
.month-column:hover .bar-value, .month-column.active .bar-value { color: var(--muted); }
.bar-zone { width: 100%; height: 178px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; border-bottom: 1px solid var(--line); }
.bar-zone > span { width: 35%; height: var(--pct, 0%); min-height: 0; border-radius: 6px 6px 2px 2px; transition: height .28s ease; }
.bar-income { background: linear-gradient(180deg, #34d0ad, var(--income)); }
.bar-expense { background: linear-gradient(180deg, #ffac87, var(--expense)); }
.chart-footnote { margin: 13px 0 0; color: var(--muted); font-size: 10px; }

.segmented-control { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: #eef1f6; }
.segmented-control button { min-width: 70px; height: 33px; padding: 0 10px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; }
.segmented-control button.active { color: var(--ink); background: white; box-shadow: 0 2px 7px rgba(20,30,50,.08); }
.category-total { margin: 19px 0 15px; padding: 14px 15px; display: flex; justify-content: space-between; align-items: center; border-radius: 13px; background: linear-gradient(100deg, #f3f6ff, #fafbfe); }
.category-total span { color: var(--muted); font-size: 11px; }
.category-total strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.category-chart { display: grid; gap: 5px; }
.category-chart > button { min-height: 39px; padding: 5px 2px; display: grid; grid-template-columns: 24px minmax(100px, 1fr) minmax(70px, .95fr) auto; align-items: center; gap: 9px; border: 0; border-radius: 9px; background: transparent; text-align: left; cursor: pointer; }
.category-chart > button:hover { background: var(--surface-soft); }
.category-rank { color: #a2aabc; font-size: 9px; }
.category-name { overflow: hidden; color: var(--ink-soft); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 650; }
.category-name small { display: block; color: var(--muted-2); font-size: 10px; font-weight: 550; }
.category-track { height: 6px; overflow: hidden; border-radius: 9px; background: #edf0f5; }
.category-track i { display: block; width: var(--pct, 0%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #8a83ff); }
.category-chart strong { font-size: 10px; font-variant-numeric: tabular-nums; }
.card-link { width: 100%; margin-top: 13px; justify-content: space-between; border-top: 1px solid var(--line) !important; border-radius: 0 !important; }

.insight-grid { margin: 15px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.insight-grid article { min-height: 108px; padding: 16px; display: grid; grid-template-columns: 38px 1fr; align-items: flex-start; gap: 11px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.82); box-shadow: var(--shadow-xs); }
.insight-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; font-weight: 850; }
.insight-icon.violet { color: var(--violet); background: var(--violet-soft); }
.insight-icon.mint { color: var(--income); background: var(--income-soft); }
.insight-icon.coral { color: var(--expense); background: var(--expense-soft); }
.insight-icon.blue { color: var(--blue); background: var(--blue-soft); }
.insight-grid small { display: block; color: var(--muted); font-size: 11px; font-weight: 750; }
.insight-grid strong { display: block; margin-top: 3px; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.insight-grid p { margin: 4px 0 0; color: var(--muted-2); font-size: 11px; }

.overview-lower { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 15px; }
.section-heading { margin-bottom: 14px; }
.text-button { min-height: 34px; padding: 6px 2px; display: inline-flex; align-items: center; gap: 7px; border: 0; color: var(--primary); background: transparent; font-size: 11px; }
.text-button:hover { color: #123b9f; }
.activity-list { display: grid; }
.activity-row { width: 100%; min-height: 58px; padding: 10px 3px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto 16px; align-items: center; gap: 11px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.activity-row:last-child { border-bottom: 0; }
.activity-row:hover { background: #fafbfe; }
.activity-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; font-size: 15px; font-weight: 850; }
.activity-icon.income { color: var(--income); background: var(--income-soft); }
.activity-icon.expense { color: var(--expense); background: var(--expense-soft); }
.activity-icon.investment { color: var(--violet); background: var(--violet-soft); }
.activity-icon.debt { color: var(--amber); background: var(--amber-soft); }
.activity-icon.asset, .activity-icon.finance { color: var(--blue); background: var(--blue-soft); }
.activity-copy { min-width: 0; }
.activity-copy strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.activity-copy small { display: block; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.activity-amount { font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.positive { color: var(--income) !important; }
.negative { color: var(--expense) !important; }
.activity-arrow { color: #a7afbe; font-size: 20px; }

.review-callout { min-height: 100%; padding: 25px; display: flex; flex-direction: column; align-items: flex-start; background: linear-gradient(145deg, #141d31, #222d4b); border-color: #202a45; color: white; box-shadow: 0 18px 38px rgba(16,24,43,.16); }
.review-score { display: flex; align-items: center; gap: 12px; }
.review-score > span { font-size: 48px; line-height: 1; font-weight: 720; letter-spacing: -.05em; }
.review-score small { color: #aeb8ca; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.review-callout > div:nth-child(2) { margin: auto 0 22px; }
.review-callout .eyebrow { color: #9df1d8; }
.review-callout h2 { color: white; font-size: 24px; }
.review-callout p:not(.eyebrow) { margin: 8px 0 0; color: #aeb8ca; font-size: 12px; }
.review-callout .primary-button { margin-top: auto; }

.analysis-grid { margin-bottom: 15px; }
.analysis-grid.secondary { grid-template-columns: minmax(0, 1fr) minmax(350px, .85fr); }
.donut-layout { margin-top: 23px; display: grid; grid-template-columns: minmax(190px, .72fr) minmax(300px, 1.28fr); align-items: center; gap: 28px; }
.donut-chart { width: min(220px, 100%); aspect-ratio: 1; margin: auto; display: grid; place-items: center; border-radius: 50%; }
.donut-ring { width: 100%; height: 100%; grid-area: 1 / 1; transform: rotate(-90deg); overflow: visible; filter: drop-shadow(0 6px 13px rgba(20,30,50,.08)); }
.donut-base, .donut-segment { fill: none; stroke-width: 7; }
.donut-base { stroke: #e8ebf2; }
.donut-segment { stroke-linecap: butt; }
.donut-segment.tone-0 { stroke: #6574ff; }
.donut-segment.tone-1 { stroke: #087f6b; }
.donut-segment.tone-2 { stroke: #bf5039; }
.donut-segment.tone-3 { stroke: #a778ef; }
.donut-segment.tone-4 { stroke: #3488d8; }
.donut-segment.tone-5 { stroke: #c18a25; }
.donut-segment.tone-6 { stroke: #c85273; }
.donut-chart::before { content: ""; grid-area: 1/1; width: 63%; aspect-ratio: 1; border-radius: 50%; background: white; box-shadow: 0 4px 20px rgba(20,30,50,.08); }
.donut-chart > div { grid-area: 1/1; display: grid; justify-items: center; z-index: 1; }
.donut-chart span, .donut-chart small { color: var(--muted); font-size: 10px; }
.donut-chart strong { margin: 2px 0; font-size: 21px; letter-spacing: -.035em; }
.donut-legend { display: grid; max-height: 330px; overflow-y: auto; }
.donut-legend button, .donut-item { min-height: 51px; padding: 8px 4px; display: grid; grid-template-columns: 9px minmax(0,1fr) auto; align-items: center; gap: 10px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.donut-legend button { cursor: pointer; }
.donut-legend button:hover { background: var(--surface-soft); }
.donut-legend i, .donut-item i { width: 8px; height: 28px; border-radius: 6px; }
.donut-legend .tone-0, .donut-item .tone-0 { background: #6574ff; }
.donut-legend .tone-1, .donut-item .tone-1 { background: #087f6b; }
.donut-legend .tone-2, .donut-item .tone-2 { background: #bf5039; }
.donut-legend .tone-3, .donut-item .tone-3 { background: #a778ef; }
.donut-legend .tone-4, .donut-item .tone-4 { background: #3488d8; }
.donut-legend .tone-5, .donut-item .tone-5 { background: #c18a25; }
.donut-legend .tone-6, .donut-item .tone-6 { background: #c85273; }
.donut-legend span, .donut-item span { min-width: 0; }
.donut-legend span strong, .donut-legend span small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-item span strong, .donut-item span small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend span strong, .donut-item span strong { font-size: 12px; }
.donut-legend span small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.donut-item span small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.donut-legend b, .donut-item b { font-size: 11px; font-variant-numeric: tabular-nums; }

.annual-list { margin-top: 18px; display: grid; gap: 9px; }
.annual-list button { min-height: 112px; padding: 13px; display: grid; grid-template-columns: 52px 1fr auto; grid-template-areas: "year bars result" "year values result"; align-items: center; gap: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); text-align: left; cursor: pointer; }
.annual-list button:hover, .annual-list button.active { border-color: rgba(36,87,214,.32); background: #f3f6ff; }
.annual-year { grid-area: year; font-size: 18px; font-weight: 800; }
.annual-year small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 650; white-space: nowrap; }
.annual-bars { grid-area: bars; display: grid; gap: 4px; }
.annual-bars i { display: block; width: var(--pct, 0%); height: 6px; border-radius: 9px; }
.annual-income { background: var(--income); }
.annual-expense { background: var(--expense); }
.annual-values { grid-area: values; display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); }
.annual-values small { font-size: 10px; }
.annual-list button > strong { grid-area: result; font-size: 11px; white-space: nowrap; }

.structure-card > .card-heading > strong { font-size: 16px; }
.structure-list { margin-top: 22px; display: grid; gap: 18px; }
.structure-list > div { display: grid; grid-template-columns: minmax(100px,.75fr) minmax(100px,1fr) auto; align-items: center; gap: 11px; }
.structure-list span { display: flex; justify-content: space-between; gap: 6px; }
.structure-list b { font-size: 11px; }
.structure-list small { color: var(--muted); font-size: 9px; }
.structure-list > div > strong { font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.structure-track { height: 8px; overflow: hidden; border-radius: 9px; background: #edf0f5; }
.structure-track i { display: block; width: var(--pct, 0%); height: 100%; border-radius: inherit; }
.structure-track .expense { background: var(--expense); }
.structure-track .investment { background: var(--violet); }
.structure-track .debt { background: var(--amber); }
.structure-track .asset { background: var(--blue); }
.professional-note { margin-top: 24px; padding: 14px; display: grid; grid-template-columns: 25px 1fr; gap: 10px; border-radius: 13px; color: #57538e; background: var(--primary-soft); }
.professional-note > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--primary); font-weight: 850; }
.professional-note p { margin: 0; font-size: 10px; }
.professional-note strong { display: block; margin-bottom: 2px; font-size: 11px; }

.filter-panel { margin-bottom: 23px; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.search-box { height: 44px; flex: 1 1 350px; display: flex; align-items: center; gap: 9px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: white; box-shadow: var(--shadow-xs); }
.search-box > span { color: var(--muted); font-size: 20px; transform: rotate(-12deg); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; }
.filter-panel > select, .filter-toggle, .clear-button { height: 44px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 12px; background: white; }
.filter-panel select { color: var(--ink); }
.filter-toggle.active { color: var(--primary); border-color: #b9c9f3; background: var(--primary-soft); }
.clear-button { color: var(--red); background: transparent; }
.filter-row { flex: 1 0 100%; padding: 15px; display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 10px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.76); box-shadow: var(--shadow-xs); }
.filter-row label { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.filter-row select { width: 100%; min-height: 38px; margin-top: 5px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 9px; background: white; font-size: 11px; text-transform: none; letter-spacing: 0; }

.results-heading { margin: 6px 0 13px; align-items: end; }
.results-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.review-legend { color: var(--muted); font-size: 10px; }
.review-legend span { width: 7px; height: 7px; margin: 0 4px 0 12px; display: inline-block; border-radius: 50%; }
.dot-context { background: var(--amber); }
.dot-pending { background: #8791a3; }

.ledger-panel { overflow: hidden; }
.bulk-bar { min-height: 56px; padding: 9px 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: #3f3b8a; background: var(--primary-soft); border-bottom: 1px solid #d8d5ff; }
.bulk-bar > strong { margin-right: 5px; font-size: 11px; }
.compact-button { min-height: 34px; padding: 7px 10px; color: #49449b; border-color: #cbc7ff; background: white; font-size: 10px; }
.bulk-category { display: flex; }
.bulk-category input { width: 170px; padding: 7px 9px; border: 1px solid #cbc7ff; border-right: 0; border-radius: 9px 0 0 9px; }
.bulk-category button { border-radius: 0 9px 9px 0; }
.danger-ghost { min-height: 34px; padding: 7px 10px; color: var(--red); border-color: #e8bbb6; background: white; }
.icon-button { margin-left: auto; border: 0; background: transparent; font-size: 20px; cursor: pointer; }

.table-wrap { overflow-x: auto; }
.ledger-table { width: 100%; min-width: 1120px; border-collapse: collapse; }
.ledger-table th { height: 46px; padding: 0 11px; color: #778196; background: #fafbfc; border-bottom: 1px solid var(--line); font-size: 9px; font-weight: 850; letter-spacing: .075em; text-align: left; text-transform: uppercase; }
.ledger-table td { padding: 12px 11px; border-bottom: 1px solid #edf0f5; vertical-align: middle; font-size: 11px; }
.ledger-table tbody tr { cursor: pointer; transition: background 120ms ease; }
.ledger-table tbody tr:hover { background: #f8f9fc; }
.ledger-table .row-selected { background: #f3f2ff; }
.ledger-table .row-excluded { opacity: .54; background: #f8f8f8; }
.checkbox-cell { width: 39px; text-align: center !important; }
input[type="checkbox"] { accent-color: var(--primary); }
.date-main { display: block; white-space: nowrap; font-variant-numeric: tabular-nums; }
.micro-note { display: block; color: var(--amber); font-size: 9px; }
.description-cell { max-width: 250px; }
.description-cell > span:first-child { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.description-cell small { display: block; max-width: 220px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.modified-dot { margin-top: 4px; display: inline-flex !important; padding: 2px 6px; border-radius: 5px; color: var(--violet); background: var(--violet-soft); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.category-pill { display: inline-block; max-width: 180px; padding: 5px 8px; overflow: hidden; border-radius: 7px; color: #49556a; background: #eef1f5; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.badge-income { color: #08715d; background: var(--income-soft); }
.badge-expense { color: #9a4632; background: var(--expense-soft); }
.badge-investment { color: #6843a9; background: var(--violet-soft); }
.badge-finance, .badge-asset { color: #27689e; background: var(--blue-soft); }
.badge-debt { color: #8b5912; background: var(--amber-soft); }
.badge-reviewed { color: #08715d; background: var(--income-soft); }
.badge-warning { color: #875613; background: var(--amber-soft); }
.badge-pending, .badge-muted { color: #606b7c; background: #edf0f4; }
.scope-review { color: var(--amber); font-weight: 750; }
.scope-text { color: #4d596c; }
.amount-cell { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 780; }
.amount-positive { color: var(--income); }
.amount-negative { color: #8d4939; }
.row-action { min-height: 30px; padding: 5px 8px; color: var(--primary); border-color: #d2cfff; background: white; font-size: 9px; }

.empty-state { padding: 55px; text-align: center; }
.empty-state.compact { padding: 24px 12px; }
.empty-state span { font-size: 20px; font-weight: 680; }
.empty-state p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.pagination { min-height: 54px; padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; gap: 15px; color: var(--muted); background: #fafbfc; font-size: 10px; }
.pagination-controls { display: flex; align-items: center; gap: 8px; }
.pagination select { margin-left: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.pagination button { min-height: 32px; padding: 5px 10px; border-color: var(--line); background: white; font-size: 9px; }

.drawer-backdrop { position: fixed; inset: 0; display: flex; justify-content: flex-end; background: rgba(8,14,26,.48); backdrop-filter: blur(4px); z-index: 100; }
.editor-drawer { width: min(600px, 96vw); height: 100%; overflow-y: auto; background: #f9fafc; box-shadow: -24px 0 70px rgba(8,14,26,.24); animation: slideIn 180ms ease-out; }
@keyframes slideIn { from { transform: translateX(40px); opacity: .5; } }
.drawer-header { position: sticky; top: 0; padding: 24px 26px 19px; display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); background: rgba(249,250,252,.94); backdrop-filter: blur(14px); z-index: 5; }
.drawer-header h2 { margin: 0; font-size: 27px; font-weight: 690; letter-spacing: -.035em; }
.close-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: white; cursor: pointer; font-size: 21px; }
.editor-drawer form { padding: 23px 26px 32px; }
.source-card { margin-bottom: 20px; padding: 15px; display: flex; justify-content: space-between; gap: 18px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.source-card span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.source-card strong { display: block; margin-top: 4px; font-size: 11px; }
.source-card p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.source-card a { align-self: center; color: var(--primary); font-size: 10px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 13px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; color: #4c576a; font-size: 10px; font-weight: 800; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; padding: 10px 11px; color: var(--ink); border: 1px solid var(--line-strong); border-radius: 10px; background: white; outline: 0; font-weight: 500; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,87,214,.12); }
.form-grid textarea { resize: vertical; }
.form-grid small { color: var(--muted); font-size: 9px; font-weight: 500; }
.full-field { grid-column: 1 / -1; }
.review-check { margin: 20px 0; padding: 14px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid #c8e4dc; border-radius: 12px; background: var(--income-soft); cursor: pointer; }
.review-check input { margin-top: 3px; }
.review-check strong, .review-check small { display: block; }
.review-check small { margin-top: 2px; color: #577066; font-size: 9px; }
.original-card { margin-bottom: 14px; padding: 14px; border-left: 3px solid var(--violet); border-radius: 6px 11px 11px 6px; background: var(--violet-soft); }
.original-card > span { color: var(--violet); font-size: 9px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.original-card p { margin: 6px 0 0; color: #5f5577; font-size: 9px; }
.similar-button { width: 100%; padding: 10px; color: #4f469c; border-color: #d2cfff; background: white; }
.similar-button:hover { background: var(--primary-soft); }
.drawer-footer { margin-top: 25px; padding-top: 18px; display: flex; justify-content: space-between; align-items: center; gap: 15px; border-top: 1px solid var(--line); }
.drawer-footer > div { display: flex; gap: 8px; }

.toast { position: fixed; right: 25px; bottom: 25px; padding: 13px 17px; display: flex; align-items: center; gap: 9px; color: white; border-radius: 12px; background: #151e31; box-shadow: var(--shadow-md); z-index: 200; animation: toastIn 180ms ease-out; }
.toast span { width: 21px; height: 21px; display: grid; place-items: center; color: white; border-radius: 50%; background: var(--income); font-size: 11px; font-weight: 900; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } }

.auth-screen {
  min-height: 100vh;
  padding: 28px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 75% 5%, rgba(36,87,214,.30), transparent 32%),
    radial-gradient(circle at 10% 90%, rgba(15,159,130,.12), transparent 28%),
    var(--sidebar);
}
.auth-card { width: min(100%, 420px); padding: 30px; border: 1px solid rgba(255,255,255,.1); border-radius: 24px; color: white; background: rgba(18,26,44,.9); box-shadow: 0 30px 80px rgba(0,0,0,.3); backdrop-filter: blur(20px); }
.auth-brand { display: flex; align-items: center; gap: 13px; }
.auth-brand strong, .auth-brand span { display: block; }
.auth-brand span { margin-top: 2px; color: #8f99ad; font-size: 11px; }
.auth-copy { margin: 36px 0 23px; }
.auth-copy h1 { margin: 5px 0 8px; font-size: 30px; line-height: 1.1; letter-spacing: -.035em; }
.auth-copy > p:last-child { margin: 0; color: #aab3c3; }
.auth-card form { display: grid; gap: 15px; }
.auth-card form label { display: grid; gap: 7px; color: #c5ccda; font-size: 11px; font-weight: 750; }
.auth-card form input { width: 100%; padding: 12px 13px; border: 1px solid rgba(255,255,255,.14); border-radius: 11px; color: white; background: rgba(5,10,20,.42); outline: 0; }
.auth-card form input:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(123,116,255,.2); }
.auth-card form .primary-button { min-height: 44px; margin-top: 5px; }
.auth-alert { margin-bottom: 17px; padding: 11px 12px; border: 1px solid rgba(255,150,140,.28); border-radius: 10px; color: #ffd5d0; background: rgba(184,74,69,.18); font-size: 12px; }
.auth-footnote { margin: 19px 0 0; color: #8792a6; font-size: 10px; text-align: center; }
.enrollment-card { width: min(100%, 460px); }
.enrollment-card .auth-copy { margin-bottom: 18px; }
.enrollment-status { margin-bottom: 17px; padding: 11px 12px; border: 1px solid rgba(142,172,255,.24); border-radius: 10px; color: #c9d8ff; background: rgba(36,87,214,.14); font-size: 12px; }
.enrollment-status.error { color: #ffd5d0; border-color: rgba(255,150,140,.28); background: rgba(184,74,69,.18); }
.enrollment-status.success { color: #c8f5e8; border-color: rgba(120,225,192,.25); background: rgba(8,127,107,.18); }
.enrollment-success { display: grid; gap: 15px; }
.enrollment-success h2 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.enrollment-success p { margin: 0; color: #aab3c3; }
.enrollment-success .primary-button { display: grid; place-items: center; text-decoration: none; }
.auth-alternatives { margin-top: 12px; display: flex; justify-content: space-between; gap: 10px; }
.auth-alternatives .text-button { color: #b9ccff; }
.auth-alternatives .text-button.muted { color: #8792a6; }

.security-backdrop { position: fixed; inset: 0; padding: 24px; display: grid; place-items: center; overflow-y: auto; background: rgba(4,9,20,.68); backdrop-filter: blur(8px); z-index: 190; }
.security-dialog { width: min(100%, 760px); max-height: calc(100vh - 48px); padding: 26px; overflow-y: auto; border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: 0 34px 90px rgba(4,9,20,.3); }
.security-dialog > header { margin-bottom: 22px; display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.security-dialog h2 { margin: 0; font-size: 25px; letter-spacing: -.035em; }
.security-dialog h3 { margin: 0 0 5px; font-size: 15px; letter-spacing: -.015em; }
.security-dialog p { margin: 0; color: var(--muted); font-size: 12px; }
.security-dialog .auth-alert { color: #8d3732; border-color: #efc2bd; background: var(--red-soft); }
.security-notice { margin-bottom: 17px; padding: 11px 12px; border: 1px solid #b9ddcf; border-radius: 10px; color: #17634f; background: var(--income-soft); font-size: 12px; }
.security-dialog label { display: grid; gap: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 750; }
.security-dialog input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 11px; outline: 0; }
.security-dialog input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,87,214,.12); }
.security-intro, .security-status { padding: 18px; display: grid; grid-template-columns: 42px 1fr; gap: 14px; border: 1px solid #cdd9f6; border-radius: 16px; background: var(--primary-soft); }
.security-intro > span, .security-status > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: white; background: var(--primary); font-size: 20px; font-weight: 850; }
.security-status.active { border-color: #c8e4dc; background: var(--income-soft); }
.security-status.active > span { background: var(--income); }
.security-status .security-note { margin-top: 9px; color: #567167; font-size: 10px; }
.security-form { margin-top: 18px; display: grid; grid-template-columns: minmax(220px,1fr) auto; align-items: end; gap: 12px; }
.security-form .primary-button { min-height: 44px; }
.security-steps { display: grid; gap: 18px; }
.security-steps > section { display: grid; grid-template-columns: 32px 1fr; gap: 13px; }
.security-steps > section > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--primary); font-size: 11px; font-weight: 850; }
.totp-setup { margin-top: 13px; padding: 14px; display: grid; grid-template-columns: 208px 1fr; align-items: center; gap: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-soft); }
.totp-setup canvas { width: 208px; height: 208px; border-radius: 10px; background: white; }
.totp-setup > div { min-width: 0; display: grid; justify-items: start; gap: 10px; }
.totp-setup .secondary-button { display: inline-flex; align-items: center; text-decoration: none; }
.totp-setup small { color: var(--muted); font-size: 10px; }
.totp-setup code { max-width: 100%; overflow-wrap: anywhere; color: #123b9f; font-size: 12px; font-weight: 800; letter-spacing: .07em; }
.backup-code-list { margin: 12px 0 0; padding: 13px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 12px; border: 1px dashed #b9c9f3; border-radius: 13px; background: #f7f9ff; list-style: none; }
.backup-code-list code { color: var(--ink-soft); font-size: 12px; font-weight: 750; letter-spacing: .04em; }
#verify-enrollment-form { margin-top: 12px; display: grid; grid-template-columns: minmax(180px,1fr) auto; align-items: end; gap: 12px; }
#verify-enrollment-form .primary-button { min-height: 44px; }
.password-change { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.password-change > div { margin-bottom: 13px; }
.password-change > div p { margin-top: 4px; }
.password-change form { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)) auto; align-items: end; gap: 10px; }
.password-change form .secondary-button { min-height: 44px; white-space: nowrap; }
.security-footnote { margin-top: 22px !important; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted-2) !important; font-size: 10px !important; }

.loading-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; background: var(--sidebar); color: white; }
.loading-screen .loading-mark { width: 60px; height: 60px; border-radius: 18px; font-size: 18px; }
.loading-screen h1 { margin: 20px 0 5px; font-size: 28px; font-weight: 670; letter-spacing: -.03em; }
.loading-screen p { margin: 0; color: #97a3b7; }
.loading-line { width: 190px; height: 3px; margin-top: 23px; overflow: hidden; border-radius: 6px; background: rgba(255,255,255,.08); }
.loading-line::after { content: ""; width: 45%; height: 100%; display: block; border-radius: inherit; background: var(--primary-2); animation: loading 1s infinite ease-in-out; }
@keyframes loading { 0% { transform: translateX(-110%); } 100% { transform: translateX(330%); } }

/* Escala dinámica compatible con la política CSP del sitio. */
.pct-0 { --pct: 0%; }
.pct-1 { --pct: 1%; }
.pct-2 { --pct: 2%; }
.pct-3 { --pct: 3%; }
.pct-4 { --pct: 4%; }
.pct-5 { --pct: 5%; }
.pct-6 { --pct: 6%; }
.pct-7 { --pct: 7%; }
.pct-8 { --pct: 8%; }
.pct-9 { --pct: 9%; }
.pct-10 { --pct: 10%; }
.pct-11 { --pct: 11%; }
.pct-12 { --pct: 12%; }
.pct-13 { --pct: 13%; }
.pct-14 { --pct: 14%; }
.pct-15 { --pct: 15%; }
.pct-16 { --pct: 16%; }
.pct-17 { --pct: 17%; }
.pct-18 { --pct: 18%; }
.pct-19 { --pct: 19%; }
.pct-20 { --pct: 20%; }
.pct-21 { --pct: 21%; }
.pct-22 { --pct: 22%; }
.pct-23 { --pct: 23%; }
.pct-24 { --pct: 24%; }
.pct-25 { --pct: 25%; }
.pct-26 { --pct: 26%; }
.pct-27 { --pct: 27%; }
.pct-28 { --pct: 28%; }
.pct-29 { --pct: 29%; }
.pct-30 { --pct: 30%; }
.pct-31 { --pct: 31%; }
.pct-32 { --pct: 32%; }
.pct-33 { --pct: 33%; }
.pct-34 { --pct: 34%; }
.pct-35 { --pct: 35%; }
.pct-36 { --pct: 36%; }
.pct-37 { --pct: 37%; }
.pct-38 { --pct: 38%; }
.pct-39 { --pct: 39%; }
.pct-40 { --pct: 40%; }
.pct-41 { --pct: 41%; }
.pct-42 { --pct: 42%; }
.pct-43 { --pct: 43%; }
.pct-44 { --pct: 44%; }
.pct-45 { --pct: 45%; }
.pct-46 { --pct: 46%; }
.pct-47 { --pct: 47%; }
.pct-48 { --pct: 48%; }
.pct-49 { --pct: 49%; }
.pct-50 { --pct: 50%; }
.pct-51 { --pct: 51%; }
.pct-52 { --pct: 52%; }
.pct-53 { --pct: 53%; }
.pct-54 { --pct: 54%; }
.pct-55 { --pct: 55%; }
.pct-56 { --pct: 56%; }
.pct-57 { --pct: 57%; }
.pct-58 { --pct: 58%; }
.pct-59 { --pct: 59%; }
.pct-60 { --pct: 60%; }
.pct-61 { --pct: 61%; }
.pct-62 { --pct: 62%; }
.pct-63 { --pct: 63%; }
.pct-64 { --pct: 64%; }
.pct-65 { --pct: 65%; }
.pct-66 { --pct: 66%; }
.pct-67 { --pct: 67%; }
.pct-68 { --pct: 68%; }
.pct-69 { --pct: 69%; }
.pct-70 { --pct: 70%; }
.pct-71 { --pct: 71%; }
.pct-72 { --pct: 72%; }
.pct-73 { --pct: 73%; }
.pct-74 { --pct: 74%; }
.pct-75 { --pct: 75%; }
.pct-76 { --pct: 76%; }
.pct-77 { --pct: 77%; }
.pct-78 { --pct: 78%; }
.pct-79 { --pct: 79%; }
.pct-80 { --pct: 80%; }
.pct-81 { --pct: 81%; }
.pct-82 { --pct: 82%; }
.pct-83 { --pct: 83%; }
.pct-84 { --pct: 84%; }
.pct-85 { --pct: 85%; }
.pct-86 { --pct: 86%; }
.pct-87 { --pct: 87%; }
.pct-88 { --pct: 88%; }
.pct-89 { --pct: 89%; }
.pct-90 { --pct: 90%; }
.pct-91 { --pct: 91%; }
.pct-92 { --pct: 92%; }
.pct-93 { --pct: 93%; }
.pct-94 { --pct: 94%; }
.pct-95 { --pct: 95%; }
.pct-96 { --pct: 96%; }
.pct-97 { --pct: 97%; }
.pct-98 { --pct: 98%; }
.pct-99 { --pct: 99%; }
.pct-100 { --pct: 100%; }

@media (max-width: 1260px) {
  .period-toolbar { grid-template-columns: minmax(180px,1fr) auto auto; }
  .month-switcher { grid-column: 1 / -1; grid-row: 2; }
  .period-detail-button { grid-column: 3; grid-row: 1; }
  .insight-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1100px) {
  .sidebar { position: static; width: 100%; min-height: auto; padding: 15px 20px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 16px; }
  .brand { padding: 0; }
  .sidebar nav { display: flex; justify-content: flex-end; overflow-x: auto; }
  .sidebar nav button { width: auto; min-width: max-content; }
  .review-progress, .sidebar-note { display: none; }
  .workspace { margin-left: 0; padding: 30px; }
  .overview-grid, .analysis-grid, .analysis-grid.secondary, .overview-lower { grid-template-columns: 1fr; }
  .category-card { min-height: auto; }
}

@media (max-width: 800px) {
  .sidebar { grid-template-columns: 1fr; }
  .brand { justify-self: center; }
  .sidebar nav { justify-content: flex-start; }
  .workspace { padding: 24px 18px 52px; }
  .topbar { display: block; }
  .header-actions { margin-top: 18px; justify-content: flex-start; }
  .save-state { flex-basis: 100%; margin-bottom: 2px; }
  .period-toolbar { grid-template-columns: 1fr auto; }
  .period-summary { grid-column: 1; }
  .year-select { grid-column: 2; }
  .period-detail-button { grid-column: 1 / -1; grid-row: 3; }
  .month-switcher { grid-column: 1 / -1; grid-row: 2; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .monthly-card { overflow-x: auto; }
  .monthly-chart { width: 720px; }
  .donut-layout { grid-template-columns: 1fr; }
  .donut-chart { width: 210px; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .full-field { grid-column: auto; }
  .drawer-footer { align-items: stretch; flex-direction: column-reverse; }
  .drawer-footer > div { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .sidebar { padding: 12px; gap: 10px; }
  .brand { justify-self: start; padding-left: 4px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  .sidebar nav { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; overflow: visible; }
  .sidebar nav button { width: 100%; min-width: 0; min-height: 54px; padding: 7px 2px; grid-template-columns: 1fr; justify-items: center; gap: 2px; text-align: center; font-size: 10px; }
  .sidebar nav em { display: none; }
  .nav-symbol { width: 22px; height: 22px; font-size: 15px; }
  .workspace { padding: 20px 12px 45px; }
  .topbar h1 { font-size: 32px; }
  .header-actions .secondary-button { display: none; }
  .period-toolbar { padding: 13px; }
  .period-summary small { max-width: 200px; }
  .kpi-grid, .insight-grid { grid-template-columns: 1fr; }
  .kpi-card { min-height: 128px; }
  .chart-card, .analysis-card, .activity-card { padding: 18px 15px; }
  .card-heading { display: block; }
  .card-heading .legend, .card-heading .segmented-control { margin-top: 12px; }
  .overview-lower { display: block; }
  .review-callout { margin-top: 15px; min-height: 320px; }
  .activity-row { grid-template-columns: 36px minmax(0,1fr) auto; }
  .activity-arrow { display: none; }
  .activity-amount { font-size: 10px; }
  .annual-list button { grid-template-columns: 42px 1fr; grid-template-areas: "year result" "bars bars" "values values"; }
  .annual-list button > strong { justify-self: end; }
  .structure-list > div { grid-template-columns: 1fr auto; }
  .structure-track { grid-column: 1 / -1; grid-row: 2; }
  .filter-row { grid-template-columns: 1fr; }
  .results-heading { display: block; }
  .review-legend { margin-top: 9px; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .editor-drawer form, .drawer-header { padding-left: 17px; padding-right: 17px; }
  .source-card { display: block; }
  .source-card a { display: inline-block; margin-top: 10px; }
  .auth-alternatives { align-items: flex-start; flex-direction: column; }
  .security-backdrop { padding: 0; place-items: stretch; }
  .security-dialog { min-height: 100vh; max-height: none; padding: 22px 16px; border-radius: 0; }
  .security-form, #verify-enrollment-form, .totp-setup { grid-template-columns: 1fr; }
  .password-change form { grid-template-columns: 1fr; }
  .totp-setup { justify-items: center; }
  .totp-setup > div { justify-items: center; text-align: center; }
  .backup-code-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
