/* ============================================================
   Daily — minimal life manager
   Type: Hanken Grotesk (UI) + JetBrains Mono (meta labels)
   Three themes via [data-theme]: paper · mono · mist
   ============================================================ */

:root {
  --font-ui: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;

  --gap: 14px;
  --col-min: 200px;

  /* defaults overridden per theme below */
  --bg:        oklch(0.985 0.006 75);
  --surface:   oklch(1 0 0);
  --surface-2: oklch(0.975 0.008 75);
  --line:      oklch(0.9 0.008 75);
  --line-soft: oklch(0.94 0.006 75);
  --ink:       oklch(0.24 0.012 60);
  --ink-soft:  oklch(0.52 0.012 60);
  --ink-faint: oklch(0.68 0.01 60);
  --accent:    oklch(0.63 0.13 42);
  --accent-bg: oklch(0.95 0.04 50);
  --today:     oklch(0.965 0.018 60);
}

[data-theme="paper"] {
  --bg:        oklch(0.985 0.007 80);
  --surface:   oklch(1 0.002 80);
  --surface-2: oklch(0.975 0.01 78);
  --line:      oklch(0.9 0.01 75);
  --line-soft: oklch(0.945 0.008 75);
  --ink:       oklch(0.26 0.014 55);
  --ink-soft:  oklch(0.53 0.014 55);
  --ink-faint: oklch(0.7 0.012 55);
  --today:     oklch(0.965 0.02 60);
}

[data-theme="mono"] {
  --bg:        oklch(0.98 0.001 0);
  --surface:   oklch(1 0 0);
  --surface-2: oklch(0.972 0.001 0);
  --line:      oklch(0.9 0.001 0);
  --line-soft: oklch(0.945 0.001 0);
  --ink:       oklch(0.18 0.001 0);
  --ink-soft:  oklch(0.5 0.002 0);
  --ink-faint: oklch(0.68 0.002 0);
  --today:     oklch(0.955 0.002 0);
}

[data-theme="mist"] {
  --bg:        oklch(0.98 0.008 240);
  --surface:   oklch(0.995 0.004 240);
  --surface-2: oklch(0.965 0.012 240);
  --line:      oklch(0.9 0.012 240);
  --line-soft: oklch(0.94 0.009 240);
  --ink:       oklch(0.3 0.025 250);
  --ink-soft:  oklch(0.54 0.022 250);
  --ink-faint: oklch(0.7 0.018 250);
  --today:     oklch(0.95 0.02 240);
}

/* accent is set as an inline var on the root app node from the tweak */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea {
  font-family: inherit;
  color: inherit;
}

::selection { background: var(--accent-bg); }

#root { height: 100%; }

/* ---------- App shell ---------- */
.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* demo banner */
.demobar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
}
.demobar-txt { flex: 1 1 auto; line-height: 1.35; }
.demobar-txt b { font-weight: 700; }
.demobar-cta {
  flex: 0 0 auto;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 15px;
  border-radius: 100px;
  background: rgba(255,255,255,.22);
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s;
}
.demobar-cta:hover { background: rgba(255,255,255,.34); }
.demobar-x {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,.16);
  color: #fff; font-size: 12px; cursor: pointer;
  display: grid; place-items: center;
  opacity: .9; transition: background .15s, opacity .15s;
}
.demobar-x:hover { opacity: 1; background: rgba(255,255,255,.28); }

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 26px 16px;
}
.tb-brand { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.tb-status { display: flex; align-items: center; gap: 10px; }
.tb-nav { display: flex; align-items: center; gap: 8px; }
.nav-arrows { display: flex; align-items: center; gap: 4px; }

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.tb-brand .mark, .brand .mark {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.tb-brand .mark .dot, .brand .mark .dot { color: var(--accent); }
.tb-brand .sub, .brand .sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.weeknav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.weeknav .range {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  min-width: 130px;
  text-align: center;
  white-space: nowrap;
}
.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }

.today-btn {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  transition: border-color .15s, color .15s, background .15s;
}
.today-btn:hover { border-color: var(--ink-faint); color: var(--ink); }

/* ---------- Week grid (desktop) ---------- */
.board {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 26px 24px;
}
.week {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(var(--col-min), 1fr);
  gap: 0;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.daycol {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: transparent;
  border-right: 1px solid var(--line-soft);
  transition: background .18s;
}
.daycol:last-child { border-right: none; }
.daycol.is-today { background: color-mix(in oklab, var(--accent) 5%, transparent); }

.dayhead {
  flex: 0 0 auto;
  height: 54px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}
.dh-main { display: flex; align-items: baseline; gap: 7px; }
.dayhead .dow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.is-today .dayhead .dow { color: var(--accent); }
.dayhead .num {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.dayhead .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: 20px;
}
.is-today .dayhead .count { color: var(--accent); background: var(--accent-bg); }

.day-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 9px 9px;
  scrollbar-width: thin;
}

/* ---------- Turno (shift) blocks ---------- */
.turno { padding: 8px 5px 4px; }
.turno-label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 9px 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.turno-label .glyph { flex: 0 0 17px; text-align: center; font-size: 11px; opacity: .8; }
.turno-label .ln { flex: 1; height: 1px; background: var(--line-soft); }

.turno.drop-active {
  background: var(--accent-bg);
  border-radius: var(--r-md);
  outline: 1px dashed color-mix(in oklch, var(--accent) 55%, transparent);
  outline-offset: -3px;
}

.dropzone-tasks { min-height: 8px; display: flex; flex-direction: column; gap: 5px; }

/* ---------- Task row (seamless) ---------- */
.task {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 9px 8px 9px;
  border-radius: var(--r-md);
  background: transparent;
  border: 1px solid transparent;
  transition: background .12s, opacity .12s;
  cursor: grab;
}
.task:hover { background: var(--surface-2); }
.task.is-done { opacity: .5; }
.task.menu-open { z-index: 20; }
/* the selection ring only shows while the user is driving by keyboard (.kb-active),
   so an auto-selected task never looks "stuck" highlighted for a mouse/touch user */
.kb-active .task.is-selected {
  background: var(--surface-2);
  box-shadow: 0 0 0 2px var(--accent);
  z-index: 15;
}
.kb-active .task.is-selected::before {
  content: "";
  position: absolute;
  left: -1px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 3px;
  background: var(--accent);
  opacity: 0;
}
.task.is-done .task-text { text-decoration: line-through; color: var(--ink-soft); }
.task.dragging { opacity: .35; }

.check {
  flex: 0 0 auto;
  margin-top: 1px;
  width: 17px; height: 17px;
  border-radius: 50%;
  border: 1.6px solid var(--ink-faint);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: border-color .12s, background .12s;
}
.check:hover { border-color: var(--accent); }
.check.on {
  background: var(--accent);
  border-color: var(--accent);
}
.check svg { display: block; width: 11px; height: 11px; color: white; opacity: 0; transform: scale(.6); transition: opacity .12s, transform .12s; }
.check.on svg { opacity: 1; transform: scale(1); }

.task-body { flex: 1 1 auto; min-width: 0; }
.task-text-row { display: flex; align-items: flex-start; gap: 6px; }
.task-text-row .task-text { flex: 1 1 auto; min-width: 0; }
/* priority marker — Reminders-style ! / !! / !!! getting stronger by level */
.prio-mark {
  flex: 0 0 auto;
  margin-top: 1px;
  font-weight: 800;
  font-size: 13.5px;
  line-height: 1.32;
  letter-spacing: -0.06em;
  color: var(--accent);
}
.prio-mark.p1 { opacity: .55; }
.prio-mark.p2 { opacity: .78; }
.prio-mark.p3 { opacity: 1; }
.focus .prio-mark { font-size: 15px; }
.task-text {
  font-size: 13.5px;
  line-height: 1.32;
  letter-spacing: -0.005em;
  word-break: break-word;
  outline: none;
}
.task-text:empty::before {
  content: "New task…";
  color: var(--ink-faint);
}
.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.task-note {
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--ink-soft);
  margin-top: 3px;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.task-note:empty { display: none; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
}
.tag svg { width: 11px; height: 11px; }
.tag.recur { color: var(--ink-soft); }

/* task URL attribute (Reminders-style link chip + inline editor) */
.task-url {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 4px; max-width: 100%;
  font-size: 11.5px; color: var(--accent); cursor: pointer;
}
.task-url svg { flex: 0 0 auto; width: 12px; height: 12px; }
.task-url span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-url:hover span { text-decoration: underline; }
.url-input {
  width: 100%; margin-top: 4px;
  border: 1px solid var(--accent);
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 5px 8px;
  font-size: 12px; color: var(--ink);
  outline: none;
}
/* focus view scales secondary lines up — keep the URL chip/editor in step */
.focus .task-url { font-size: 12.5px; }
.focus .task-url svg { width: 14px; height: 14px; }
.focus .url-input { font-size: 13.5px; }

/* hover toolbar */
.task-tools {
  position: absolute;
  top: 5px; right: 5px;
  display: flex;
  gap: 1px;
  opacity: 0;
  transition: opacity .12s;
  background: var(--surface);
  border-radius: var(--r-sm);
}
.task:hover .task-tools, .task:focus-within .task-tools { opacity: 1; }
.tool {
  width: 24px; height: 24px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--ink-faint);
  transition: background .12s, color .12s;
}
.tool:hover { background: var(--surface-2); color: var(--ink); }
.tool.active { color: var(--accent); }
.tool svg { width: 14px; height: 14px; }

/* delete-repeat confirm menu */
.del-menu {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: 0 10px 28px rgba(0,0,0,.16);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: default;
}
.del-title {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 2px 4px 4px;
}
.del-opt {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  transition: background .12s;
}
.del-opt:hover { background: var(--surface-2); }
.del-opt.hl { background: var(--surface-2); box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--accent) 45%, transparent); }
.del-opt-l { font-size: 12.5px; font-weight: 600; }
.del-opt-d { font-size: 10.5px; color: var(--ink-soft); }

/* shared menu footer (Cancel + Esc hint) */
.menu-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 5px; padding: 7px 4px 1px;
  border-top: 1px solid var(--line-soft);
}
.menu-foot-cancel {
  font-size: 12px; color: var(--ink-soft);
  padding: 3px 6px; border-radius: var(--r-sm);
  transition: color .12s, background .12s;
}
.menu-foot-cancel:hover { color: var(--ink); background: var(--surface-2); }
.menu-foot-kbd {
  font-family: var(--font-mono);
  font-size: 9.5px; color: var(--ink-faint);
  padding: 2px 6px; border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

/* repeat picker menu */
.rep-menu {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 14px 38px rgba(0,0,0,.18);
  padding: 7px;
  cursor: default;
}
.rep-head, .rep-custom-head {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint);
  padding: 4px 8px 7px;
}
.rep-opts { display: flex; flex-direction: column; gap: 1px; }
.rep-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--r-sm);
  text-align: left; font-size: 13px; color: var(--ink);
  transition: background .12s;
}
.rep-opt:hover { background: var(--surface-2); }
.rep-opt.hl { background: var(--surface-2); box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--accent) 45%, transparent); }
.rep-opt.on { background: var(--accent-bg); }
.rep-opt.on.hl { box-shadow: inset 0 0 0 1.5px var(--accent); }
.rep-radio {
  flex: 0 0 auto; width: 15px; height: 15px; border-radius: 50%;
  border: 1.5px solid var(--ink-faint);
  display: grid; place-items: center;
  transition: border-color .12s, background .12s;
}
.rep-opt.on .rep-radio { border-color: var(--accent); background: var(--accent); }
.rep-radio::after {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: #fff; opacity: 0; transition: opacity .12s;
}
.rep-opt.on .rep-radio::after { opacity: 1; }
.rep-l { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-opt.on .rep-l { color: var(--accent); font-weight: 600; }

.rep-custom {
  margin-top: 6px; padding-top: 2px;
  border-top: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 8px;
}
.rep-custom-head { padding: 8px 8px 1px; }
.rc-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 0 8px; }
.rc-every { font-size: 13px; color: var(--ink-soft); }
.rc-num {
  flex: 0 0 46px; padding: 6px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font-size: 13px; text-align: center; outline: none;
  -moz-appearance: textfield;
}
.rc-num::-webkit-outer-spin-button, .rc-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rc-num:focus { border-color: var(--accent); }
.rc-units {
  display: flex; flex: 1 1 auto;
  background: var(--surface-2); border-radius: var(--r-sm);
  padding: 2px; gap: 2px;
}
.rc-unit {
  flex: 1; padding: 5px 4px; border-radius: 5px;
  font-size: 11px; color: var(--ink-soft);
  transition: background .12s, color .12s;
}
.rc-unit.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.rc-set {
  margin: 2px 8px 4px;
  padding: 8px; border-radius: var(--r-sm);
  background: var(--accent); color: #fff;
  font-size: 12.5px; font-weight: 600;
  transition: filter .12s;
}
.rc-set:hover { filter: brightness(1.06); }

/* ---- view toggle + day (focus) view ---- */
.view-toggle { margin-right: 2px; }
.view-toggle .seg { padding: 3px; }
.view-toggle .seg-btn { padding: 6px 14px; font-size: 12px; }

.board.board-day {
  display: flex;
  justify-content: center;
  overflow: hidden;
  padding: 4px 26px 24px;
}
.focus {
  width: min(620px, 100%);
  height: 100%;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 6px 24px 40px;
  scrollbar-width: thin;
}
.focus-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 2px 24px;
}
.focus-dow { font-size: 32px; font-weight: 700; letter-spacing: -0.025em; line-height: 1; }
.focus.is-today .focus-dow { color: var(--ink); }
.focus-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
  margin-top: 8px;
}
.focus.is-today .focus-sub { color: var(--accent); }
.focus-prog { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.focus-prog-txt { font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); }
.focus-prog.done .focus-prog-txt { color: var(--accent); }
.focus-bar { width: 110px; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.focus-bar span { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .4s cubic-bezier(.2,.7,.3,1); }

.focus-body { padding: 0; }
.focus .turno { padding: 6px 4px 18px; }
.focus .turno-label { font-size: 10.5px; padding-bottom: 10px; }
.focus .turno-label .glyph { font-size: 12px; }
.focus .dropzone-tasks { gap: 7px; }
.focus .task { padding: 11px 11px; }
.focus .task-text { font-size: 15px; line-height: 1.35; }
.focus .task-note { font-size: 12.5px; }
.focus .check { width: 19px; height: 19px; }
.focus .add-task { font-size: 14px; padding: 10px 11px; }

/* add task affordance */
.add-task {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 9px;
  border-radius: var(--r-md);
  color: var(--ink-faint);
  font-size: 13px;
  text-align: left;
  border: 1px dashed transparent;
  transition: background .12s, color .12s, border-color .12s;
}
.turno:hover .add-task { color: var(--ink-soft); }
.add-task:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-soft); }
.add-task svg { width: 14px; height: 14px; }
.add-task .add-hint { display: none; }
/* keyboard cursor parked on an empty shift — mirrors .task.is-selected, and like
   it only shows while driving by keyboard (.kb-active) */
.kb-active .add-task.is-cursor { border-color: var(--accent); border-style: solid; box-shadow: 0 0 0 2px var(--accent); background: var(--surface-2); color: var(--ink); }
.kb-active .add-task.is-cursor .add-label { display: none; }
.kb-active .add-task.is-cursor .add-hint { display: inline; }

.add-input {
  width: 100%;
  border: 1px solid var(--accent);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 8px 10px;
  font-size: 13.5px;
  outline: none;
}

/* ---------- Floating drag ghost ---------- */
.drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  width: var(--ghost-w, 200px);
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  transform: rotate(-1.2deg);
  opacity: .96;
}
.drag-ghost .task {
  cursor: grabbing;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
}

/* ---------- Mobile day strip ---------- */
.daystrip { display: none; }

/* ---------- Empty hint ---------- */
.empty-day {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  text-align: center;
  padding: 10px 0 4px;
  opacity: .7;
}

/* ---------- Density ---------- */
.density-compact { --gap: 9px; --col-min: 178px; }
.density-compact .task { padding: 6px 8px; }
.density-compact .task-text { font-size: 13px; }
.density-compact .dayhead { height: 46px; padding: 0 12px; }
.density-compact .dayhead .num { font-size: 17px; }
.density-compact .turno { padding: 6px 4px 2px; }
.density-compact .day-scroll { padding: 3px 7px 7px; }

/* ============================================================
   Responsive: tablet horizontal scroll, mobile single-day
   ============================================================ */
@media (max-width: 1100px) {
  .week { grid-auto-columns: 230px; }
}

@media (max-width: 720px) {
  .topbar { padding: 14px 16px 12px; gap: 12px 12px; flex-wrap: wrap; }
  .tb-brand { margin-right: auto; }
  .tb-brand .sub, .brand .sub { display: none; }
  .tb-brand .mark, .brand .mark { font-size: 23px; }
  .kbd-btn { display: none; }
  .tb-status { gap: 12px; }
  .icon-btn { width: 42px; height: 42px; border-radius: var(--r-md); flex: 0 0 auto; }
  .icon-btn svg { width: 20px; height: 20px; }
  .demobar { padding: 12px 16px; gap: 10px; font-size: 13.5px; }
  .tb-nav {
    order: 3;
    width: 100%;
    gap: 8px;
  }
  .tb-nav .view-toggle { flex: 0 0 auto; }
  .tb-nav .view-toggle .seg { padding: 4px; }
  .tb-nav .view-toggle .seg-btn { padding: 10px 17px; font-size: 14.5px; }
  .tb-nav .today-btn { margin-left: auto; font-size: 14.5px; padding: 10px 15px; }
  .nav-arrows { gap: 2px; }
  .weeknav .range { min-width: 0; font-size: 14px; padding: 0 2px; }

  /* move primary controls to the bottom tab bar; keep the date nav up top */
  .tb-nav .view-toggle, .tb-nav .today-btn, .tb-status .set-wrap { display: none; }
  .tb-nav { order: 3; width: 100%; justify-content: center; gap: 6px; }
  .weeknav .range { font-size: 15px; }

  /* iOS-style liquid-glass bottom tab bar */
  .app .tabbar {
    display: flex;
    position: fixed;
    left: 14px; right: 14px; bottom: 14px;
    z-index: 60;
    justify-content: space-around;
    gap: 4px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    border-radius: 28px;
    background: color-mix(in oklab, var(--surface) 58%, transparent);
    -webkit-backdrop-filter: blur(26px) saturate(190%);
    backdrop-filter: blur(26px) saturate(190%);
    border: 1px solid color-mix(in oklab, white 55%, var(--line));
    box-shadow: 0 10px 34px -8px rgba(40,30,15,.3), 0 2px 8px -3px rgba(40,30,15,.2), inset 0 1px 0 rgba(255,255,255,.65), inset 0 -1px 0 rgba(255,255,255,.18);
  }
  .tab {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 4px;
    border: none; background: none; cursor: pointer;
    border-radius: 18px;
    color: var(--ink-faint);
    transition: color .15s, background .15s;
  }
  .tab svg { width: 23px; height: 23px; }
  .tab span { font-size: 10.5px; font-weight: 600; letter-spacing: .01em; }
  .tab:active { background: color-mix(in oklab, var(--ink) 6%, transparent); }
  .tab.on { color: var(--accent); }
  .tab.on svg { filter: drop-shadow(0 1px 4px color-mix(in oklab, var(--accent) 35%, transparent)); }

  /* ---- native full-bleed day/week sheet ---- */
  .board { padding: 0; overflow: hidden; }
  .board.board-day { padding: 0; justify-content: stretch; }
  .focus {
    width: 100%;
    border: none;
    border-radius: 26px 26px 0 0;
    background: var(--surface);
    padding: 4px 20px 150px;            /* deep bottom pad: last items clear bar + scrim */
    box-shadow: 0 -1px 0 var(--line-soft);
  }
  .focus-head { padding: 22px 2px 20px; }
  .daycol.is-active {
    width: 100%;
    border: none;
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -1px 0 var(--line-soft);
  }

  /* room so content clears the floating bar */
  .day-scroll { padding-bottom: 150px; }

  /* native bottom fade: content dissolves into the page behind the glass bar */
  .app::after {
    content: "";
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 128px;
    background: linear-gradient(to top,
      var(--bg) 20%,
      color-mix(in oklab, var(--bg) 72%, transparent) 52%,
      transparent);
    pointer-events: none;
    z-index: 55;
  }

  /* settings sheet must sit above the fade scrim */
  .set-root { z-index: 70; }

  /* settings as a bottom sheet above the tab bar */
  .set-root { position: fixed; top: auto; right: 14px; left: 14px; bottom: 92px; }
  .set-root .set-pop {
    width: auto;
    border-radius: 22px;
    background: color-mix(in oklab, var(--surface) 80%, transparent);
    -webkit-backdrop-filter: blur(26px) saturate(190%);
    backdrop-filter: blur(26px) saturate(190%);
    box-shadow: 0 18px 50px -10px rgba(40,30,15,.35), inset 0 1px 0 rgba(255,255,255,.5);
  }

  /* show only the active day, full width */
  .week {
    display: block;
    height: 100%;
  }
  .daycol { display: none; }
  .daycol.is-active {
    display: flex;
    height: 100%;
    border-right: none;
  }

  /* day selector strip */
  .daystrip {
    display: flex;
    gap: 6px;
    padding: 4px 12px 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .daystrip::-webkit-scrollbar { display: none; }
  .chip {
    flex: 1 0 auto;
    min-width: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    border-radius: var(--r-md);
    border: 1px solid var(--line-soft);
    background: var(--surface);
    transition: border-color .12s, background .12s;
  }
  .chip .c-dow {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }
  .chip .c-num { font-size: 15px; font-weight: 600; }
  .chip .c-dot {
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--accent);
    opacity: 0;
  }
  .chip.has-tasks .c-dot { opacity: .55; }
  .chip.active {
    border-color: var(--accent);
    background: var(--accent-bg);
  }
  .chip.is-today .c-dow { color: var(--accent); }
  .chip.drop-active {
    border-color: var(--accent);
    background: var(--accent-bg);
    outline: 1px dashed var(--accent);
  }
}

/* ============================================================
   Gamification
   ============================================================ */
.gamewrap { position: relative; display: flex; align-items: center; }

.gamebar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gamebar .streak {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-faint);
  padding: 5px 4px;
}
.gamebar .streak svg { width: 16px; height: 16px; }
.gamebar .streak.on { color: var(--accent); }
.gamebar .streak.on svg { fill: color-mix(in oklab, var(--accent) 22%, transparent); }

.levelbtn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px 6px 10px;
  border-radius: 20px;
  border: 1px solid var(--line);
  transition: border-color .15s, background .15s;
}
.levelbtn:hover, .levelbtn.open { border-color: var(--ink-faint); background: var(--surface-2); }
.levelbtn .lv {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  white-space: nowrap;
}
.xpbar {
  width: 56px; height: 5px;
  border-radius: 5px;
  background: var(--line);
  overflow: hidden;
}
.xpbar.lg { width: 100%; height: 7px; }
.xpfill {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: 5px;
  transition: width .4s cubic-bezier(.2,.7,.3,1);
}

/* ---- stats popover ---- */
.stats-pop {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 18px 50px rgba(0,0,0,.16);
  padding: 16px;
  animation: pop-in .16s ease;
}
@keyframes pop-in { from { opacity: 0; transform: translateX(-50%) translateY(-5px); } }
.stats-pop::before {
  content: "";
  position: absolute; top: -6px; left: 50%; margin-left: -6px;
  width: 11px; height: 11px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}
.sp-level { display: flex; align-items: center; gap: 13px; }
.sp-lv-badge {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 19px; font-weight: 700;
  color: white;
  background: var(--accent);
  box-shadow: inset 0 0 0 3px color-mix(in oklab, white 30%, transparent);
}
.sp-lv-info { flex: 1 1 auto; min-width: 0; }
.sp-lv-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.sp-lv-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  margin-top: 5px;
}
.sp-row {
  display: flex;
  gap: 8px;
  margin: 15px 0 6px;
}
.sp-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.sp-stat .sp-n { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.sp-stat .sp-l {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.sp-ach-title {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 14px 0 8px;
}
.sp-ach { display: flex; flex-direction: column; gap: 7px; }
.ach {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 5px 4px;
  opacity: .45;
}
.ach.ok { opacity: 1; }
.ach-mark {
  flex: 0 0 auto;
  margin-top: 1px;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--line);
  color: white;
}
.ach.ok .ach-mark { background: var(--accent); border-color: var(--accent); }
.ach-mark svg { width: 11px; height: 11px; }
.ach-l { font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.ach-d { font-size: 11px; color: var(--ink-soft); line-height: 1.25; margin-top: 1px; }

/* ---- progress ring on day header ---- */
.ring {
  position: relative;
  display: inline-grid;
  place-items: center;
}
.ring svg { display: block; }
.ring .ring-bg { stroke: var(--line); }
.ring .ring-fg { stroke: var(--accent); transition: stroke-dasharray .45s cubic-bezier(.2,.7,.3,1); }
.ring .ring-num {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-faint);
}
.ring .ring-check { position: absolute; width: 12px; height: 12px; color: var(--accent); }
.ring.is-complete .ring-fg { stroke: var(--accent); }

.daycol.is-complete .dayhead { background: var(--accent-bg); }

.chip.is-complete .c-dot { opacity: 1; width: 5px; height: 5px; }
.chip.is-complete { border-color: color-mix(in oklab, var(--accent) 40%, var(--line)); }

/* ---- confetti ---- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 9998; overflow: hidden; }
.confetti-bit { position: fixed; will-change: transform, opacity; }

/* ---- in-app settings popover ---- */
.set-wrap { position: relative; display: flex; align-items: center; }
.set-btn.open { background: var(--surface-2); color: var(--ink); }
.set-pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: 248px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 18px 50px rgba(0,0,0,.16);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.set-pop::before {
  content: "";
  position: absolute; top: -6px; right: 12px;
  width: 11px; height: 11px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}

/* settings popover root container (desktop: anchored top-right near the gear) */
.set-root { position: fixed; z-index: 130; top: 60px; right: 24px; }
.set-root .set-pop { position: static; width: 256px; }
.set-root .set-pop::before { display: none; }

/* bottom tab bar — hidden on desktop, iOS liquid-glass on mobile */
.tabbar { display: none; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 6px; margin: 0 -6px; border-radius: var(--r-sm); transition: background .12s; }
.set-row.hl { background: var(--surface-2); box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--accent) 38%, transparent); }
.set-l { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.set-hint { font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-faint); letter-spacing: 0.02em; }
.set-divider { height: 1px; background: var(--line-soft); margin: 0 -2px; }

.seg {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
}
.seg-btn {
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-soft);
  text-transform: capitalize;
  transition: background .12s, color .12s;
}
.seg-btn.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.set-swatches { display: flex; gap: 6px; }
.swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  transition: transform .12s, box-shadow .12s;
}
.swatch:hover { transform: scale(1.08); }
.swatch.on { box-shadow: 0 0 0 2px var(--accent); }

.toggle {
  width: 38px; height: 22px;
  border-radius: 20px;
  background: var(--line);
  padding: 2px;
  transition: background .18s;
}
.toggle.on { background: var(--accent); }
.toggle .knob {
  display: block;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transform: translateX(0);
  transition: transform .18s cubic-bezier(.2,.7,.3,1);
}
.toggle.on .knob { transform: translateX(16px); }

/* ---- keyboard shortcuts modal ---- */
.kbd-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: color-mix(in oklab, var(--ink) 32%, transparent);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.kbd-modal {
  width: min(620px, 100%);
  max-height: 86vh; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px rgba(0,0,0,.28);
  padding: 22px 24px 18px;
}
.kbd-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.kbd-modal-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.kbd-close {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--ink-faint);
  transform: rotate(45deg); transition: background .12s, color .12s;
}
.kbd-close:hover { background: var(--surface-2); color: var(--ink); }
.kbd-close svg { width: 18px; height: 18px; }
.kbd-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 22px 32px;
}
.kbd-group-title {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 9px; margin-bottom: 5px;
  border-bottom: 1px solid var(--line-soft);
}
.kbd-line { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.kbd-keys { display: flex; gap: 4px; flex: 0 0 auto; min-width: 92px; }
.kbd-key {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  min-width: 22px; height: 24px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  color: var(--ink);
}
.kbd-desc { font-size: 13px; color: var(--ink-soft); }
.kbd-foot {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px; color: var(--ink-faint);
  text-align: center;
}

@media (max-width: 560px) {
  .kbd-grid { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 720px) {
  .gamebar .levelbtn .lv { display: none; }
  .xpbar { width: 40px; }
  .stats-pop { left: auto; right: -40px; transform: none; }
  .stats-pop::before { left: auto; right: 56px; }
  @keyframes pop-in { from { opacity: 0; transform: translateY(-5px); } }
}

/* ---------------- first-run onboarding ---------------- */
.onboard-backdrop { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px;
  background: color-mix(in oklab, var(--bg) 55%, transparent); backdrop-filter: blur(6px); }
.onboard-card { width: 100%; max-width: 420px; background: var(--surface, #fff); border: 1px solid var(--line, #e7e2d9);
  border-radius: 22px; padding: 30px 28px; box-shadow: 0 40px 90px -30px rgba(60,40,20,.4); text-align: center; }
.onboard-brand { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 14px; }
.onboard-brand .dot { color: var(--accent, #c2703f); }
.onboard-h { font-size: 22px; margin: 0 0 6px; letter-spacing: -.02em; }
.onboard-sub { font-size: 14.5px; color: var(--ink-soft, #6b655d); margin: 0 0 22px; line-height: 1.5; }
.onboard-list { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.onboard-list li { display: flex; gap: 12px; align-items: flex-start; }
.onboard-num { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--accent, #c2703f); color: #fff;
  font-size: 13px; font-weight: 700; display: grid; place-items: center; margin-top: 1px; }
.onboard-list b { display: block; font-size: 14.5px; }
.onboard-list li span:last-child { font-size: 13px; color: var(--ink-soft, #6b655d); }
.onboard-list kbd { font-family: var(--font-mono, monospace); background: var(--bg-2, #f3efe8); border: 1px solid var(--line, #e7e2d9);
  border-radius: 5px; padding: 0 5px; font-size: 12px; }
.onboard-go { width: 100%; padding: 13px; border: none; border-radius: 13px; background: var(--accent, #c2703f); color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer; }
.onboard-go:hover { filter: brightness(1.05); }
.onboard-alt { margin-top: 12px; background: none; border: none; color: var(--ink-soft, #6b655d); font-size: 13.5px; cursor: pointer; text-decoration: underline; }

/* ---------------- account menu (avatar + sign out) ---------------- */
.acct-wrap { position: relative; display: flex; align-items: center; }
.acct-btn { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line, #e7e2d9);
  background: var(--surface-2, #f3efe8); display: grid; place-items: center; cursor: pointer; overflow: hidden; padding: 0; }
.acct-btn:hover { border-color: var(--ink-faint, #a8a299); }
.acct-btn img { width: 100%; height: 100%; object-fit: cover; }
.acct-initial { font-size: 13px; font-weight: 700; color: var(--ink-soft, #6b655d); }
.acct-signin { font-size: 13.5px; font-weight: 600; color: var(--accent-ink, #9a4a2a); text-decoration: none; padding: 6px 8px; }
.acct-signin:hover { text-decoration: underline; }
.acct-menu { position: absolute; right: 0; top: 40px; z-index: 60; min-width: 210px;
  background: var(--surface, #fff); border: 1px solid var(--line, #e7e2d9); border-radius: 14px;
  box-shadow: 0 20px 50px -20px rgba(60,40,20,.4); padding: 12px; }
.acct-info { padding: 4px 6px 10px; border-bottom: 1px solid var(--line-soft, #f0ece4); margin-bottom: 8px; }
.acct-name { font-size: 14px; font-weight: 600; }
.acct-email { font-size: 12.5px; color: var(--ink-soft, #6b655d); word-break: break-all; }
.acct-logout { width: 100%; text-align: left; background: none; border: none; padding: 9px 6px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--ink, #33302c); cursor: pointer; }
.acct-logout:hover { background: var(--bg-2, #f3efe8); }
