/* ═══════════════════════════════════════════════════════════════════════════
   GOAT Expense Desk — the Zova design system, without a build step.

   Tokens, type scale and component shapes follow Zova (src/app/globals.css
   and its shadcn "new-york" components): warm beige ground, cobalt primary,
   sun-yellow accent, Geist, 14px UI text, 10px radius.

   Two layouts share these components:
     .shell   desktop / tablet — sidebar, top bar, tables, side panel
     .m-*     phone — app bar, bottom tab bar, card lists, bottom sheets
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  /* Brand: warm beige #EDECE6 · cobalt blue #1546D9 · sun yellow #F9B318 */
  --radius: 0.625rem;
  --background: #edece6;
  --foreground: #1c1b18;
  --card: #f8f7f3;
  --card-foreground: #1c1b18;
  --popover: #fbfaf7;
  --primary: #1546d9;
  --primary-foreground: #ffffff;
  --secondary: #e2e0d7;
  --secondary-foreground: #1c1b18;
  --muted: #e4e2da;
  --muted-foreground: #66645b;
  --accent: #e3e1d8;
  --accent-foreground: #1c1b18;
  --sun: #f9b318;
  --sun-foreground: #1c1b18;
  --destructive: oklch(0.56 0.22 27);
  --success: oklch(0.56 0.14 155);
  --warning: #f9b318;
  --border: #d8d6cc;
  --input: #d0cec3;
  --ring: #1546d9;
  --sidebar: #e5e4dd;
  --sidebar-foreground: #2a2924;
  --sidebar-accent: #f8f7f3;
  --sidebar-border: #d8d6cc;
  --overlay: rgb(28 27 24 / 0.45);
  --shadow-sm: 0 1px 3px 0 rgb(28 27 24 / 0.08), 0 1px 2px -1px rgb(28 27 24 / 0.08);
  --shadow-xs: 0 1px 2px 0 rgb(28 27 24 / 0.05);
  --shadow-lg: 0 10px 30px -10px rgb(28 27 24 / 0.25), 0 4px 12px -4px rgb(28 27 24 / 0.12);

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

/* Dark: the user's explicit choice, or the system's when they have not chosen. */
:root[data-theme="dark"] {
  --background: #161512; --foreground: #edece6; --card: #1e1d19; --card-foreground: #edece6;
  --popover: #22211d; --primary: #5b82f5; --primary-foreground: #0a1440;
  --secondary: #2a2924; --secondary-foreground: #edece6; --muted: #2a2924; --muted-foreground: #a8a69c;
  --accent: #2e2d28; --accent-foreground: #edece6; --destructive: oklch(0.7 0.19 22); --success: oklch(0.7 0.15 155);
  --border: rgb(237 236 230 / 10%); --input: rgb(237 236 230 / 16%); --ring: #5b82f5;
  --sidebar: #1a1915; --sidebar-foreground: #dcdbd4; --sidebar-accent: #2a2924; --sidebar-border: rgb(237 236 230 / 10%);
  --overlay: rgb(0 0 0 / 0.6);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4); --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 30px -10px rgb(0 0 0 / 0.7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: #161512; --foreground: #edece6; --card: #1e1d19; --card-foreground: #edece6;
    --popover: #22211d; --primary: #5b82f5; --primary-foreground: #0a1440;
    --secondary: #2a2924; --secondary-foreground: #edece6; --muted: #2a2924; --muted-foreground: #a8a69c;
    --accent: #2e2d28; --accent-foreground: #edece6; --destructive: oklch(0.7 0.19 22); --success: oklch(0.7 0.15 155);
    --border: rgb(237 236 230 / 10%); --input: rgb(237 236 230 / 16%); --ring: #5b82f5;
    --sidebar: #1a1915; --sidebar-foreground: #dcdbd4; --sidebar-accent: #2a2924; --sidebar-border: rgb(237 236 230 / 10%);
    --overlay: rgb(0 0 0 / 0.6);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4); --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 30px -10px rgb(0 0 0 / 0.7);
    color-scheme: dark;
  }
}

/* ── base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--background); color: var(--foreground);
  font-family: var(--font-sans); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
button, input, select, textarea { font: inherit; color: inherit; }
button:not(:disabled), [role="button"]:not(:disabled), a[href] { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--ring) 60%, transparent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--primary) 22%, transparent); }
[hidden], .hidden { display: none !important; }

/* type */
.h1 { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.025em; }
.h2 { font-size: 18px; line-height: 28px; font-weight: 600; letter-spacing: -0.015em; }
.h3 { font-size: 15px; line-height: 22px; font-weight: 600; }
.text-sm { font-size: 13px; line-height: 20px; }
.text-xs { font-size: 12px; line-height: 16px; }
.text-2xs { font-size: 11px; line-height: 14px; }
.muted { color: var(--muted-foreground); }
.strong { font-weight: 600; }
.medium { font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.money { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.big-money { font-size: 36px; line-height: 40px; font-weight: 600; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.eyebrow { font-size: 12px; font-weight: 500; color: var(--muted-foreground); letter-spacing: 0.01em; }
.danger-text { color: var(--destructive); }
.success-text { color: var(--success); }

/* layout helpers */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-nw { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sep { height: 1px; background: var(--border); border: 0; margin: 0; }

/* icon */
.i { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: -3px; }
.i-sm { width: 14px; height: 14px; }
.i-lg { width: 20px; height: 20px; }
.i-xl { width: 24px; height: 24px; }

/* ── button ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: calc(var(--radius) - 2px);
  font-size: 14px; font-weight: 500; white-space: nowrap; border: 1px solid transparent;
  background: transparent; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, opacity .15s;
  user-select: none; text-decoration: none;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 45%, transparent); }
.btn .i { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 90%, black); }
.btn-outline { border-color: var(--border); background: var(--background); box-shadow: var(--shadow-xs); }
.btn-outline:hover { background: var(--accent); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover { background: color-mix(in srgb, var(--secondary) 80%, var(--foreground) 6%); }
.btn-ghost:hover { background: var(--accent); }
.btn-destructive { background: var(--destructive); color: #fff; box-shadow: var(--shadow-xs); }
.btn-destructive:hover { background: color-mix(in srgb, var(--destructive) 90%, black); }
.btn-success { background: var(--success); color: #fff; box-shadow: var(--shadow-xs); }
.btn-success:hover { background: color-mix(in srgb, var(--success) 90%, black); }
.btn-sun { background: var(--sun); color: var(--sun-foreground); box-shadow: var(--shadow-xs); }
.btn-link { color: var(--primary); padding: 0; height: auto; }
.btn-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.btn-sm { height: 32px; padding: 0 12px; gap: 6px; font-size: 13px; }
.btn-lg { height: 40px; padding: 0 24px; }
.btn-xl { height: 48px; padding: 0 24px; font-size: 15px; border-radius: var(--radius); }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }

/* ── card ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card); color: var(--card-foreground); border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 24px; }
.card-head { padding: 20px 24px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.card-desc { font-size: 13px; color: var(--muted-foreground); margin-top: 4px; }
.card-body { padding: 16px 24px 20px; }
.card-foot { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.card-flush { overflow: hidden; }

/* ── form ───────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 14px; font-weight: 500; line-height: 1; display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--destructive); }
.hint { font-size: 12px; color: var(--muted-foreground); line-height: 1.4; }
.input, .select, .textarea {
  width: 100%; min-width: 0; height: 36px; padding: 4px 12px;
  border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px);
  background: transparent; box-shadow: var(--shadow-xs); font-size: 14px;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
:root[data-theme="dark"] .input, :root[data-theme="dark"] .select, :root[data-theme="dark"] .textarea { background: rgb(237 236 230 / 4%); }
.input::placeholder, .textarea::placeholder { color: var(--muted-foreground); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
.input[aria-invalid="true"] { border-color: var(--destructive); }
.textarea { height: auto; min-height: 72px; padding: 8px 12px; resize: vertical; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366645b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.select option { background: var(--popover); color: var(--foreground); }
.input.filled-by-ai, .select.filled-by-ai, .textarea.filled-by-ai {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--input));
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); pointer-events: none; }
.input-prefix > .input { padding-left: 26px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

details.disclose > summary { list-style: none; cursor: pointer; padding: 6px 0; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary .chev { transition: transform .15s; color: var(--muted-foreground); }
details.disclose[open] > summary .chev { transform: rotate(180deg); }

/* Segmented choice: category tiles, travel modes, transfer kind */
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice button {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px);
  background: var(--background); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-xs);
}
.choice button:hover { background: var(--accent); }
.choice button[aria-pressed="true"] { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--background)); color: var(--primary); }
.choice.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.choice.tiles button { height: 64px; flex-direction: column; justify-content: center; gap: 4px; font-size: 13px; }
.choice.tiles .i { width: 20px; height: 20px; }

/* ── badge ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: calc(var(--radius) - 4px); border: 1px solid transparent;
  font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 1;
}
.badge .i { width: 12px; height: 12px; }
.badge-outline { border-color: var(--border); color: var(--foreground); }
.badge-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge-primary { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.badge-success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.badge-warning { background: color-mix(in srgb, var(--sun) 28%, transparent); color: color-mix(in srgb, var(--sun) 35%, var(--foreground)); }
.badge-destructive { background: color-mix(in srgb, var(--destructive) 12%, transparent); color: var(--destructive); }
.badge-count { min-width: 20px; height: 20px; padding: 0 6px; justify-content: center; border-radius: 999px; background: var(--primary); color: var(--primary-foreground); font-size: 11px; }

/* ── alert / flags ──────────────────────────────────────────────────────── */
.alert {
  display: grid; grid-template-columns: 16px 1fr; gap: 2px 10px; align-items: start;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); font-size: 13px; line-height: 1.45;
}
.alert > .i { margin-top: 1px; }
.alert-title { font-weight: 600; font-size: 13px; }
.alert-info > .i { color: var(--primary); }
.alert-warn { border-color: color-mix(in srgb, var(--sun) 55%, var(--border)); background: color-mix(in srgb, var(--sun) 10%, var(--card)); }
.alert-warn > .i { color: color-mix(in srgb, var(--sun) 60%, var(--foreground)); }
.alert-destructive { border-color: color-mix(in srgb, var(--destructive) 35%, var(--border)); background: color-mix(in srgb, var(--destructive) 6%, var(--card)); }
.alert-destructive > .i, .alert-destructive .alert-title { color: var(--destructive); }
.alert-success > .i { color: var(--success); }
.alert-ai { border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); background: color-mix(in srgb, var(--primary) 5%, var(--card)); }
.alert-ai > .i { color: var(--primary); }
.flags { display: flex; flex-direction: column; gap: 6px; list-style: none; margin: 0; padding: 0; }
.flag { display: grid; grid-template-columns: 16px 1fr; gap: 10px; align-items: start; font-size: 13px; line-height: 1.45; padding: 8px 10px; border-radius: calc(var(--radius) - 2px); }
.flag .i { margin-top: 1px; }
.flag-high { background: color-mix(in srgb, var(--destructive) 8%, transparent); }
.flag-high .i { color: var(--destructive); }
.flag-warn { background: color-mix(in srgb, var(--sun) 14%, transparent); }
.flag-warn .i { color: color-mix(in srgb, var(--sun) 55%, var(--foreground)); }
.flag-info { background: var(--muted); }
.flag-info .i { color: var(--muted-foreground); }

/* ── table ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  height: 40px; padding: 0 12px; text-align: left; font-weight: 500; font-size: 13px;
  color: var(--muted-foreground); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.table .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th:first-child, .table td:first-child { padding-left: 24px; }
.table th:last-child, .table td:last-child { padding-right: 24px; }
.table .sub { font-size: 12px; color: var(--muted-foreground); }
.empty { padding: 40px 24px; text-align: center; color: var(--muted-foreground); font-size: 14px; }
.empty .i { width: 28px; height: 28px; margin: 0 auto 10px; display: block; opacity: .6; }

/* ── tabs / segmented filter ────────────────────────────────────────────── */
.tabs { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--muted); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { height: 30px; padding: 0 12px; border: 0; border-radius: calc(var(--radius) - 3px); background: transparent; font-size: 13px; font-weight: 500; color: var(--muted-foreground); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button[aria-selected="true"] { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .tabs button[aria-selected="true"] { background: var(--accent); }

/* ── avatar ─────────────────────────────────────────────────────────────── */
.avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--primary); color: var(--primary-foreground); display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; flex-shrink: 0; letter-spacing: .02em; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }

/* ── logo ───────────────────────────────────────────────────────────────── */
.logo { display: flex; align-items: center; gap: 10px; }
.logo img { width: 32px; height: 32px; }
.logo .name { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.1; }
.logo .org { font-size: 11px; color: var(--muted-foreground); line-height: 1.2; }

/* ── overlays: dialog, side sheet, bottom sheet, menu, toast ────────────── */
.overlay { position: fixed; inset: 0; z-index: 50; background: var(--overlay); animation: fade .15s ease-out; }
.dialog {
  position: fixed; z-index: 51; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto;
  background: var(--background); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-lg); padding: 24px; animation: pop .16s ease-out;
}
.dialog-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.dialog-title { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.dialog-desc { font-size: 14px; color: var(--muted-foreground); }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.sheet {
  position: fixed; z-index: 51; top: 0; right: 0; bottom: 0; width: min(720px, 100vw);
  background: var(--background); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide-in .2s ease-out;
}
.sheet-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.sheet-body { flex: 1; overflow: auto; padding: 20px; }
.sheet-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; background: var(--card); }
.menu {
  position: fixed; z-index: 60; min-width: 220px; padding: 4px; background: var(--popover);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: pop .12s ease-out;
}
.menu-label { padding: 6px 8px; font-size: 13px; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border: 0; border-radius: calc(var(--radius) - 4px); background: transparent; font-size: 14px; text-align: left; }
.menu-item:hover { background: var(--accent); }
.menu-item.danger { color: var(--destructive); }
.menu .sep { margin: 4px -4px; }
.toaster { position: fixed; z-index: 70; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: grid; grid-template-columns: 16px 1fr; gap: 10px; align-items: start;
  padding: 12px 14px; background: var(--popover); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500; animation: rise .18s ease-out;
}
.toast .i { margin-top: 1px; color: var(--success); }
.toast.err .i { color: var(--destructive); }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .2s; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.97); } }
.menu { animation-name: fade; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes slide-up { from { transform: translateY(100%); } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.spin { width: 16px; height: 16px; border-radius: 999px; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; flex-shrink: 0; }
.skeleton { border-radius: calc(var(--radius) - 2px); background: linear-gradient(90deg, var(--muted) 25%, color-mix(in srgb, var(--muted) 60%, var(--card)) 37%, var(--muted) 63%); background-size: 800px 100%; animation: shimmer 1.4s infinite linear; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ── shared pieces ──────────────────────────────────────────────────────── */
.kpi { padding: 18px 20px; }
.kpi .label-row { display: flex; align-items: center; justify-content: space-between; color: var(--muted-foreground); font-size: 13px; font-weight: 500; }
.kpi .value { font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .foot { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.balance-card { position: relative; overflow: hidden; padding: 22px 24px; }
.balance-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 999px; background: radial-gradient(circle, color-mix(in srgb, var(--sun) 35%, transparent), transparent 70%); pointer-events: none; }
.balance-card.holding { background: var(--primary); color: var(--primary-foreground); border-color: transparent; }
.balance-card.holding .muted, .balance-card.holding .eyebrow { color: color-mix(in srgb, var(--primary-foreground) 75%, transparent); }
.balance-card.owed { border-color: color-mix(in srgb, var(--sun) 60%, var(--border)); }
.ledger { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ledger > div { padding: 14px 18px; border-right: 1px solid var(--border); }
.ledger > div:last-child { border-right: 0; }
.ledger .k { font-size: 12px; color: var(--muted-foreground); font-weight: 500; }
.ledger .v { font-size: 16px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width .3s; }
.meter > i.over { background: var(--destructive); }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 96px; gap: 12px; align-items: center; font-size: 13px; }
.bar-row .track { height: 8px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.bar-row .track i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.dropzone {
  border: 1.5px dashed color-mix(in srgb, var(--primary) 40%, var(--border)); border-radius: calc(var(--radius) + 4px);
  background: color-mix(in srgb, var(--primary) 3%, var(--card)); padding: 28px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px; transition: background .15s, border-color .15s;
}
.dropzone.over { background: color-mix(in srgb, var(--primary) 8%, var(--card)); border-color: var(--primary); }
.dropzone .i-xl { color: var(--primary); width: 28px; height: 28px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { position: relative; width: 76px; height: 96px; border-radius: calc(var(--radius) - 2px); border: 1px solid var(--border); background: var(--muted); overflow: hidden; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .state { position: absolute; left: 4px; bottom: 4px; }
.thumb .rm { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 999px; border: 0; background: rgb(0 0 0 / .55); color: #fff; display: grid; place-items: center; }
.thumb .rm .i { width: 12px; height: 12px; }
.bill-preview { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--muted); }
.bill-preview img { width: 100%; max-height: 560px; object-fit: contain; background: #fff; }
.bill-preview iframe { width: 100%; height: 560px; border: 0; background: #fff; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; margin: 0; }
.dl dt { color: var(--muted-foreground); }
.dl dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.record { font-size: 13px; }
.record .items { width: 100%; border-collapse: collapse; margin-top: 4px; }
.record .items td, .record .items th { padding: 6px 0; border-bottom: 1px dashed var(--border); text-align: left; }
.record .items th { font-weight: 500; color: var(--muted-foreground); font-size: 12px; }
.record .items .n { text-align: right; font-variant-numeric: tabular-nums; }
.record .totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.record .totals .grand { font-weight: 600; font-size: 14px; padding-top: 6px; border-top: 1px solid var(--border); }
.ai-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--primary); }
.ai-tag .i { width: 13px; height: 13px; }
.status-ico { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--muted); color: var(--foreground); flex-shrink: 0; }
.status-ico .i { width: 18px; height: 18px; }

/* ═══ DESKTOP / TABLET SHELL ═════════════════════════════════════════════ */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; background: var(--sidebar); color: var(--sidebar-foreground);
  border-right: 1px solid var(--sidebar-border); display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar .logo { padding: 16px 16px 12px; }
.nav { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 12px 8px 6px; font-size: 12px; font-weight: 500; color: var(--muted-foreground); }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: calc(var(--radius) - 2px);
  font-size: 14px; color: var(--sidebar-foreground); border: 0; background: transparent; width: 100%; text-align: left;
}
.nav-item:hover { background: color-mix(in srgb, var(--sidebar-accent) 70%, transparent); }
.nav-item[aria-current="page"] { background: var(--sidebar-accent); font-weight: 500; box-shadow: var(--shadow-xs); }
.nav-item[aria-current="page"] .i { color: var(--primary); }
.nav-item .badge-count { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--sidebar-border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); width: 100%; border: 0; background: transparent; text-align: left; }
.user-chip:hover { background: color-mix(in srgb, var(--sidebar-accent) 70%, transparent); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 24px;
  border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--background) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted-foreground); min-width: 0; }
.crumbs b { color: var(--foreground); font-weight: 500; }
.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 32px 56px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .desc { color: var(--muted-foreground); margin-top: 4px; font-size: 14px; }
.page-narrow { max-width: 760px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.date-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-range .input { width: 150px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.cols-even { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.sticky-col { position: sticky; top: 80px; }
@media (max-width: 1180px) { .cols { grid-template-columns: 1fr; } .sticky-col { position: static; } }
@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; }
  .shell > .sidebar { display: none; }
  .page { padding: 24px 24px 48px; }
  .cols-even { grid-template-columns: 1fr; }
}
.tablet-only { display: none; }
@media (max-width: 1023px) { .tablet-only { display: inline-flex; } }
.drawer-nav { position: fixed; z-index: 51; top: 0; left: 0; bottom: 0; width: 280px; animation: slide-in .2s ease-out; }
.drawer-nav.sidebar { height: 100dvh; display: flex; }

/* sign-in */
.signin { min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; }
.signin-form { display: flex; flex-direction: column; padding: 32px 40px; }
.signin-form .inner { flex: 1; display: flex; align-items: center; justify-content: center; }
.signin-form .box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 20px; }
.signin-art {
  background: var(--primary); color: var(--primary-foreground); position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 48px;
}
.signin-art::before { content: ""; position: absolute; width: 520px; height: 520px; right: -160px; top: -160px; border-radius: 999px; background: radial-gradient(circle, color-mix(in srgb, var(--sun) 70%, transparent), transparent 65%); opacity: .55; }
.signin-art .quote { position: relative; font-size: 26px; line-height: 1.25; font-weight: 600; letter-spacing: -0.03em; max-width: 440px; }
.signin-art .points { position: relative; margin-top: 24px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: color-mix(in srgb, var(--primary-foreground) 85%, transparent); }
.signin-art .points div { display: flex; gap: 10px; align-items: center; }
.ms-btn { gap: 10px; }
.dev-box { border: 1px dashed var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.dev-box .tag { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: color-mix(in srgb, var(--sun) 50%, var(--foreground)); }
@media (max-width: 900px) { .signin { grid-template-columns: 1fr; } .signin-art { display: none; } .signin-form { padding: 24px 20px calc(24px + var(--safe-bottom)); } }

/* ═══ PHONE ══════════════════════════════════════════════════════════════
   A separate layout, not a squeezed desktop: an app bar, a bottom tab bar
   with the scan button in reach of a thumb, card lists instead of tables,
   bottom sheets instead of dialogs, and a fixed action bar on forms.
   ═══════════════════════════════════════════════════════════════════════ */
body.is-mobile { font-size: 15px; }
.m-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.m-appbar {
  position: sticky; top: 0; z-index: 30; padding-top: var(--safe-top);
  background: color-mix(in srgb, var(--background) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.m-appbar.scrolled { border-bottom-color: var(--border); }
.m-appbar .bar { height: 52px; display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; padding: 0 8px; }
.m-appbar .bar .t { text-align: center; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-appbar .bar .l { justify-self: start; }
.m-appbar .bar .r { justify-self: end; display: flex; gap: 2px; }
.m-appbar .back { display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 0 8px 0 2px; border: 0; background: transparent; color: var(--primary); font-size: 16px; font-weight: 500; }
.m-appbar .back .i { width: 24px; height: 24px; }
.m-iconbtn { width: 40px; height: 40px; border-radius: 999px; border: 0; background: transparent; display: grid; place-items: center; }
.m-iconbtn:active { background: var(--accent); }
.m-iconbtn .i { width: 20px; height: 20px; }
.m-page { flex: 1; padding: 4px 16px calc(96px + var(--safe-bottom)); }
.m-page.pushed { padding-bottom: calc(32px + var(--safe-bottom)); }
.m-page.has-actionbar { padding-bottom: calc(112px + var(--safe-bottom)); }
.m-title { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.03em; margin: 8px 0 16px; }
.m-section { margin-top: 24px; }
.m-section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 8px; }
.m-section-head h2 { font-size: 13px; font-weight: 600; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .05em; }
.m-section-head button { border: 0; background: none; color: var(--primary); font-size: 14px; font-weight: 500; padding: 0; }

/* inset grouped list */
.m-list { background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-xs); }
.m-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px; width: 100%; text-align: left; border: 0; background: transparent; position: relative; }
.m-row + .m-row::before { content: ""; position: absolute; top: 0; left: 62px; right: 0; height: 1px; background: var(--border); }
.m-row:active { background: var(--accent); }
.m-row .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.m-row .t { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-row .s { font-size: 13px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-row .end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.m-row .end .money { font-size: 15px; }
.m-row > .chev { color: var(--muted-foreground); width: 18px; height: 18px; flex-shrink: 0; margin-right: -4px; }
.m-row.simple { min-height: 50px; }
.m-row.simple + .m-row.simple::before { left: 14px; }

.m-balance { border-radius: 20px; padding: 20px; position: relative; overflow: hidden; }
.m-balance .big-money { font-size: 40px; line-height: 44px; margin: 6px 0 4px; }
.m-ledger { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; margin-top: 12px; }
.m-ledger > div { background: var(--card); padding: 12px 14px; }
.m-ledger .k { font-size: 12px; color: var(--muted-foreground); }
.m-ledger .v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.m-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.m-actions .btn { height: 52px; border-radius: 14px; font-size: 15px; }
.m-chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.m-chips::-webkit-scrollbar { display: none; }
.m-chips button { flex-shrink: 0; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-size: 14px; font-weight: 500; }
.m-chips button[aria-pressed="true"] { background: var(--foreground); color: var(--background); border-color: var(--foreground); }

/* forms on the phone: bigger targets, 16px text so iOS does not zoom */
body.is-mobile .input, body.is-mobile .select, body.is-mobile .textarea { height: 46px; font-size: 16px; border-radius: 12px; padding: 4px 14px; }
body.is-mobile .textarea { height: auto; min-height: 84px; padding: 10px 14px; }
body.is-mobile .select { padding-right: 36px; }
body.is-mobile .input-prefix > span { left: 14px; font-size: 16px; }
body.is-mobile .input-prefix > .input { padding-left: 30px; }
body.is-mobile .label { font-size: 14px; }
body.is-mobile .btn { height: 44px; font-size: 15px; border-radius: 12px; }
body.is-mobile .btn-sm { height: 36px; font-size: 14px; }
body.is-mobile .choice button { height: 44px; border-radius: 12px; font-size: 15px; }
body.is-mobile .choice.tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
body.is-mobile .choice.tiles button { height: 72px; font-size: 12px; padding: 0 4px; }
body.is-mobile .card { border-radius: 16px; }
body.is-mobile .card-pad, body.is-mobile .card-body { padding: 16px; }
body.is-mobile .card-head { padding: 16px 16px 0; }
.m-form-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 16px; }

/* bottom tab bar */
.m-tabbar {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--card) 88%, transparent); border-top: 1px solid var(--border);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.m-tabbar .in { height: 62px; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
.m-tab { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--muted-foreground); font-size: 11px; font-weight: 500; position: relative; }
.m-tab .i { width: 22px; height: 22px; }
.m-tab[aria-current="page"] { color: var(--primary); }
.m-tab .badge-count { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 10px; }
.m-scan { justify-self: center; width: 58px; height: 58px; margin-top: -26px; border-radius: 999px; border: 4px solid var(--background); background: var(--primary); color: var(--primary-foreground); display: grid; place-items: center; box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--primary) 60%, transparent); position: relative; }
.m-scan::after { content: ""; position: absolute; inset: -4px; border-radius: 999px; border: 2px solid var(--sun); clip-path: inset(0 0 55% 55%); }
.m-scan .i { width: 26px; height: 26px; }
.m-scan:active { transform: scale(.96); }

/* fixed action bar on forms and review screens */
.m-actionbar {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + var(--safe-bottom));
  background: color-mix(in srgb, var(--card) 92%, transparent); border-top: 1px solid var(--border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: flex; gap: 10px;
}
.m-actionbar .btn { flex: 1; height: 50px; border-radius: 14px; font-size: 16px; }
.m-actionbar .btn-icon { flex: 0 0 50px; width: 50px; }

/* bottom sheet (dialogs and menus on the phone) */
.bsheet {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow: auto;
  background: var(--background); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg);
  padding: 8px 16px calc(20px + var(--safe-bottom)); animation: slide-up .22s cubic-bezier(.2,.8,.2,1);
}
.bsheet .grip { width: 40px; height: 5px; border-radius: 999px; background: var(--border); margin: 0 auto 12px; }
.bsheet .dialog-title { font-size: 19px; }
.bsheet .dialog-foot { flex-direction: column-reverse; }
.bsheet .dialog-foot .btn { width: 100%; height: 50px; border-radius: 14px; font-size: 16px; }
.bsheet .menu-item { height: 50px; font-size: 16px; border-radius: 12px; gap: 12px; }
.bsheet .menu-item .i { width: 20px; height: 20px; }
body.is-mobile .toaster { left: 16px; right: 16px; width: auto; bottom: calc(86px + var(--safe-bottom)); }
body.is-mobile .toast { font-size: 14px; border-radius: 14px; }

/* scan screen */
.m-scan-hero { text-align: center; padding: 28px 16px; border-radius: 20px; background: var(--card); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.m-scan-hero .ring { width: 72px; height: 72px; border-radius: 22px; background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); display: grid; place-items: center; }
.m-scan-hero .ring .i { width: 34px; height: 34px; }
.reading { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, var(--primary) 6%, var(--card)); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); font-size: 14px; }
.reading .spin { color: var(--primary); }
