/* Alphaeus kit 2.1 tokens and shared components (lead-owned). Views add their own css files. */
:root {
  --paper: #F4F3EF;
  --surface: #FCFCFC;
  --surface-2: #EDEBE5;
  --ink: #131210;
  --ink-2: #4A4740;
  --line: #CBC8C0;
  --line-strong: #79766F;
  --scarlet: #D63438;
  --scarlet-text: #A12B2E;
  --scarlet-wash: #F7EEEE;
  --teal: #3FB6C0;
  --teal-text: #2C686D;
  --teal-wash: #EFF5F6;
  --amber: #FEAD01;
  --amber-text: #8A5D00;
  --amber-wash: #F9F5EC;
  --green: #41BE62;
  --on-teal: #112022;
  --sans: "Schibsted Grotesk", system-ui, -apple-system, sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131210; --surface: #1C1B18; --surface-2: #26241F;
    --ink: #F3F2F2; --ink-2: #CBC8C0; --line: #4A4740; --line-strong: #96938B;
    --scarlet-text: #DC898B; --scarlet-wash: #2a1617;
    --teal-text: #94CCD1; --teal-wash: #16292b;
    --amber-text: #F2C973; --amber-wash: #2a2210;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131210; --surface: #1C1B18; --surface-2: #26241F;
  --ink: #F3F2F2; --ink-2: #CBC8C0; --line: #4A4740; --line-strong: #96938B;
  --scarlet-text: #DC898B; --scarlet-wash: #2a1617;
  --teal-text: #94CCD1; --teal-wash: #16292b;
  --amber-text: #F2C973; --amber-wash: #2a2210;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.wrap { max-width: 600px; margin: 0 auto; padding: 0 16px 64px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header */
header { padding: 20px 0 8px; }
.brandrow { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 14px; }
.brandrow svg { width: 26px; height: 26px; color: var(--ink); flex: none; }
h1 {
  font-weight: 800; font-size: clamp(38px, 11vw, 56px); line-height: 0.98;
  letter-spacing: -0.025em; margin: 18px 0 8px;
}
h1 .dot { color: var(--scarlet); }
.sub { margin: 0; color: var(--ink-2); font-size: 15px; }

/* lock bar */
.lock {
  margin: 18px 0 4px; padding: 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface);
}
.lock p { margin: 0 0 10px; font-size: 15px; }
.lock form { display: flex; flex-wrap: wrap; gap: 8px; }
.lock input {
  flex: 1 1 120px; min-width: 0; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--paper);
}
.lock .err { color: var(--scarlet-text); font-size: 14px; margin: 8px 0 0; }
.who { font-size: 14px; color: var(--ink-2); margin: 14px 0 0; }
.who button { background: none; border: 0; padding: 0; text-decoration: underline; color: var(--ink-2); font-size: 14px; }

.btn {
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 10px; font-weight: 700; font-size: 15px;
  min-height: 44px;
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); font-weight: 500; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* day strip */
.days {
  display: grid; grid-template-columns: repeat(var(--ndays, 6), 1fr); gap: 6px; margin: 22px 0 0;
}
.day {
  border: 1px solid var(--line); background: transparent; border-radius: 12px;
  padding: 8px 4px 10px; text-align: center; min-height: 44px;
}
.day .dow { display: block; font-size: 12px; color: var(--ink-2); }
.day .num { display: block; font: 600 20px/1.2 var(--mono); }
.day .bar { display: block; height: 4px; border-radius: 2px; background: var(--surface-2); margin: 6px 6px 0; overflow: hidden; }
.day .bar i { display: block; height: 100%; background: var(--teal); }
.day[aria-current="date"] .dow::after { content: " today"; }
.day[aria-pressed="true"] { border-color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--ink); }

/* next up */
.next { margin: 26px 0 6px; display: flex; gap: 16px; align-items: center; }
.ring { flex: none; width: 76px; height: 76px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .count { position: absolute; inset: 0; display: grid; place-items: center; font: 600 15px var(--mono); }
.next .lead { font-size: 14px; color: var(--ink-2); margin: 0; }
.next .what { font-size: 22px; font-weight: 700; line-height: 1.2; margin: 2px 0 0; }
.next .what.late { color: var(--scarlet-text); }

/* timeline */
.rail { list-style: none; margin: 24px 0 0; padding: 0; position: relative; }
.rail::before {
  content: ""; position: absolute; left: 80px; top: 6px; bottom: 6px; width: 2px; background: var(--line);
}
.row { display: grid; grid-template-columns: 66px 1fr; column-gap: 32px; padding: 12px 0 16px; position: relative; }
.row .t { font: 600 13px/1.6 var(--mono); color: var(--ink-2); text-align: right; padding-top: 2px; }
.row .t small { display: block; font: 400 11px/1.3 var(--sans); }
.row::after {
  content: ""; position: absolute; left: 75px; top: 17px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--line-strong);
}
.row.done::after { background: var(--teal); border-color: var(--teal); }
.row.skipped::after { background: var(--amber); border-color: var(--amber); }
.row.late::after { border-color: var(--scarlet); background: var(--scarlet-wash); }
.row h3 { margin: 0; font-size: 17px; line-height: 1.3; font-weight: 700; }
.row.done h3, .row.skipped h3 { color: var(--ink-2); }
.row .d { margin: 3px 0 10px; font-size: 14.5px; color: var(--ink-2); max-width: 60ch; }
.row .status { font-size: 13.5px; margin: 8px 0 0; color: var(--ink-2); }
.row .status.late { color: var(--scarlet-text); font-weight: 500; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line-strong);
  background: var(--surface); font-weight: 700; font-size: 15px;
}
.chip .box {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-strong);
  display: grid; place-items: center; flex: none;
}
.chip[aria-pressed="true"] { background: var(--teal-wash); border-color: var(--teal); color: var(--teal-text); }
.chip[aria-pressed="true"] .box { background: var(--teal); border-color: var(--teal); }
.chip[aria-pressed="true"] .box::after { content: ""; width: 8px; height: 4px; border: solid var(--on-teal); border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.chip.skip-state { background: var(--amber-wash); border-color: var(--amber); color: var(--amber-text); }
.chip:disabled { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 10px 6px; color: var(--ink-2); text-decoration: underline; font-size: 14px; min-height: 44px; }
.linkbtn:disabled { opacity: .4; }
.timein { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); font-family: var(--mono); min-height: 44px; }

.now {
  position: relative; height: 0; margin: 4px 0; list-style: none;
}
.now span {
  position: absolute; left: 0; right: 0; top: -9px; display: grid; grid-template-columns: 66px 1fr; column-gap: 32px; align-items: center;
}
.now b { font: 600 12px var(--mono); color: var(--scarlet-text); text-align: right; }
.now i { height: 2px; background: var(--scarlet); position: relative; margin-left: -18px; }
.now i::before { content: ""; position: absolute; left: -3px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--scarlet); }

/* notes + facts */
h2 { font-size: 20px; font-weight: 800; margin: 40px 0 10px; letter-spacing: -0.01em; }
textarea {
  width: 100%; min-height: 110px; padding: 12px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); resize: vertical; line-height: 1.5;
}
.notemeta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; font-size: 13.5px; color: var(--ink-2); flex-wrap: wrap; }
.facts { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.facts li { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 110px 1fr; gap: 12px; font-size: 15px; }
.facts b { font-weight: 700; }

.amt { font: 400 12.5px var(--mono); color: var(--ink-2); }
.chip[aria-pressed="true"] .amt { color: var(--teal-text); }

.phead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 40px 0 10px; }
.phead h2 { margin: 0; }
.phead .count { font: 400 13px var(--mono); color: var(--ink-2); }
.addphoto { display: inline-flex; align-items: center; gap: 8px; position: relative; overflow: hidden; }
.addphoto input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.addphoto:focus-within { outline: 2px solid var(--teal); outline-offset: 2px; }
.pmsg { font-size: 14.5px; color: var(--ink-2); margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.grid button { padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); position: relative; }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .pending { display: grid; place-items: center; font: 400 12px var(--mono); color: var(--ink-2); }
dialog.viewer { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100dvh; margin: 0; }
dialog.viewer::backdrop { background: rgba(10,10,9,.92); }
.viewer .inner { background: #0D0C0B; height: 100%; display: flex; flex-direction: column; padding: calc(12px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom)); gap: 12px; }
.viewer .img { flex: 1; min-height: 0; display: grid; place-items: center; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer .bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: #F3F2F2; font-size: 14px; flex-wrap: wrap; }
.viewer .bar .btn { background: #F3F2F2; color: #131210; border-color: #F3F2F2; }
.viewer .bar .btn.ghost { background: transparent; color: #F3F2F2; border-color: #79766F; }

footer { margin-top: 36px; font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; font-size: 14.5px;
  max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.18); display: none;
}
.toast.show { display: block; }
.toast.err { background: var(--scarlet-text); color: #fff; }

@media (max-width: 380px) {
  .row { grid-template-columns: 58px 1fr; column-gap: 26px; }
  .rail::before { left: 70px; }
  .row::after { left: 65px; }
  .now span { grid-template-columns: 58px 1fr; column-gap: 26px; }
  .now i { margin-left: -14px; }
  .days { gap: 4px; }
  .day .num { font-size: 18px; }
}
@media (prefers-reduced-motion: no-preference) {
  .day .bar i, .ring circle { transition: all .35s ease; }
}

/* ---------- app shell (lead) ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0 0; }
.topbar .brandrow { text-decoration: none; color: var(--ink-2); }
.topbar .mk svg { width: 26px; height: 26px; color: var(--ink); display: block; }
.offline { font: 400 12.5px var(--mono); color: var(--amber-text); background: var(--amber-wash); border: 1px solid var(--amber); padding: 4px 10px; border-radius: 999px; }
main { outline: none; }
.loading, .empty { color: var(--ink-2); padding: 32px 0; }
.wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(var(--tabs, 4), 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px;
  text-decoration: none; color: var(--ink-2); font-size: 12.5px; font-weight: 500; border-radius: 10px;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabbar a[aria-current="page"] svg { color: var(--scarlet); }
.tabbar a.urgent { color: var(--scarlet-text); }
.pagehead { margin: 18px 0 6px; }
.pagehead h1 { font-size: clamp(32px, 9vw, 46px); margin: 0 0 6px; }
.field { display: grid; gap: 6px; margin: 0 0 14px; }
.field > span { font-size: 14px; font-weight: 700; }
.field small { color: var(--ink-2); font-size: 13px; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); min-height: 44px;
}
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list > li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.list a.item { display: flex; justify-content: space-between; gap: 12px; text-decoration: none; color: inherit; align-items: center; min-height: 44px; }
.muted { color: var(--ink-2); }
.err { color: var(--scarlet-text); }
.login { max-width: 360px; margin: 10vh auto 0; }
.login h1 { font-size: clamp(38px, 11vw, 52px); }
.login .pin { font: 600 28px var(--mono); letter-spacing: .3em; text-align: center; }
@media print {
  .tabbar, .topbar, .noprint { display: none !important; }
  body { background: #fff; color: #000; }
  .wrap { padding: 0; max-width: none; }
}

main:focus, main:focus-visible { outline: none; }
