:root {
  --ground: #F3F5EE;
  --ink: #1D2B22;
  --muted: #5B6A60;
  --moss: #2F5D3C;
  --sage: #E4EADB;
  --sage-deep: #DCE6CF;
  --line: #A9B8A0;
  --chip-line: #C9D4C0;
  --honey: #E8B04A;
  --honey-line: #B9801E;
  --card: #FFFFFF;
  --error: #9B2C1F;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: 'Figtree', system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2 { font-family: 'Bricolage Grotesque', sans-serif; margin: 0; }

.screen { max-width: 480px; min-height: 100dvh; margin: 0 auto; padding: max(48px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 20px; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--sage); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); }
.icon-btn.plain { background: transparent; margin-left: -8px; }
.icon-btn svg { width: 22px; height: 22px; }

.btn { height: 56px; border-radius: 28px; border: 0; background: var(--moss); color: #fff; font-size: 17px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.btn.round { width: 56px; background: var(--card); color: var(--ink); border: 1.5px solid var(--line); flex: none; }
:focus-visible { outline: 3px solid var(--honey-line); outline-offset: 2px; }

.bar { height: 6px; border-radius: 3px; background: var(--sage); overflow: hidden; }
.bar > div { height: 100%; background: var(--moss); transition: width .2s; }

/* login */
.login { padding-top: 96px; gap: 40px; }
.login h1 { font-size: 40px; line-height: 1.05; font-weight: 700; }
.login p { margin: 8px 0 0; font-size: 17px; line-height: 1.4; }
.form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; }
.field input { height: 52px; border: 1.5px solid var(--line); border-radius: 14px; padding: 0 16px; font-size: 17px; background: var(--card); color: var(--ink); }
.error { color: var(--error); font-size: 15px; margin: 0; }

/* library */
.library-title { font-size: 32px; line-height: 1.1; font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cover-card { display: flex; flex-direction: column; background: var(--card); border-radius: 20px; overflow: hidden; box-shadow: 0 1px 2px rgba(29,43,34,.08); }
.cover { height: 150px; background: var(--sage-deep); display: flex; align-items: center; justify-content: center; color: var(--moss); }
.cover svg { width: 104px; height: 104px; }
.cover-body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.cover-body strong { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 600; font-size: 18px; }
.cover-body .small { font-size: 13px; }
.cover-body .progress-label { font-size: 13px; font-weight: 600; color: var(--moss); }
.add-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 260px; border: 2px dashed var(--line); border-radius: 20px; color: var(--moss); text-align: center; padding: 16px; font-weight: 600; font-size: 15px; }
.add-tile svg { width: 40px; height: 40px; }

/* overview */
.overview h1 { font-size: 32px; line-height: 1.1; font-weight: 700; }
.sections { display: flex; flex-direction: column; gap: 8px; }
.section { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 12px 16px; border: 0; border-radius: 16px; background: var(--card); text-align: left; cursor: pointer; color: var(--ink); }
.section .name { font-weight: 600; }
.section .sub { font-size: 13px; color: var(--muted); }
.section .count { font-size: 13px; color: var(--muted); }
.section.current { background: var(--moss); color: #fff; }
.section.current .sub { color: var(--sage-deep); }
.section.current .count { color: #fff; font-weight: 600; }
.section.done .count { color: var(--moss); font-weight: 600; }
.mark { width: 22px; height: 22px; flex: none; }
.mark.todo { border-radius: 50%; border: 2px solid var(--line); }
.mark.done { color: var(--moss); }
.mark.now { color: var(--honey); }

/* row view */
.rowview { gap: 16px; padding-top: max(40px, env(safe-area-inset-top)); }
.rowview .title { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 600; font-size: 18px; }
.rowview .sub { font-size: 13px; }
.peek { display: flex; gap: 10px; padding: 0 4px; color: var(--muted); font-size: 15px; }
.peek b { font-weight: 600; flex: none; }
.peek.upcoming { opacity: .75; }
.peek.prev { align-items: center; }
.peek.prev svg { width: 18px; height: 18px; color: var(--moss); flex: none; }
.current-card { background: var(--card); border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 2px 6px rgba(29,43,34,.10); }
.current-card .big { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 36px; line-height: 1; }
.current-card .side { font-size: 14px; font-weight: 600; color: var(--moss); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-width: 44px; height: 48px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--chip-line); background: var(--ground); color: var(--ink); font-size: 20px; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--honey); border-color: var(--honey-line); }
.help { background: var(--sage); border-radius: 16px; padding: 14px 16px; min-height: 84px; display: flex; flex-direction: column; gap: 4px; }
.help .h { font-size: 13px; font-weight: 600; color: var(--moss); }
.help .b { font-size: 16px; line-height: 1.4; }
.spacer { flex: 1; }
.actions { display: flex; gap: 12px; position: sticky; bottom: 0; padding-bottom: 4px; }
.actions .btn:not(.round) { flex: 1; }
.finished { align-items: center; text-align: center; padding-top: 96px; gap: 16px; }
.finished svg.hero { width: 96px; height: 96px; color: var(--moss); }
.finished h1 { font-size: 32px; }

/* bracketed repeats, row remarks, notes */
.group { position: relative; display: flex; flex-wrap: wrap; gap: 8px; padding: 22px 10px 10px; border: 2px solid var(--moss); border-radius: 18px; background: var(--sage); }
.group-label { position: absolute; top: -1px; left: 12px; transform: translateY(-50%); background: var(--moss); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .02em; padding: 2px 10px; border-radius: 10px; }
.group .chip { background: var(--card); }
.group .chip[aria-pressed="true"] { background: var(--honey); }
.row-note { font-size: 14px; color: var(--muted); }
.notes-box { background: var(--sage); border-radius: 16px; overflow: hidden; }
.notes-toggle { width: 100%; min-height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; background: transparent; color: var(--ink); font-size: 15px; font-weight: 600; text-align: left; cursor: pointer; }
.chev { width: 10px; height: 10px; border-right: 2.5px solid var(--moss); border-bottom: 2.5px solid var(--moss); transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; flex: none; }
.notes-toggle[aria-expanded="true"] .chev { transform: rotate(-135deg) translate(-2px, -2px); }
.notes-body { padding: 0 16px 14px; font-size: 15px; line-height: 1.45; }
.notes-body[hidden] { display: none; }
.notes-body .h { font-size: 13px; font-weight: 600; color: var(--moss); margin-bottom: 6px; }
.notes-body p { margin: 0 0 8px; }
.notes-body p:last-child { margin-bottom: 0; }
.notes-body a, .about a { color: var(--moss); text-decoration: underline; }
.about { background: var(--card); border-radius: 16px; padding: 12px 16px; font-size: 15px; line-height: 1.45; }
.about summary { font-weight: 600; cursor: pointer; min-height: 24px; }
.about ul { padding-left: 18px; margin: 8px 0; }
.about li { margin-bottom: 6px; }
