/* ExioCraftz Expense Tracker */

@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url(/fonts/sora-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url(/fonts/sora-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --surface: rgba(255, 253, 249, 0.86);
  --surface-solid: #fffdf9;
  --surface-2: #f8f5ee;
  --ink: #0d0f10;
  --ink-2: #3f4447;
  --muted: #5f6467;
  --line: rgba(13, 15, 16, 0.09);
  --line-strong: rgba(13, 15, 16, 0.16);
  --accent: #0e5d5f;
  --accent-hover: #0a4a4c;
  --accent-soft: #dcefe9;
  --mint: #6fdcae;
  --lime: #c9dd8a;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5a00;
  --warn-soft: #fdf3dc;
  --ok: #1d7a46;
  --ok-soft: #e3f4ea;
  --focus: #0e7c7f;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(13, 15, 16, 0.04), 0 12px 32px -12px rgba(13, 15, 16, 0.12);
  --font: 'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Menlo, Consolas, monospace;
  --topbar-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1[tabindex="-1"]:focus { outline: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; text-decoration: none;
}
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ ambient background */
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.orb {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(90px); will-change: transform;
}
.orb-a {
  width: 60vmax; height: 60vmax; left: -18vmax; top: -22vmax;
  background: radial-gradient(circle, rgba(111, 220, 174, 0.42), transparent 65%);
  animation: drift-a 32s ease-in-out infinite alternate;
}
.orb-b {
  width: 52vmax; height: 52vmax; right: -16vmax; top: 8vh;
  background: radial-gradient(circle, rgba(201, 221, 138, 0.45), transparent 65%);
  animation: drift-b 38s ease-in-out infinite alternate;
}
.orb-c {
  width: 46vmax; height: 46vmax; left: 20vw; bottom: -26vmax;
  background: radial-gradient(circle, rgba(31, 143, 139, 0.22), transparent 65%);
  animation: drift-c 44s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate3d(14vw, 10vh, 0) scale(1.08); } }
@keyframes drift-b { to { transform: translate3d(-12vw, 14vh, 0) scale(0.92); } }
@keyframes drift-c { to { transform: translate3d(10vw, -12vh, 0) scale(1.1); } }
#contours { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.55; }
.grain {
  position: absolute; inset: 0; opacity: 0.35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.05 0 0 0 0 0.06 0 0 0 0 0.06 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.motion-off .orb { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------ brand */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.mark { width: 30px; height: 30px; color: var(--ink); }
.mark-lg { width: 56px; height: 56px; }
.wordmark { font-size: 18px; letter-spacing: -0.02em; font-weight: 300; }
.wordmark b { font-weight: 700; }
.brand-lg .mark { width: 40px; height: 40px; }
.brand-lg .wordmark { font-size: 22px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2);
  padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.6); border: 1px solid var(--line);
}
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: #22b07d; box-shadow: 0 0 0 3px rgba(34, 176, 125, 0.18); }

.glass {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
}

/* ------------------------------------------------------------------ boot & login */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot .mark { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 420px; border-radius: 28px; padding: 36px 32px 28px; }
.login-card .brand { display: flex; margin-bottom: 24px; }
.login-title { font-size: 30px; margin: 18px 0 6px; }
.login-card form { margin-top: 24px; display: grid; gap: 4px; }
.login-card .btn-block { margin-top: 10px; }
.fineprint { font-size: 12.5px; color: var(--muted); margin-top: 20px; text-align: center; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 500; font-size: 14.5px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px -8px rgba(14, 93, 95, 0.7); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: rgba(255, 255, 255, 0.65); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8f1c13; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn[aria-busy='true'] { position: relative; color: transparent !important; }
.btn[aria-busy='true']::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #fff; animation: spin 0.7s linear infinite;
}
.btn-ghost[aria-busy='true']::after { border-color: var(--line-strong); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: transparent; border: 1px solid transparent; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: rgba(13, 15, 16, 0.06); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn.danger { color: var(--danger); }

/* ------------------------------------------------------------------ forms */
.field { display: grid; gap: 6px; margin-bottom: 12px; min-width: 0; }
.field > label, .label { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
input:where(:not([type='checkbox'], [type='radio'], [type='file'])), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 72px; }
select {
  appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%233f4447' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(14, 124, 127, 0.18); }
[aria-invalid='true'] { border-color: var(--danger) !important; }
[aria-invalid='true']:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.15) !important; }
.field-error { font-size: 13px; color: var(--danger); min-height: 0; }
.field-error:empty { display: none; }
.hint { font-size: 12.5px; color: var(--muted); }
.form-alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 12px;
  border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 14px;
}
.form-alert ul { margin: 6px 0 0; padding-left: 18px; }
.form-alert.success { background: var(--ok-soft); color: var(--ok); }
.input-affix { position: relative; display: flex; align-items: center; }
/* :where() keeps the base input rule low-specificity so these paddings win */
.input-affix input { padding-right: 70px; }
.input-affix.prefix input { padding-left: 34px; padding-right: 14px; }
.input-affix .affix { position: absolute; left: 14px; color: var(--muted); font-weight: 500; pointer-events: none; }
.affix-btn {
  position: absolute; right: 6px; height: 32px; padding: 0 12px; border-radius: 8px;
  background: transparent; border: 0; color: var(--accent); font-size: 13px; font-weight: 500; cursor: pointer;
}
.affix-btn:hover { background: var(--accent-soft); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.checkbox input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch input { appearance: none; flex: none; width: 46px; height: 28px; border-radius: 999px; background: #cfccc4; position: relative; cursor: pointer; transition: background 0.2s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform 0.2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.file-drop {
  display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: var(--radius-sm);
  border: 1.5px dashed var(--line-strong); background: rgba(255, 255, 255, 0.55); cursor: pointer;
  color: var(--ink-2); font-size: 14px; transition: border-color 0.15s, background 0.15s;
}
.file-drop svg { width: 20px; height: 20px; flex: none; color: var(--accent); }
.file-drop:hover, .file-drop.dragover { border-color: var(--accent); background: var(--accent-soft); }
input[type='file']:focus-visible + .file-drop, .file-drop:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.receipt-current { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 14px; margin-bottom: 8px; }
.receipt-current svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.receipt-current a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ app shell */
.app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  background: linear-gradient(to bottom, rgba(244, 241, 234, 0.92), rgba(244, 241, 234, 0.6));
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; gap: 4px; padding: 5px; border-radius: 999px; }
.nav a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
  color: rgba(13, 15, 16, 0.66); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav a svg { width: 17px; height: 17px; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current='page'] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(13, 15, 16, 0.08); }
.topbar-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.user-menu { position: relative; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-strong); cursor: pointer;
  background: linear-gradient(135deg, var(--mint), var(--lime)); font-weight: 600; color: var(--ink);
}
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 8px; border-radius: 16px; z-index: 30; background: var(--surface-solid); }
.menu-head { padding: 8px 12px 10px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head strong { color: var(--ink); }
.menu-item {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; border: 0; background: none;
  color: var(--ink); text-decoration: none; cursor: pointer; font-size: 14px;
}
.menu-item:hover, .menu-item:focus-visible { background: rgba(13, 15, 16, 0.05); }
.fab { display: none; }

main { max-width: 1240px; margin: 0 auto; padding: 28px 24px 64px; outline: none; }

/* ------------------------------------------------------------------ page header & filters */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 30px; }
.page-head .sub { color: var(--muted); margin-top: 6px; }
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 12px; border-radius: 18px; margin-bottom: 20px;
}
.filters .field { margin: 0; }
.filters label { font-size: 12px; font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.filters select, .filters input:where(:not([type='checkbox'])) { min-height: 40px; padding-top: 7px; padding-bottom: 7px; font-size: 14px; }
.filters .grow { flex: 1 1 220px; }
.filters .w-sm { flex: 0 1 150px; }
.filters .w-md { flex: 0 1 190px; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px !important; }
.filters .actions { display: flex; gap: 8px; margin-left: auto; }

/* ------------------------------------------------------------------ cards & dashboard */
.card { border-radius: var(--radius); padding: 22px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-size: 16px; }
.card-head .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; overflow-wrap: anywhere; }
.kpi-meta { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi-accent { background: linear-gradient(150deg, #13242f, #0b161d); color: #fff; border-color: rgba(255,255,255,.06); }
.kpi-accent .kpi-label, .kpi-accent .kpi-meta { color: rgba(255, 255, 255, 0.68); }
.kpi-accent .kpi-value { background: linear-gradient(100deg, #8fe6c4, #c9dd8a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.delta { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.delta.up { background: rgba(253, 236, 234, 0.95); color: var(--danger); }
.delta.down { background: rgba(227, 244, 234, 0.95); color: var(--ok); }
.delta.flat { background: rgba(255,255,255,.15); color: inherit; }

.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; }
.span-12 { grid-column: span 12; }

.chart-box { position: relative; height: 260px; }
.donut-wrap { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 20px; align-items: center; }
.donut-wrap .chart-box { height: 200px; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center strong { font-size: 18px; letter-spacing: -0.02em; }
.donut-center span { font-size: 11px; color: var(--muted); font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; font-size: 14px; padding: 6px 8px; border-radius: 10px; }
.legend li:hover { background: rgba(13, 15, 16, 0.04); }
.swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.legend .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .pct { color: var(--muted); font-size: 12.5px; min-width: 42px; text-align: right; }
.legend .amt { font-weight: 500; text-align: right; }

.table-toggle { font-size: 13px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 12px; }
.data-table caption { text-align: left; font-size: 13px; color: var(--muted); padding-bottom: 6px; }
.data-table th, .data-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.data-table th { font-size: 12px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; }
.data-table td.r, .data-table th.r { text-align: right; }

/* recent list */
.tx-list { list-style: none; margin: 0; padding: 0; }
.tx { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tx:last-child { border-bottom: 0; }
.tx-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; }
.tx-main { min-width: 0; }
.tx-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.tx-title span:first-child { overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-amt { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .02em; flex: none; white-space: nowrap; }
.badge-sample { background: #fff2cc; color: #7a5300; border: 1px dashed #d9a400; }
.badge-shared { background: #e8eefb; color: #2b4f9b; }
.badge svg { width: 12px; height: 12px; }

/* budgets */
.budget-list { display: grid; gap: 14px; }
.budget-row { display: grid; gap: 6px; }
.budget-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; }
.budget-top .name { display: flex; align-items: center; gap: 8px; font-weight: 500; min-width: 0; }
.budget-top .vals { color: var(--muted); font-size: 13px; text-align: right; }
.bar { height: 8px; border-radius: 999px; background: rgba(13, 15, 16, 0.07); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.bar.warn > i { background: #d99a00; }
.bar.over > i { background: var(--danger); }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; }
.status svg { width: 14px; height: 14px; }
.status.warn { color: var(--warn); }
.status.over { color: var(--danger); }
.status.ok { color: var(--ok); }
.alerts { display: grid; gap: 10px; margin-bottom: 16px; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 14px; font-size: 14px; }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #f0d9a0; }
.alert.over { background: var(--danger-soft); color: var(--danger); border: 1px solid #f5c2bd; }
.alert.info { background: #fff6dc; color: #6b4a00; border: 1px dashed #d9a400; align-items: center; flex-wrap: wrap; }
.alert .grow { flex: 1; }

/* empty states */
.empty { text-align: center; padding: 48px 20px; display: grid; justify-items: center; gap: 10px; }
.empty h2, .empty h3 { font-size: 18px; }
.empty p { color: var(--muted); max-width: 380px; }
.empty .actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.empty-illus { width: 120px; height: 90px; margin-bottom: 4px; }
.empty-sm { padding: 28px 12px; }

/* expenses table */
.list-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
.list-summary strong { color: var(--ink); }
.etable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.etable th { text-align: left; font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--line-strong); }
.etable td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.etable tr:last-child td { border-bottom: 0; }
.etable tbody tr:hover td { background: rgba(255, 255, 255, 0.55); }
.etable .r { text-align: right; }
.etable .desc { font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.etable .notes { font-size: 12.5px; color: var(--muted); margin-top: 2px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.etable .row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.cat-chip { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.75); border: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
.cat-chip .swatch { width: 9px; height: 9px; border-radius: 50%; }
.receipt-link { display: inline-flex; color: var(--muted); }
.receipt-link svg { width: 16px; height: 16px; }
.receipt-link:hover { color: var(--accent); }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 16px; font-size: 14px; color: var(--muted); }
.sort-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.sort-btn:hover { color: var(--ink); }

/* settings */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.settings-grid .card h2 { font-size: 17px; margin-bottom: 4px; }
.settings-grid .card > p.muted { font-size: 14px; margin-bottom: 16px; }
.stack { display: grid; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cat-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; }
.cat-item { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.55); border: 1px solid var(--line); font-size: 14px; }
.cat-item .count { font-size: 12.5px; color: var(--muted); }
.cat-item .tag { font-size: 11px; color: var(--muted); font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.swatches legend { font-size: 13.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 8px; padding: 0; }
.swatches label { position: relative; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatches span { display: block; width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line-strong); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.swatches input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 3px; }
.import-errors { max-height: 220px; overflow: auto; font-size: 13px; }

/* ------------------------------------------------------------------ dialogs */
.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 24px;
  background: var(--surface-solid); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(13, 15, 16, 0.35);
}
.dialog-sm { width: min(420px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(13, 15, 16, 0.38); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dialog[open] { animation: dialog-in 0.18s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 20px 4px 24px; }
.dialog-head h2 { font-size: 20px; }
.dialog-body { padding: 12px 24px; overflow-y: auto; }
.dialog-body h2 { font-size: 19px; margin-bottom: 8px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 22px; border-top: 1px solid var(--line); }
.dialog-sm .dialog-body { padding-top: 24px; }
.dialog-sm .dialog-foot { border-top: 0; padding-top: 4px; }

/* toasts */
.toasts { position: fixed; z-index: 50; bottom: 24px; left: 50%; translate: -50% 0; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; pointer-events: auto;
  background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.2s ease-out;
}
.toast svg { width: 18px; height: 18px; flex: none; color: var(--mint); }
.toast.error svg { color: #ff9f94; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.skeleton { border-radius: 12px; background: linear-gradient(90deg, rgba(13,15,16,.05), rgba(13,15,16,.09), rgba(13,15,16,.05)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-5, .span-7, .span-6 { grid-column: span 12; }
  .nav a span { display: none; }
  .nav a { padding: 9px 12px; }
}
@media (max-width: 860px) {
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .etable thead { display: none; }
  .etable, .etable tbody, .etable tr, .etable td { display: block; }
  .etable tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
  .etable tr:last-child { border-bottom: 0; }
  .etable td { padding: 0; border: 0; }
  .etable tbody tr:hover td { background: none; }
  .etable td.c-desc { grid-column: 1; grid-row: 1; }
  .etable td.c-amt { grid-column: 2; grid-row: 1; font-size: 15px; font-weight: 600; }
  .etable td.c-info { grid-column: 1; grid-row: 2; font-size: 12.5px; color: var(--muted); align-self: center; }
  .etable td.c-info .swatch { display: inline-block; margin-right: 6px; vertical-align: 1px; }
  .etable td.c-actions { grid-column: 2; grid-row: 2; }
  .etable .hide-sm { display: none; }
}
@media (min-width: 861px) {
  .etable .show-sm { display: none; }
}
@media (max-width: 720px) {
  :root { --topbar-h: 60px; }
  body { font-size: 14.5px; }
  /* backdrop-filter would make the topbar the containing block for the fixed bottom nav */
  .topbar { grid-template-columns: 1fr auto; padding: 0 16px; -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(244, 241, 234, 0.94); }
  .alert.info { flex-direction: column; align-items: stretch; }
  .alert.info svg { display: none; }
  .nav {
    position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 25;
    justify-content: space-around; padding: 6px; border-radius: 22px; background: rgba(255, 253, 249, 0.94);
  }
  .nav a { flex-direction: column; gap: 2px; padding: 7px 4px; flex: 1; font-size: 11px; border-radius: 16px; }
  .nav a span { display: block; }
  .nav a svg { width: 20px; height: 20px; }
  .btn-add { display: none; }
  .fab {
    display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 84px); z-index: 24;
    width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--accent); color: #fff; box-shadow: 0 12px 28px -10px rgba(14, 93, 95, 0.8);
  }
  .fab svg { width: 24px; height: 24px; }
  main { padding: 20px 16px 140px; }
  .page-head h1 { font-size: 24px; }
  .kpis { gap: 10px; }
  .card { padding: 16px; border-radius: 18px; }
  .kpi-value { font-size: 21px; }
  .filters { padding: 10px; }
  .filters .grow, .filters .w-sm, .filters .w-md { flex: 1 1 calc(50% - 5px); }
  .filters .search { flex-basis: 100%; }
  .filters .actions { margin-left: 0; width: 100%; }
  .filters .actions .btn { flex: 1; }
  .donut-wrap { grid-template-columns: minmax(0, 1fr); }
  .donut-wrap .chart-box { height: 190px; max-width: 220px; margin: 0 auto; width: 100%; }
  .chart-box { height: 220px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .dialog { width: 100vw; max-width: 100vw; max-height: 94dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .dialog form { max-height: 94dvh; }
  .dialog-sm { margin: auto; border-radius: 24px; width: calc(100vw - 32px); }
  .dialog-foot .btn { flex: 1; }
  .toasts { bottom: 100px; }
  .login-card { padding: 28px 22px 22px; }
}
@media (max-width: 380px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .wordmark { display: none; }
}

@media (forced-colors: active) {
  .orb, #contours, .grain { display: none; }
  .bar > i { background: Highlight; }
}
@media print {
  .ambient, .topbar, .fab, .filters .actions, .row-actions { display: none !important; }
  .glass { box-shadow: none; border: 1px solid #ccc; backdrop-filter: none; }
}

/* ------------------------------------------------------------------ money in / money out */
.amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.amount.in { color: var(--ok); }
.amount.out { color: var(--ink); }
.tx-icon svg { width: 18px; height: 18px; color: #fff; }
.flow-tag { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.flow-tag svg { width: 14px; height: 14px; }
.flow-tag.in { color: var(--ok); }
.chart-legend { display: inline-flex; gap: 14px; font-size: 13px; color: var(--ink-2); }
.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 0 0 14px; border: 0; border-radius: 14px; background: rgba(13, 15, 16, 0.06); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border-radius: 10px; font-weight: 500; color: var(--ink-2); transition: background 0.15s, color 0.15s; }
.segmented span svg { width: 17px; height: 17px; }
.segmented input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(13, 15, 16, 0.12); }
.segmented input[value='income']:checked + span { color: var(--ok); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.type-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(13, 15, 16, 0.06); }
.type-tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.type-tabs button[aria-pressed='true'] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(13, 15, 16, 0.1); }
.code-input { letter-spacing: 0.4em; font-variant-numeric: tabular-nums; max-width: 180px; }
.cat-group-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 6px 0 8px; }
