/* Receipt Vault — Generated 11/27/2026 9:16 PM | Family Receipt Capture */
:root {
  --bg: #efeae0;
  --paper: #fbf8f1;
  --paper-2: #f4efe4;
  --ink: #1d2433;
  --ink-2: #4a5263;
  --muted: #7b8192;
  --line: #ddd5c5;
  --accent: #d9622b;
  --accent-ink: #fff;
  --ok: #2f7d5b;
  --warn: #a86a12;
  --bad: #b3372b;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(29, 36, 51, 0.04), 0 6px 18px -10px rgba(29, 36, 51, 0.35);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tab-h: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c;
    --paper: #1c2029;
    --paper-2: #232835;
    --ink: #ece7dc;
    --ink-2: #c3bfb5;
    --muted: #8d92a0;
    --line: #333a48;
    --accent: #ec7a43;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 8px 20px -12px rgba(0, 0, 0, 0.8);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px);
  min-height: 100vh;
}
body.no-tabs { padding-bottom: 0; }
a { color: inherit; }
h1 { font-size: 1.6rem; line-height: 1.15; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.num, .amt { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { padding: 40vh 0 0; text-align: center; color: var(--muted); }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Layout */
main { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.top {
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 14px) 0 12px;
}
.top.sticky {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  flex-direction: column; align-items: stretch; margin: 0 -16px; padding-left: 16px; padding-right: 16px;
  border-bottom: 1px solid transparent;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.01em; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.spacer { flex: 1; }
.who { font-size: 0.85rem; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 600; color: var(--ink-2); padding: 6px 0; }

/* Cards & paper */
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 12px 0; }
.paper {
  position: relative; background: var(--paper); box-shadow: var(--shadow);
  padding: 20px 18px 30px; margin: 14px 0; font-family: var(--mono);
  border-radius: var(--radius) var(--radius) 0 0;
  -webkit-mask: radial-gradient(10px at 50% 100%, transparent 98%, #000) 50% 100% / 20px 100% repeat-x;
          mask: radial-gradient(10px at 50% 100%, transparent 98%, #000) 50% 100% / 20px 100% repeat-x;
}
.paper .pm { font-family: var(--sans); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; }
.paper .pd { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.paper .prow { display: flex; justify-content: space-between; border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; align-items: baseline; }
.paper .ptotal { font-size: 1.6rem; font-weight: 700; }
.paper .psum { font-family: var(--sans); color: var(--ink-2); font-size: 0.92rem; margin-top: 8px; }

/* Buttons */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font: 600 1rem/1 var(--sans); padding: 12px 16px; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; min-height: 46px;
  transition: transform 0.06s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn.big { min-height: 64px; font-size: 1.1rem; border-radius: 16px; }
.btn.sm { min-height: 36px; padding: 8px 12px; font-size: 0.9rem; border-radius: 10px; }
.icon-btn { appearance: none; border: 0; background: var(--paper); color: var(--ink); width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; position: relative; box-shadow: var(--shadow); cursor: pointer; }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 auto; }

/* Forms */
.form label.f, .form .f { display: block; margin: 0 0 12px; }
.form .f > span { display: block; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; font: 16px/1.3 var(--sans); color: var(--ink); background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 46px; outline: none;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--ink); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }
.grid2 > *, .grid3 > * { min-width: 0; }
select { min-width: 0; text-overflow: ellipsis; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 10px; }
fieldset { border: 0; padding: 0; margin: 0 0 6px; }
legend { font-weight: 700; padding: 0; margin: 6px 0 10px; font-size: 1rem; }
.money-in { font-family: var(--mono); text-align: right; }

/* Capture */
.capture h1 { margin-top: 6px; }
.shoot { display: grid; gap: 10px; margin: 16px 0; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.pages:empty { display: none; }
.page { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--paper-2); box-shadow: var(--shadow); }
.page img { width: 100%; height: 100%; object-fit: cover; display: block; }
.page .n { position: absolute; left: 6px; bottom: 6px; background: rgba(29, 36, 51, 0.8); color: #fff; font-size: 0.75rem; padding: 2px 7px; border-radius: 99px; }
.page .x { position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(29, 36, 51, 0.8); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.progress { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--paper-2); display: flex; gap: 10px; align-items: center; font-weight: 600; }
.spin { width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; color: var(--ink-2); }

/* Search + list */
.search { display: flex; gap: 8px; }
.search input { background: var(--paper); border-color: transparent; box-shadow: var(--shadow); padding-left: 40px; }
.search .sw { position: relative; flex: 1; }
.search .sw svg { position: absolute; left: 12px; top: 13px; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 600; background: var(--ink); color: var(--paper); border: 0; border-radius: 99px; padding: 6px 10px; cursor: pointer; }
.summary { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 0.9rem; padding: 6px 2px 2px; }
.summary b { color: var(--ink); font-family: var(--mono); }
.rlist { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.rlist > li { min-width: 0; }
.ritem { display: flex; gap: 12px; align-items: center; text-decoration: none; background: var(--paper); border-radius: var(--radius); padding: 10px 12px 10px 10px; box-shadow: var(--shadow); }
.thumb { width: 54px; height: 54px; border-radius: 10px; background: var(--paper-2); overflow: hidden; flex: none; display: grid; place-items: center; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.rmain { flex: 1; min-width: 0; }
.rtitle { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rsub { font-size: 0.84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ramt { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badges { display: flex; gap: 4px; margin-top: 3px; flex-wrap: wrap; }
.badge { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 99px; background: var(--paper-2); color: var(--ink-2); }
.badge.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.empty { text-align: center; padding: 48px 12px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; margin-bottom: 8px; }
.more { text-align: center; margin: 12px 0 24px; }

/* Detail */
.gallery { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x mandatory; }
.gallery figure { margin: 0; position: relative; flex: none; width: 128px; scroll-snap-align: start; }
.gallery img { width: 128px; height: 170px; object-fit: cover; border-radius: 12px; display: block; background: var(--paper-2); box-shadow: var(--shadow); }
.gallery figcaption { font-size: 0.75rem; color: var(--muted); text-align: center; margin-top: 4px; }
.gallery .x { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(29, 36, 51, 0.8); color: #fff; cursor: pointer; }
.addpage { flex: none; width: 128px; height: 170px; border-radius: 12px; border: 2px dashed var(--line); display: grid; place-items: center; color: var(--muted); font-weight: 600; cursor: pointer; text-align: center; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin: 10px 0; font-size: 0.92rem; }
.banner.info { background: var(--paper-2); }
.banner.warn { background: color-mix(in srgb, var(--warn) 14%, var(--paper)); }
.banner.bad { background: color-mix(in srgb, var(--bad) 12%, var(--paper)); }
.banner .grow { flex: 1; }
.banner a { font-weight: 700; }
.items { width: 100%; border-collapse: collapse; }
.items td { padding: 3px 2px; vertical-align: top; }
.items input { min-height: 40px; padding: 8px; font-size: 15px; }
.items .d { width: 52%; }
.items .q { width: 14%; }
.items .a { width: 26%; }
.items .rm { width: 8%; text-align: center; }
.items .rm button { border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 8px; }
details.card summary { font-weight: 700; cursor: pointer; }
pre.raw { white-space: pre-wrap; word-break: break-word; font: 13px/1.5 var(--mono); background: var(--paper-2); padding: 12px; border-radius: 10px; max-height: 60vh; overflow: auto; margin: 12px 0 0; }
.metaline { font-size: 0.82rem; color: var(--muted); margin: 8px 2px 16px; }
.savebar {
  position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px); z-index: 4;
  margin: 12px 0; padding: 0;
}
.savebar .btn { box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.6); }

/* Settings */
.row { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row input[type="text"] { flex: 1; min-width: 0; min-height: 40px; padding: 8px 10px; }
.row .narrow { width: 64px; flex: none; }
.row.off input[type="text"] { opacity: 0.55; }
.tog { display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.sec-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.sec-tabs button { flex: 1; }
.sec-tabs .on { background: var(--ink); color: var(--paper); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 0; }
.login .card { width: 100%; max-width: 380px; padding: 28px 22px; }
.login .logo { width: 64px; height: 64px; border-radius: 16px; display: block; margin: 0 0 14px; }
.err { color: var(--bad); font-weight: 600; font-size: 0.92rem; min-height: 1.3em; margin: 4px 0 10px; }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 0.72rem; font-weight: 600; text-decoration: none; color: var(--muted); border-radius: 12px; }
.tabbar a.on { color: var(--ink); }
.tabbar a.on .ti svg { stroke: var(--accent); }
.tabbar .ti svg { width: 24px; height: 24px; }

/* Toast + dialog */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50;
  top: calc(env(safe-area-inset-top) + 12px);
  background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px;
  font-weight: 600; font-size: 0.92rem; max-width: min(92vw, 520px); box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.6);
}
.toast.error { background: var(--bad); color: #fff; }
dialog { max-width: 94vw; overflow-x: hidden; border: 0; border-radius: 18px; padding: 0; width: min(94vw, 520px); background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6); }
dialog::backdrop { background: rgba(18, 21, 28, 0.5); }
dialog .dbody { padding: 18px; }
dialog .dfoot { display: flex; gap: 8px; padding: 0 18px 18px; }
dialog .dfoot .btn { flex: 1; }

@media (min-width: 640px) {
  .shoot { grid-template-columns: 1fr 1fr; }
  .gallery figure, .gallery img, .addpage { width: 150px; }
  .gallery img, .addpage { height: 200px; }
}
