/* AiExpenseMate: calm and clear, phone-first, one column up to 560 px. Monochrome surfaces with
   one inverted accent (ink on paper in light, paper on ink in dark); colour only where it carries
   meaning: categories, budgets, money in and out. Light and dark are the same tokens switched. */

/* Fonts are bundled so the app looks the same offline. Inter and Poppins: SIL Open Font License. */
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/poppins-latin-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/poppins-latin-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/poppins-latin-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f4f4f5;
  --bg-2: #ffffff;
  --card: #ffffff;
  --card-2: #f1f1f3;
  --ink: #0a0a0b;
  --ink-2: #3f3f46;
  --muted: #71717a;
  --line: #e4e4e7;
  --accent: #0a0a0b;         /* the inverted pill: black in light, white in dark */
  --accent-ink: #ffffff;
  --accent-soft: #ececef;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --shadow: 0 1px 2px rgba(10, 10, 11, 0.04);
  --shadow-lg: 0 16px 40px -18px rgba(10, 10, 11, 0.35);
  --radius: 20px;
  --nav-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --display: "Poppins", "Inter", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a0a0b;
  --bg-2: #121214;
  --card: #141416;
  --card-2: #1d1d21;
  --ink: #f4f4f5;
  --ink-2: #d4d4d8;
  --muted: #8d8d96;
  --line: #27272b;
  --accent: #f4f4f5;
  --accent-ink: #0a0a0b;
  --accent-soft: #26262b;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --shadow: none;
  --shadow-lg: 0 16px 40px -18px rgba(0, 0, 0, 0.9);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--ink); text-decoration: none; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; }
svg.ic { flex: none; display: inline-block; vertical-align: middle; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; position: relative; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 28px); }
.app.bare { padding-bottom: 24px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px; }
.page-head h1 { font-size: 26px; }
.page-head a.muted { font-size: 14px; color: var(--muted); }
.sub { color: var(--muted); font-size: 13px; }
.eyebrow, .hero .label, .stat .k, .day-head, .section-title h2:not(.big-title) {
  font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em;
}

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 8px; gap: 10px; }
.book-switch {
  display: inline-flex; align-items: center; gap: 9px; border: 1px solid var(--line); background: var(--card); padding: 5px 14px 5px 5px;
  border-radius: 999px; font-weight: 600; font-family: var(--display); max-width: 70%;
}
.book-switch span.name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-badge {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  color: #fff; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; font-family: var(--display);
}
.book-badge.sm { width: 20px; height: 20px; font-size: 8.5px; }
.book-badge.all { background: var(--accent); color: var(--accent-ink); }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; color: var(--ink); background: var(--card); flex: none; font-family: var(--display); }
.sync-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; border: 0; background: none; padding: 0; }
.sync-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); display: inline-block; }
.sync-dot.off i { background: var(--warn); }
.sync-dot.busy i { background: var(--muted); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ---------- the summary card ---------- */
.hero { margin: 4px 16px 14px; padding: 18px 20px 20px; border-radius: 24px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.hero .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.hero .month-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card-2); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 14px; font-family: var(--display); }
.hero .arrows { display: inline-flex; gap: 6px; }
.hero .arrows button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: transparent; display: grid; place-items: center; color: var(--ink); }
.hero .arrows button:disabled { opacity: 0.3; }
.hero .big { font-family: var(--display); font-size: 38px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.hero .bar { height: 6px; border-radius: 99px; background: var(--card-2); overflow: hidden; margin-top: 14px; }
.hero .bar > i { display: block; height: 100%; border-radius: 99px; background: var(--good); transition: width 0.4s ease; }
.hero .bar.over > i { background: var(--bad); }
.hero .meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--muted); margin-top: 8px; }
.hero .meta b, .hero .meta a { color: var(--ink); font-weight: 600; }
.hero .split { display: grid; gap: 0; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 6px; }
.hero .split-item { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 0; text-align: left; border-bottom: 1px solid var(--line); }
.hero .split-item:last-child { border-bottom: 0; }
.hero .split-item .n { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero .split-item .v { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- cards & lists ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 0 16px 14px; }
.card.flat { box-shadow: none; }
.card h2 { font-size: 17px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 20px 10px; }
.section-title h2.big-title { font-size: 22px; }
.section-title a, .section-title button { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 500; border: 0; background: none; color: var(--muted); padding: 0; }

.day { margin: 0 16px 14px; }
.day-head { display: flex; justify-content: space-between; padding: 8px 4px 8px; font-variant-numeric: tabular-nums; }
.day-head span:last-child { text-transform: none; letter-spacing: 0; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list.inset { margin: 0 16px 14px; }
.list.flat { box-shadow: none; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; border: 0; background: none; text-align: left; border-top: 1px solid var(--line); color: inherit; }
.item:first-child { border-top: 0; }
button.item:active, a.item:active { background: var(--card-2); }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 600; font-family: var(--display); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .note { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .amount { font-weight: 600; font-family: var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.item .amount small { display: flex; align-items: center; justify-content: flex-end; gap: 3px; color: var(--muted); font-weight: 400; font-size: 12px; font-family: "Inter", sans-serif; }

/* A category's mark: its colour as a tint behind its icon. */
.cat-ic {
  --c: #71717a;
  width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; flex: none;
  color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent);
}
:root[data-theme="dark"] .cat-ic { background: color-mix(in srgb, var(--c) 20%, transparent); color: color-mix(in srgb, var(--c) 80%, white); }
.cat-ic .emo { font-size: 19px; line-height: 1; }
.cat-ic.xs { width: 22px; height: 22px; border-radius: 6px; }
.cat-ic.xs .emo { font-size: 12px; }
.center > .cat-ic { width: 64px; height: 64px; border-radius: 18px; }
.bubble { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex: none; }

/* "By category": a coloured dot, the amount, and a bar against the largest. */
.cat-bars { padding: 16px 18px 12px; }
.cat-bars .eyebrow { margin-bottom: 8px; }
.cat-bar { display: block; width: 100%; border: 0; background: none; padding: 7px 0; text-align: left; }
.cat-bar .n { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
.cat-bar .n i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.cat-bar .v { font-weight: 500; font-variant-numeric: tabular-nums; }
.cat-bar .track { display: block; height: 5px; border-radius: 99px; background: var(--card-2); margin-top: 7px; overflow: hidden; }
.cat-bar .track i { display: block; height: 100%; border-radius: 99px; transition: width 0.4s ease; }
.cat-bar.on .n { font-weight: 700; }

.search { display: flex; align-items: center; gap: 10px; margin: 0 16px 10px; padding: 4px 6px 4px 16px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.search:focus-within { border-color: var(--ink-2); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 10px 0; }

.empty { text-align: center; padding: 30px 20px; color: var(--muted); }
.empty .art { width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 50%; background: var(--card-2); color: var(--ink-2); display: grid; place-items: center; }
.empty h3 { color: var(--ink); font-size: 17px; margin-bottom: 4px; }
.empty p { margin: 4px 0 0; font-size: 14px; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 12px 20px;
  font-weight: 600; font-size: 15px; font-family: var(--display); background: var(--card); color: var(--ink); transition: background 0.15s, transform 0.06s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.btn.small { padding: 7px 13px; font-size: 13px; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin: 0 0 7px 4px; text-transform: uppercase; letter-spacing: 0.1em; }
.input {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 14px; outline: none; transition: border-color 0.15s;
}
.input:focus { border-color: var(--ink-2); }
textarea.input { resize: vertical; }
select.input { appearance: auto; }
.error { background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--bad); border-radius: 14px; padding: 10px 14px; font-size: 14px; font-weight: 500; margin-bottom: 12px; }
.ok { background: color-mix(in srgb, var(--good) 10%, transparent); color: var(--good); border-radius: 14px; padding: 10px 14px; font-size: 14px; font-weight: 500; margin-bottom: 12px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 13px; font-weight: 500; font-size: 13.5px; white-space: nowrap; color: var(--ink-2); }
.chip.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip.static { cursor: default; }
.chip b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.book-chips { margin-bottom: 6px; }

/* ---------- quick add by typing ---------- */
.quick { display: flex; align-items: center; gap: 8px; margin: 0 16px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 5px 5px 16px; }
.quick:focus-within { border-color: var(--ink-2); }
.quick input { flex: 1; border: 0; background: transparent; outline: none; padding: 8px 2px; min-width: 0; }
.quick button { border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-family: var(--display); padding: 9px 18px; }
.quick button:disabled { background: var(--card-2); color: var(--muted); }
.quick-hint { margin: -8px 24px 12px; font-size: 13px; color: var(--muted); }

/* ---------- bottom navigation: a floating pill ---------- */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-b)); width: min(528px, calc(100% - 24px)); z-index: 20;
  height: var(--nav-h); padding: 8px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; justify-items: center;
}
.nav a { width: 56px; height: 56px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 10px; font-weight: 500; color: var(--muted); }
.nav a.active { color: var(--ink); background: var(--card-2); }
.nav .fab {
  width: 58px; height: 58px; border-radius: 50%; border: 0; color: var(--accent-ink);
  background: var(--accent); display: grid; place-items: center; transition: transform 0.1s;
}
.nav .fab:active { transform: scale(0.94); }

/* ---------- bottom sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 40; animation: fade 0.18s ease; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(560px, 100%); max-height: 94dvh; overflow-y: auto; z-index: 41;
  background: var(--bg-2); border-radius: 26px 26px 0 0; padding: 8px 18px calc(18px + var(--safe-b)); animation: rise 0.22s cubic-bezier(.2,.8,.3,1);
  border-top: 1px solid var(--line);
}
.sheet .grip { width: 38px; height: 4px; border-radius: 9px; background: var(--line); margin: 2px auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.sheet-head h2 { font-size: 19px; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); display: grid; place-items: center; flex: none; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn:disabled { opacity: 0.35; }
@keyframes rise { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- amount entry ---------- */
.amount-display { text-align: center; padding: 6px 0 14px; font-variant-numeric: tabular-nums; font-family: var(--display); }
.amount-display .cur { font-size: 24px; font-weight: 500; color: var(--muted); vertical-align: 16px; margin-right: 4px; }
.amount-display .val { font-size: 50px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.amount-display .val.zero { color: var(--muted); opacity: 0.45; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 16px; }
.keypad button { border: 1px solid var(--line); border-radius: 16px; background: var(--card); font-size: 22px; font-weight: 500; font-family: var(--display); height: 50px; transition: background 0.12s; }
.keypad button:active { background: var(--card-2); }

.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.cat {
  border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 10px 4px 8px; display: flex; flex-direction: column;
  align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; color: var(--ink-2); min-width: 0;
}
.cat .cat-ic { width: 36px; height: 36px; }
.cat span.n { width: 100%; text-align: center; white-space: normal; line-height: 1.15; min-height: 2.3em; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cat.on { border-color: var(--ink); color: var(--ink); box-shadow: 0 0 0 1px var(--ink); font-weight: 600; }

/* ---------- date and month pickers ---------- */
.datepick { position: relative; }
.date-field { width: 100%; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 14px; text-align: left; color: var(--ink); }
.date-field .v { flex: 1; font-weight: 500; }
.date-field .chev { color: var(--muted); transition: transform 0.15s; }
.date-field.open { border-color: var(--ink-2); }
.date-field.open .chev { transform: rotate(180deg); }
.date-field > svg:first-child { color: var(--muted); }
.calendar { margin-top: 8px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); padding: 12px; animation: fade 0.12s ease; }
.cal-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.cal-quick button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 4px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.cal-quick button.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head strong { font-weight: 600; font-family: var(--display); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-grid .wd { font-size: 11px; font-weight: 500; color: var(--muted); padding: 6px 0; text-transform: uppercase; letter-spacing: 0.06em; }
.cal-grid button { aspect-ratio: 1; border: 0; background: none; border-radius: 50%; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ink); }
.cal-grid button:hover:not(:disabled) { background: var(--card-2); }
.cal-grid button.today { box-shadow: inset 0 0 0 1px var(--ink-2); font-weight: 600; }
.cal-grid button.sel { background: var(--accent); color: var(--accent-ink); font-weight: 600; box-shadow: none; }
.cal-grid button:disabled { color: var(--muted); opacity: 0.35; }
.month-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.month-grid button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 12px 0; font-weight: 500; color: var(--ink); }
.month-grid button.today { border-color: var(--ink-2); }
.month-grid button.sel { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.month-grid button:disabled { opacity: 0.35; }

/* ---------- budgets ---------- */
.budget { padding: 14px 16px; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; display: block; color: inherit; }
.budget:first-child { border-top: 0; }
.budget .top { display: flex; align-items: center; gap: 12px; }
.budget .top .main { flex: 1; min-width: 0; }
.progress { height: 5px; border-radius: 99px; background: var(--card-2); overflow: hidden; margin-top: 10px; }
.progress > i { display: block; height: 100%; border-radius: 99px; transition: width 0.4s ease; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 8px; vertical-align: 1px; text-transform: uppercase; letter-spacing: 0.06em; }
.tag.good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.tag.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.tag.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.tag.info { background: var(--card-2); color: var(--ink-2); }

/* ---------- charts ---------- */
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-wrap svg { flex: none; }
.legend { flex: 1; min-width: 0; display: grid; gap: 8px; }
.legend .row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.legend .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.legend .row .n { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend .row .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 8px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .b i { width: 100%; max-width: 28px; border-radius: 8px 8px 4px 4px; background: var(--accent); min-height: 3px; transition: height 0.4s ease; }
.bars .b.dim i { background: var(--line); }
.bars .b span { font-size: 11px; color: var(--muted); font-weight: 500; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 16px 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat .v { font-family: var(--display); font-size: 21px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- import preview ---------- */
.import-group { margin-bottom: 12px; }
.import-group h3 { font-size: 15px; margin: 6px 2px 8px; display: flex; gap: 8px; align-items: center; }
.import-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); margin-bottom: 6px; }
.import-row .main { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.import-row select { border: 1px solid var(--line); background: var(--bg-2); border-radius: 999px; padding: 5px 8px; font-size: 13px; max-width: 42%; }
.import-row .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.import-row.skip { opacity: 0.45; }

/* ---------- settings ---------- */
.setting { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; color: inherit; }
.setting:first-child { border-top: 0; }
.setting .main { flex: 1; min-width: 0; }
.setting .main b { font-weight: 600; font-family: var(--display); }
.setting .chev { color: var(--muted); }
.set-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--card-2); color: var(--ink); }
.set-ic.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 2px var(--bg-2); }
.swatch.on { border-color: var(--ink); }
.emoji-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.emoji-grid button { border: 1px solid var(--line); background: var(--card); border-radius: 12px; height: 42px; display: grid; place-items: center; color: var(--ink-2); font-size: 18px; }
.emoji-grid button.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }

/* ---------- misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 22px); transform: translateX(-50%); z-index: 60;
  background: var(--accent); color: var(--accent-ink); padding: 11px 18px; border-radius: 999px; font-weight: 500; font-size: 14px; box-shadow: var(--shadow-lg);
  animation: rise 0.2s ease; max-width: calc(100% - 32px); display: flex; gap: 14px; align-items: center;
}
.toast button { border: 0; background: none; color: inherit; font-weight: 700; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px; }
.logo { width: 58px; height: 58px; border-radius: 18px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; margin: 0 auto 16px; }
.auth h1 { text-align: center; font-size: 26px; }
.auth .tagline { text-align: center; color: var(--muted); margin: 6px 0 22px; }
.auth .switch { text-align: center; margin-top: 16px; color: var(--muted); }
.auth .switch a, .auth a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: grid; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 14px; }
.offline-banner { margin: 6px 16px 0; padding: 8px 14px; border-radius: 999px; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); font-size: 13px; font-weight: 500; text-align: center; }
.receipt-thumb { width: 100%; max-height: 260px; object-fit: contain; border-radius: 16px; background: var(--card-2); margin-bottom: 12px; border: 1px solid var(--line); }

/* Blazor's own loading and error UI */
.boot { min-height: 100dvh; display: grid; place-items: center; background: var(--bg); }
.boot .logo { margin: 0; animation: pulse 1.4s infinite; }
#blazor-error-ui { background: #fef3c7; color: #92400e; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); display: none; left: 0; padding: 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; font-weight: 500; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* The add sheet's Save stays in reach while the form scrolls. */
.sheet-foot { position: sticky; bottom: calc(-18px - var(--safe-b)); margin: 6px -18px calc(-18px - var(--safe-b)); padding: 12px 18px calc(14px + var(--safe-b)); background: color-mix(in srgb, var(--bg-2) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr; gap: 10px; z-index: 2; }
