/* Murphy: pine field green with golden-coat honey. System font for text,
   Bricolage Grotesque (bundled) for display. Light and dark. */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-grotesque-latin-wght.woff2') format('woff2-variations'),
       url('/fonts/bricolage-grotesque-latin-wght.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #EEF2EA;
  --surface: #FFFFFF;
  --surface-2: #F3F6F0;
  --ink: #12221C;
  --muted: #4F6058;
  --line: #DAE2D7;
  --pine: #1B4D3E;
  --pine-deep: #143B30;
  --on-pine: #F1F7F1;
  --on-pine-muted: #B9D3C7;
  --accent-text: #1B4D3E;
  --honey: #F0B429;
  --honey-press: #DFA41B;
  --on-honey: #261A04;
  --honey-text: #7A5200;
  --honey-wash: #FCF1D2;
  --ok: #1B7350;
  --ok-wash: #DDF0E5;
  --bad: #B92D4B;
  --bad-wash: #FBE4EA;
  --shadow: 0 1px 2px rgba(18, 34, 28, .05), 0 8px 24px -12px rgba(18, 34, 28, .18);
  --display: 'Bricolage Grotesque', ui-rounded, -apple-system, system-ui, sans-serif;
  --text: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Roboto, sans-serif;
  --tabs-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0D1613;
    --surface: #17231F;
    --surface-2: #1F2D28;
    --ink: #EAF1EB;
    --muted: #9FB2A9;
    --line: #2B3B35;
    --pine: #1C4F40;
    --pine-deep: #123229;
    --accent-text: #8FDDBB;
    --honey-text: #F4C65A;
    --honey-wash: #382D10;
    --ok: #62CC9C;
    --ok-wash: #173528;
    --bad: #F27A93;
    --bad-wash: #3B1A22;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #0D1613;
  --surface: #17231F;
  --surface-2: #1F2D28;
  --ink: #EAF1EB;
  --muted: #9FB2A9;
  --line: #2B3B35;
  --pine: #1C4F40;
  --pine-deep: #123229;
  --accent-text: #8FDDBB;
  --honey-text: #F4C65A;
  --honey-wash: #382D10;
  --ok: #62CC9C;
  --ok-wash: #173528;
  --bad: #F27A93;
  --bad-wash: #3B1A22;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

body.sheet-open { overflow: hidden; }

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; -webkit-user-select: none; user-select: none; cursor: pointer; }
a, label, summary { touch-action: manipulation; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }
#view:focus { outline: none; }

.icon { flex: none; }

/* ---------- Layout ---------- */

#view {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabs-h) + var(--safe-b) + 28px);
}

body.no-tabs #view { padding-bottom: calc(var(--safe-b) + 24px); }

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-after-hero { padding-top: 16px; }

.page-head {
  padding: calc(var(--safe-t) + 22px) 4px 2px;
}

.page-head h1 {
  font-family: var(--display);
  font-size: 36px;
  line-height: 1.05;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.page-head.has-back h1 { font-size: 30px; }

.page-sub { color: var(--muted); margin-top: 6px; font-size: 16px; }

.back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -6px 0 6px -10px;
  border-radius: 50%;
  color: var(--ink);
}

.back:active { background: var(--line); }

section > h2, .card h2, .section-head h2 {
  font-family: var(--display);
  font-size: 21px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.card h3 { font-size: 16px; font-weight: 650; margin-top: 4px; }

.section-head, .card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-head { padding: 6px 4px 0; margin-bottom: 10px; }

.count { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.muted { color: var(--muted); font-size: 16px; }
.lead { padding: 0 4px; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.4; }
.center { text-align: center; }
.link { font-weight: 600; font-size: 16px; display: inline-flex; align-items: center; min-height: 44px; }

.link-btn {
  background: none; border: 0; padding: 0;
  color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
  min-height: 44px;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* ---------- Card ---------- */

.card {
  background: var(--surface);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-accent { background: var(--honey-wash); box-shadow: none; }
.card-do { border-left: 5px solid var(--ok); }
.card-dont { border-left: 5px solid var(--bad); }

/* ---------- Hero (home) ---------- */

.hero {
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(240, 180, 41, .16), transparent 55%),
    var(--pine);
  color: var(--on-pine);
  padding: calc(var(--safe-t) + 18px) 20px 24px;
  border-radius: 0 0 34px 34px;
}

.hero > * { max-width: 520px; margin-left: auto; margin-right: auto; }

.hero-top { display: flex; align-items: center; gap: 12px; }
.hero-id { flex: 1; min-width: 0; }
.hero-name { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.1; }
.hero-sub { color: var(--on-pine-muted); font-size: 15px; }
.hero-kicker { margin-top: 22px; color: var(--on-pine-muted); font-size: 17px; }
.hero-kicker + .hero-big { margin-top: 0; }

.hero-big {
  margin-top: 20px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(52px, 17vw, 72px);
  line-height: .95;
  letter-spacing: -0.04em;
  color: var(--honey);
}

.hero-line { margin-top: 10px; font-size: 19px; font-weight: 600; line-height: 1.25; }

.hero-link {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px; margin-top: 4px;
  color: var(--on-pine-muted); font-size: 15px; text-decoration: none;
}

.hero-streak {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px; padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: var(--on-pine);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.hero-streak.is-done { background: var(--honey); color: var(--on-honey); }

/* Collar-tag avatar: a disc with a honey rim, like a name tag. */
.tagpic {
  position: relative;
  flex: none;
  width: 58px; height: 58px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--pine-deep);
  box-shadow: 0 0 0 3px var(--honey);
}

.tagpic-mark { display: grid; place-items: center; overflow: hidden; }
.tagpic-lg { width: 84px; height: 84px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 20px;
  border: 0;
  border-radius: 16px;
  font-weight: 650;
  font-size: 17px;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: transform .08s ease, background-color .15s ease;
}

.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .45; }

.btn-primary { background: var(--honey); color: var(--on-honey); }
.btn-primary:active { background: var(--honey-press); }
.btn-pine { background: var(--pine); color: var(--on-pine); }
.btn-soft { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost { background: transparent; color: var(--accent-text); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1.5px var(--bad); }
.btn-sm { min-height: 44px; padding: 8px 14px; font-size: 15px; border-radius: 13px; }

.btn-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }

.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; font-size: 100px; cursor: pointer; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; margin: -6px -8px -6px 0;
  border: 0; border-radius: 50%; background: none; color: var(--muted);
}

.icon-btn:active { background: var(--surface-2); }

/* ---------- Tags, chips, segmented ---------- */

.tag {
  display: inline-block;
  font-style: normal;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}

.tag-now { background: var(--honey); color: var(--on-honey); }
.tag-soft { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.card .chips { justify-content: flex-start; }

.chip {
  min-height: 44px; padding: 0 18px;
  border: 0; border-radius: 999px;
  background: var(--surface); color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-weight: 600; font-size: 16px;
  display: inline-flex; align-items: center;
}

.chip.is-active { background: var(--pine); color: var(--on-pine); box-shadow: none; }
.chip.is-static { min-height: 38px; background: var(--surface); font-variant-numeric: tabular-nums; }
.chip:disabled { opacity: .5; }

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--line);
  border-radius: 16px;
}

.seg > * {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 12px;
  background: transparent; color: var(--muted);
  font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap;
}

.seg > .is-active { background: var(--pine); color: var(--on-pine); }

.seg-scroll {
  grid-auto-columns: max-content;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 4px 16px;
  background: transparent;
  gap: 8px;
}

.seg-scroll::-webkit-scrollbar { display: none; }
.seg-scroll > * { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); border-radius: 999px; padding: 0 16px; }
.seg-scroll > .is-active { background: var(--pine); color: var(--on-pine); box-shadow: none; }

/* ---------- Lists and rows ---------- */

.list { display: flex; flex-direction: column; }
.list-inset { margin: 0 -6px -8px; }

.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 10px 6px;
  color: var(--ink); text-decoration: none;
  border-top: 1px solid var(--line);
}

.row:first-child { border-top: 0; }
.row:active { background: var(--surface-2); }
.row > .icon:last-child { color: var(--muted); }
.row-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); color: var(--accent-text); flex: none; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 600; }
.row-sub { color: var(--muted); font-size: 15px; line-height: 1.35; }
.row-end { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 15px; }
.row-end.is-ok { color: var(--ok); font-weight: 700; }

.menu { display: flex; flex-direction: column; gap: 10px; }

.menu-item {
  display: flex; align-items: center; gap: 14px;
  min-height: 72px; padding: 14px 14px 14px 16px;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none;
}

.menu-item:active { transform: scale(.985); }
.menu-item > .icon:last-child { color: var(--muted); }
.menu-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--pine); color: var(--honey); flex: none; }
.menu-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.menu-main b { font-size: 18px; font-weight: 650; }
.menu-main span { color: var(--muted); font-size: 15px; line-height: 1.35; }
.menu-main small { color: var(--honey-text); font-size: 14px; font-weight: 600; }

/* ---------- Checklists ---------- */

.checks { display: flex; flex-direction: column; margin: 0 -6px -6px; }

.check {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; min-height: 52px; padding: 11px 6px;
  background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0;
  text-align: left;
}

.check:first-child { border-top: 0; }

.check-box {
  flex: none; display: grid; place-items: center;
  width: 28px; height: 28px; margin-top: 1px;
  border-radius: 9px;
  box-shadow: inset 0 0 0 2px var(--muted);
  color: transparent;
  transition: background-color .15s ease, box-shadow .15s ease;
}

.check.is-on .check-box, [aria-pressed='true'] > .check-box { background: var(--ok); box-shadow: none; color: #fff; }
:root[data-theme='dark'] .check.is-on .check-box, :root[data-theme='dark'] [aria-pressed='true'] > .check-box { color: #0D1613; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .check.is-on .check-box, :root:not([data-theme='light']) [aria-pressed='true'] > .check-box { color: #0D1613; }
}

.check-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.check-text { font-weight: 550; line-height: 1.35; }
.check-note { color: var(--muted); font-size: 15px; line-height: 1.4; }
.check.is-on .check-text { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }

/* ---------- Text blocks ---------- */

.bullets { display: flex; flex-direction: column; gap: 10px; }
.bullets li { position: relative; padding-left: 22px; line-height: 1.45; }
.bullets li::before { content: ''; position: absolute; left: 4px; top: .6em; width: 7px; height: 7px; border-radius: 50%; background: var(--honey); }
.bullets-check li::before { width: 10px; height: 6px; border-radius: 0; background: none; border-left: 2.5px solid var(--ok); border-bottom: 2.5px solid var(--ok); transform: rotate(-45deg); top: .42em; left: 2px; }
.bullets-x li::before { content: '×'; width: auto; height: auto; background: none; color: var(--bad); font-weight: 800; font-size: 19px; line-height: 1; top: .12em; left: 2px; }

.steps { counter-reset: step; display: flex; flex-direction: column; gap: 12px; }
.steps li { counter-increment: step; position: relative; padding-left: 40px; line-height: 1.45; min-height: 28px; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--pine); color: var(--on-pine);
  font-family: var(--display); font-weight: 700; font-size: 15px;
}
.steps .icon { vertical-align: -3px; }

.note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 14px 16px; border-radius: 18px;
  font-size: 16px; line-height: 1.45;
}

.note > .icon { margin-top: 2px; }
.note-info { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.note-honey { background: var(--honey-wash); }
.note-honey > .icon { color: var(--honey-text); }
.note-vet { background: var(--ok-wash); }
.note-vet > .icon { color: var(--ok); }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 8px; text-align: left; border-top: 1px solid var(--line); font-weight: 500; }
.table tr:first-child th, .table tr:first-child td { border-top: 0; }
.table td { text-align: right; color: var(--muted); }
.table .is-current th, .table .is-current td { font-weight: 700; color: var(--ink); background: var(--honey-wash); }
.table .is-current th { border-radius: 10px 0 0 10px; }
.table .is-current td { border-radius: 0 10px 10px 0; }

.freq { color: var(--honey-text); font-weight: 650; font-size: 15px; margin-top: -6px; }

/* ---------- Progress ---------- */

.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--honey); transition: width .3s ease; }
.bar-lg { height: 12px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats-card { background: var(--surface); border-radius: 22px; padding: 16px 10px; box-shadow: var(--shadow); }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.stat-num { font-family: var(--display); font-weight: 750; font-size: 30px; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-lab { color: var(--muted); font-size: 14px; line-height: 1.25; }

.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: calc(var(--h) + 44px); padding-top: 22px; }
.chart-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.chart-col i { display: block; width: 100%; max-width: 44px; min-height: 3px; border-radius: 8px 8px 3px 3px; background: var(--accent-text); opacity: .85; }
.chart-col.is-hl i { background: var(--honey); opacity: 1; }
.chart-val { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 18px; }
.chart-lab { font-size: 13px; color: var(--muted); white-space: nowrap; height: 18px; }

.chart-line { width: 100%; height: auto; display: block; }
.chart-line text { font-size: 11px; fill: var(--muted); font-family: var(--text); }
.chart-line .val { font-size: 13px; font-weight: 700; fill: var(--ink); }
.chart-line .grid { stroke: var(--line); stroke-width: 1; }
.chart-line .line { fill: none; stroke: var(--accent-text); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-line .dot { fill: var(--surface); stroke: var(--accent-text); stroke-width: 2; }
.chart-line .dot.last { fill: var(--honey); stroke: var(--surface); }

/* ---------- Home: exercises, routine ---------- */

.ex-list { display: flex; flex-direction: column; gap: 12px; }

.ex {
  background: var(--surface); border-radius: 22px; padding: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
  border-top: 5px solid var(--line);
}

.ex.is-logged { border-top-color: var(--honey); }
.ex-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ex-head h3 { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; }
.ex-note { line-height: 1.45; }
.ex-crit { font-size: 16px; color: var(--muted); line-height: 1.4; }
.ex-crit b { color: var(--ink); font-weight: 650; }
.ex-actions { display: grid; grid-template-columns: 1.25fr 1fr; gap: 10px; margin-top: 2px; }
.ex-today { font-size: 15px; color: var(--honey-text); font-weight: 600; }

details > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; min-height: 44px;
  color: var(--accent-text); font-weight: 600; font-size: 16px;
}

details > summary::-webkit-details-marker { display: none; }
.ex details > summary::after { content: ''; width: 8px; height: 8px; margin-left: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-3px); transition: transform .15s ease; }
.ex details[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.ex details[open] > summary { margin-bottom: 6px; }

.fold { gap: 0; }
.fold > summary { justify-content: space-between; color: var(--ink); min-height: 44px; margin: -6px 0; }
.fold > summary .icon { color: var(--muted); transform: rotate(90deg); transition: transform .15s ease; }
.fold[open] > summary .icon { transform: rotate(-90deg); }
.fold[open] > summary { margin-bottom: 12px; }
.fold > p { margin-bottom: 10px; }

.timeline { display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 82px 34px 1fr; gap: 8px; align-items: start; padding: 9px 0; position: relative; }
.timeline li + li::before { content: ''; position: absolute; left: 106px; top: -9px; height: 18px; width: 2px; background: var(--line); }
.tl-time { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--muted); padding-top: 6px; white-space: nowrap; }
.tl-dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); position: relative; z-index: 1; }
.tl-body { display: flex; flex-direction: column; gap: 1px; padding-top: 5px; }
.tl-body b { font-weight: 600; }
.tl-body span { font-size: 15px; color: var(--muted); line-height: 1.35; }
.timeline .is-past { opacity: .55; }
.timeline .is-next .tl-dot { background: var(--honey); color: var(--on-honey); }
.timeline .is-next .tl-time { color: var(--ink); font-weight: 700; }

.facts { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.facts p { display: flex; gap: 10px; font-size: 16px; line-height: 1.4; }
.facts .icon { color: var(--accent-text); margin-top: 2px; }

.potty-quick.is-due { background: var(--honey-wash); box-shadow: none; }

/* ---------- Plan ---------- */

.plan-list { display: flex; flex-direction: column; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }

.plan-row {
  display: grid; grid-template-columns: 104px 1fr auto; gap: 12px; align-items: center;
  min-height: 68px; padding: 12px 12px 12px 16px;
  color: var(--ink); text-decoration: none;
  border-top: 1px solid var(--line);
}

.plan-row:first-child { border-top: 0; }
.plan-row:active { background: var(--surface-2); }
.plan-row > .icon { color: var(--muted); }
.plan-when { display: flex; flex-direction: column; }
.plan-when b { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.plan-when span { color: var(--muted); font-size: 13px; }
.plan-what { font-size: 16px; line-height: 1.3; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.plan-row.is-past .plan-when b, .plan-row.is-past .plan-what { color: var(--muted); }
.plan-row.is-now { background: var(--honey-wash); }
.plan-row-prep { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); border-top: 0; }
.plan-row-prep.is-now { box-shadow: none; }
.plan-row-prep { grid-template-columns: 1fr auto; row-gap: 6px; padding-top: 16px; padding-bottom: 16px; }
.plan-row-prep .plan-what { grid-column: 1; grid-row: 2; color: var(--muted); align-items: stretch; }
.plan-row-prep > .icon { grid-column: 2; grid-row: 1 / 3; }
.plan-progress { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; width: 100%; color: var(--muted); font-size: 13px; }

.unit-lead { padding: 4px 4px 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.unit-lead h2 { font-size: 26px; }
.unit-lead p { font-size: 18px; line-height: 1.45; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Commands ---------- */

.cmd-list { display: flex; flex-direction: column; gap: 10px; }

.cmd-row {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 12px 16px 18px;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none;
}

.cmd-row:active { transform: scale(.985); }
.cmd-row > .icon { color: var(--muted); }
.cmd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cmd-name { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.015em; line-height: 1.15; }
.cmd-short { color: var(--muted); font-size: 15px; line-height: 1.35; }
.cmd-meter { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-top: 6px; color: var(--muted); font-size: 13px; }
.cmd-row.is-mastered .cmd-meter span:last-child { color: var(--ok); font-weight: 700; }
.cmd-row.is-mastered .bar i { background: var(--ok); }

.levels { display: flex; flex-direction: column; gap: 4px; }
.levels li { display: flex; gap: 12px; padding: 10px; border-radius: 14px; }
.lv-num { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 15px; box-shadow: inset 0 0 0 2px var(--line); color: var(--muted); }
.lv-body { display: flex; flex-direction: column; gap: 2px; }
.lv-body b { font-weight: 600; }
.lv-body span { color: var(--muted); font-size: 15px; line-height: 1.4; }
.levels .is-done .lv-num { background: var(--ok); color: var(--surface); box-shadow: none; }
.levels .is-done .lv-body b { color: var(--muted); }
.levels .is-current { background: var(--honey-wash); }
.levels .is-current .lv-num { background: var(--honey); color: var(--on-honey); box-shadow: none; }
.levels .is-current .lv-body span { color: var(--ink); }

/* ---------- Logs ---------- */

.log { display: flex; flex-direction: column; }
.log li { display: flex; align-items: center; gap: 12px; min-height: 48px; border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
.log-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; background: none; border: 0; padding: 0; text-align: left; }
.log-btn .icon { color: var(--muted); }
.log-main { flex: 1; font-weight: 550; display: flex; flex-direction: column; }
.log-main small { color: var(--muted); font-weight: 400; font-size: 14px; }
.log-when { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-day { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 16px; font-weight: 700; margin-top: 6px; padding-bottom: 4px; }
.log-day:first-of-type { margin-top: 0; }
.log-day::first-letter { text-transform: uppercase; }
.log-day span { color: var(--muted); font-weight: 400; font-size: 14px; }

.dot { flex: none; width: 12px; height: 12px; border-radius: 50%; }
.dot-ok { background: var(--ok); }
.dot-work { background: var(--honey); }
.dot-bad { background: var(--bad); }

/* ---------- Potty ---------- */

.potty-timer {
  background: var(--pine); color: var(--on-pine);
  border-radius: 26px; padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}

.pt-label { color: var(--on-pine-muted); font-size: 15px; }
.pt-big { font-family: var(--display); font-weight: 800; font-size: clamp(40px, 13vw, 56px); line-height: 1; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.pt-line { font-size: 16px; line-height: 1.35; }
.potty-timer .bar { background: rgba(255, 255, 255, .18); }
.potty-timer.is-due { background: var(--honey); color: var(--on-honey); }
.potty-timer.is-due .pt-label { color: var(--on-honey); opacity: .75; }
.potty-timer.is-due .bar { background: rgba(38, 26, 4, .18); }
.potty-timer.is-due .bar i { background: var(--on-honey); }

.potty-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.potty-btn {
  min-height: 88px; padding: 14px 16px;
  border: 0; border-radius: 22px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  text-align: left;
  transition: transform .08s ease;
}

.potty-btn:active { transform: scale(.96); }
.potty-btn b { font-family: var(--display); font-weight: 750; font-size: 24px; line-height: 1.1; letter-spacing: -0.02em; }
.potty-btn span { font-size: 16px; font-weight: 550; }
.potty-btn.is-out { background: var(--ok-wash); color: var(--ok); box-shadow: inset 0 0 0 2px var(--ok); }
.potty-btn.is-acc { background: var(--surface); color: var(--bad); box-shadow: inset 0 0 0 2px var(--line); }
.potty-btn.is-out b, .potty-btn.is-acc b { color: var(--ink); }

/* ---------- Tools ---------- */

.clicker-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 14px 0 4px; }

.clicker {
  position: relative;
  width: min(68vw, 264px); aspect-ratio: 1;
  border: 0; border-radius: 50%;
  background: var(--honey); color: var(--on-honey);
  box-shadow: 0 10px 0 var(--honey-press), 0 22px 34px -12px rgba(18, 34, 28, .45);
  display: grid; place-items: center;
  touch-action: none;
  -webkit-touch-callout: none;
}

.clicker:active { transform: translateY(8px); box-shadow: 0 2px 0 var(--honey-press), 0 8px 14px -8px rgba(18, 34, 28, .45); }
.clicker-ring { position: absolute; inset: 16px; border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(38, 26, 4, .16); pointer-events: none; }
.clicker.is-hit .clicker-ring { animation: ring .28s ease-out; }
.clicker-label { font-family: var(--display); font-weight: 800; font-size: 44px; letter-spacing: -0.03em; pointer-events: none; }
.clicker-count { color: var(--muted); display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.clicker-count b { color: var(--ink); font-family: var(--display); font-size: 22px; font-variant-numeric: tabular-nums; }

@keyframes ring { from { box-shadow: inset 0 0 0 14px rgba(38, 26, 4, .22); } to { box-shadow: inset 0 0 0 3px rgba(38, 26, 4, .16); } }

.timer { display: flex; flex-direction: column; align-items: stretch; gap: 16px; padding-top: 8px; }

.timer-dial {
  --pct: 0;
  align-self: center;
  width: min(64vw, 248px); aspect-ratio: 1; border-radius: 50%;
  background:
    radial-gradient(closest-side, var(--bg) 0, var(--bg) calc(100% - 15px), transparent calc(100% - 14px)),
    conic-gradient(var(--honey) calc(var(--pct) * 1%), var(--line) 0);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}

.timer-dial-nap { background: radial-gradient(closest-side, var(--bg) 0, var(--bg) calc(100% - 15px), transparent calc(100% - 14px)), var(--line); }
.timer.is-nap .timer-dial-nap { background: radial-gradient(closest-side, var(--bg) 0, var(--bg) calc(100% - 15px), transparent calc(100% - 14px)), var(--pine); }
.timer-clock { font-family: var(--display); font-weight: 800; font-size: 56px; letter-spacing: -0.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.timer-sub { color: var(--muted); font-size: 15px; text-align: center; padding: 0 28px; }
.timer.is-finished .timer-clock { color: var(--ok); }

/* ---------- Health ---------- */

.hlist { display: flex; flex-direction: column; margin: 0 -6px -6px; }
.hrow { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--line); }
.hrow:first-child { border-top: 0; }
.hrow > .icon { color: var(--muted); margin-right: 4px; }
.hrow-check { flex: none; width: 48px; min-height: 64px; display: grid; place-items: center; background: none; border: 0; padding: 0; }
.hrow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; padding: 12px 0; background: none; border: 0; text-align: left; }
.hrow-main b { font-weight: 600; line-height: 1.3; }
.hrow-main > span { color: var(--muted); font-size: 15px; }
.hrow-tags { display: flex; gap: 6px; margin-top: 3px; }
.hrow.is-done .hrow-main b { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.hrow.is-overdue .hrow-main > span:first-of-type { color: var(--bad); font-weight: 600; }

.inline-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-form .btn { grid-column: 1 / -1; }

/* ---------- Progress ---------- */

.streak-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--pine); color: var(--on-pine);
  border-radius: 26px; padding: 20px;
}

.streak-flame { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 255, 255, .12); color: var(--on-pine-muted); flex: none; }
.streak-card.is-done .streak-flame { background: var(--honey); color: var(--on-honey); }
.streak-num { font-family: var(--display); font-weight: 800; font-size: 38px; line-height: 1; letter-spacing: -0.03em; color: var(--honey); }
.streak-text { color: var(--on-pine-muted); font-size: 16px; margin-top: 6px; line-height: 1.35; }

.mastery { display: flex; flex-direction: column; margin: 0 -6px -6px; }
.mastery-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 6px; min-height: 56px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); }
.mastery-row:first-child { border-top: 0; }
.mastery-row .bar { grid-column: 1 / -1; }
.mastery-name { font-weight: 600; }
.mastery-val { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 15px; font-weight: 600; color: var(--muted); }
.field > small { font-size: 14px; color: var(--muted); line-height: 1.35; }

/* 17px text: iOS zooms the page when a focused field is smaller than 16px. */
input[type='text'], input[type='date'], input[type='time'], input[type='number'], input[type='datetime-local'], select, textarea {
  width: 100%; min-width: 0; min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--surface-2); color: var(--ink);
  font-size: 17px; line-height: 1.3;
  -webkit-appearance: none; appearance: none;
}

input[type='date'], input[type='time'], input[type='datetime-local'] { display: block; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; }
textarea { resize: vertical; min-height: 88px; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--honey); box-shadow: 0 0 0 3px rgba(240, 180, 41, .3); }
::placeholder { color: var(--muted); opacity: .7; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 56px; padding: 8px 0; font-weight: 600; }
.switch-row > span { display: flex; flex-direction: column; gap: 1px; }
.switch-row small { color: var(--muted); font-weight: 400; font-size: 14px; line-height: 1.3; }

.switch-row input[type='checkbox'] {
  -webkit-appearance: none; appearance: none;
  flex: none; position: relative;
  width: 54px; height: 32px; margin: 0; border-radius: 99px;
  background: var(--line); cursor: pointer;
  transition: background-color .18s ease;
}

.switch-row input[type='checkbox']::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .18s ease; }
.switch-row input[type='checkbox']:checked { background: var(--ok); }
.switch-row input[type='checkbox']:checked::after { transform: translateX(22px); }

.settings-group { display: flex; flex-direction: column; border-top: 1px solid var(--line); margin-top: 4px; }
.settings-group > .switch-row { border-top: 1px solid var(--line); }
.settings-group > .switch-row:first-child { border-top: 0; }
.sub-rows { display: flex; flex-direction: column; gap: 8px; padding: 0 0 14px; }
.time-row { display: grid; grid-template-columns: 1fr minmax(0, 170px); align-items: center; gap: 12px; }
.time-row-wide { grid-template-columns: auto minmax(0, 1fr); }
.time-row > span { color: var(--muted); font-size: 16px; }
.time-row input, .time-row select { min-height: 46px; padding: 8px 12px; }

.push-status { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface-2); }
.status-ok { display: flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 650; }
.photo-row { display: flex; align-items: center; gap: 18px; padding: 4px 4px 4px; }

/* ---------- Onboarding ---------- */

.onboarding {
  max-width: 480px; margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  padding: calc(var(--safe-t) + 20px) 22px calc(var(--safe-b) + 20px);
  display: flex; flex-direction: column; gap: 16px;
}

.ob-dots { display: flex; gap: 6px; }
.ob-dots i { width: 28px; height: 5px; border-radius: 99px; background: var(--line); }
.ob-dots i.on { background: var(--honey); }
.ob-hero { align-self: flex-start; width: 132px; height: 132px; border-radius: 36px; background: var(--pine); display: grid; place-items: center; margin-top: 8vh; }
.ob-title { font-family: var(--display); font-weight: 800; font-size: clamp(34px, 10vw, 44px); line-height: 1.02; letter-spacing: -0.035em; margin-top: 8px; }
.ob-dots + .ob-title { margin-top: 8vh; }
.ob-text { font-size: 18px; line-height: 1.45; color: var(--muted); }
.ob-end { margin-top: auto; padding-top: 12px; }
.onboarding form { margin-top: 8px; }

/* ---------- Tab bar ---------- */

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px max(6px, env(safe-area-inset-right)) calc(var(--safe-b) + 4px) max(6px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}

.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px;
  color: var(--muted); text-decoration: none;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
}

.tab .icon { box-sizing: content-box; padding: 3px 18px; border-radius: 99px; transition: background-color .15s ease; }
.tab.is-active { color: var(--ink); }
.tab.is-active .icon { background: var(--honey); color: var(--on-honey); }

/* ---------- Sheet and toast ---------- */

.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 16, 13, .5); opacity: 0; transition: opacity .2s ease; }

.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto; max-height: 92dvh; overflow-y: auto;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 10px 20px calc(var(--safe-b) + 20px);
  transform: translateY(100%);
  transition: transform .24s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column; gap: 14px;
}

.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
.sheet-grip { align-self: center; width: 40px; height: 5px; border-radius: 99px; background: var(--line); }
.sheet-title { font-family: var(--display); font-size: 24px; font-weight: 750; letter-spacing: -0.02em; }
.sheet-text { color: var(--muted); }

.toast {
  position: fixed; z-index: 50;
  left: 12px; right: 12px; bottom: calc(var(--tabs-h) + var(--safe-b) + 14px);
  max-width: 536px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 16px;
  background: var(--ink); color: var(--bg);
  font-size: 16px; font-weight: 550; line-height: 1.35;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5);
  opacity: 0; transform: translateY(12px);
  transition: opacity .2s ease, transform .2s ease;
}

.toast span { flex: 1; }
.toast button { flex: none; min-height: 44px; margin: -8px -8px -8px 0; padding: 0 12px; background: none; border: 0; color: var(--honey); font-weight: 700; }
.toast.show { opacity: 1; transform: none; }
body.no-tabs .toast { bottom: calc(var(--safe-b) + 16px); }

.haptic { position: fixed; left: -100px; top: 0; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
