/* Fonts are served from this site (SIL Open Font License; see fonts/). */
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-hyperlegible-400.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-hyperlegible-700.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("fonts/bricolage-grotesque-var.woff") format("woff"); font-weight: 600 800; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-400.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-500.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
/* Base reset (the Claude Artifact host adds the same rules). */
:root { color-scheme: light; }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
/* Layout: one-column case file sized for one hand. Quick-log folder tabs up top, the record below, tabs at the thumb. */
:root {
  --bg: #F2F5F6;
  --surface: #FFFFFF;
  --surface-2: #E7EDEF;
  --ink: #16313A;
  --ink-soft: #4F656D;
  --line: #CFDADE;
  --action: #1D5466;
  --action-ink: #FFFFFF;
  --tab: #E9C98A;
  --tab-ink: #5A3D06;
  --danger: #B42318;
  --danger-soft: #FCE7E4;
  --warn: #9A5408;
  --warn-soft: #FBEED8;
  --ok: #1D7347;
  --ok-soft: #E1F2E8;
  --shadow: 0 1px 2px rgba(22, 49, 58, 0.08);
  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible", -apple-system, "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1618; --surface: #162023; --surface-2: #1E2A2E; --ink: #E3ECEE; --ink-soft: #9DB0B6; --line: #2B393E;
    --action: #67B7CC; --action-ink: #0A1416; --tab: #8A6721; --tab-ink: #FCEBC6;
    --danger: #F28B7F; --danger-soft: #3B1C19; --warn: #F1B661; --warn-soft: #382811; --ok: #72CF9C; --ok-soft: #142E21;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1618; --surface: #162023; --surface-2: #1E2A2E; --ink: #E3ECEE; --ink-soft: #9DB0B6; --line: #2B393E;
  --action: #67B7CC; --action-ink: #0A1416; --tab: #8A6721; --tab-ink: #FCEBC6;
  --danger: #F28B7F; --danger-soft: #3B1C19; --warn: #F1B661; --warn-soft: #382811; --ok: #72CF9C; --ok-soft: #142E21;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px calc(96px + env(safe-area-inset-bottom, 0px));
}
.app { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; font-weight: 800; }
h3 { font-size: 1.1rem; font-weight: 800; }
p { margin: 0; }
a { color: var(--action); }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; border-radius: 6px; }

/* Header */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.wordmark { display: flex; flex-direction: column; gap: 2px; }
.wordmark h1 { font-size: 1.9rem; font-weight: 800; line-height: 1; display: flex; align-items: center; gap: 10px; }
.wordmark h1::before {
  content: ""; width: 26px; height: 20px; border-radius: 3px 8px 3px 3px;
  background: linear-gradient(var(--tab), var(--tab)) top left / 55% 5px no-repeat, linear-gradient(var(--tab), var(--tab)) 0 4px / 100% 16px no-repeat;
}
.wordmark .who { color: var(--ink-soft); font-size: 0.95rem; }
.badge { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 8px; border-radius: 4px; background: var(--surface-2); color: var(--ink-soft); }

/* Banners */
.banners { display: flex; flex-direction: column; gap: 10px; }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.banner p { flex: 1 1 220px; min-width: 0; }
.banner.warn { background: var(--warn-soft); border-color: transparent; }
.banner.danger { background: var(--danger-soft); border-color: transparent; }

/* Sections */
.tab { display: flex; flex-direction: column; gap: 18px; }
.section-head { display: flex; flex-direction: column; gap: 4px; }
.section-head p { color: var(--ink-soft); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }

/* Quick log tiles: folder tabs */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile {
  position: relative; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px 10px 10px 10px;
  padding: 18px 12px 12px; min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  box-shadow: var(--shadow);
}
.tile::before { content: ""; position: absolute; top: -7px; left: -1px; width: 46%; height: 8px; background: var(--tab); border-radius: 5px 8px 0 0; }
.tile:hover { border-color: var(--action); }
.tile:active { transform: translateY(1px); }
.tile .t-label { font-family: var(--f-display); font-weight: 800; font-size: 1.02rem; line-height: 1.15; }
.tile .t-count { font-family: var(--f-mono); font-size: 0.78rem; color: var(--ink-soft); }

/* Week strip */
.week { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .n { font-family: var(--f-mono); font-size: 1.35rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 0.76rem; color: var(--ink-soft); line-height: 1.25; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.row {
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: start;
}
.row:hover { border-color: var(--action); }
.row .r-title { font-weight: 700; min-width: 0; }
.row .r-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row .r-note { grid-column: 1 / -1; color: var(--ink-soft); font-size: 0.92rem; overflow-wrap: anywhere; }
.row .r-when { font-family: var(--f-mono); font-size: 0.8rem; color: var(--ink-soft); white-space: nowrap; }
.empty { padding: 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--ink-soft); text-align: center; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); white-space: nowrap; }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.example { background: var(--tab); color: var(--tab-ink); }

/* Buttons */
.btn { font: inherit; font-weight: 700; cursor: pointer; border-radius: 10px; padding: 12px 16px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-height: 44px; }
.btn.primary { background: var(--action); color: var(--action-ink); border-color: var(--action); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); color: var(--surface); border-color: var(--danger); }
.btn.danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 8px 12px; min-height: 36px; font-size: 0.9rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 auto; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, legend { font-weight: 700; font-size: 0.95rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="datetime-local"], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; min-height: 44px;
}
textarea { resize: vertical; }
/* iPhone Safari sizes date and time fields that keep the native look without their padding and border, so they
   stick out of the form and the form can be dragged sideways (WebKit bug 301648; found on a real iPhone, fixed in 0.3.1).
   Without the native look they follow the sizing above. */
input[type="date"], input[type="datetime-local"] { -webkit-appearance: none; appearance: none; box-sizing: border-box; max-width: 100%; min-width: 0; text-align: left; }
input[type="date"]::-webkit-date-and-time-value, input[type="datetime-local"]::-webkit-date-and-time-value { margin: 0; text-align: left; min-height: 1.5em; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: inline-block; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 0.92rem; }
.choice input:checked + span { background: var(--action); color: var(--action-ink); border-color: var(--action); }
.choice input:focus-visible + span { outline: 3px solid var(--action); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: center; }
.check input { width: 22px; height: 22px; accent-color: var(--action); }
.dur-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dur-row input { flex: 0 0 110px; }
.chip-btn { font: inherit; font-size: 0.85rem; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; font-family: var(--f-mono); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 420px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.confirm { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 10px; background: var(--danger-soft); }
.confirm.neutral { background: var(--surface-2); }

/* Sheet */
dialog#sheet { border: 0; padding: 0; width: min(560px, 100%); max-height: calc(100% - 24px); margin: auto auto 0; border-radius: 16px 16px 0 0; background: var(--surface); color: var(--ink); }
/* The sheet scrolls up and down only, and scrolling inside it doesn't move the page behind (0.3.1). */
dialog#sheet { overflow-x: hidden; overscroll-behavior: contain; }
.sheet-head > div { min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 600px) { dialog#sheet { margin: auto; border-radius: 16px; } }
dialog#sheet::backdrop { background: rgba(0, 0, 0, 0.45); }
.sheet-body { display: flex; flex-direction: column; gap: 16px; padding: 18px max(16px, env(safe-area-inset-left, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.icon-btn { font: inherit; font-size: 1.4rem; line-height: 1; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; flex: none; }

/* Report */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stats .stat { background: var(--surface); border: 1px solid var(--line); padding: 12px; }
.stats .stat .n { font-size: 1.6rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 700; background: var(--surface-2); }
td.num, th.num { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.stamp { align-self: flex-start; font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tab-ink); background: var(--tab); padding: 3px 8px; border-radius: 3px; }

/* Guide */
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--action); width: 0; transition: width 0.3s ease; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: step; }
.step { counter-increment: step; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 4px 12px; }
.step::before { content: counter(step); font-family: var(--f-mono); font-weight: 500; width: 30px; height: 30px; border-radius: 999px; background: var(--surface-2); display: grid; place-items: center; grid-row: 1 / span 2; }
.step.done::before { content: "\2713"; background: var(--ok-soft); color: var(--ok); }
.step h3 { font-size: 1.05rem; }
.step .s-body { grid-column: 2; display: flex; flex-direction: column; gap: 8px; }
.step ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.step .links { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 0.92rem; }
.note { font-size: 0.9rem; color: var(--ink-soft); padding: 12px 14px; border-left: 3px solid var(--tab); background: var(--surface); border-radius: 0 8px 8px 0; }

details.template { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
details.template summary { cursor: pointer; font-weight: 700; }
details.template pre { white-space: pre-wrap; font-family: var(--f-body); font-size: 0.95rem; background: var(--surface-2); padding: 12px; border-radius: 8px; overflow-wrap: anywhere; }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
.tabbar-inner { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.tabbar button { font: inherit; font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); background: transparent; border: 0; border-radius: 10px; padding: 6px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; }
.tabbar button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button[aria-current="page"] { color: var(--action); background: var(--surface-2); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 30; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 700; max-width: calc(100% - 32px); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); }

.toast.error { background: var(--danger); color: var(--surface); }
.banner .btn-row { flex: 0 0 auto; }
.explain { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; }
.srcs { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.85rem; align-items: baseline; }
.srcs .lead { color: var(--ink-soft); }
details.hist { font-size: 0.9rem; overflow-wrap: anywhere; }
details.hist summary { cursor: pointer; color: var(--ink-soft); }
details.hist ul { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.report-label { font-size: 0.92rem; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid var(--action); }
.version { font-family: var(--f-mono); font-size: 0.75rem; color: var(--ink-soft); }

.row.withdrawn { opacity: 0.68; }
.ci-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
dl.ro { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 0.95rem; }
dl.ro dt { color: var(--ink-soft); }
dl.ro dd { margin: 0; overflow-wrap: anywhere; }
.banner.demo { background: var(--tab); color: var(--tab-ink); border-color: transparent; }
.passrow { display: flex; flex-direction: column; gap: 10px; }
.stack-10 { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.stack-14 { display: flex; flex-direction: column; gap: 14px; }
#restore-label { text-align: center; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
