@font-face {
  font-family: Geist;
  src: url("fonts/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --navy: #0a1940;
  --ink: #142348;
  --secondary: #344765;
  --muted: #526380;
  --border: #e2eaf5;
  --surface: #f5f8fd;
  --blue: #0041dc;
  --blue-deep: #0036b7;
  --blue-soft: #edf4ff;
  --nav-active: #142e63;
  --nav-marker: #649bff;
  --nav-text: #c9d6ee;
  --green: #137455;
  --green-bg: #e5f6ed;
  --rose: #b33350;
  --rose-bg: #fdecf0;
  --card-shadow: 0 2px 4px #0a194006, 0 7px 24px #0a194006;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; background: #fff; }
body {
  margin: 0;
  font-family: Geist, Inter, system-ui, sans-serif;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #4479e6;
  outline-offset: 3px;
}
h1, h2, p { margin: 0; }
svg { flex: none; vertical-align: middle; }

.finance-shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 27px 16px 19px;
  color: #fff;
  background: var(--navy);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--blue); white-space: nowrap; }
.sidebar .brand { margin: 0 8px 32px; color: #fff; }
.brand-symbol { display: block; width: 37px; height: 37px; border-radius: 24%; object-fit: cover; flex: none; }
.brand-wordmark { display: grid; gap: 2px; }
.brand-wordmark strong { font-size: 24px; line-height: 1; font-weight: 760; letter-spacing: -.045em; }
.brand-wordmark small { color: var(--muted); font-size: 11px; line-height: 1.1; font-weight: 570; }
.sidebar .brand-wordmark small { color: var(--nav-text); }
.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 610;
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.button.primary { background: var(--blue); color: #fff; box-shadow: 0 3px 8px #0041dc2a; }
.button.primary:hover:not(:disabled) { background: var(--blue-deep); }
.button.secondary { background: #fff; border-color: var(--border); color: var(--blue-deep); }
.button.secondary:hover:not(:disabled) { background: var(--surface); border-color: #cddcf5; }
.button.danger { background: #ad2848; color: #fff; }
.button.danger:hover:not(:disabled) { background: #8c1c37; }
.button.compact { min-height: 36px; padding: 7px 12px; }
.sidebar-new { justify-content: flex-start; gap: 10px; margin: 0 4px 29px; padding: 11px 12px; font-weight: 650; }
.sidebar-nav { display: grid; gap: 5px; }
.sidebar-nav a, .sidebar-setting {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--nav-text);
  font-size: 13px;
  font-weight: 520;
  text-align: left;
}
.sidebar-nav a:hover, .sidebar-setting:hover { background: #ffffff15; color: #fff; }
.sidebar-nav a[aria-current="page"] { background: var(--nav-active); box-shadow: inset 3px 0 0 var(--nav-marker); color: #fff; font-weight: 670; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid #ffffff26; padding-top: 11px; }
.sidebar-setting { width: 100%; }
.mobile-nav { display: none; }

.finance-main { min-width: 0; background: #fff; }
.topbar {
  height: 67px;
  padding: 0 clamp(20px, 3.1vw, 43px);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  border-bottom: 1px solid #edf1f7;
}
.topbar-brand { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 19px; }
.profile { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: var(--secondary); white-space: nowrap; }
.profile-icon { display: grid; place-items: center; border-radius: 50%; width: 34px; height: 34px; color: var(--blue); background: var(--blue-soft); }
.content { width: 100%; max-width: 1540px; margin: 0 auto; padding: 30px clamp(20px, 3.1vw, 43px) 40px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.page-heading h1 { font-size: clamp(27px, 3.1vw, 36px); line-height: 1.1; font-weight: 710; letter-spacing: -.058em; }
.page-heading p { margin-top: 7px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.heading-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

.period-control {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 3px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--card-shadow);
  border-radius: 10px;
}
.icon-button { display: inline-grid; place-items: center; padding: 0; width: 33px; height: 33px; border: 0; border-radius: 7px; color: var(--secondary); background: transparent; flex: none; }
.icon-button:hover:not(:disabled) { background: var(--blue-soft); color: var(--blue-deep); }
.icon-button.quiet { color: var(--muted); }
.icon-button.danger-quiet:hover:not(:disabled) { background: var(--rose-bg); color: var(--rose); }
.period-select { display: flex; align-items: center; position: relative; color: var(--blue); gap: 4px; padding-left: 6px; }
.period-select select { appearance: none; background: transparent; border: 0; padding: 5px 19px 5px 3px; color: var(--ink); font-weight: 590; font-size: 12px; cursor: pointer; }
.period-select select:focus-visible { outline-offset: 0; border-radius: 6px; }
.period-chevron { position: absolute; right: 4px; color: var(--muted); pointer-events: none; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 21px; }
.summary-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  min-height: 128px;
  padding: 18px 18px 17px 19px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--card-shadow);
}
.summary-card.balance { background: var(--blue-soft); border-color: #d7e6ff; }
.summary-card.income .summary-amount { color: var(--green); }
.summary-card.expense .summary-amount { color: var(--rose); }
.summary-copy { min-width: 0; }
.summary-copy h2 { font-size: 13px; line-height: 1.4; color: var(--secondary); font-weight: 590; }
.summary-amount {
  margin-top: 5px;
  font-size: clamp(19px, 2.65vw, 31px);
  line-height: 1.2;
  font-weight: 690;
  letter-spacing: -.06em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.summary-detail { display: flex; align-items: center; gap: 6px; font-size: 11.5px; min-height: 19px; color: var(--muted); margin-top: 8px; }
.summary-icon { display: grid; place-items: center; border-radius: 12px; width: 42px; height: 42px; flex: none; background: #dceaff; color: var(--blue); }
.summary-card.income .summary-icon, .chart-heading-icon.income { background: var(--green-bg); color: var(--green); }
.summary-card.expense .summary-icon, .chart-heading-icon.expense { background: var(--rose-bg); color: var(--rose); }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; background: transparent; padding: 0; border: 0; color: var(--blue-deep); font-size: 12px; font-weight: 650; white-space: nowrap; }
.text-button:hover { color: #0041dc; text-decoration: underline; text-underline-offset: 3px; }
.balance-edit { width: 24px; height: 22px; border-radius: 5px; }
.balance-edit:hover { background: #dceaff; }

.panel { min-width: 0; border: 1px solid var(--border); background: #fff; border-radius: 15px; box-shadow: var(--card-shadow); }
.panel-heading { display: flex; align-items: center; gap: 10px; }
.panel-heading h2 { font-weight: 670; font-size: 15px; line-height: 1.3; letter-spacing: -.025em; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 21px; }
.chart-panel { padding: 18px 18px 16px; container-type: inline-size; }
.chart-heading-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; flex: none; }
.chart-content { display: grid; grid-template-columns: 197.5px minmax(0, 1fr); gap: 14px; align-items: center; min-height: 204px; padding-top: 6px; }
.donut { width: 100%; aspect-ratio: 1; position: relative; display: grid; place-items: center; }
.donut svg { display: block; width: 100%; height: auto; }
.donut-segment { cursor: pointer; transition: opacity .16s; }
.donut-center { position: absolute; inset: 16% 17%; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 3px; text-align: center; pointer-events: none; }
.donut-center strong { font-size: clamp(12px, 1.25vw, 16px); font-weight: 690; letter-spacing: -.05em; line-height: 1.18; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.donut-share { color: var(--blue-deep); font-size: 12px; font-weight: 690; line-height: 1.2; font-variant-numeric: tabular-nums; }
.donut-label { color: var(--muted); font-size: 10px; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-legend { list-style: none; display: grid; gap: 3px; min-width: 0; max-height: 181px; overflow: auto; margin: 0; padding: 2px; }
.legend-item {
  width: 100%;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 6px;
  padding: 4px 4px;
  color: var(--secondary);
  background: transparent;
  text-align: left;
  font-size: 11.5px;
}
.legend-item[aria-pressed="true"], .legend-item:hover { background: var(--surface); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-value { color: var(--ink); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.chart-empty { color: var(--muted); font-size: 12px; display: grid; justify-items: start; gap: 8px; }
@container (max-width: 345px) {
  .chart-content { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 7px; padding-top: 12px; padding-bottom: 4px; }
  .donut { max-width: 187.5px; }
  .chart-legend { width: 100%; max-height: 175px; }
  .chart-empty { text-align: center; justify-items: center; }
}

.table-panel, .manage-panel { overflow: hidden; }
.table-heading { min-height: 55px; padding: 12px 19px; justify-content: space-between; }
.entry-list { width: 100%; }
.entry-row {
  min-height: 59px;
  display: grid;
  grid-template-columns: minmax(148px, 1.6fr) minmax(80px, .9fr) minmax(63px, .55fr) minmax(85px, .85fr) 70px;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-top: 1px solid #edf1f7;
}
.entry-row.entry-head { min-height: 34px; font-size: 11px; font-weight: 630; color: var(--muted); background: #f5f8fd; padding-top: 7px; padding-bottom: 7px; }
.entry-title { min-width: 0; display: flex; align-items: center; gap: 10px; }
.category-badge {
  width: 35px;
  height: 35px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--category-color) 16%, white);
  color: color-mix(in srgb, var(--category-color) 77%, #142348);
  flex: none;
}
.entry-text { min-width: 0; display: grid; gap: 2px; }
.entry-text strong, .entry-category { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-text strong { font-size: 12.5px; font-weight: 640; }
.entry-note { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 10.5px; }
.entry-mobile-meta { display: none; }
.entry-category, .entry-date { font-size: 12px; color: var(--muted); }
.amount { text-align: right; }
.entry-amount { font-size: 12px; font-weight: 660; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.entry-amount.income { color: var(--green); }
.entry-amount.expense { color: var(--rose); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 1px; }
.row-actions .icon-button { width: 31px; height: 31px; }

.list-toolbar { min-height: 65px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 18px; }
.filter-tabs { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: #f5f8fd; }
.filter-tabs button { min-height: 32px; display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; background: transparent; border: 0; border-radius: 7px; color: var(--secondary); font-size: 12px; font-weight: 590; }
.filter-tabs button:hover, .filter-tabs button[aria-pressed="true"] { color: var(--blue-deep); background: #edf4ff; }
.search-input { display: flex; gap: 8px; align-items: center; min-height: 37px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; color: var(--muted); }
.search-input:focus-within { border-color: #739bee; }
.search-input input { min-width: 0; width: 170px; border: 0; background: transparent; color: var(--ink); font-size: 12px; outline: 0; }
.category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; padding: 3px 18px 18px; }
.manage-category { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 62px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.manage-category strong { font-size: 13px; overflow-wrap: anywhere; font-weight: 620; }
.manage-category .row-actions { margin-left: auto; }
.rule-row { display: grid; grid-template-columns: 35px minmax(85px, 1.3fr) minmax(90px, 1fr) minmax(75px, .6fr) 98px; align-items: center; gap: 11px; padding: 13px 18px; border-top: 1px solid var(--border); }
.rule-info, .rule-date { display: grid; gap: 4px; min-width: 0; }
.rule-info strong { font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.rule-info span, .rule-date span, .count-label { color: var(--muted); font-size: 11px; }
.rule-date strong, .rule-amount { font-size: 12px; font-weight: 650; }
.rule-amount { color: var(--rose); text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.empty-state, .load-state { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; min-height: 158px; padding: 19px; color: var(--muted); text-align: center; }
.empty-state p, .load-state p { font-size: 13px; line-height: 1.45; }
.empty-icon { display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); border-radius: 13px; width: 43px; height: 43px; }
.load-state svg { color: var(--blue); }
.spinner { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.example-notice { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 13px; margin-bottom: 14px; border-radius: 10px; background: var(--blue-soft); color: var(--blue-deep); font-size: 12px; }
.example-notice .text-button { margin-left: auto; }

.dialog {
  width: min(100% - 24px, 510px);
  max-height: min(92dvh, 810px);
  max-width: none;
  padding: 0;
  border: 1px solid #dbe6f7;
  background: #fff;
  color: var(--ink);
  border-radius: 19px;
  box-shadow: 0 20px 70px #0a194037;
}
.dialog::backdrop { background: #0a194059; }
body:has(.dialog[open]) { overflow: hidden; }
.dialog-inner { padding: 21px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.category-detail-hint { margin: 3px 0 2px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.category-detail-dialog { width: min(100% - 24px, 740px); }
.category-detail-heading { display: flex; align-items: center; min-width: 0; gap: 12px; }
.category-detail-heading > div { min-width: 0; }
.category-detail-heading h2 { overflow-wrap: anywhere; }
.category-detail-heading .category-badge { width: 43px; height: 43px; border-radius: 12px; }
.category-detail-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.category-detail-summary > div { display: grid; gap: 4px; min-width: 0; }
.category-detail-summary > div > span { color: var(--muted); font-size: 12px; }
.category-detail-summary strong { font-size: 24px; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.category-detail-summary strong.expense, .category-detail-amount.expense { color: var(--rose); }
.category-detail-summary strong.income, .category-detail-amount.income { color: var(--green); }
.category-detail-summary p { display: grid; gap: 5px; text-align: right; font-size: 12px; font-weight: 650; }
.category-detail-summary p span { color: var(--muted); font-size: 11px; font-weight: 450; }
.category-detail-scroll { max-height: min(46dvh, 420px); overflow: auto; border: 1px solid var(--border); border-radius: 10px; overscroll-behavior: contain; }
.category-detail-table { width: 100%; border-spacing: 0; table-layout: fixed; font-size: 13px; text-align: left; }
.category-detail-table th { position: sticky; top: 0; z-index: 1; padding: 11px 12px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 650; }
.category-detail-table th:first-child { width: 103px; }
.category-detail-table th:last-child { width: 125px; }
.category-detail-table td { padding: 12px; border-top: 1px solid var(--border); vertical-align: top; }
.category-detail-date { color: var(--muted); white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
.category-detail-description { overflow-wrap: anywhere; line-height: 1.5; }
.category-detail-description > span:first-child { display: block; }
.category-detail-description .entry-note { margin: 4px 6px 0 0; }
.category-detail-amount { font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.category-detail-footer { margin-top: 16px; }
@media (max-width: 540px) {
  .category-detail-dialog .dialog-inner { padding: 16px; }
  .category-detail-summary { padding: 12px; }
  .category-detail-summary strong { font-size: 21px; }
  .category-detail-table { font-size: 12px; }
  .category-detail-table th, .category-detail-table td { padding: 10px 7px; }
  .category-detail-table th:first-child { width: 83px; }
  .category-detail-table th:last-child { width: 96px; }
  .category-detail-date { font-size: 10px; }
  .category-detail-heading .category-badge { width: 36px; height: 36px; }
}
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 17px; }
.dialog-heading h2 { font-weight: 690; font-size: 23px; letter-spacing: -.05em; line-height: 1.2; }
.dialog-heading p { margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.editor-form { display: grid; gap: 13px; }
.field { display: grid; min-width: 0; gap: 6px; color: var(--secondary); font-size: 12px; font-weight: 610; }
.field small { font-weight: 440; color: var(--muted); line-height: 1.45; }
.field input, .field select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid #dbe6f7;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 470;
}
.field input::placeholder { color: #697991; }
.field input:disabled { opacity: .67; background: var(--surface); }
.fields-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.currency-input { display: flex; align-items: center; border: 1px solid #dbe6f7; border-radius: 9px; overflow: hidden; min-width: 0; }
.currency-input > span { padding-left: 10px; color: var(--muted); }
.currency-input input { border: 0; border-radius: 0; }
.currency-input:focus-within { outline: 2px solid #4479e6; outline-offset: 2px; }
.currency-input input:focus-visible { outline: none; }
.kind-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 10px; background: var(--surface); }
.kind-switch button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 35px; padding: 6px; border: 0; border-radius: 7px; background: transparent; font-weight: 610; color: var(--muted); }
.kind-switch .on.expense { background: var(--rose-bg); color: var(--rose); }
.kind-switch .on.income { background: var(--green-bg); color: var(--green); }
.recurring-switch { min-height: 58px; padding: 9px 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.toggle-copy { display: flex; align-items: center; gap: 8px; color: var(--blue); }
.toggle-copy strong, .toggle-copy small { display: block; }
.toggle-copy strong { color: var(--ink); font-size: 12px; font-weight: 650; }
.toggle-copy small { margin-top: 3px; font-size: 11px; color: var(--muted); }
.recurring-switch input { appearance: none; width: 35px; height: 21px; position: relative; display: inline-block; border: 0; border-radius: 11px; background: #d8e1ef; cursor: pointer; flex: none; }
.recurring-switch input:checked { background: var(--blue); }
.recurring-switch input::after { content: ""; position: absolute; width: 15px; height: 15px; inset: 3px auto auto 3px; border-radius: 50%; background: #fff; transition: transform .14s; box-shadow: 0 1px 4px #0a19402a; }
.recurring-switch input:checked::after { transform: translateX(14px); }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.form-error { display: flex; align-items: flex-start; gap: 7px; padding: 9px 10px; margin-bottom: 12px; border-radius: 8px; background: var(--rose-bg); color: #92243c; font-size: 12px; line-height: 1.4; }
.picker-group { padding: 0; margin: 0; min-width: 0; border: 0; }
.picker-group legend { margin-bottom: 7px; color: var(--secondary); font-size: 12px; font-weight: 610; }
.color-picker, .icon-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid #14234814; border-radius: 50%; color: #fff; padding: 0; }
.swatch[aria-pressed="true"] { outline: 1px solid #344765; outline-offset: 2px; }
.custom-color input { display: block; width: 30px; height: 28px; border: 1px dashed #8b9db8; padding: 3px; border-radius: 7px; background: #fff; cursor: pointer; }
.icon-choice { display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--muted); width: 37px; height: 35px; }
.icon-choice:hover, .icon-choice[aria-pressed="true"] { color: var(--blue-deep); border-color: #c5d8fa; background: var(--blue-soft); }
.category-preview { display: flex; align-items: center; gap: 9px; color: var(--secondary); font-size: 12px; font-weight: 610; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 5; display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 36px); padding: 8px 10px 8px 12px; border: 1px solid #c9e9dc; border-radius: 12px; background: #fff; box-shadow: 0 8px 28px #0a194021; color: var(--green); font-size: 13px; }
.toast span { color: var(--ink); }
.toast-error { color: var(--rose); border-color: #efcbd4; }
.toast .icon-button { width: 28px; height: 28px; margin-left: 5px; }
.signin-page { min-height: 100dvh; display: grid; place-items: center; padding: 18px; background: var(--surface); }
.signin-card { width: min(100%, 350px); display: grid; gap: 13px; padding: 23px; }
.signin-card h1 { letter-spacing: -.06em; }
.signin-card p { color: var(--muted); }

@media (max-width: 1110px) {
  .finance-shell { grid-template-columns: 202px minmax(0, 1fr); }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .summary-card { padding: 15px 14px; }
  .summary-icon { width: 36px; height: 36px; }
  .summary-icon svg { width: 19px; height: 19px; }
}
@media (max-width: 870px) {
  .finance-shell { display: block; }
  .sidebar { display: none; }
  .topbar { height: 58px; justify-content: space-between; }
  .topbar-brand { display: block; }
  .topbar-brand .brand-symbol { width: 33px; height: 33px; }
  .topbar-brand .brand-wordmark strong { font-size: 21px; }
  .profile > span:last-child { display: none; }
  .content { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .mobile-nav {
    position: fixed;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    inset: auto 0 0;
    z-index: 4;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    background: var(--navy);
    color: #fff;
    box-shadow: 0 -4px 20px #0a194025;
  }
  .mobile-nav a { min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 4px 1px; border-radius: 9px; color: var(--nav-text); font-size: 10px; font-weight: 540; text-align: center; }
  .mobile-nav a[aria-current="page"] { background: var(--nav-active); box-shadow: inset 0 2px 0 var(--nav-marker); color: #fff; font-weight: 680; }
  .toast { bottom: calc(71px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .topbar { padding: 0 14px; }
  .topbar-actions { gap: 8px; }
  .example-action { font-size: 11px; }
  .example-action svg { width: 13px; }
  .content { padding-top: 22px; padding-left: 14px; padding-right: 14px; }
  .page-heading { display: grid; align-items: start; gap: 12px; margin-bottom: 16px; }
  .heading-actions { justify-content: space-between; gap: 7px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 13px; }
  .summary-card { position: relative; display: block; min-height: 96px; padding: 12px; border-radius: 12px; }
  .summary-card.balance { grid-column: 1 / -1; }
  .summary-amount { font-size: clamp(16px, 5vw, 21px); margin-top: 8px; }
  .summary-card.balance .summary-amount { font-size: 26px; }
  .summary-copy h2 { font-size: 12px; padding-right: 31px; }
  .summary-detail { margin-top: 5px; font-size: 10px; }
  .summary-icon { position: absolute; right: 11px; top: 9px; width: 25px; height: 25px; border-radius: 7px; }
  .summary-icon svg { width: 15px; height: 15px; }
  .chart-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 13px; }
  .chart-panel { padding: 14px; }
  .chart-content { grid-template-columns: 155px minmax(0, 1fr); gap: 10px; min-height: 163px; justify-items: stretch; padding-top: 8px; }
  .chart-empty { text-align: left; justify-items: start; }
  .legend-item { gap: 5px; font-size: 11px; padding: 4px 2px; }
  .legend-value { font-size: 10px; }
  .donut-center strong { font-size: 12px; }
  .panel-heading h2 { font-size: 14px; }
  .table-heading, .list-toolbar { padding-left: 12px; padding-right: 12px; }
  .entry-row.entry-head, .entry-category, .entry-date { display: none; }
  .entry-row { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 7px; padding: 8px 11px; min-height: 54px; }
  .entry-title { grid-row: span 2; gap: 7px; }
  .entry-mobile-meta { display: block; font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .entry-row .category-badge { width: 30px; height: 30px; border-radius: 8px; }
  .entry-row .row-actions { grid-column: 2; }
  .entry-row .row-actions .icon-button { width: 27px; height: 24px; }
  .entry-amount { font-size: 11px; }
  .category-grid { grid-template-columns: minmax(0, 1fr); padding-left: 12px; padding-right: 12px; }
  .rule-row { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 5px 8px; padding: 10px; }
  .rule-row > .category-badge { grid-row: span 2; width: 31px; height: 31px; }
  .rule-date { grid-row: 2; grid-column: 2; gap: 2px; }
  .rule-date span { font-size: 10px; }
  .rule-date strong, .rule-amount { font-size: 11px; }
  .rule-amount { grid-row: 1; grid-column: 3; }
  .rule-row .row-actions { grid-row: 2; grid-column: 3; }
  .rule-row .row-actions .icon-button { width: 27px; height: 27px; }
}
@media (max-width: 385px) {
  .chart-content { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .chart-empty { text-align: center; justify-items: center; }
  .donut { max-width: 155px; }
}
@media (max-width: 365px) {
  .period-select { padding-left: 2px; }
  .period-select > svg:first-child { display: none; }
  .period-control .icon-button { width: 27px; }
  .button { padding-left: 9px; padding-right: 9px; }
  .donut { max-width: 150px; }
  .chart-legend { max-height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.signin-card { width: min(100%, 410px); padding: clamp(20px, 5vw, 30px); gap: 17px; }
.signin-card h1 { font-size: clamp(24px, 6vw, 28px); line-height: 1.15; }
.signin-card .brand { margin-bottom: 3px; }
.signin-card .form-error { margin: 0; }
.signin-intro { display: grid; gap: 5px; }
.signin-card .editor-form > .button { margin-top: 4px; }
.signin-switch { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px; line-height: 1.5; }
.profile > span:last-child { max-width: 24ch; overflow: hidden; text-overflow: ellipsis; }
.logout-form { margin: 0; }
@media (max-width: 540px) {
  .logout-form .button { min-width: 34px; padding: 6px; }
  .logout-form .button span { display: none; }
}
