@import url('https://cdn.jsdelivr.net/npm/@flaticon/flaticon-uicons@3.3.1/css/regular/rounded.css');
@import url('https://cdn.jsdelivr.net/npm/@flaticon/flaticon-uicons@3.3.1/css/bold/rounded.css');
@import url('https://cdn.jsdelivr.net/npm/@flaticon/flaticon-uicons@3.3.1/css/solid/rounded.css');

/* Money Tracker design system.

   Same visual language as Tradee: warm canvas, lifted cards, filled control
   wells, Mona Sans, ink CTAs, physical primary buttons. Charts stay on
   lightweight-charts. Flaticon loads via @import; Mona Sans is self-hosted. */

@font-face {
  font-family: "Mona Sans";
  src: url("../fonts/mona-sans.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 900;
  font-stretch: 75% 125%;
  font-display: swap;
}

:root {
  --bp-mobile: 900px;
  --brand-paper: #f4f4f3;
  --brand-surface: #ffffff;
  --brand-surface-quiet: #ececeb;
  --brand-ink: #0b0b0b;
  --brand-ink-muted: #5c5c5c;
  --brand-border: #d4d4d2;
  --brand-border-strong: #a8a8a6;
  --brand-primary: #2756c7;
  --brand-primary-hover: #1e439d;
  --brand-trust: #27684d;
  --font-ui: "Mona Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-sans: var(--font-ui);
  --bg: var(--brand-paper);
  --panel: var(--brand-surface);
  --panel-2: var(--brand-surface-quiet);
  --panel-3: #f8f8f7;
  --border: rgba(11, 11, 11, 0.09);
  --border-strong: rgba(11, 11, 11, 0.16);
  --text: var(--brand-ink);
  --text-muted: var(--brand-ink-muted);
  --muted: #6e6e6e;
  --control-bg: var(--brand-surface-quiet);
  --accent: var(--brand-ink);
  --accent-hover: #2a2a2a;
  --accent-contrast: #ffffff;
  --action-fg: #ffffff;
  --accent-soft: rgba(39, 86, 199, 0.10);
  --accent-ring: rgba(39, 86, 199, 0.28);
  --link: var(--brand-primary);
  --link-hover: var(--brand-primary-hover);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);
  --warning: #d97706;
  --success: var(--brand-trust);
  --success-soft: rgba(39, 104, 77, 0.12);
  --info: var(--brand-primary);
  --selection-bg: rgba(39, 86, 199, 0.28);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.72) inset, 0 8px 24px rgba(11, 11, 11, 0.06);
  --shadow-card-hover: 0 1px 0 rgba(255, 255, 255, 0.88) inset, 0 12px 28px rgba(11, 11, 11, 0.10);
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-overlay: 0 16px 40px rgba(0, 0, 0, 0.18);
  --overlay-scrim: rgba(25, 24, 22, 0.38);
  --shadow-focus: 0 0 0 2px var(--accent-ring);
  --shadow-primary: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -1px 2px rgba(11, 11, 11, 0.22), 0 8px 16px -8px color-mix(in srgb, var(--accent) 28%, transparent);
  --shadow-primary-hover: inset 0 1px 0 rgba(255, 255, 255, 0.32), inset 0 -1px 2px rgba(11, 11, 11, 0.18), 0 12px 24px -6px color-mix(in srgb, var(--accent) 42%, transparent);
  --shadow-primary-press: inset 0 2px 5px rgba(11, 11, 11, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --radius-circle: 50%;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --page-pad: 22px;
  --content-max-width: 1100px;
  --section-gap: 16px;
  --card-pad-y: 18px;
  --card-pad-x: 20px;
  --grid-gap: 14px;
  --stack-gap: 14px;
  --fs-xxs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 22px;
  --fs-2xl: 28px;
  --fs-3xl: 34px;
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --mobile-nav-clearance: 76px;
  --control-height: 36px;
  --control-height-mobile: 44px;
  --transition-speed: 0.22s;
  --press-speed: 0.12s;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --press-scale: 0.98;
  color-scheme: light;
}

html[data-theme="dark"] {
  --brand-paper: #0b0b0b;
  --brand-surface: #101010;
  --brand-surface-quiet: #181818;
  --brand-ink: #f2f2f2;
  --brand-ink-muted: #a3a3a3;
  --brand-border: #2a2a2a;
  --brand-border-strong: #3f3f3f;
  --brand-primary: #5b8def;
  --brand-primary-hover: #7aa3f5;
  --brand-trust: #72b894;
  --bg: #191816;
  --panel: #22211e;
  --panel-2: #2a2926;
  --panel-3: #26241f;
  --border: rgba(255, 247, 237, 0.08);
  --border-strong: rgba(255, 247, 237, 0.16);
  --text: #f3f1ee;
  --text-muted: #a8a49e;
  --muted: #8d8882;
  --control-bg: #2a2926;
  --accent: #f2f2f2;
  --accent-hover: #ffffff;
  --accent-contrast: #0b0b0b;
  --action-fg: #0b0b0b;
  --accent-soft: rgba(91, 141, 239, 0.16);
  --accent-ring: rgba(91, 141, 239, 0.34);
  --link: var(--brand-primary);
  --link-hover: var(--brand-primary-hover);
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.16);
  --warning: #ff9f0a;
  --success: var(--brand-trust);
  --success-soft: rgba(114, 184, 148, 0.16);
  --info: var(--brand-primary);
  --selection-bg: rgba(91, 141, 239, 0.40);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-card-hover: 0 1px 0 rgba(255, 255, 255, 0.10) inset, 0 12px 28px rgba(0, 0, 0, 0.40);
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.55);
  --shadow-overlay: 0 16px 40px rgba(0, 0, 0, 0.70);
  --overlay-scrim: rgba(10, 9, 8, 0.50);
  --shadow-primary: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 -1px 2px rgba(0, 0, 0, 0.28), 0 8px 16px -8px color-mix(in srgb, var(--accent) 32%, transparent);
  --shadow-primary-hover: inset 0 1px 0 rgba(255, 255, 255, 0.34), inset 0 -1px 2px rgba(0, 0, 0, 0.2), 0 14px 28px -6px color-mix(in srgb, var(--accent) 55%, transparent);
  --shadow-primary-press: inset 0 2px 5px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color-scheme: dark;
}

html[data-text-size="small"]{
  --fs-xxs:10px;
  --fs-xs:11px;
  --fs-sm:12px;
  --fs-md:13px;
  --fs-lg:14px;
  --fs-xl:16px;
  --fs-2xl:18px;
  --fs-3xl:20px;
  --sidebar-nav-icon-size:0.8rem;
}
html[data-text-size="medium"]{
  --fs-xxs:11px;
  --fs-xs:12px;
  --fs-sm:13px;
  --fs-md:14px;
  --fs-lg:16px;
  --fs-xl:19px;
  --fs-2xl:24px;
  --fs-3xl:28px;
  --sidebar-nav-icon-size:0.85rem;
}
html[data-text-size="large"]{
  --fs-xxs:11px;
  --fs-xs:12px;
  --fs-sm:13px;
  --fs-md:15px;
  --fs-lg:17px;
  --fs-xl:22px;
  --fs-2xl:28px;
  --fs-3xl:34px;
  --sidebar-nav-icon-size:0.9rem;
}
html[data-text-size="xl"]{
  --fs-xxs:12px;
  --fs-xs:13px;
  --fs-sm:14px;
  --fs-md:16px;
  --fs-lg:19px;
  --fs-xl:25px;
  --fs-2xl:32px;
  --fs-3xl:40px;
  --sidebar-nav-icon-size:1rem;
}
html[data-corners="small"]{
  --radius-sm:2px;
  --radius-md:4px;
  --radius-lg:6px;
  --radius-pill:4px;
}
html[data-corners="medium"]{
  --radius-sm:6px;
  --radius-md:12px;
  --radius-lg:16px;
  --radius-pill:12px;
}
html[data-corners="large"]{
  --radius-sm:10px;
  --radius-md:16px;
  --radius-lg:20px;
  --radius-pill:999px;
}
html[data-spacing="small"]{
  --space-xs:3px;
  --space-sm:6px;
  --space-md:8px;
  --space-lg:12px;
  --space-xl:16px;
  --page-pad:12px;
  --page-header-bar-height:48px;
  --section-gap:10px;
  --card-pad-y:10px;
  --card-pad-x:12px;
  --grid-gap:8px;
  --stack-gap:8px;
  --mobile-page-tabs-height:34px;
  --sidebar-width:212px;
  --mobile-top-bar-height:44px;
  --mobile-bottom-nav-bar:44px;
  --wip-banner-row-height:28px;
  --mobile-header-control:32px;
  --touch-target-min:32px;
  --control-height:26px;
  --control-height-mobile:30px;
}
html[data-spacing="medium"]{
  --space-xs:4px;
  --space-sm:7px;
  --space-md:10px;
  --space-lg:14px;
  --space-xl:20px;
  --page-pad:16px;
  --page-header-bar-height:52px;
  --section-gap:12px;
  --card-pad-y:14px;
  --card-pad-x:16px;
  --grid-gap:11px;
  --stack-gap:11px;
  --mobile-page-tabs-height:38px;
  --sidebar-width:226px;
  --mobile-top-bar-height:50px;
  --mobile-bottom-nav-bar:50px;
  --wip-banner-row-height:30px;
  --mobile-header-control:36px;
  --touch-target-min:36px;
  --control-height:30px;
  --control-height-mobile:36px;
}
html[data-spacing="large"]{
  --space-xs:4px;
  --space-sm:8px;
  --space-md:12px;
  --space-lg:16px;
  --space-xl:24px;
  --page-pad:22px;
  --page-header-bar-height:76px;
  --section-gap:16px;
  --card-pad-y:18px;
  --card-pad-x:20px;
  --grid-gap:14px;
  --stack-gap:14px;
  --mobile-page-tabs-height:44px;
  --sidebar-width:240px;
  --mobile-top-bar-height:56px;
  --mobile-bottom-nav-bar:56px;
  --wip-banner-row-height:36px;
  --mobile-header-control:40px;
  --touch-target-min:44px;
  --control-height:36px;
  --control-height-mobile:44px;
}
html[data-focus-color="mono"]{
  --brand-primary:var(--brand-ink);
  --brand-primary-hover:#2a2a2a;
  --accent:var(--brand-ink);
  --accent-hover:#2a2a2a;
  --accent-soft:rgba(11,11,11,0.08);
  --accent-ring:rgba(11,11,11,0.28);
  --action-fg:#ffffff;
  --selection-bg:rgba(11,11,11,0.18);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="mono"]{
  --brand-primary:#f2f2f2;
  --brand-primary-hover:#ffffff;
  --accent:#f2f2f2;
  --accent-hover:#ffffff;
  --accent-soft:rgba(242,242,242,0.14);
  --accent-ring:rgba(242,242,242,0.34);
  --action-fg:#0b0b0b;
  --selection-bg:rgba(242,242,242,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-focus-color="red"]{
  --brand-primary:#c62828;
  --brand-primary-hover:#a61e1e;
  --accent:#c62828;
  --accent-hover:#a61e1e;
  --accent-soft:rgba(198,40,40,0.10);
  --accent-ring:rgba(198,40,40,0.28);
  --action-fg:#ffffff;
  --selection-bg:rgba(198,40,40,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="red"]{
  --brand-primary:#ff6b6b;
  --brand-primary-hover:#ff8585;
  --accent:#c62828;
  --accent-hover:#a61e1e;
  --accent-soft:rgba(255,107,107,0.16);
  --accent-ring:rgba(255,107,107,0.34);
  --action-fg:#ffffff;
  --selection-bg:rgba(255,107,107,0.40);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-focus-color="orange"]{
  --brand-primary:#d35400;
  --brand-primary-hover:#b34700;
  --accent:#d35400;
  --accent-hover:#b34700;
  --accent-soft:rgba(211,84,0,0.12);
  --accent-ring:rgba(211,84,0,0.30);
  --action-fg:#ffffff;
  --selection-bg:rgba(211,84,0,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="orange"]{
  --brand-primary:#ff9f43;
  --brand-primary-hover:#ffb366;
  --accent:#d35400;
  --accent-hover:#b34700;
  --accent-soft:rgba(255,159,67,0.16);
  --accent-ring:rgba(255,159,67,0.34);
  --action-fg:#ffffff;
  --selection-bg:rgba(255,159,67,0.40);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-focus-color="amber"]{
  --brand-primary:#c56a0a;
  --brand-primary-hover:#a35708;
  --accent:#c56a0a;
  --accent-hover:#a35708;
  --accent-soft:rgba(197,106,10,0.12);
  --accent-ring:rgba(197,106,10,0.30);
  --action-fg:#ffffff;
  --selection-bg:rgba(197,106,10,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="amber"]{
  --brand-primary:#ffb020;
  --brand-primary-hover:#ffc14d;
  --accent:#c56a0a;
  --accent-hover:#a35708;
  --accent-soft:rgba(255,176,32,0.16);
  --accent-ring:rgba(255,176,32,0.34);
  --action-fg:#ffffff;
  --selection-bg:rgba(255,176,32,0.40);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-focus-color="yellow"]{
  --brand-primary:#c9a000;
  --brand-primary-hover:#a68500;
  --accent:#c9a000;
  --accent-hover:#a68500;
  --accent-soft:rgba(201,160,0,0.14);
  --accent-ring:rgba(201,160,0,0.32);
  --action-fg:#0b0b0b;
  --selection-bg:rgba(201,160,0,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="yellow"]{
  --brand-primary:#f5d000;
  --brand-primary-hover:#ffe14d;
  --accent:#8a7000;
  --accent-hover:#6e5a00;
  --accent-soft:rgba(245,208,0,0.18);
  --accent-ring:rgba(245,208,0,0.36);
  --action-fg:#ffffff;
  --selection-bg:rgba(245,208,0,0.40);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-focus-color="lime"]{
  --brand-primary:#6a9a00;
  --brand-primary-hover:#567d00;
  --accent:#6a9a00;
  --accent-hover:#567d00;
  --accent-soft:rgba(106,154,0,0.12);
  --accent-ring:rgba(106,154,0,0.30);
  --action-fg:#ffffff;
  --selection-bg:rgba(106,154,0,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="lime"]{
  --brand-primary:#a8e63a;
  --brand-primary-hover:#bdf05a;
  --accent:#6a9a00;
  --accent-hover:#567d00;
  --accent-soft:rgba(168,230,58,0.16);
  --accent-ring:rgba(168,230,58,0.34);
  --action-fg:#ffffff;
  --selection-bg:rgba(168,230,58,0.40);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-focus-color="green"]{
  --brand-primary:#1f7a4d;
  --brand-primary-hover:#18633e;
  --accent:#1f7a4d;
  --accent-hover:#18633e;
  --accent-soft:rgba(31,122,77,0.10);
  --accent-ring:rgba(31,122,77,0.28);
  --action-fg:#ffffff;
  --selection-bg:rgba(31,122,77,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="green"]{
  --brand-primary:#3dd68c;
  --brand-primary-hover:#5ce0a0;
  --accent:#1f7a4d;
  --accent-hover:#18633e;
  --accent-soft:rgba(61,214,140,0.16);
  --accent-ring:rgba(61,214,140,0.34);
  --action-fg:#ffffff;
  --selection-bg:rgba(61,214,140,0.40);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-focus-color="teal"]{
  --brand-primary:#0f766e;
  --brand-primary-hover:#0c5f59;
  --accent:#0f766e;
  --accent-hover:#0c5f59;
  --accent-soft:rgba(15,118,110,0.12);
  --accent-ring:rgba(15,118,110,0.30);
  --action-fg:#ffffff;
  --selection-bg:rgba(15,118,110,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="teal"]{
  --brand-primary:#2dd4bf;
  --brand-primary-hover:#5eead4;
  --accent:#0f766e;
  --accent-hover:#0c5f59;
  --accent-soft:rgba(45,212,191,0.16);
  --accent-ring:rgba(45,212,191,0.34);
  --action-fg:#ffffff;
  --selection-bg:rgba(45,212,191,0.40);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-focus-color="cyan"]{
  --brand-primary:#0891b2;
  --brand-primary-hover:#0e7490;
  --accent:#0891b2;
  --accent-hover:#0e7490;
  --accent-soft:rgba(8,145,178,0.12);
  --accent-ring:rgba(8,145,178,0.30);
  --action-fg:#ffffff;
  --selection-bg:rgba(8,145,178,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="cyan"]{
  --brand-primary:#22d3ee;
  --brand-primary-hover:#67e8f9;
  --accent:#0891b2;
  --accent-hover:#0e7490;
  --accent-soft:rgba(34,211,238,0.16);
  --accent-ring:rgba(34,211,238,0.34);
  --action-fg:#ffffff;
  --selection-bg:rgba(34,211,238,0.40);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-focus-color="blue"]{
  --brand-primary:#2756c7;
  --brand-primary-hover:#1e439d;
  --accent:#2756c7;
  --accent-hover:#1e439d;
  --accent-soft:rgba(39,86,199,0.10);
  --accent-ring:rgba(39,86,199,0.28);
  --action-fg:#ffffff;
  --selection-bg:rgba(39,86,199,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="blue"]{
  --brand-primary:#5b8def;
  --brand-primary-hover:#7aa3f5;
  --accent:#2756c7;
  --accent-hover:#1e439d;
  --accent-soft:rgba(91,141,239,0.16);
  --accent-ring:rgba(91,141,239,0.34);
  --action-fg:#ffffff;
  --selection-bg:rgba(91,141,239,0.40);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-focus-color="indigo"]{
  --brand-primary:#4338ca;
  --brand-primary-hover:#3730a3;
  --accent:#4338ca;
  --accent-hover:#3730a3;
  --accent-soft:rgba(67,56,202,0.12);
  --accent-ring:rgba(67,56,202,0.30);
  --action-fg:#ffffff;
  --selection-bg:rgba(67,56,202,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="indigo"]{
  --brand-primary:#818cf8;
  --brand-primary-hover:#a5b4fc;
  --accent:#4338ca;
  --accent-hover:#3730a3;
  --accent-soft:rgba(129,140,248,0.16);
  --accent-ring:rgba(129,140,248,0.34);
  --action-fg:#ffffff;
  --selection-bg:rgba(129,140,248,0.40);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-focus-color="violet"]{
  --brand-primary:#7c3aed;
  --brand-primary-hover:#6d28d9;
  --accent:#7c3aed;
  --accent-hover:#6d28d9;
  --accent-soft:rgba(124,58,237,0.12);
  --accent-ring:rgba(124,58,237,0.30);
  --action-fg:#ffffff;
  --selection-bg:rgba(124,58,237,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="violet"]{
  --brand-primary:#a78bfa;
  --brand-primary-hover:#c4b5fd;
  --accent:#7c3aed;
  --accent-hover:#6d28d9;
  --accent-soft:rgba(167,139,250,0.16);
  --accent-ring:rgba(167,139,250,0.34);
  --action-fg:#ffffff;
  --selection-bg:rgba(167,139,250,0.40);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-focus-color="pink"]{
  --brand-primary:#db2777;
  --brand-primary-hover:#be185d;
  --accent:#db2777;
  --accent-hover:#be185d;
  --accent-soft:rgba(219,39,119,0.12);
  --accent-ring:rgba(219,39,119,0.30);
  --action-fg:#ffffff;
  --selection-bg:rgba(219,39,119,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="pink"]{
  --brand-primary:#f472b6;
  --brand-primary-hover:#f9a8d4;
  --accent:#db2777;
  --accent-hover:#be185d;
  --accent-soft:rgba(244,114,182,0.16);
  --accent-ring:rgba(244,114,182,0.34);
  --action-fg:#ffffff;
  --selection-bg:rgba(244,114,182,0.40);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-focus-color="rose"]{
  --brand-primary:#e11d48;
  --brand-primary-hover:#be123c;
  --accent:#e11d48;
  --accent-hover:#be123c;
  --accent-soft:rgba(225,29,72,0.12);
  --accent-ring:rgba(225,29,72,0.30);
  --action-fg:#ffffff;
  --selection-bg:rgba(225,29,72,0.28);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}
html[data-theme="dark"][data-focus-color="rose"]{
  --brand-primary:#fb7185;
  --brand-primary-hover:#fda4af;
  --accent:#e11d48;
  --accent-hover:#be123c;
  --accent-soft:rgba(251,113,133,0.16);
  --accent-ring:rgba(251,113,133,0.34);
  --action-fg:#ffffff;
  --selection-bg:rgba(251,113,133,0.40);
  --selection-fg:var(--brand-ink);
  --status-info:var(--brand-primary);
  --brand:var(--brand-primary);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html {
  overflow-x: clip;
}

body {
  overflow-x: clip;
  max-width: 100%;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

::selection {
  background: var(--selection-bg);
  color: var(--text);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
}

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

h1, h2, h3, h4 {
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

i[class^="fi"],
i[class*=" fi"] {
  display: inline-flex;
  line-height: 0;
  vertical-align: middle;
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

/* ---------- Scrollbars ---------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
  background-clip: content-box;
}

::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

/* ---------- Native control normalization ---------- */

button {
  font-family: inherit;
  color: inherit;
}

button:not([class]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-height);
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 600;
  font-size: var(--fs-md);
  cursor: pointer;
  transition: border-color var(--transition-speed) ease, background-color var(--transition-speed) ease;
}

button:not([class]):hover {
  border-color: var(--border-strong);
  background: var(--panel-3);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

textarea.field-input {
  min-height: 88px;
  resize: vertical;
  line-height: 1.5;
}

input[type="file"].field-input {
  padding: 8px 12px;
  cursor: pointer;
}

input[type="file"].field-input::file-selector-button {
  margin-right: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-3);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

input[type="date"].field-input::-webkit-calendar-picker-indicator,
input[type="month"].field-input::-webkit-calendar-picker-indicator,
input[type="time"].field-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
}

html[data-theme="dark"] input[type="date"].field-input::-webkit-calendar-picker-indicator,
html[data-theme="dark"] input[type="month"].field-input::-webkit-calendar-picker-indicator,
html[data-theme="dark"] input[type="time"].field-input::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.4);
}

/* ---------- Checkboxes & radios ---------- */

input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 19px;
  height: 19px;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  background: var(--panel-2);
  border-radius: 6px;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

input[type="radio"] {
  border-radius: var(--radius-circle);
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
  border-color: var(--border-strong);
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
  content: "";
  width: 6px;
  height: 10px;
  margin-top: -2px;
  border: solid var(--action-fg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="radio"]:checked::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-circle);
  background: var(--action-fg);
}

input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* ---------- Segmented toggle (single-select button group) ---------- */

.seg-group {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.seg-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--fs-md);
  cursor: pointer;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: none;
  border-color: var(--border);
}

.seg-btn[data-variant="income"].active {
  color: var(--success);
}

.seg-btn[data-variant="expense"].active {
  color: var(--danger);
}

/* ---------- Surfaces ---------- */

.surface-page {
  min-height: 100vh;
  background: var(--bg);
}

.surface-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-speed) var(--ease-out), background-color var(--transition-speed) var(--ease-out), box-shadow var(--transition-speed) var(--ease-out);
}

.text-muted {
  color: var(--text-muted);
}

/* ---------- Buttons ---------- */

.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control-height);
  padding: 4px 12px;
  border-radius: var(--radius-md);
  font-weight: 650;
  font-size: var(--fs-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color var(--transition-speed) var(--ease-out),
    border-color var(--transition-speed) var(--ease-out),
    color var(--transition-speed) var(--ease-out),
    transform 0.08s var(--ease-out),
    box-shadow var(--transition-speed) var(--ease-out);
}

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
  transform: scale(var(--press-scale));
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.btn-primary {
  background: var(--accent);
  color: var(--action-fg);
  border-color: transparent;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--action-fg);
  box-shadow: var(--shadow-primary-hover);
}

.btn-primary:active {
  box-shadow: var(--shadow-primary-press);
}

.btn-secondary {
  background: var(--control-bg);
  color: var(--text);
  border-color: transparent;
}

.btn-secondary:hover {
  border-color: var(--border);
  background: color-mix(in srgb, var(--control-bg) 52%, var(--text) 22%);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(0.92);
  color: #fff;
}

.btn-sm {
  min-height: 28px;
  padding: 2px 8px;
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--control-bg);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  flex: none;
  transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.icon-btn .fi {
  display: block;
  line-height: 1;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  background: var(--panel-2);
  color: var(--text);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-btn:disabled:hover {
  background: var(--panel);
  color: var(--text-muted);
}

.icon-btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--action-fg);
}

.icon-btn-primary:hover {
  background: var(--accent-hover);
  border-color: transparent;
  color: var(--action-fg);
}

.icon-btn-danger:hover {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border-strong));
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- Forms ---------- */

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.field-input {
  width: 100%;
  min-height: var(--control-height);
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--control-bg);
  color: var(--text);
  font-size: var(--fs-sm);
  transition: border-color var(--transition-speed) var(--ease-out), box-shadow var(--transition-speed) var(--ease-out), background-color var(--transition-speed) var(--ease-out);
}

.field-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-focus);
  background: var(--control-bg);
}

select.field-input {
  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='%238a909b' stroke-width='3' 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;
}

.error-text {
  color: var(--danger);
  font-size: var(--fs-sm);
}

.stack {
  display: grid;
  gap: var(--stack-gap);
  min-width: 0;
  max-width: 100%;
}

/* ---------- Page header ---------- */

.page-title {
  margin: 0 0 16px;
  font-size: var(--fs-2xl);
  font-weight: 700;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-header .page-title {
  margin: 0;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-block {
  margin-top: 28px;
  min-width: 0;
  max-width: 100%;
}

.section-block h2 {
  margin: 0 0 12px;
  font-size: var(--fs-lg);
  font-weight: 600;
}

/* ---------- App shell ---------- */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-main-col {
  min-width: 0;
  max-width: 100%;
}

.app-sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-right: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  background: var(--panel-2);
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
}

.app-brand {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 820;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--text);
  padding: 10px 8px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-main {
  padding: var(--page-pad);
  max-width: min(var(--content-max-width), 100%);
  width: 100%;
  min-width: 0;
  margin-inline: auto;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 8px 10px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 1px 0;
  min-height: 30px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 520;
  font-size: var(--fs-sm);
  transition: background-color var(--transition-speed) var(--ease-out), color var(--transition-speed) var(--ease-out);
}

.nav-link i {
  font-size: 0.9rem;
  width: 1.25em;
  justify-content: center;
}

.nav-link:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}

.nav-link.active {
  background: var(--accent);
  color: var(--action-fg);
  font-weight: 650;
}

.nav-link.active i {
  color: var(--action-fg);
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* ---------- Spaces switcher ---------- */

.space-switcher {
  position: relative;
  margin: 4px 0 10px;
}

.space-switcher-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition-speed) ease, background-color var(--transition-speed) ease;
}

.space-switcher-btn:hover {
  border-color: var(--border-strong);
}

.space-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--text) 14%, transparent);
  color: var(--text);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.space-switcher-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.space-switcher-caret {
  color: var(--muted);
  font-size: 13px;
}

.space-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
  max-height: 320px;
  overflow-y: auto;
}

.space-menu[hidden] {
  display: none;
}

.space-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-size: var(--fs-sm);
}

.space-menu-item:hover {
  background: var(--panel-2);
}

.space-menu-item.active {
  color: var(--text);
  font-weight: 650;
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.space-menu-item i {
  font-size: 15px;
  width: 18px;
  justify-content: center;
}

.space-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

/* ---------- Top bar (mobile) ---------- */

.app-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--topbar-height);
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.app-topbar .app-brand {
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Theme toggle ---------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
}

.theme-toggle:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border-color: color-mix(in srgb, var(--text) 28%, transparent);
}

/* ---------- Mobile bottom nav ---------- */

.mobile-bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: calc(var(--mobile-nav-clearance) + env(safe-area-inset-bottom, 0px));
  }

  .app-sidebar {
    display: none;
  }

  .app-topbar {
    display: flex;
  }

  .app-main {
    padding: 18px 16px;
  }

  .mobile-bottom-nav {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
  }

  .mobile-nav-bar {
    display: flex;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }

  .mobile-nav-bar > a,
  .mobile-more-btn,
  .mobile-nav-grid a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 2px;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
  }

  .mobile-more-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
  }

  .mobile-nav-bar > a i,
  .mobile-more-btn i,
  .mobile-nav-grid a i {
    font-size: 19px;
  }

  .mobile-more-btn i {
    transition: transform 0.2s ease;
  }

  .mobile-nav-bar > a.active,
  .mobile-more-btn.active,
  .mobile-nav-grid a.active {
    color: var(--text);
    font-weight: 650;
  }

  .mobile-bottom-nav.expanded .mobile-more-btn i {
    transform: rotate(180deg);
  }

  .mobile-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    padding: 0 6px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease, padding 0.28s ease;
  }

  .mobile-bottom-nav.expanded .mobile-nav-grid {
    max-height: 40vh;
    padding: 6px 6px 0;
    overflow-y: auto;
  }
}

/* ---------- Auth ---------- */

.auth-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  max-width: 100%;
  overflow-x: clip;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 28px 24px;
  box-shadow: none;
}

.auth-brand {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 820;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 22px;
  display: block;
}

.auth-title {
  margin: 0 0 20px;
  font-size: var(--fs-xl);
  font-weight: 650;
  letter-spacing: -0.03em;
}

/* ---------- Floating add ---------- */

.floating-add {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--mobile-nav-clearance) + 16px + env(safe-area-inset-bottom, 0px));
  width: 48px;
  height: 48px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--action-fg);
  font-size: 22px;
  line-height: 1;
  box-shadow: var(--shadow-elevated);
  cursor: pointer;
  z-index: 30;
  transition: transform var(--transition-speed) var(--ease-out), background-color var(--transition-speed) ease;
}

.floating-add:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

@media (min-width: 901px) {
  .floating-add {
    right: 20px;
    bottom: 28px;
  }
}

/* ---------- KPI ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr));
  gap: 14px;
}

.kpi-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-grid-3 .kpi-card {
  min-width: 0;
}

.kpi-grid-3 .kpi-value {
  overflow-wrap: anywhere;
  font-size: clamp(1.05rem, 2.2vw, var(--fs-xl));
}

.kpi-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-label {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.kpi-value {
  font-size: var(--fs-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kpi-value-hero {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hero-kpi {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--space-xl);
  align-items: stretch;
  padding: var(--card-pad-y) var(--card-pad-x);
}

.hero-kpi-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.hero-kpi-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.hero-kpi-split .kpi-value {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-lg);
}

.panel-pad {
  padding: var(--card-pad-y) var(--card-pad-x);
}

.mt-md {
  margin-top: var(--space-md);
}

.section-heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.section-heading-row h2 {
  margin: 0;
}

.chart-host {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.chart-host.panel-pad {
  padding-right: 12px;
}

.chart-host-sparkline {
  min-height: 88px;
  align-self: end;
}

.chart-host-md {
  min-height: 260px;
}

.chart-host-lg {
  min-height: 300px;
}

.chart-empty {
  margin: 0;
  padding: 28px 8px;
  text-align: center;
}

.chart-sparkline-empty {
  min-height: 88px;
  background:
    linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--brand-primary) 8%, transparent) 100%);
  border-radius: var(--radius-md);
}

.split-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr);
  gap: var(--space-xl);
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.split-panel-visual,
.split-panel-list {
  min-width: 0;
}

.cashflow-compare {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cashflow-compare-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: var(--fs-sm);
}

.cashflow-compare-label {
  color: var(--text-muted);
  font-weight: 500;
}

.cashflow-compare-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cashflow-compare-track {
  height: 10px;
  background: var(--panel-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.cashflow-compare-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.35s var(--ease-out);
}

.cashflow-compare-row.is-income .cashflow-compare-value {
  color: var(--success);
}

.cashflow-compare-row.is-income .cashflow-compare-fill {
  background: var(--success);
}

.cashflow-compare-row.is-expense .cashflow-compare-value {
  color: var(--danger);
}

.cashflow-compare-row.is-expense .cashflow-compare-fill {
  background: var(--danger);
}

.donut-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.donut-figure {
  position: relative;
  width: min(180px, 100%);
  aspect-ratio: 1;
}

.donut-figure svg {
  display: block;
  width: 100%;
  height: auto;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  padding: 18%;
}

.donut-center-label {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 500;
}

.donut-center-value {
  font-size: var(--fs-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.donut-legend li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: var(--fs-xs);
}

.donut-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-sm);
}

.donut-legend-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.donut-legend-meta {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-height);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  cursor: pointer;
  user-select: none;
  font-size: var(--fs-sm);
  transition: border-color var(--transition-speed) ease, background-color var(--transition-speed) ease;
}

.filter-chip:hover {
  border-color: var(--border-strong);
  background: var(--panel-2);
}

.filter-chip:has(input:checked) {
  border-color: color-mix(in srgb, var(--brand-primary) 55%, var(--border));
  background: var(--accent-soft);
}

.filter-chip input {
  margin: 0;
  accent-color: var(--brand-primary);
}

.series-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.field-hint {
  margin: 8px 0 0;
  font-size: var(--fs-sm);
}

/* ---------- Lists / rows ---------- */

.list-row,
.ledger-row,
.category-row,
.reminder-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  min-height: 56px;
  min-width: 0;
  max-width: 100%;
}

.list-row-main,
.ledger-row-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.list-row-main strong,
.ledger-row-main strong,
.category-info strong,
.reminder-row strong {
  font-size: var(--fs-md);
  font-weight: 650;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-row-meta,
.ledger-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-row-side {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 52%;
}

.list-row-balance,
.ledger-row-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-md);
  line-height: 1.25;
  text-align: right;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ledger-row-amount:has(.ledger-total-sep) {
  white-space: normal;
}

.list-row-actions,
.reminder-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.list-row-actions .icon-btn,
.reminder-actions .icon-btn {
  width: 30px;
  height: 30px;
  font-size: 14px;
  border-color: transparent;
  background: transparent;
}

.list-row-actions .icon-btn:hover,
.reminder-actions .icon-btn:hover {
  border-color: var(--border-strong);
  background: var(--panel-2);
}

.list-row-actions .icon-btn-primary,
.reminder-actions .icon-btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--action-fg);
}

.list-row-actions .icon-btn-primary:hover,
.reminder-actions .icon-btn-primary:hover {
  background: var(--accent-hover);
  border-color: transparent;
  color: var(--action-fg);
}

.ledger-row {
  cursor: pointer;
  transition: background-color var(--transition-speed) ease;
}

.ledger-row:hover {
  background: var(--panel-2);
}

.amount-income,
.amount-positive {
  color: var(--success);
}

.amount-expense,
.amount-negative {
  color: var(--danger);
}

.amount-transfer {
  color: var(--text-muted);
}

.category-row {
  min-height: 48px;
}

.category-info {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-circle);
}

.categories-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.category-section {
  padding: 0;
}

.category-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.category-section-title {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 600;
}

.color-swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.color-swatch {
  height: 32px;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: var(--swatch);
  cursor: pointer;
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.color-swatch:hover {
  transform: scale(1.05);
}

.color-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-muted {
  background: var(--panel-2);
  color: var(--text-muted);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
  overflow-y: auto;
}

.modal-overlay[hidden] {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 22px;
  box-shadow: var(--shadow-overlay);
}

.modal-wide {
  max-width: 560px;
}

.adjust-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.adjust-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-2);
}

.adjust-card-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.adjust-card-field .field-label {
  margin: 0;
}

.adjust-wallet-name,
.adjust-current {
  min-height: var(--control-height);
  display: flex;
  align-items: center;
  font-size: var(--fs-md);
  font-weight: 650;
}

.adjust-wallet-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adjust-current {
  font-variant-numeric: tabular-nums;
}

.adjust-card-field .field-input.amount-positive {
  color: var(--success);
  font-weight: 650;
}

.adjust-card-field .field-input.amount-negative {
  color: var(--danger);
  font-weight: 650;
}

.adjust-card-delta {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

.ledger-total-sep {
  color: var(--text-muted);
  font-weight: 500;
}

@media (max-width: 900px) {
  .adjust-card {
    grid-template-columns: 1fr 1fr;
  }

  .adjust-card-field:first-child {
    grid-column: 1 / -1;
  }

  .adjust-card-delta .adjust-card-field:first-child {
    grid-column: auto;
  }
}

.modal-overlay.modal-layer-2 {
  z-index: 120;
  background: rgba(0, 0, 0, 0.4);
}

/* Popups fill the screen on mobile for comfortable one-hand editing.
   Declared after the base modal rules so the full-bleed sizing wins
   inside the mobile breakpoint. */
@media (max-width: 900px) {
  .modal-overlay {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }

  .modal-card,
  .modal-wide {
    max-width: none;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: none;
  }
}

/* ---------- Picker (searchable list, e.g. currency/category) ---------- */

.picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: var(--control-height);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition-speed) ease, background-color var(--transition-speed) ease;
}

.picker-trigger:hover {
  border-color: var(--border-strong);
}

.picker-trigger.is-placeholder {
  color: var(--muted);
}

.picker-trigger i {
  color: var(--muted);
  font-size: 13px;
}

.picker-search {
  margin-bottom: 10px;
}

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0 6px;
}

.picker-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  padding-left: calc(12px + var(--picker-depth, 0) * 18px);
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: default;
  text-align: left;
  font-size: var(--fs-md);
}

.picker-option-group {
  font-weight: 700;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  pointer-events: none;
  margin-top: 6px;
}

.picker-option-group:first-child {
  margin-top: 0;
}

.picker-option-selectable {
  cursor: pointer;
  font-weight: 500;
}

.picker-option-selectable:hover {
  background: var(--panel-2);
}

.picker-option-selectable.active {
  background: var(--accent);
  color: var(--action-fg);
  font-weight: 650;
}

.picker-option .picker-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  font-weight: 700;
  color: var(--text-muted);
}

.picker-option .picker-meta {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.picker-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* ---------- Date / time picker ---------- */

.dp-trigger-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dp-card {
  max-width: 360px;
}

.dp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.dp-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition-speed) ease, background-color var(--transition-speed) ease;
}

.dp-nav-btn:hover {
  border-color: var(--border-strong);
}

.dp-month-label {
  flex: 1;
  min-height: 40px;
  padding: 0 12px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: var(--fs-md);
  cursor: pointer;
  transition: background-color var(--transition-speed) ease;
}

.dp-month-label:hover {
  background: var(--panel-2);
}

.dp-weekdays,
.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dp-weekday {
  text-align: center;
  padding: 6px 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.dp-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  min-height: 40px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: var(--fs-md);
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.dp-day:hover {
  background: var(--panel-2);
}

.dp-day.active {
  background: var(--accent);
  color: var(--action-fg);
  font-weight: 650;
}

.dp-day-blank {
  cursor: default;
  background: transparent;
}

.dp-day-blank:hover {
  background: transparent;
}

.dp-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.dp-month-option {
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: var(--fs-md);
  transition: border-color var(--transition-speed) ease, background-color var(--transition-speed) ease;
}

.dp-month-option:hover {
  border-color: var(--border-strong);
}

.dp-month-option.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--action-fg);
  font-weight: 650;
}

.dp-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.dp-time-label {
  color: var(--text-muted);
  font-weight: 600;
}

.dp-time-fields {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dp-time-select {
  width: auto;
  min-width: 72px;
  text-align: center;
}

.dp-time-sep {
  font-weight: 700;
  color: var(--text-muted);
}

.dp-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 6px;
}

.field-label-row .field-label {
  margin-bottom: 0;
}

.hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  cursor: help;
  position: relative;
  vertical-align: middle;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
  transition: background var(--transition-speed) ease, color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.hint:hover,
.hint:focus-visible,
.hint.is-open {
  background: var(--accent);
  color: var(--action-fg);
  outline: none;
  border-color: var(--accent);
}

.hint i {
  font-size: 9px;
  line-height: 1;
}

.hint-bubble {
  position: fixed;
  left: 0;
  top: 0;
  min-width: 200px;
  max-width: 300px;
  padding: 8px 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-elevated);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease;
  z-index: 1100;
  white-space: normal;
  cursor: default;
}

.hint:hover .hint-bubble,
.hint:focus-visible .hint-bubble,
.hint.is-open .hint-bubble {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.hint-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: var(--hint-arrow-left, 50%);
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border);
}

.hint-bubble--below::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--border);
}

/* ---------- Day-of-period picker ---------- */

.day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-grid.day-grid-months {
  grid-template-columns: repeat(4, 1fr);
}

.day-cell {
  min-height: 36px;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition-speed) ease, background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.day-cell:hover {
  border-color: var(--border-strong);
}

.day-cell.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--action-fg);
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-title {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 700;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  color: var(--text);
  background: var(--panel-2);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* ---------- Tabs ---------- */

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  background: var(--panel-2);
  border-radius: var(--radius-md);
}

.tab-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 38px;
  padding: 6px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.tab-btn.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--border);
}

.tab-btn:disabled {
  cursor: default;
}

.tab-btn:disabled:not(.active) {
  opacity: 0.45;
}

@media (max-width: 640px) {
  #tx-tab-bar .tab-btn {
    flex: 1 1 calc(50% - 4px);
  }
}

/* Quick-transaction chips shown at the top of each new-entry tab. */
.qt-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.qt-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.qt-chip:hover {
  border-color: var(--border-strong);
  background: var(--panel);
}

.qt-chip-amount {
  color: var(--text-muted);
  font-weight: 500;
}

.qt-hint {
  margin: 4px 0 0;
  font-size: var(--fs-sm);
}

/* Compact inline segmented control (e.g. categories income/expense toggle). */
.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--panel-2);
  border-radius: var(--radius-pill);
}

.segmented-btn {
  min-height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.segmented-btn.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: none;
}

/* Side-by-side form fields (e.g. transaction date + time). */
.field-row {
  display: flex;
  gap: 12px;
}

.field-col {
  flex: 1 1 0;
  min-width: 0;
}

.field-col-time {
  flex: 0 0 40%;
}

.field-col .field-input {
  width: 100%;
}

/* ---------- Filters ---------- */

.filter-bar {
  padding: 16px;
  margin-bottom: 16px;
  min-width: 0;
  max-width: 100%;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
  gap: 12px 16px;
  align-items: end;
  min-width: 0;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.filter-field .field-label {
  margin: 0;
}

.filter-field .field-input {
  width: 100%;
}

.filter-grid-2 {
  grid-template-columns: repeat(2, minmax(140px, 1fr));
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 16px;
  cursor: pointer;
}

.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

/* ---------- Reminders ---------- */

.reminders-strip {
  margin-bottom: 16px;
}

.reminders-title {
  margin: 0 0 8px;
  font-weight: 600;
}

.reminders-strip .stack {
  gap: 8px;
}

/* ---------- Tables ---------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.table-wrap {
  padding: 0;
  overflow-x: auto;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ---------- Admin database ---------- */

.db-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 16px;
  align-items: start;
}

.db-tables {
  padding: 12px;
  position: sticky;
  top: 16px;
}

.db-tables-head {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  padding: 4px 8px 8px;
}

.db-table-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 70vh;
  overflow-y: auto;
}

.db-table-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--text);
}

.db-table-item:hover {
  background: var(--panel-2);
}

.db-table-item.active {
  background: var(--accent);
  color: var(--action-fg);
}

.db-table-name {
  font-weight: 600;
  font-size: var(--fs-sm);
  word-break: break-all;
}

.db-table-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.db-view {
  min-width: 0;
}

.db-view-empty {
  padding: 32px;
  text-align: center;
}

.db-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px;
  margin-bottom: 12px;
}

.db-view-title {
  margin: 0;
  font-size: var(--fs-md);
}

.db-view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.db-search {
  min-width: 200px;
}

.db-cell {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-cell-editable {
  cursor: text;
}

.db-cell-editable:hover {
  background: var(--panel-2);
}

.db-cell-input {
  min-height: 32px;
  padding: 4px 8px;
}

.db-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .db-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .db-tables {
    position: static;
  }

  .db-table-list {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
  }

  .db-search {
    min-width: 0;
    flex: 1 1 100%;
  }
}

/* ---------- Bar list ---------- */

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-list-row {
  display: grid;
  grid-template-columns: 10px minmax(72px, 1.1fr) minmax(0, 2fr) auto;
  gap: 10px;
  align-items: center;
}

.bar-list-swatch {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.bar-list-label {
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-list-track {
  height: 8px;
  background: var(--panel-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
  min-width: 48px;
}

.bar-list-fill {
  height: 100%;
  background: var(--brand-primary);
  border-radius: var(--radius-pill);
  transition: width 0.35s var(--ease-out);
}

.bar-list-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
  font-size: var(--fs-sm);
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .hero-kpi {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .chart-host-sparkline {
    order: -1;
    min-height: 72px;
  }

  .split-panel {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
  }

  .kpi-grid-3 {
    grid-template-columns: 1fr;
  }

  .filter-grid,
  .filter-grid-2 {
    grid-template-columns: 1fr;
  }

  .bar-list-row {
    grid-template-columns: 10px minmax(0, 1fr) auto;
    grid-template-areas:
      "swatch label value"
      "track track track";
    row-gap: 6px;
  }

  .bar-list-swatch { grid-area: swatch; }
  .bar-list-label { grid-area: label; }
  .bar-list-value { grid-area: value; }
  .bar-list-track { grid-area: track; }

  .chart-host-md {
    min-height: 220px;
  }

  .chart-host-lg {
    min-height: 240px;
  }

  .section-heading-row {
    align-items: flex-start;
  }

  .filter-chip {
    min-height: var(--control-height-mobile);
  }
}

@media (max-width: 480px) {
  .hero-kpi-split {
    grid-template-columns: 1fr;
  }

  .kpi-value-hero {
    font-size: 1.7rem;
  }
}

/* ---------- Settings ---------- */

.settings-section {
  padding: 22px;
  margin-bottom: 16px;
}

.settings-section h2 {
  margin: 0 0 16px;
  font-size: var(--fs-lg);
}

.settings-danger {
  border-color: var(--danger-soft);
}

.session-list {
  margin: 0 0 16px;
  padding-left: 18px;
}

/* ---------- Empty state ---------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 34px;
  color: var(--muted);
}
