/* Light only, by design. */
:root {
  color-scheme: light;
  --ground: #ffffff;
  --ink: #111111;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f4f5f7;
  --danger: #b91c1c;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); }
body {
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}
button { cursor: pointer; touch-action: manipulation; }
.view { max-width: 560px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px 24px; }

h1 { font-size: 26px; line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 17px; margin: 28px 0 12px; }
p { margin: 0; }
.eyebrow { font-size: 12px; font-weight: 700; color: var(--muted); margin: 0 0 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.muted { color: var(--muted); margin-top: 4px; }
.small { font-size: 13px; line-height: 1.4; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }

.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 16px; }
.nav-row { align-items: center; }
.center { text-align: center; flex: 1; }
.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); display: grid; place-items: center; padding: 0;
}
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.small { width: 36px; height: 36px; margin-left: auto; }

.btn {
  font: inherit; font-weight: 600; font-size: 16px; min-height: 48px; padding: 0 18px;
  border-radius: 14px; border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); padding: 0 8px; }
.btn.wide { width: 100%; margin-top: 10px; }
.danger { color: var(--danger) !important; }

/* Track */
.now {
  border-radius: 20px; padding: 14px 16px; margin-bottom: 12px;
  background: color-mix(in srgb, var(--c) 8%, #fff);
  border: 1px solid color-mix(in srgb, var(--c) 35%, #fff);
}
.now:not(.on) { background: var(--soft); border-color: var(--line); }
.now-name { font-size: 22px; font-weight: 700; color: color-mix(in srgb, var(--c) 80%, #000); }
.now-name.idle { color: var(--ink); }
.timer { font-size: 48px; font-weight: 700; line-height: 1.05; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.now-foot { display: flex; align-items: center; justify-content: space-between; }
.now-foot .muted { margin: 0; }
.now-foot .btn.quiet { min-height: 40px; padding: 0 4px; text-decoration: underline; }
.note {
  display: block; width: 100%; margin-top: 8px; font: inherit; font-size: 16px; padding: 10px 14px;
  border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink);
}

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cat-name, .entry-note, .entry-name, .acct-row b, .keybox { overflow-wrap: anywhere; }
.cat {
  min-width: 0; font: inherit; color: var(--ink); text-align: left; background: #fff;
  min-height: 76px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px;
  transition: transform 0.08s ease;
}
.cat:active { transform: scale(0.97); }
.cat-name { font-size: 16px; font-weight: 600; line-height: 1.2; }
.cat-time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 16px; }
.cat.active { background: var(--c); border-color: var(--c); color: #fff; }
.cat.active .cat-time { color: rgba(255, 255, 255, 0.85); }
.cat.active .dot { background: #fff; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; display: inline-block; }

.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.strip div { background: var(--soft); border-radius: 14px; padding: 12px; }
.strip b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.strip span { font-size: 12px; color: var(--muted); }

/* Day */
.timeline { display: flex; flex-direction: column; gap: 8px; }
.entry {
  font: inherit; color: var(--ink); text-align: left; width: 100%; background: #fff;
  display: flex; align-items: stretch; gap: 12px; padding: 12px 14px 12px 12px;
  border: 1px solid var(--line); border-radius: 14px;
}
.bar { width: 5px; border-radius: 3px; background: var(--c); flex: none; }
.entry-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entry-name { font-weight: 600; }
.entry-note { font-size: 14px; color: #374151; margin-top: 4px; }
.entry-dur { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; align-self: center; }
.live { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--c); margin-left: 8px; }
.gap {
  font: inherit; font-size: 14px; color: var(--muted); width: 100%; background: transparent;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border: 1.5px dashed #d1d5db; border-radius: 14px;
}
.gap .fill { font-weight: 600; color: var(--ink); text-decoration: underline; }

/* Week */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--soft); border-radius: 16px; padding: 14px; }
.stat.big { grid-column: 1 / -1; }
.stat b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.stat.big b { font-size: 44px; letter-spacing: -0.02em; }
.stat span { font-size: 13px; color: var(--muted); }
.bars { display: flex; flex-direction: column; gap: 16px; }
.barlabel { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; margin-bottom: 6px; }
.barlabel b { font-variant-numeric: tabular-nums; }
.track { position: relative; height: 10px; background: var(--soft); border-radius: 6px; }
.fillbar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c); border-radius: 6px; }
.guess { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); }
.legend { margin-top: 14px; }
.guess-key { display: inline-block; width: 2px; height: 12px; background: var(--ink); vertical-align: -2px; margin-right: 8px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 8px; }
.daycol { font: inherit; color: var(--ink); background: none; border: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.col { width: 100%; height: 96px; background: var(--soft); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.col span { width: 100%; background: var(--ink); }
.daycol b { font-size: 13px; font-variant-numeric: tabular-nums; }
.daycol > span:last-child { font-size: 12px; color: var(--muted); }

/* Review and Setup */
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.card h2 { margin-top: 0; margin-bottom: 8px; }
.recap-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.recap-row:last-child { border-bottom: none; }
.recap-row b { font-variant-numeric: tabular-nums; text-align: right; }
.q { display: block; margin: 20px 0; }
.q span { display: block; font-weight: 600; margin-bottom: 8px; }
textarea, .field input, .cat-edit .name, .guess-in input {
  font: inherit; font-size: 16px; width: 100%; padding: 12px 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
.field { display: block; margin: 12px 0; }
.field span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input { min-height: 48px; -webkit-appearance: none; appearance: none; }

.cat-edit { display: grid; grid-template-columns: 36px 1fr; gap: 10px 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.swatch { width: 36px; height: 36px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); padding: 0; }
.cat-opts { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; font-size: 14px; padding: 8px 12px; border: none; background: #fff; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }
.guess-in { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.guess-in input { width: 76px; padding: 8px 10px; }
.hidden-list { margin-top: 14px; }
.hidden-list summary { color: var(--muted); font-size: 14px; padding: 6px 0; }
.hidden-cat { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }

/* Sheet */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 560px; margin: 0 auto;
  max-height: 90vh; overflow: auto; background: #fff; border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { margin: 0; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.chip {
  font: inherit; font-size: 14px; color: var(--ink); background: #fff;
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 999px;
}
.chip[aria-pressed="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.chip[aria-pressed="true"] .dot { background: #fff; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .primary { flex: 1; }
.problem { color: var(--danger); font-weight: 600; margin-top: 8px; }
.problem:empty { display: none; }

/* Toast and banner */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 15; padding: 0 16px; pointer-events: none; }
.toast {
  max-width: 528px; margin: 0 auto; pointer-events: auto; background: var(--ink); color: #fff;
  border-radius: 16px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.toast.error { background: var(--danger); }
.toast-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.toast button { font: inherit; font-size: 14px; font-weight: 600; color: #fff; background: rgba(255, 255, 255, 0.16); border: none; border-radius: 10px; padding: 8px 12px; white-space: nowrap; }
.toast .chips { margin-top: 10px; justify-content: flex-start; flex-wrap: wrap; font-size: 14px; }
.banner { background: #fef2f2; color: #991b1b; font-weight: 600; padding: 10px 14px; border-radius: 12px; margin-top: 8px; }

/* Fix-it prompts */
.btn.link { min-height: 40px; padding: 0; text-decoration: underline; color: var(--ink); background: none; border: none; font-size: 15px; }
.now .btn.link { margin-top: 6px; }
.now-foot > span:last-child { display: inline-flex; gap: 14px; }
.longrun {
  background: #fff; border: 1.5px solid var(--ink); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 14px;
}
.longrun p { font-size: 15px; line-height: 1.4; }
.check-actions { display: flex; gap: 8px; margin-top: 10px; }
.check-actions .btn { flex: 1; min-height: 44px; font-size: 15px; padding: 0 10px; }
.pending-note {
  margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: #fff;
  border: 1px dashed var(--muted); font-size: 14px; font-weight: 600;
}
.pending-note .btn.link { min-height: 0; font-size: 14px; margin-left: 4px; }
.room { margin-top: 12px; padding: 12px 14px; border: 1.5px solid var(--ink); border-radius: 14px; }
.room ul { margin: 8px 0 4px; padding-left: 20px; }
.room li { margin: 4px 0; }

/* Work hours and category hints */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.days-pick { display: flex; width: 100%; }
.days-pick button { flex: 1; padding: 10px 0; }
.cat-edit .hint-in {
  grid-column: 2; font: inherit; font-size: 14px; width: 100%; padding: 8px 12px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.guide { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 6px; }
.guide summary { font-weight: 600; padding: 10px 0; cursor: pointer; }
.guide p { display: flex; gap: 8px; align-items: baseline; font-size: 14px; line-height: 1.4; margin: 8px 0; }
.guide .dot { flex: none; transform: translateY(1px); }
.track-layout > .guide { order: 5; }

/* Widget setup */
.steps { margin: 12px 0; padding-left: 20px; font-size: 14px; line-height: 1.45; }
.steps li { margin: 6px 0; }
.links { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 8px; }
.linkrow {
  font: inherit; font-size: 15px; color: var(--ink); background: #fff; text-align: left;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 12px;
}
.linkrow > span:nth-child(2) { flex: 1; }
.linkrow .copy { font-size: 13px; font-weight: 600; text-decoration: underline; }

/* Phone order: timer, evening prompt, buttons, then totals. Desktop uses grid areas below. */
.track-layout { display: flex; flex-direction: column; }
.track-layout > .now { order: 0; }
.track-layout > .evening { order: 1; margin: 0 0 12px; }
.track-layout > .grid { order: 2; }
.track-layout > .strip { order: 3; }
.track-layout > .add { order: 4; }

/* Evening prompt and reviews */
.evening {
  font: inherit; color: var(--ink); text-align: left; width: 100%; margin-top: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: #fff; border: 1.5px solid var(--ink); border-radius: 16px;
}
.evening > span { display: flex; flex-direction: column; }
.evening svg { width: 20px; height: 20px; flex: none; }
.day-review { margin-top: 20px; }
.day-review .recap { margin: 10px 0 4px; }
.recap-row .dot { margin-right: 6px; }
.day-review .q { margin: 16px 0; }
.daily-notes h2 { margin-bottom: 4px; }
.note-day { padding: 12px 0; border-bottom: 1px solid var(--line); }
.note-day:last-child { border-bottom: none; padding-bottom: 0; }
.note-day p + p { margin-top: 4px; }

/* Desktop: use the width instead of one long column. */
@media (min-width: 900px) {
  .view { max-width: 1140px; padding: 28px 32px 32px; }
  .top { margin-bottom: 20px; }

  .track-layout {
    display: grid; grid-template-columns: 380px 1fr; column-gap: 24px; align-items: start;
    grid-template-areas: "now cats" "strip cats" "evening cats" "add cats" "guide cats";
    grid-template-rows: auto auto auto auto 1fr;
  }
  .track-layout > .now { grid-area: now; margin: 0; }
  .track-layout > .grid { grid-area: cats; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 12px; }
  .track-layout > .strip { grid-area: strip; }
  .track-layout > .evening { grid-area: evening; margin: 12px 0 0; }
  .track-layout > .add { grid-area: add; }
  .track-layout > .guide { grid-area: guide; }
  .cat { min-height: 100px; padding: 14px 16px; }
  .cat-name { font-size: 17px; }

  .day-layout { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
  .day-review { margin-top: 0; position: sticky; top: 24px; max-height: calc(100vh - 140px); overflow: auto; }

  .week-layout {
    display: grid; grid-template-columns: 400px 1fr; column-gap: 40px; align-items: start;
    grid-template-areas: "stats bars" "days bars"; grid-template-rows: auto 1fr;
  }
  .w-stats { grid-area: stats; }
  .w-bars { grid-area: bars; }
  .w-bars h2 { margin-top: 0; }
  .w-bars .bars { gap: 10px; }
  .w-bars .barlabel { margin-bottom: 4px; }
  .w-bars .barrow .muted { margin-top: 2px; font-size: 12px; }
  .w-days { grid-area: days; }

  .review-layout { display: grid; grid-template-columns: 380px 1fr; gap: 32px; align-items: start; }
  .review-side { position: sticky; top: 24px; max-height: calc(100vh - 140px); overflow: auto; }
  .review-main .q:first-child { margin-top: 0; }

  .setup-layout {
    display: grid; grid-template-columns: 1fr 1.4fr; column-gap: 24px; align-items: start;
    grid-template-areas: "account cats" "start cats" "data cats" "home cats" "widget cats"; grid-template-rows: auto auto auto auto 1fr;
  }
  .s-account { grid-area: account; }
  .s-start { grid-area: start; }
  .s-cats { grid-area: cats; }
  .s-data { grid-area: data; }
  .s-home { grid-area: home; }
  .s-widget { grid-area: widget; }

  .sheet {
    top: 50%; bottom: auto; left: 50%; right: auto; width: 520px; margin: 0;
    transform: translate(-50%, -50%); border-radius: 20px; padding-bottom: 20px;
  }
  nav.tabs { grid-template-columns: repeat(5, 120px); justify-content: center; }
}

@media (hover: hover) {
  .cat:hover, .entry:hover, .gap:hover, .evening:hover, .btn:hover, .icon-btn:not(:disabled):hover { border-color: #b8bdc4; }
  .cat.active:hover { border-color: var(--c); }
}

/* Tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.tabs button {
  font: inherit; font-size: 11px; font-weight: 600; color: var(--muted); background: none; border: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; min-height: 52px;
}
.tabs svg { width: 24px; height: 24px; }
.tabs button[aria-current="page"] { color: var(--ink); }

/* Sign up, log in, reset */
body.auth { padding-bottom: 24px; }
.auth-view { max-width: 420px; }
.auth-view h1 { margin: 8px 0 6px; }
.auth-view form { margin-top: 8px; }
.auth-head { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin: 16px 0 24px; }
.auth-head img { border-radius: 10px; }
.auth-links { margin-top: 16px; font-size: 15px; color: var(--muted); }
.auth-links a, .muted a { color: var(--ink); font-weight: 600; }
.field .pw { display: flex; gap: 6px; align-items: center; margin: 0; }
.pw input { flex: 1; }
.field select { width: 100%; min-height: 48px; font: inherit; font-size: 16px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
.as-btn { display: flex; align-items: center; justify-content: center; text-decoration: none; box-sizing: border-box; }
.keybox { font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; user-select: all; }
.acct-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.acct-row:last-of-type { border-bottom: none; }
.acct-row .btn { min-height: 40px; }
.btn.primary.danger-fill { background: var(--danger); border-color: var(--danger); }
