@font-face {
  font-family: 'Inter';
  src: url('vendor/fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
/* ===== iOS dark-mode system tokens; accent is the single theme variable =====
   To switch to the Aevum navy palette, swap this block back (kept in git history):
   bg #0e1620, card #182434, ink #f3efe4, line #26364a. */
:root {
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --card2: #F2F2F7;
  --fill: #E5E5EA;
  --ink: #000000;
  --muted: rgba(60,60,67,0.6);
  --faint: rgba(60,60,67,0.3);
  --accent: #007AFF;
  --accent-ink: #FFFFFF;
  --gold: var(--accent);
  --gold-ink: var(--accent-ink);
  --warn: var(--accent);
  --danger: #FF3B30;
  --line: rgba(60,60,67,0.12);
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
  --radius: 20px;
}
[data-mode="dark"] {
  --bg: #000000;
  --card: #1C1C1E;
  --card2: #2C2C2E;
  --fill: #3A3A3C;
  --ink: #FFFFFF;
  --muted: rgba(235,235,245,0.6);
  --faint: rgba(235,235,245,0.3);
  --accent: #0A84FF;
  --accent-ink: #FFFFFF;
  --danger: #FF453A;
  --line: rgba(84,84,88,0.65);
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 10px 28px rgba(0,0,0,.45);
}
* { box-sizing: border-box; }
button { color: inherit; font-family: inherit; }
body {
  margin: 0 auto; max-width: 560px; padding: 0 16px 120px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
header { padding: 30px 4px 14px; display: flex; align-items: center; gap: 14px; }
header h1 { margin: 0; }
h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.tagline { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

.tabs {
  display: flex; gap: 4px; position: fixed; bottom: 14px; left: 16px; right: 16px; z-index: 20;
  max-width: 524px; margin: 0 auto;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid var(--line); border-radius: 24px; padding: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.tab {
  flex: 1; padding: 7px 4px 6px; border: none; border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; position: relative;
  transition: background .2s, color .2s;
}
.tab.active { background: var(--accent); color: var(--accent-ink); }
.badge {
  position: absolute; top: -4px; right: 2px; background: var(--gold); color: var(--gold-ink);
  font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 6px;
}
.hidden { display: none !important; }
.tabpane { display: none; }
.tabpane.active { display: block; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.sectionlabel, label { display: block; margin: 0 0 12px; font-size: 14px; font-weight: 600; }
input, select {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font-size: 16px;
  background: var(--card); color: var(--ink); border: 0.5px solid var(--line); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.center { text-align: center; }
.error { color: var(--danger); font-size: 13px; margin: 4px 0 10px; }
.mono { font-family: ui-monospace, monospace; font-size: 11px; word-break: break-all; color: var(--muted); }
.small { font-size: 12px; }

.btnrow { display: flex; gap: 10px; margin-top: 8px; }
.btn {
  border: none; border-radius: 999px; padding: 13px 16px; font-size: 15px; font-weight: 600;
  cursor: pointer; flex: 1; transition: transform .12s, box-shadow .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
.btn.secondary { background: var(--fill); color: var(--ink); border: none; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.small { padding: 7px 12px; font-size: 12px; flex: none; }
.btn.tiny { padding: 5px 10px; font-size: 11px; flex: none; }
.btn.gold { background: var(--gold); color: var(--gold-ink); flex: none; padding: 10px 22px; }

.card { background: var(--card); border: 0.5px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 10px; font-size: 14px; }
.card h4 { margin: 16px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.card ul { margin: 6px 0; padding-left: 18px; font-size: 13px; line-height: 1.6; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--card); color: var(--ink); border: 0.5px solid var(--line);
  border-radius: 999px; padding: 7px 14px; font-size: 12.5px; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .12s;
}
.chip:active { transform: scale(.96); }

.row { display: flex; align-items: center; gap: 8px; }
.row.space { justify-content: space-between; }
h2 { font-size: 12px; margin: 26px 4px 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }

.entry {
  background: transparent; border: none; border-radius: 0; box-shadow: none;
  border-bottom: 0.5px solid var(--line); padding: 11px 16px; margin: 0;
  background: var(--card); border: 0.5px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; display: flex; gap: 10px; box-shadow: var(--shadow);
}
.entry.confirmed { opacity: .72; }
.entry-main { flex: 1; min-width: 0; }
.entry-top { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.amount { font-weight: 700; font-size: 17px; }
.entry-reason { color: var(--ink); font-size: 13px; margin-top: 3px; }
.entry-meta { color: var(--muted); font-size: 11px; margin-top: 4px; }
.entry-utr { color: var(--muted); font-size: 11px; margin-top: 4px; word-break: break-all; }
.entry-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.chipstatus { font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.chipstatus.pending { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.chipstatus.confirmed { background: color-mix(in srgb, #ffffff 10%, transparent); color: rgba(255,255,255,.75); }

.statrow { display: flex; gap: 10px; margin-bottom: 10px; }
.stat {
  flex: 1; background: var(--card2); border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--muted);
}
.statnum { font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.statnum.warn { color: var(--warn); }
.catrow { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; border-top: 1px solid var(--line); }
.daylist { font-size: 13px; line-height: 1.7; padding-left: 18px; }
.ok { color: rgba(255,255,255,.75); font-weight: 600; }
.bigok { color: var(--ink); font-size: 16px; font-weight: 700; margin: 8px 0; }

.sumtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.sumtable th, .sumtable td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); }
.sumtable th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.sumtable tr[data-day] { cursor: pointer; }

input[type="file"].btn { display: block; width: 100%; padding: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--fill); color: var(--ink);
  padding: 11px 18px; border-radius: 999px; font-size: 13px; opacity: 0; transition: all .25s; z-index: 50;
  max-width: 90vw; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer { margin-top: 40px; text-align: center; color: var(--faint); font-size: 11px; }

.seg { display: flex; border: 0.5px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); padding: 2px; }
.segbtn { background: transparent; color: var(--muted); border: none; padding: 7px 16px; font-size: 12.5px; font-weight: 600; cursor: pointer; border-radius: 10px; }
.segbtn.active { background: var(--accent); color: var(--accent-ink); }
.weeklabel { font-size: 13px; color: var(--muted); }
.reasonedit { display: flex; gap: 6px; margin-top: 8px; }
.reasonedit input { margin-top: 0; padding: 8px 10px; font-size: 13px; border-radius: 10px; }
.reasonedit .btn { align-self: center; }
.warn { color: var(--warn); }
h3 { font-size: 14px; }

/* module home */
#moduleGrid { display: grid; gap: 14px; margin-top: 6px; }
.modulecard {
  display: block; width: 100%; text-align: left; padding: 22px;
  border-radius: 20px; border: 0.5px solid var(--line); background: var(--card);
  box-shadow: var(--shadow); cursor: pointer; transition: transform .15s;
}
.modulecard.active:hover { transform: translateY(-2px); }
.modulecard strong { display: block; font-size: 1.2rem; letter-spacing: -0.01em; margin-bottom: 4px; }
.modulecard.planned { opacity: .5; cursor: default; box-shadow: none; }
.modulecard .chipstatus { margin-top: 10px; display: inline-block; background: var(--bg); color: var(--muted); }
#backHome { margin-bottom: 8px; }

/* dashboard */
.hero { text-align: center; padding: 28px 18px 22px; }
.hero .hero-label { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.hero .hero-num { display: block; color: var(--accent); font-size: 3rem; font-weight: 700; letter-spacing: -0.01em; margin: 8px 0 6px; }
.hero .hero-delta { font-size: 12.5px; color: var(--muted); }
.dashgrid { display: grid; gap: 14px; margin-top: 6px; }
.statcard { padding: 18px; border-radius: var(--radius); }
.statcard > .hint { display: block; margin-bottom: 10px; text-transform: uppercase; letter-spacing: .1em; font-size: 11px; }
.bignum { display: block; font-size: 2rem; font-weight: 700; margin: 2px 0 6px; }
.promo {
  margin-top: 16px; border: none; color: var(--ink);
  background: var(--card); border: 0.5px solid var(--line); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer;
}
.promo strong { display: block; font-size: 1.05rem; }
.promo .hint { color: var(--muted); }
.donutrow { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.donut { width: 128px; flex: none; }
.donut-num { font-size: 14px; font-weight: 700; fill: var(--accent); }
.donut-sub { font-size: 8.5px; fill: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.legend { list-style: none; margin: 0; padding: 0; font-size: .85rem; flex: 1; min-width: 130px; }
.legend li { display: flex; align-items: center; gap: 8px; margin: 4px 0; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; color: var(--ink); }
.bars { width: 100%; }
.bar { fill: color-mix(in srgb, var(--ink) 18%, transparent); }
.bar-cur { fill: var(--accent); }
.bar-label { font-size: 9px; fill: var(--faint); }
.bar-val { font-size: 9px; fill: var(--muted); }
.toplist { list-style: none; margin: 0; padding: 0; }
.toplist li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.toplist li:last-child { border-bottom: 0; }
.toplist b { }
.toplist i { font-style: normal; font-size: .75rem; margin-left: 6px; color: var(--faint); }

/* minimal log rows */
.entry {
  background: transparent; border: none; border-radius: 0; box-shadow: none;
  border-bottom: 0.5px solid var(--line); padding: 11px 16px; margin: 0; align-items: flex-start; cursor: pointer; }
.dot { width: 9px; height: 9px; border-radius: 999px; margin-top: 6px; flex: none; }
.dot.ok { background: rgba(235,235,245,.45); }
.dot.warn { background: var(--accent); }
.dot.pend { background: var(--faint); }
.entry-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.entry-details { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.reasonchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.reasonchips .chip { padding: 5px 10px; font-size: 11.5px; }
.reasonchips .reason-input { flex: 1; min-width: 110px; margin-top: 0; padding: 6px 10px; font-size: 12px; border-radius: 999px; }
/* compact import */
.importrow { display: grid; grid-template-columns: 28px 1fr; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.importrow:last-of-type { border-bottom: 0; }
.iicon { font-size: 20px; text-align: center; grid-row: 1; }
.ilabel { grid-column: 2; grid-row: 1; }
.ilabel b { display: block; font-size: 14px; }
.importrow input[type="file"], .importrow select { grid-column: 2; width: 100%; margin-top: 4px; font-size: 11px; }
.importrow select { padding: 8px 10px; font-size: 12px; border-radius: 10px; }
#importInfoBtn { margin-top: 8px; }
#importInfo { margin-top: 8px; }
/* report */
#reportView .btnrow { gap: 8px; }
@media print {
  header, .tabs, footer, .btnrow, #backHome, #openReport { display: none !important; }
  body { background: #fff; color: #000; }
}

#appLogoImg.home-mark { width: 56px; height: 56px; border-radius: 15px; }
#appLogoImg.mark { width: 34px; height: 34px; border-radius: 9px; }

/* icon-led import */
.importicons { display: flex; gap: 12px; margin-top: 8px; }
.importbtn { flex: 1; background: var(--card); border: 0.5px solid var(--line); border-radius: 16px; padding: 16px 8px; cursor: pointer; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.importbtn span { font-size: 24px; }
.importbtn small { color: var(--muted); font-size: 11px; }
#shotApp { margin-top: 10px; }
/* placeholder module */
.modulecard.planned { display: flex; align-items: center; justify-content: center; min-height: 84px; }
.modulecard .plus { font-size: 26px; color: var(--faint); }

/* Apple-style tap states + SF-like icons */
.btn, .tab, .importbtn, .modulecard, .chip, .segbtn, .iconbtn { transition: transform .12s ease, opacity .12s ease, background .2s, color .2s, border-color .15s, box-shadow .15s; }
.btn:active, .tab:active, .importbtn:active, .modulecard:active, .chip:active, .segbtn:active { transform: scale(.96); opacity: .8; }
.importbtn svg { width: 26px; height: 26px; stroke: var(--muted); }
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.iconbtn svg { width: 14px; height: 14px; stroke: currentColor; vertical-align: -2px; margin-right: 5px; }

/* grouped inset log list + row chevrons */
.grouped { padding: 0; overflow: hidden; }
.entry:last-child { border-bottom: none; }
.chev { width: 8px; height: 14px; min-width: 8px; stroke: var(--faint); stroke-width: 2.5; fill: none; flex: none; margin-top: 5px; }
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }

input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* ---- landing: black hero ---- */
#appLogoImg.hero { display: block; width: 88%; margin: 0 auto 6px; }
#appTitle.hero-title { font-size: 13px; letter-spacing: .28em; color: #8e8e93; font-weight: 600; text-align: center; }
body.landing-dark { background: #000; color: #f5f5f7; }
body.landing-dark header { display: block; text-align: center; padding: 44px 4px 26px; }
body.landing-dark .modulecard.active { background: rgba(44,44,46,.66); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); color: #f5f5f7; box-shadow: 0 10px 34px rgba(0,0,0,.65); border: 1px solid rgba(255,255,255,.09); }
body.landing-dark .modulecard.planned { background: rgba(44,44,46,.38); border: 1px solid rgba(255,255,255,.05); opacity: 1; box-shadow: none; }
body.landing-dark .modulecard.planned .plus { color: #48484a; }
body.landing-dark footer { color: #636366; }
