/* Tokens copied from kamalatreats.com (assets/css/app.css) so the app reads as
   the same brand: cream paper, gold foil, KamalaTreats red, leaf green, serif display. */
:root {
  --bg: #FFFDF5;          /* --ground */
  --card: #FFFFFF;        /* --surface */
  --ink: #1A1210;         /* --paper */
  --muted: #7D7062;       /* --paper-mute */
  --line: #E4D2AE;        /* --hairline */
  --brand: #D4AF37;       /* --gild: filled buttons, the + */
  --brand-ink: #1A1008;   /* --gild-ink */
  --accent: #8A6608;      /* --foil: gold text/links on cream */
  --red: #A8283A;
  --in: #1A5D3A;          /* --leaf */
  --out: #A8283A;         /* --red */
  --warn-bg: #FDF6E6;     /* --surface-lift */
  --warn-ink: #6F5416;    /* --foil-lit */
  --chip: #F7E7CE;        /* --panel (biscuit) */
  --shadow: 0 1px 2px rgb(90 62 20 / .10), 0 6px 18px rgb(90 62 20 / .08);
  --r: 3px;
  --ff-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Cambria, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #100A0A;
    --card: #191110;
    --ink: #F7F1E6;
    --muted: #8E8478;
    --line: #3A2A22;
    --brand: #D4AF37;
    --brand-ink: #1A1008;
    --accent: #D4AF37;
    --red: #D34457;
    --in: #4E9E6A;
    --out: #D34457;
    --warn-bg: #241917;
    --warn-ink: #F2DFA4;
    --chip: #2A1D19;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 720px; margin: 0 auto; padding: 0 16px; }
h1 { font-family: var(--ff-display); font-weight: 600; font-size: 26px; margin: 18px 0 4px; letter-spacing: -.005em; }
h2 { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 24px 0 8px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
a { color: var(--accent); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: env(safe-area-inset-top); }
.top select { width: auto; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-family: var(--ff-display); font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.in { color: var(--in); } .out { color: var(--out); }
.banner { display: flex; align-items: center; gap: 10px; background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; text-decoration: none; font-weight: 600; }
.banner span { margin-left: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.scroll-x { overflow-x: auto; }

.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; height: 120px; margin-top: 8px; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 2px; }
.bar i { display: block; border-radius: 3px 3px 0 0; min-height: 1px; }
.bar .bi { background: var(--in); opacity: .85; }
.bar .bo { background: var(--out); opacity: .7; }
.bar-labels { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; font-size: 10px; color: var(--muted); text-align: center; margin-top: 4px; }
.legend { font-size: 12px; color: var(--muted); display: flex; gap: 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.row { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.row:last-child { border-bottom: 0; }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .m { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.thumb { width: 40px; height: 40px; border-radius: var(--r); background: var(--chip) center/cover no-repeat; flex: none; display: grid; place-items: center; font-size: 11px; color: var(--muted); }
.tag { display: inline-block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; padding: 1px 6px; border-radius: 2px; background: var(--chip); color: var(--muted); margin-right: 4px; font-weight: 600; }
.tag.draft { background: var(--warn-bg); color: var(--warn-ink); }
.tag.ok { color: var(--in); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.chips button, .chip { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: var(--r); padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chips button.on, .chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
textarea { min-height: 64px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.amt-row { display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
.conv { font-size: 13px; color: var(--muted); margin-top: 6px; }
.conv b { color: var(--ink); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--chip); border-radius: var(--r); padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; border-radius: 2px; padding: 10px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button.on-in { background: var(--card); color: var(--in); box-shadow: var(--shadow); }
.seg button.on-out { background: var(--card); color: var(--out); box-shadow: var(--shadow); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); font-weight: 500; }
.check input { width: 20px; height: 20px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: var(--r); padding: 13px 16px; font: inherit; font-size: 13px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.danger { color: var(--out); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 10px; font-size: 11px; }
.btn:disabled { opacity: .5; }
.actions { display: flex; gap: 8px; margin: 18px 0; }
.actions .btn { flex: 1; }
.sticky-actions { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); padding-top: 14px; }

.big-actions { display: grid; gap: 10px; margin-top: 12px; }
.big { display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; box-shadow: var(--shadow); }
.big .ic { width: 46px; height: 46px; border-radius: var(--r); display: grid; place-items: center; font-size: 22px; flex: none; }
.big b { display: block; font-family: var(--ff-display); font-size: 18px; font-weight: 600; }
.big small { color: var(--muted); }

.preview { display: flex; gap: 8px; overflow-x: auto; margin: 10px 0; }
.preview a { flex: none; }
.preview img { height: 150px; border-radius: var(--r); border: 1px solid var(--line); display: block; }
.preview .pdf { height: 150px; width: 110px; border-radius: var(--r); border: 1px solid var(--line); display: grid; place-items: center; background: var(--chip); color: var(--muted); text-decoration: none; font-weight: 700; }
details { margin-top: 10px; font-size: 13px; color: var(--muted); }
details pre { white-space: pre-wrap; font-size: 12px; background: var(--chip); padding: 10px; border-radius: 8px; max-height: 240px; overflow: auto; }

#tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; align-items: center; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
#tabs a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; min-width: 60px; padding: 4px 0; }
#tabs a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#tabs a circle { fill: currentColor; stroke: none; }
#tabs a.on { color: var(--accent); }
#tabs a.add { background: var(--brand); color: var(--brand-ink); width: 54px; height: 54px; min-width: 0; border-radius: 50%; justify-content: center; margin-top: -22px; box-shadow: 0 4px 14px rgb(138 102 8 / .35); border: 2px solid var(--card); }
#tabs a.add svg { width: 28px; height: 28px; stroke-width: 2.4; }
.badge { position: absolute; top: 0; right: 12px; background: var(--out); color: #fff; font-size: 10px; border-radius: 99px; padding: 0 5px; min-width: 16px; text-align: center; }

#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 32px); z-index: 30; }
#toast.show { opacity: 1; transform: translateX(-50%); }
.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 40; }
.overlay .card { width: min(92vw, 380px); text-align: center; }

.login { max-width: 360px; margin: 12vh auto 0; }
.logo { width: 96px; height: 96px; display: block; margin: 0 auto 6px; }
.login h1, .login .sub { text-align: center; }
.err { color: var(--out); font-size: 13px; margin-top: 8px; }
.muted { color: var(--muted); }
.mt { margin-top: 12px; }
