/* ============================================================
   Questlog - "night ledger"
   Warm near-black, gold = hours that count.
   Fraunces (editorial serif) for numerals, Inter for UI.
   ============================================================ */

:root {
  --bg: #100e0b;
  --bg-raise: #16130f;
  --panel: #1a1712;
  --panel-2: #201c16;
  --line: rgba(255, 246, 226, 0.07);
  --line-strong: rgba(255, 246, 226, 0.14);

  --text: #ece5d8;
  --muted: #a89d88;
  --faint: #6f6656;

  --gold: #e2b34e;
  --gold-bright: #f6cd6d;
  --gold-dim: rgba(226, 179, 78, 0.14);

  --green: #8fb573;
  --red: #d96c5a;

  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", sans-serif;

  --r: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* faint paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.07 0 0 0 0 0.05 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.hidden { display: none !important; }

.kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  font-size: 11px;
  font-family: var(--sans);
  color: var(--muted);
  background: var(--bg-raise);
}

button { font-family: var(--sans); cursor: pointer; border: none; background: none; color: inherit; }
input, select {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg-raise);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
}
input:focus, select:focus { border-color: rgba(226, 179, 78, 0.45); }
input::placeholder { color: var(--faint); }

/* ============ LAYOUT ============ */

#app {
  display: grid;
  grid-template-columns: 216px 1fr;
  height: 100vh;
  position: relative;
  z-index: 1;
}

#sidebar {
  border-right: 1px solid var(--line);
  background: var(--bg-raise);
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--gold);
  color: #17120a;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  border-radius: 8px;
}
.brand-name { font-family: var(--serif); font-size: 17px; font-weight: 500; letter-spacing: 0.01em; }

#nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 246, 226, 0.04); color: var(--text); }
.nav-item.on { background: var(--gold-dim); color: var(--gold-bright); }
.nav-key {
  width: 17px; height: 17px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 10px;
  color: var(--faint);
}
.nav-item.on .nav-key { border-color: rgba(226, 179, 78, 0.4); color: var(--gold); }

/* the quieter pair, parked at the bottom */
#nav-more {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.nav-item.nav-minor { font-size: 12.5px; padding: 6px 10px; color: var(--faint); }
.nav-item.nav-minor .nav-key { width: 15px; height: 15px; font-size: 9px; }
.nav-item.nav-minor:hover { color: var(--muted); }
.nav-item.nav-minor.on { color: var(--gold-bright); }

.side-section { flex: 1; min-height: 0; overflow-y: auto; }
.side-section-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 6px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--faint);
}
.icon-btn {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--faint);
  font-size: 15px;
  transition: all 0.15s;
}
.icon-btn:hover { background: rgba(255, 246, 226, 0.06); color: var(--text); }

.habit-row {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}
.habit-row:hover { background: rgba(255, 246, 226, 0.03); }
.habit-check {
  width: 18px; height: 18px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid; place-items: center;
  font-size: 11px;
  color: transparent;
  transition: all 0.18s var(--ease);
}
.habit-check.done {
  background: var(--habit-color, var(--gold));
  border-color: var(--habit-color, var(--gold));
  color: #17120a;
}
.habit-check:hover { border-color: var(--habit-color, var(--gold)); transform: scale(1.1); }
.habit-name { flex: 1; font-size: 12.5px; color: var(--muted); }
.habit-row .habit-check.done ~ .habit-name { color: var(--text); }
.habit-streak { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.habit-streak.hot { color: var(--gold); }

#habit-form { display: flex; flex-direction: column; gap: 6px; padding: 8px 6px 0; }
#habit-form input, #habit-form select { font-size: 12px; padding: 6px 8px; }

.side-foot { font-size: 11.5px; color: var(--faint); padding: 0 6px; }

.foot-row { display: flex; gap: 6px; margin-bottom: 8px; }

/* a phone has no keyboard: its shortcut hints only take room, and "hold space" means nothing */
.only-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .only-keys, .qa-hint, .focus-hints { display: none; }
  .only-touch { display: inline; }
}

/* sync between devices - quiet when all is well, plain when it is not */
.sync-status {
  display: flex; align-items: center; gap: 7px;
  width: 100%;
  margin-bottom: 8px;
  padding: 4px 2px;
  font-size: 11px;
  color: var(--faint);
  text-align: left;
  border-radius: 6px;
  transition: color 0.15s;
}
.sync-status:hover { color: var(--muted); }
.sync-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--faint); }
.sync-status.is-ok .sync-dot { background: var(--green); }
.sync-status.is-syncing .sync-dot { background: var(--gold); animation: syncPulse 1.2s ease-in-out infinite; }
.sync-status.is-offline .sync-dot { background: transparent; box-shadow: inset 0 0 0 1px var(--muted); }
.sync-status.is-error { color: var(--red); }
.sync-status.is-error .sync-dot { background: var(--red); }
@keyframes syncPulse { 50% { opacity: 0.35; } }
.sync-status.is-connect { color: var(--gold); }
.sync-status.is-connect .sync-dot { background: transparent; box-shadow: inset 0 0 0 1px var(--gold); }
.sync-status.is-connect:hover { color: var(--gold-bright); }

.sync-head {
  padding: 7px 9px 8px;
  margin-bottom: 3px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  max-width: 240px;
  line-height: 1.45;
}
.sync-sub { display: block; font-size: 10.5px; color: var(--faint); }

/* logging in - one form for every device */
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form p { margin: 0; }
.login-field { display: flex; flex-direction: column; gap: 5px; }
.login-field span { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
.login-field input { width: 100%; font-size: 15px; padding: 10px 12px; }
.login-check { display: flex; gap: 9px; align-items: flex-start; font-size: 12px; line-height: 1.45; color: var(--muted); cursor: pointer; }
.login-check input { margin-top: 2px; flex: none; accent-color: var(--gold); }
.login-check b { color: var(--text); font-weight: 600; }
.login-form .confirm-row { margin-top: 4px; }
.login-form button:disabled, .login-form input:disabled { opacity: 0.55; cursor: progress; }
.connect-error { margin-top: 8px; font-size: 12.5px; color: var(--red); }
.connect-note { margin-top: 10px; font-size: 11.5px; line-height: 1.5; color: var(--faint); }

@media (prefers-reduced-motion: reduce) { .sync-status.is-syncing .sync-dot { animation: none; } }
#backup-btn {
  width: 32px;
  flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  transition: all 0.15s;
}
#backup-btn:hover { color: var(--gold); border-color: rgba(226, 179, 78, 0.4); background: var(--gold-dim); }

/* ============ CONFIRM DIALOG ============ */

.confirm-overlay {
  position: fixed; inset: 0;
  z-index: 650;
  background: rgba(8, 7, 5, 0.62);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn 0.12s;
}
.confirm-box {
  width: min(420px, 100%);
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.7);
  padding: 22px 22px 18px;
  animation: paletteIn 0.18s var(--ease);
}
.confirm-title { font-family: var(--serif); font-size: 20px; font-weight: 550; margin-bottom: 10px; }
.confirm-body { font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.confirm-body p { margin-bottom: 8px; }
.confirm-body b { color: var(--text); }
.cf-warn { color: var(--red); }
.confirm-row { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.form-btn.danger-solid { background: var(--red); color: #1a0d0b; }
.form-btn.danger-solid:hover { background: #e5806e; }

#sound-toggle {
  display: flex; align-items: center; gap: 7px;
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--muted);
  transition: all 0.15s;
}
#sound-toggle:hover { color: var(--text); border-color: var(--line-strong); }
#sound-toggle .st-icon { color: var(--gold); font-size: 13px; }
#sound-toggle.muted { color: var(--faint); }
#sound-toggle.muted .st-icon { color: var(--faint); }

/* habit detail popover */
.habit-row { cursor: pointer; }
.habit-pop {
  position: fixed;
  z-index: 300;
  width: 262px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.65);
  padding: 14px;
  animation: menuIn 0.16s var(--ease);
}
.hp-name { font-family: var(--serif); font-size: 16px; font-weight: 550; }
.hp-quest {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px;
  color: var(--habit-color, var(--faint));
  margin-top: 3px;
}
.hp-quest .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--habit-color, var(--faint)); }
.hp-stats { display: flex; gap: 8px; margin: 12px 0; }
.hp-stat {
  flex: 1;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 4px 6px;
  text-align: center;
}
.hp-stat b {
  display: block;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 550;
  color: var(--gold-bright);
  line-height: 1.1;
}
.hp-stat span {
  font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--faint);
}
.hp-grid-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--faint);
  margin-bottom: 6px;
}
.hp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 13px; }
.hp-dot { height: 11px; border-radius: 3px; background: rgba(255, 246, 226, 0.05); }
.hp-dot.on { background: var(--habit-color, var(--gold)); opacity: 0.9; }
.hp-dot.future { background: transparent; border: 1px dashed rgba(255, 246, 226, 0.06); }
.hp-dot.today { box-shadow: 0 0 0 1.5px var(--gold); }
.hp-row { display: flex; gap: 8px; align-items: center; }
.hp-row select { flex: 1; font-size: 12px; padding: 6px 8px; min-width: 0; }
.hp-del {
  font-size: 11.5px;
  color: var(--faint);
  padding: 6px 9px;
  border-radius: 6px;
  transition: all 0.15s;
}
.hp-del:hover { color: var(--red); background: rgba(217, 108, 90, 0.08); }

#main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

/* ============ TOPBAR / HERO METRIC ============ */

#topbar {
  display: flex;
  align-items: flex-end; /* everything settles on the headline number's baseline */
  gap: 16px;
  padding: 16px 32px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(226,179,78,0.035), transparent);
}
.top-date {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--muted);
  font-style: italic;
  margin-right: auto;
  white-space: nowrap;
}

#instant-focus {
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 3px;
  padding: 7px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: all 0.18s var(--ease);
}
#instant-focus:hover {
  color: var(--gold-bright);
  border-color: rgba(226, 179, 78, 0.5);
  background: var(--gold-dim);
  transform: translateY(-1px);
}
#instant-focus .if-icon { font-size: 9px; color: var(--gold); }

#hero-metric { text-align: right; }
.hero-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  margin-bottom: 2px;
}
.hero-row { display: flex; align-items: center; gap: 16px; }

/* Tag und Woche nebeneinander - an der Grundlinie der Zahlen ausgerichtet,
   damit die beiden Groessen zusammen eine Linie ergeben. */
.hero-figs { display: flex; align-items: baseline; gap: 20px; }
.hero-fig + .hero-fig { border-left: 1px solid var(--line); padding-left: 20px; }
.hero-sub {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--faint);
  margin-top: 5px;
}
.hero-num {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 550;
  line-height: 1;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(226, 179, 78, 0.25);
}
.hero-num .hero-unit { font-size: 22px; font-style: italic; font-weight: 400; color: var(--gold); }
/* Die Woche bleibt die Hauptzahl - der Tag ist kleiner und ruhiger.
   Doppelte Klasse, damit auch die spaeteren .hero-num-Regeln uebersteuert werden. */
.hero-num.hero-num-day {
  font-size: 24px;
  color: var(--gold);
  text-shadow: none;
  opacity: 0.9;
}
.hero-num.hero-num-day .hero-unit { font-size: 14px; }
.hero-num.pulse { animation: heroPulse 0.7s var(--ease); }
@keyframes heroPulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.07); text-shadow: 0 0 36px rgba(246, 205, 109, 0.55); }
  100% { transform: scale(1); }
}
.hero-meta { font-size: 11.5px; color: var(--muted); text-align: left; line-height: 1.5; }
.hero-meta .up { color: var(--green); }
.hero-meta .down { color: var(--red); }
.hero-meta .rec { color: var(--faint); }

/* ============ VIEW SHELL ============ */

#view { flex: 1; overflow-y: auto; padding: 26px 32px 60px; }
.view-inner { max-width: 780px; margin: 0 auto; }
.view-inner.wide { max-width: 980px; }

h2.view-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  margin-bottom: 4px;
}
.view-sub { color: var(--faint); font-size: 13px; margin-bottom: 22px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: inset 0 1px 0 rgba(255, 246, 226, 0.04), 0 2px 12px rgba(0,0,0,0.25);
}

/* ============ QUICK ADD ============ */

#quick-add {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 4px 4px 16px;
  margin-bottom: 18px;
}
#quick-add .plus { color: var(--gold); font-size: 18px; font-weight: 300; }
#quick-add input {
  flex: 1;
  background: none; border: none;
  font-size: 14.5px;
  padding: 12px 0;
}
#quick-add .qa-hint { color: var(--faint); font-size: 11.5px; padding-right: 10px; white-space: nowrap; }

/* ============ TASK LIST ============ */

.task-list { display: flex; flex-direction: column; gap: 7px; }
.list-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--faint);
  margin: 20px 0 8px 2px;
}

.task-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--quest-color, transparent);
  border-radius: 10px;
  padding: 10px 12px 10px 14px;
  user-select: none;
  position: relative;
  transition: transform 0.18s var(--ease), box-shadow 0.18s, opacity 0.25s, border-color 0.15s;
}
.task-row.no-quest {
  border-left: 3px dashed var(--line-strong);
  background: rgba(26, 23, 18, 0.55);
}
.task-row.no-quest .task-title { color: var(--muted); }
.task-row.selected { border-color: rgba(226, 179, 78, 0.35); box-shadow: 0 0 0 1px rgba(226, 179, 78, 0.25); }
.task-row.dragging-ghost { opacity: 0.25; }
/* a long press starts a drag on touch screens - it must not select text or open a menu instead */
.task-row, .tray-item, .tl-grid {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.task-row.drag-float {
  position: fixed; z-index: 100;
  pointer-events: none;
  box-shadow: 0 14px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(226,179,78,0.3);
  transform: scale(1.02) rotate(0.4deg);
  background: var(--panel-2);
}
.task-row.done-row { opacity: 0.45; }
.task-row.done-row .task-title { text-decoration: line-through; text-decoration-color: var(--faint); }

.task-check {
  width: 19px; height: 19px; flex: none;
  border-radius: 6px;
  border: 1.5px solid var(--line-strong);
  display: grid; place-items: center;
  color: transparent;
  font-size: 12px;
  transition: all 0.18s var(--ease);
}
.task-check:hover { border-color: var(--gold); transform: scale(1.08); }
.task-check.done { background: var(--gold); border-color: var(--gold); color: #17120a; }
.task-check.done.flash { animation: checkSpring 0.36s var(--ease); }
@keyframes checkSpring {
  0% { transform: scale(1) rotate(0deg); box-shadow: 0 0 0 0 rgba(226,179,78,0.55); }
  22% { transform: scale(0.74) rotate(-8deg); }
  55% { transform: scale(1.32) rotate(5deg); box-shadow: 0 0 0 12px rgba(226,179,78,0); }
  78% { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); box-shadow: 0 0 0 0 rgba(226,179,78,0); }
}

.task-body { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.task-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-time { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.task-time.has { color: var(--gold); }

.quest-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 2.5px 8px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--quest-color, #888) 14%, transparent);
  color: var(--quest-color, var(--faint));
  white-space: nowrap;
  transition: background 0.15s;
}
.quest-tag:hover { background: color-mix(in srgb, var(--quest-color, #888) 26%, transparent); }
.quest-tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--quest-color, var(--faint)); }
.quest-tag.none { color: var(--faint); background: rgba(255,246,226,0.04); border: 1px dashed var(--line-strong); }

.kind-toggle {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--faint);
  border: 1px solid var(--line);
  padding: 2.5px 7px;
  border-radius: 5px;
  transition: all 0.15s;
}
.kind-toggle:hover { color: var(--muted); border-color: var(--line-strong); }
.kind-toggle.personal { color: #b78fd6; border-color: rgba(183, 143, 214, 0.3); }

.task-focus-btn {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  color: var(--faint);
  font-size: 11px;
  transition: all 0.15s;
}
.task-focus-btn:hover { background: var(--gold-dim); color: var(--gold-bright); transform: scale(1.1); }

/* quest picker dropdown */
.qmenu {
  position: fixed;
  z-index: 800;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 16px 44px rgba(0,0,0,0.6);
  padding: 5px;
  min-width: 190px;
  animation: menuIn 0.14s var(--ease);
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.qmenu button {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 12.5px;
  text-align: left;
  color: var(--text);
}
.qmenu button:hover { background: rgba(255,246,226,0.06); }
.qmenu .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ============ RECORD CHART CARD (You vs. Record-Self) ============ */

.record-card { padding: 18px 20px 14px; margin-top: 26px; }
.record-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.record-title { font-family: var(--serif); font-size: 16px; font-weight: 550; }
.seg { display: flex; background: var(--bg-raise); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button {
  padding: 4px 13px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--faint);
  transition: all 0.15s;
}
.seg button.on { background: var(--gold-dim); color: var(--gold-bright); }

.delta-banner {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600;
  margin-bottom: 12px;
}
.delta-banner.ahead { color: var(--green); }
.delta-banner.behind { color: var(--red); }
.delta-banner .arrow { font-size: 14px; }

.record-chart svg { display: block; width: 100%; }
.chart-legend {
  display: flex; gap: 18px;
  margin-top: 10px;
  font-size: 11px; color: var(--faint);
}
.chart-legend .li { display: flex; align-items: center; gap: 6px; }
.chart-legend .swatch { width: 14px; height: 3px; border-radius: 2px; }

/* ============ QUESTS VIEW ============ */

.quest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }

.quest-card { padding: 18px 18px 16px; position: relative; overflow: hidden; }
.quest-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--quest-color);
  opacity: 0.85;
}
.quest-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.quest-name {
  font-family: var(--serif);
  font-size: 18px; font-weight: 550; line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
}
/* chips sit on their own line so a long name can never squeeze them off the card */
.quest-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2.5px 7px;
  border-radius: 5px;
  color: var(--muted);
  background: rgba(255,246,226,0.05);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.quest-hours-row { display: flex; align-items: baseline; gap: 10px; margin: 12px 0 2px; }
.quest-hours {
  font-family: var(--serif);
  font-size: 32px; font-weight: 550;
  color: var(--quest-color);
  line-height: 1;
}
.quest-hours .u { font-size: 18px; font-style: italic; font-weight: 400; opacity: 0.7; }
.quest-week { font-size: 12px; color: var(--muted); }
.quest-week b { color: var(--text); }

.quest-activity { display: flex; align-items: flex-end; gap: 4px; height: 34px; margin: 12px 0 10px; }
.quest-activity .bar {
  flex: 1;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: color-mix(in srgb, var(--quest-color) 55%, transparent);
  transition: height 0.4s var(--ease);
}
.quest-activity .bar.cur { background: var(--quest-color); }

.quest-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--faint); }
.link-task-btn { color: var(--muted); font-size: 12px; padding: 3px 8px; border-radius: 6px; border: 1px dashed var(--line-strong); transition: all 0.15s; }
.link-task-btn:hover { color: var(--text); border-color: var(--muted); }

.new-quest-card {
  display: grid; place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  color: var(--faint);
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s;
  background: none; box-shadow: none;
}
.new-quest-card:hover { color: var(--gold); border-color: rgba(226,179,78,0.4); background: rgba(226,179,78,0.03); }

#quest-form { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
#quest-form .row { display: flex; gap: 10px; align-items: center; }
#quest-form input[type="text"] { flex: 1; font-size: 14px; }
.color-swatches { display: flex; gap: 7px; }
.color-swatches button {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid transparent;
  transition: transform 0.12s;
}
.color-swatches button:hover { transform: scale(1.15); }
.color-swatches button.on { border-color: var(--text); transform: scale(1.12); }
.form-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  background: var(--gold);
  color: #17120a;
  transition: all 0.15s;
}
.form-btn:hover { background: var(--gold-bright); }
.form-btn.ghost { background: none; color: var(--muted); }
.form-btn.ghost:hover { color: var(--text); }

.pill-toggle { display: flex; background: var(--bg-raise); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.pill-toggle button { padding: 5px 12px; border-radius: 6px; font-size: 12px; color: var(--faint); }
.pill-toggle button.on { background: rgba(255,246,226,0.08); color: var(--text); }

/* ============ TASK ROW BLOCK BADGE ============ */

.block-chip {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold);
  background: var(--gold-dim);
  border-radius: 5px;
  padding: 2.5px 7px;
  white-space: nowrap;
}

/* ============ TIMELINE ============ */

.tl-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.tl-toolbar-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--faint);
}
.tool-btn {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--muted);
  transition: all 0.15s;
}
.tool-btn:hover { color: var(--gold); border-color: rgba(226, 179, 78, 0.4); background: rgba(226, 179, 78, 0.04); }
.tl-toolbar-hint { margin-left: auto; font-size: 11.5px; color: var(--faint); font-style: italic; }

/* planned focus blocks - the plan layer behind the log */
.fb {
  position: absolute;
  left: 4px; right: 8px;
  border: 1.5px dashed rgba(226, 179, 78, 0.32);
  border-radius: 12px;
  background: rgba(226, 179, 78, 0.035);
  z-index: 1;
  pointer-events: none;
}
.fb.manipulating { border-color: rgba(226, 179, 78, 0.75); background: rgba(226, 179, 78, 0.07); z-index: 9; }
.fb-head {
  pointer-events: auto;
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 12px 3px;
  cursor: grab;
}
.fb-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--gold);
}
.fb-time { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fb-meta { margin-left: auto; font-size: 10.5px; color: var(--faint); }
.fb-chips {
  pointer-events: auto;
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 2px 12px 6px;
  cursor: pointer;
}
.fb-chip {
  font-size: 10.5px; font-weight: 500;
  padding: 2px 9px;
  border-radius: 12px;
  color: var(--quest-color, var(--muted));
  background: color-mix(in srgb, var(--quest-color, #6f6656) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--quest-color, #6f6656) 28%, transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 180px;
}
.fb-chip.done { opacity: 0.45; text-decoration: line-through; }
.fb-handle { position: absolute; left: 0; right: 0; height: 8px; cursor: ns-resize; pointer-events: auto; }
.fb-handle.top { top: -4px; }
.fb-handle.bottom { bottom: -4px; }


.tool-btn.accent { color: var(--gold); border-color: rgba(226, 179, 78, 0.35); border-style: solid; }
.tool-btn.accent:hover { background: var(--gold-dim); }

/* ---- planning tray: that day's tasks, waiting for a time ---- */
.tl-layout { display: flex; gap: 18px; align-items: flex-start; }
.tl-layout .tl-main { flex: 1; min-width: 0; }

/* ---------- Google Calendar column (read-only, left of the blocks) ---------- */
.tl-heads { display: flex; align-items: flex-end; margin-bottom: 6px; }
.tl-heads-spacer { width: 52px; flex: none; }
.tl-cal-head {
  width: 150px; flex: none;
  display: flex; flex-direction: column; gap: 3px;
  padding: 0 3px;
}
.tl-cal-label {
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--faint); padding-left: 2px;
}
.tl-cal-chip {
  font-size: 10.5px; line-height: 1.3;
  padding: 3px 6px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--cal-color) 16%, var(--panel));
  border-left: 3px solid var(--cal-color);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-cal-chip-time { color: var(--muted); margin-right: 5px; font-variant-numeric: tabular-nums; }

.tl-cal {
  width: 150px; flex: none;
  position: relative;
  border-left: 1px solid var(--line-strong);
  background-image: linear-gradient(var(--line) 1px, transparent 1px);
}
.tl-cal-ev {
  position: absolute;
  border-radius: 6px;
  background: color-mix(in srgb, var(--cal-color) 18%, var(--panel));
  border-left: 3px solid var(--cal-color);
  padding: 3px 6px;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.25;
  z-index: 1;
}
.tl-cal-ev:hover { z-index: 3; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
.tl-cal-ev-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-cal-ev-time { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-cal-ev.short { padding-top: 1px; }
.tl-cal-ev.short .tl-cal-ev-time { display: none; }
.tl-cal-now { position: absolute; left: 0; right: 0; height: 1px; background: var(--gold); opacity: 0.45; pointer-events: none; z-index: 2; }
.tl-cal-note {
  position: sticky; top: 10px;
  margin: 10px 8px;
  font-size: 10.5px; line-height: 1.45; color: var(--faint); text-align: center;
}

@media (max-width: 720px) {
  .tl-cal, .tl-cal-head { width: 96px; }
}

.tl-tray {
  width: 232px;
  flex: none;
  position: sticky;
  top: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: calc(100vh - 190px);
}
.tray-head { display: flex; align-items: baseline; gap: 8px; }
.tray-title { font-family: var(--serif); font-size: 14.5px; font-weight: 550; }
.tray-count { margin-left: auto; font-size: 10.5px; color: var(--faint); white-space: nowrap; }

.tray-list { display: flex; flex-direction: column; gap: 5px; overflow-y: auto; min-height: 40px; }
.tray-empty { padding: 12px 4px; font-size: 12px; }

.tray-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--quest-color, var(--line-strong));
  border-radius: 8px;
  background: var(--bg-raise);
  font-size: 12.5px;
  cursor: grab;
  user-select: none;
  transition: border-color 0.15s, transform 0.12s;
}
.tray-item:hover { border-color: var(--line-strong); transform: translateX(2px); }
.tray-item:active { cursor: grabbing; }
.tray-item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--quest-color, var(--faint)); flex: none; }
.tray-item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-item.placed { opacity: 0.5; border-left-style: dashed; }
.tray-badge { font-size: 9px; font-weight: 700; color: var(--gold); white-space: nowrap; }

.tray-float {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(226, 179, 78, 0.35);
  background: var(--panel-2);
  transform: rotate(-1deg);
}

.tray-add { font-size: 12.5px; padding: 8px 9px; }
.tray-hint { font-size: 10.5px; color: var(--faint); line-height: 1.45; }

.fb.drop-target { border-color: rgba(226, 179, 78, 0.8); background: rgba(226, 179, 78, 0.09); }
.fb.ghost-plan {
  pointer-events: none;
  border-style: dashed;
  border-color: rgba(226, 179, 78, 0.55);
  background: rgba(226, 179, 78, 0.06);
  z-index: 8;
}

@media (max-width: 900px) {
  .tl-layout { flex-direction: column-reverse; }
  /* stacked, align-items: flex-start would shrink both to their content - the grid has none */
  .tl-tray, .tl-layout .tl-main { width: 100%; }
  .tl-tray { position: static; max-height: 300px; }
}

.tl-wrap { display: flex; gap: 0; position: relative; }
.tl-hours { width: 52px; flex: none; position: relative; }
.tl-hour-label {
  position: absolute;
  right: 10px;
  transform: translateY(-50%);
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.tl-grid {
  flex: 1;
  position: relative;
  border-left: 1px solid var(--line-strong);
  cursor: crosshair;
}
.tl-gridline { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); pointer-events: none; }
.tl-gridline.half { background: rgba(255,246,226,0.03); }
.tl-nowline {
  position: absolute; left: -5px; right: 0;
  height: 1px;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(226,179,78,0.6);
  pointer-events: none;
  z-index: 5;
}
.tl-nowline::before {
  content: "";
  position: absolute; left: 0; top: -3px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
}

.tl-block {
  position: absolute;
  left: 10px; right: 14px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--quest-color, #6f6656) 16%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--quest-color, #6f6656) 40%, transparent);
  border-left: 3px solid var(--quest-color, var(--faint));
  padding: 5px 10px;
  overflow: hidden;
  cursor: grab;
  transition: box-shadow 0.15s;
  z-index: 2;
}
.tl-block:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.4); z-index: 4; }
.tl-block.no-quest { border-left-style: dashed; opacity: 0.8; }
.tl-block.manipulating { box-shadow: 0 10px 30px rgba(0,0,0,0.55), 0 0 0 1px rgba(226,179,78,0.35); z-index: 10; cursor: grabbing; }
.tl-block.ghost-new { background: var(--gold-dim); border: 1px dashed rgba(226,179,78,0.5); z-index: 10; pointer-events: none; }
.tl-block-title { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-block-time { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-handle {
  position: absolute; left: 0; right: 0; height: 7px;
  cursor: ns-resize;
  z-index: 3;
}
.tl-handle.top { top: -3px; }
.tl-handle.bottom { bottom: -3px; }

.tl-form {
  position: absolute;
  z-index: 30;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.65);
  padding: 12px;
  width: 250px;
  display: flex; flex-direction: column; gap: 8px;
  animation: menuIn 0.16s var(--ease);
}
.tl-form .tl-form-time { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tl-form .row { display: flex; gap: 6px; justify-content: flex-end; }

/* ============ FOCUS MODE ============ */

#focus-overlay {
  position: fixed; inset: 0;
  z-index: 500;
  background: radial-gradient(ellipse 90% 70% at 50% 38%, #17130d 0%, #0b0a08 100%);
  display: grid;
  place-items: center;
  animation: focusIn 0.5s var(--ease);
}
@keyframes focusIn { from { opacity: 0; transform: scale(1.02); } }
#focus-overlay.leaving { animation: focusOut 0.35s var(--ease) forwards; }
@keyframes focusOut { to { opacity: 0; transform: scale(0.99); } }

.focus-stage { display: flex; flex-direction: column; align-items: center; gap: 0; }

.focus-quest {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--quest-color, var(--faint));
  margin-bottom: 14px;
  padding: 5px 13px;
  border: 1px solid transparent;
  border-radius: 16px;
  transition: all 0.16s var(--ease);
}
.focus-quest:hover { border-color: var(--line-strong); background: rgba(255, 246, 226, 0.03); }
.focus-quest .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--quest-color, var(--faint)); }

.focus-task {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 450;
  text-align: center;
  max-width: 560px;
  line-height: 1.3;
  margin-bottom: 40px;
  padding: 2px 14px;
  border-radius: 8px;
  cursor: text;
  border-bottom: 1px solid transparent;
  transition: border-color 0.16s;
}
.focus-task:hover { border-bottom-color: var(--line-strong); }
.focus-task-input {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 450;
  text-align: center;
  max-width: 560px;
  width: 560px;
  line-height: 1.3;
  margin-bottom: 40px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--gold);
  border-radius: 0;
  padding: 2px 14px;
  color: var(--text);
}

.focus-ring-wrap { position: relative; width: 330px; height: 330px; display: grid; place-items: center; }
#focus-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(255,246,226,0.06); stroke-width: 3; }
.ring-fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(226,179,78,0.5));
  transition: stroke-dashoffset 0.5s linear;
}
.focus-timer {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 76px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: baseline;
}
.focus-timer .digit { display: inline-block; width: 0.58em; text-align: center; }
.focus-timer .colon { display: inline-block; width: 0.3em; text-align: center; animation: colonBreathe 2s ease-in-out infinite; }
@keyframes colonBreathe { 50% { opacity: 0.35; } }
.focus-timer.paused { color: var(--faint); }
.focus-timer.paused .colon { animation: none; }
.focus-timer.pomo-done { animation: pomoFlash 1s var(--ease) 3; }
@keyframes pomoFlash { 50% { color: var(--gold-bright); text-shadow: 0 0 40px rgba(246,205,109,0.8); } }

.focus-controls { display: flex; gap: 12px; margin-top: 44px; }
.focus-btn {
  padding: 11px 30px;
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  transition: all 0.18s var(--ease);
}
.focus-btn:hover { color: var(--text); border-color: var(--muted); transform: translateY(-1px); }
.focus-btn.primary { background: var(--gold); border-color: var(--gold); color: #17120a; }
.focus-btn.primary:hover { background: var(--gold-bright); box-shadow: 0 6px 24px rgba(226,179,78,0.3); }

.focus-mode-switch { display: flex; gap: 2px; margin-top: 26px; background: rgba(255,246,226,0.04); border-radius: 8px; padding: 2px; }
.focus-mode-switch button { padding: 5px 14px; font-size: 11.5px; color: var(--faint); border-radius: 6px; }
.focus-mode-switch button.on { background: rgba(255,246,226,0.08); color: var(--muted); }

.focus-hints { display: flex; gap: 20px; margin-top: 30px; font-size: 11.5px; color: var(--faint); opacity: 0.7; }

/* ============ COMMAND PALETTE ============ */

#palette-overlay {
  position: fixed; inset: 0;
  z-index: 600;
  background: rgba(8, 7, 5, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  padding-top: 16vh;
  animation: fadeIn 0.12s;
}
@keyframes fadeIn { from { opacity: 0; } }
#palette {
  width: 520px;
  max-height: 380px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: paletteIn 0.18s var(--ease);
  height: fit-content;
}
@keyframes paletteIn { from { opacity: 0; transform: translateY(-10px) scale(0.98); } }
#palette-input {
  border: none; background: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 15px 18px;
  font-size: 15px;
}
#palette-list { overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--muted);
  text-align: left;
}
.palette-item .pi-icon { width: 20px; text-align: center; color: var(--faint); flex: none; }
.palette-item .pi-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .pi-hint { font-size: 11px; color: var(--faint); }
.palette-item.selected { background: var(--gold-dim); color: var(--gold-bright); }
.palette-item.selected .pi-icon { color: var(--gold); }
.palette-item .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ============ TOASTS ============ */

#toasts {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 700;
  pointer-events: none;
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13px;
  box-shadow: 0 10px 34px rgba(0,0,0,0.5);
  animation: toastIn 0.3s var(--ease);
  display: flex; align-items: center; gap: 8px;
}
.toast .gold { color: var(--gold-bright); font-weight: 600; }
.toast-text { max-width: 460px; }
.toast.out { animation: toastOut 0.3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(0.97); } }

/* ============ SCROLLBARS ============ */
/* Firefox */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 246, 226, 0.14) transparent; }
/* Chrome / Safari */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,246,226,0.08); border-radius: 5px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,246,226,0.15); }

/* empty states */
.empty-note { color: var(--faint); font-size: 13px; font-style: italic; padding: 18px 4px; text-align: center; }

/* ============ AGENDA - everything pushed ahead ============ */

#upcoming-list { display: flex; flex-direction: column; gap: 6px; }

.agenda-day {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 11px 11px;
  background: rgba(26, 23, 18, 0.4);
  transition: border-color 0.15s, background 0.15s;
}
.agenda-day.drop-target,
#open-list.drop-target {
  border-color: rgba(226, 179, 78, 0.55);
  background: rgba(226, 179, 78, 0.05);
}
#open-list.drop-target {
  border: 1px dashed rgba(226, 179, 78, 0.55);
  border-radius: 11px;
  padding: 6px;
  margin: -6px;
}

.ad-head { display: flex; align-items: baseline; gap: 9px; padding: 0 3px 9px; }
.ad-label {
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 550;
  color: var(--text);
}
.ad-away { font-size: 11px; color: var(--faint); }
.ad-count { margin-left: auto; font-size: 11px; color: var(--faint); }
.ad-move {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--faint);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
  transition: all 0.15s;
}
.agenda-day:hover .ad-move { color: var(--muted); border-color: var(--line); }
.ad-move:hover { color: var(--gold) !important; border-color: rgba(226, 179, 78, 0.4) !important; }

.ad-list { display: flex; flex-direction: column; gap: 6px; }
.ad-list .task-row { cursor: grab; }
.ad-list .task-row:active { cursor: grabbing; }

.ad-pull {
  width: 24px; height: 24px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--faint);
  font-size: 12px;
  opacity: 0;
  transition: all 0.15s;
}
.task-row:hover .ad-pull { opacity: 1; }
.ad-pull:hover { color: var(--gold-bright); background: var(--gold-dim); }

/* ============ MORNING PRIMING ============ */

#priming-overlay {
  position: fixed; inset: 0;
  z-index: 900;
  background: radial-gradient(ellipse 80% 60% at 50% 42%, #16120c 0%, #080706 100%);
  display: grid;
  place-items: center;
  padding: 40px 24px;
  overflow-y: auto;   /* a very long line must never push the controls out of reach */
  animation: primeIn 0.7s var(--ease);
}
@keyframes primeIn { from { opacity: 0; } }
#priming-overlay.leaving { animation: primeOut 0.42s var(--ease) forwards; }
@keyframes primeOut { to { opacity: 0; transform: scale(1.02); } }
#priming-overlay.done .pr-belief { color: var(--gold-bright); text-shadow: 0 0 60px rgba(246, 205, 109, 0.45); }

.pr-stage {
  display: flex; flex-direction: column; align-items: center;
  max-width: 760px;
  text-align: center;
}
.pr-eyebrow {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.22em;
  color: var(--faint);
  margin-bottom: 34px;
}
/* the longer the line, the quieter the type - so it always fits on one screen */
.pr-belief.mid { font-size: clamp(22px, 3vw, 32px) !important; }
.pr-belief.small { font-size: clamp(18px, 2.2vw, 25px) !important; line-height: 1.45 !important; }

.pr-belief {
  font-family: var(--serif);
  font-size: clamp(28px, 4.4vw, 46px);
  font-weight: 450;
  line-height: 1.35;
  color: var(--gold);
  opacity: 0.6;
  transition: color 0.6s, text-shadow 0.6s;
  margin-bottom: 46px;
}

.pr-progress {
  width: min(340px, 70vw);
  height: 3px;
  background: rgba(255, 246, 226, 0.09);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 30px;
}
.pr-progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  box-shadow: 0 0 12px rgba(226, 179, 78, 0.6);
}
.pr-progress i.releasing { transition: width 0.3s var(--ease); }

.pr-hold {
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 10px 22px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;   /* ten seconds of holding must not turn into a scroll or a text selection */
  transition: all 0.2s var(--ease);
}
.pr-hold:hover { color: var(--text); border-color: var(--muted); }
#priming-overlay.holding .pr-hold {
  color: var(--gold-bright);
  border-color: rgba(226, 179, 78, 0.55);
  background: var(--gold-dim);
}
.pr-hint {
  margin-top: 22px;
  font-size: 11.5px;
  color: var(--faint);
  font-style: italic;
  letter-spacing: 0.02em;
}

/* the Priming view */
.pr-today { padding: 22px 24px 20px; margin-bottom: 18px; text-align: center; }
.pr-today-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--faint);
}
.pr-today-text {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.4;
  color: var(--gold-bright);
  margin: 12px 0 16px;
}

.belief-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.belief-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 10px;
  animation: rowRise 260ms var(--ease) both;
}
.belief-row.is-today { border-left-color: var(--gold); background: rgba(226, 179, 78, 0.045); }
.belief-index {
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  min-width: 14px;
}
.belief-text { flex: 1; font-size: 13.5px; line-height: 1.5; cursor: text; }
.belief-text:hover { color: var(--gold-bright); }
.belief-edit {
  flex: 1;
  font-size: 13.5px;
  padding: 5px 8px;
  border-radius: 6px;
}
.belief-badge {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--gold);
  border: 1px solid rgba(226, 179, 78, 0.3);
  border-radius: 4px;
  padding: 2px 6px;
}
.belief-del {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 5px;
  color: var(--faint);
  font-size: 10px;
  opacity: 0;
  transition: all 0.15s;
}
.belief-row:hover .belief-del { opacity: 1; }
.belief-del:hover { color: var(--red); background: rgba(217, 108, 90, 0.1); }

.pr-setting {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.pr-toggle { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.pr-toggle input { accent-color: var(--gold); width: 15px; height: 15px; margin: 0; }
.pr-rotation { margin-left: auto; font-size: 11px; color: var(--faint); }

/* ============ COOKIE JAR ============ */

.jar-top { padding: 0; overflow: hidden; margin-bottom: 16px; }
.jar-reach {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px;
  cursor: pointer;
  transition: background 0.18s;
}
.jar-reach:hover { background: rgba(226, 179, 78, 0.05); }
.jar-glyph {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px dashed rgba(226, 179, 78, 0.45);
  color: var(--gold);
  font-size: 22px;
  flex: none;
  transition: transform 0.2s var(--ease);
}
.jar-reach:hover .jar-glyph { transform: rotate(-12deg) scale(1.06); }
.jar-reach-title { font-family: var(--serif); font-size: 19px; font-weight: 550; }
.jar-reach-sub { font-size: 12px; color: var(--faint); margin-top: 2px; }

.jar-drawn {
  padding: 22px 24px 24px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(226, 179, 78, 0.07), transparent);
}
.jar-drawn.pop { animation: rowRise 300ms var(--ease); }
.jd-text {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.4;
  color: var(--gold-bright);
}
.jd-date { font-size: 11.5px; color: var(--faint); margin-top: 8px; }

.jar-add { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 16px; margin-bottom: 20px; }
.jar-add .plus { color: var(--gold); font-size: 18px; font-weight: 300; }
.jar-add input { flex: 1; background: none; border: none; font-size: 14px; padding: 12px 0; }

.jar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.jar-note {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid rgba(226, 179, 78, 0.35);
  border-radius: 10px;
  padding: 14px 15px 11px;
  display: flex; flex-direction: column; gap: 10px;
  animation: rowRise 260ms var(--ease) both;
}
.jar-note.earned { border-left-color: var(--gold); background: rgba(226, 179, 78, 0.045); }
.jn-text { font-size: 13.5px; line-height: 1.5; flex: 1; }
.jn-foot { display: flex; align-items: center; gap: 8px; }
.jn-date { font-size: 10.5px; color: var(--faint); }
.jn-badge {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--gold);
  border: 1px solid rgba(226, 179, 78, 0.3);
  border-radius: 4px;
  padding: 2px 6px;
}
.jn-del {
  margin-left: auto;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 5px;
  color: var(--faint);
  font-size: 10px;
  opacity: 0;
  transition: all 0.15s;
}
.jar-note:hover .jn-del { opacity: 1; }
.jn-del:hover { color: var(--red); background: rgba(217, 108, 90, 0.1); }

/* ============ HABIT AT RISK ============ */

.habit-check.risk { border-color: rgba(217, 108, 90, 0.55); }
.habit-check.risk:hover { border-color: var(--red); }
.habit-streak.broken { color: var(--red); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.hp-dot.urgent {
  box-shadow: 0 0 0 1.5px var(--red);
  animation: urgentPulse 2.2s ease-in-out infinite;
}
@keyframes urgentPulse {
  50% { box-shadow: 0 0 0 1.5px rgba(217, 108, 90, 0.45); }
}
.hp-warn {
  font-size: 11.5px;
  color: var(--red);
  background: rgba(217, 108, 90, 0.08);
  border: 1px solid rgba(217, 108, 90, 0.22);
  border-radius: 7px;
  padding: 7px 9px;
  margin-bottom: 12px;
}

/* custom repeat row */
.qm-custom {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 9px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.qm-custom.on { color: var(--gold-bright); }
.qm-custom input { width: 46px; padding: 4px 6px; font-size: 12px; }
.qm-custom select { padding: 4px 4px; font-size: 11.5px; }
.qm-custom #rep-set {
  margin-left: auto;
  font-size: 11px; font-weight: 600;
  color: var(--gold);
  padding: 4px 9px;
  border: 1px solid rgba(226, 179, 78, 0.3);
  border-radius: 6px;
}
.qm-custom #rep-set:hover { background: var(--gold-dim); }

/* ============ PROGRESSION: STREAK, LEVELS, RANK ============ */

#streak-chip {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 9px 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  cursor: default;
}
#streak-chip .flame { fill: var(--faint); transition: fill 0.3s; }
#streak-chip .flame-core { fill: var(--bg); }
#streak-chip.hot {
  color: var(--gold-bright);
  border-color: rgba(226, 179, 78, 0.4);
  background: var(--gold-dim);
}
#streak-chip.hot .flame { fill: var(--gold); animation: flicker 2.4s ease-in-out infinite; }
#streak-chip.hot .flame-core { fill: #2a1d08; }
#streak-chip.record .flame { fill: var(--gold-bright); }
@keyframes flicker {
  0%, 100% { opacity: 1; transform: scaleY(1); }
  45% { opacity: 0.82; transform: scaleY(0.93); }
  70% { opacity: 1; transform: scaleY(1.04); }
}

.quest-level { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 7px; }
.ql-badge {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #17120a;
  background: var(--quest-color);
  padding: 3px 8px;
  border-radius: 5px;
}
.ql-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 550;
  color: var(--quest-color);
}
.ql-next { margin-left: auto; font-size: 11px; color: var(--faint); }

.ql-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 246, 226, 0.06);
  overflow: hidden;
}
.ql-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--quest-color) 60%, transparent), var(--quest-color));
  transform-origin: left;
  animation: growX 520ms var(--ease) both;
}
.ql-scale { display: flex; justify-content: space-between; margin-top: 5px; }
.ql-tick { font-size: 9px; color: rgba(255, 246, 226, 0.16); font-variant-numeric: tabular-nums; }
.ql-tick.on { color: color-mix(in srgb, var(--quest-color) 70%, transparent); font-weight: 600; }

.honesty-label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rank-pill {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  padding: 3px 9px;
  border-radius: 5px;
  border: 1px solid;
}
.rank-focused { color: var(--gold-bright); border-color: rgba(226, 179, 78, 0.45); background: var(--gold-dim); }
.rank-steady { color: var(--green); border-color: rgba(143, 181, 115, 0.4); background: rgba(143, 181, 115, 0.1); }
.rank-split { color: #d9a86c; border-color: rgba(217, 168, 108, 0.35); background: rgba(217, 168, 108, 0.08); }
.rank-scattered { color: var(--red); border-color: rgba(217, 108, 90, 0.35); background: rgba(217, 108, 90, 0.08); }
.rank-unwritten { color: var(--faint); border-color: var(--line-strong); }
.rank-note { font-size: 11.5px; color: var(--faint); font-style: italic; margin: 6px 0 16px; }

/* ============ SCHEDULING & REPEAT ============ */

.task-sched {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--faint);
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 3px 7px;
  white-space: nowrap;
  opacity: 0;
  transition: all 0.15s;
}
.task-row:hover .task-sched { opacity: 1; }
.task-sched:hover { color: var(--gold); border-color: rgba(226, 179, 78, 0.35); }
.task-sched.set {
  opacity: 1;
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 246, 226, 0.03);
}

.sched-menu { min-width: 208px; }
.qm-head {
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--faint);
  padding: 8px 9px 5px;
}
.qmenu button.on { background: var(--gold-dim); color: var(--gold-bright); }
.qm-hint { margin-left: auto; font-size: 10.5px; color: var(--faint); }
.qm-date {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 9px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
}
.qm-date input {
  width: 124px;
  font-size: 11.5px;
  padding: 4px 6px;
  color-scheme: dark;
}

/* pomodoro phase badge */
.focus-phase {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--faint);
  margin-bottom: 10px;
}
#focus-overlay.on-break { background: radial-gradient(ellipse 90% 70% at 50% 38%, #101512 0%, #080a09 100%); }
#focus-overlay.on-break .ring-fill { stroke: #8fb573; filter: drop-shadow(0 0 6px rgba(143, 181, 115, 0.5)); }
#focus-overlay.on-break .focus-phase { color: #8fb573; }
#focus-overlay.on-break .focus-timer { color: #cfe0c2; }

/* ============================================================
   DELIGHT - finishing things should feel like something
   ============================================================ */

/* embers from a completed thing */
.spark-layer { position: fixed; inset: 0; pointer-events: none; z-index: 900; }
.spark-layer i {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: spark 460ms cubic-bezier(0.16, 0.9, 0.3, 1) forwards;
}
@keyframes spark {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  14% { opacity: 1; }
  70% { opacity: 0.9; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.15); opacity: 0; }
}

/* logged hours travelling to the headline number */
.fly-chip {
  position: fixed;
  z-index: 900;
  pointer-events: none;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 0 18px rgba(226, 179, 78, 0.5);
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  transition: transform 420ms cubic-bezier(0.35, 0, 0.2, 1), opacity 420ms ease-in;
}

.hero-num.shimmer { animation: heroShimmer 620ms var(--ease); }
@keyframes heroShimmer {
  0% { text-shadow: 0 0 24px rgba(226, 179, 78, 0.25); }
  35% { text-shadow: 0 0 46px rgba(246, 205, 109, 0.85), 0 0 14px rgba(246, 205, 109, 0.6); transform: scale(1.05); }
  100% { text-shadow: 0 0 24px rgba(226, 179, 78, 0.25); transform: scale(1); }
}

/* the row acknowledges the click before it leaves */
.task-row.completing { border-color: rgba(226, 179, 78, 0.5) !important; }
.task-row.completing::after {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 28%, rgba(246, 205, 109, 0.26) 50%, transparent 72%);
  background-size: 240% 100%;
  animation: doneWash 340ms ease-out forwards;
}
@keyframes doneWash {
  from { background-position: -120% 0; }
  to { background-position: 220% 0; }
}

/* …and lands softly in Done */
.task-row.landed { animation: landIn 340ms var(--ease); }
@keyframes landIn {
  0% { opacity: 0; transform: translateY(-16px) scale(0.97); }
  55% { opacity: 1; transform: translateY(3px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* rows rise in when you arrive at a view */
.task-row.rise { animation: rowRise 260ms var(--ease) both; }
@keyframes rowRise {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

.habit-check.pop { animation: checkSpring 0.36s var(--ease); }

/* Done section toggle */
.done-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  text-align: left;
  padding: 6px 2px;
  border-radius: 7px;
  transition: color 0.15s;
}
.done-toggle:hover { color: var(--muted); }
.done-toggle .dt-chev { display: inline-block; transition: transform 0.22s var(--ease); font-size: 9px; }
.done-toggle.open .dt-chev { transform: rotate(90deg); }
.done-toggle .dt-hint {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--faint);
  opacity: 0;
  transition: opacity 0.18s;
}
.done-toggle:hover .dt-hint { opacity: 1; }
.done-day {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--faint);
  margin: 14px 0 4px 4px;
}
.done-day:first-child { margin-top: 4px; }

/* charts and bars grow into place */
.record-chart.drawing path[stroke="#e2b34e"] {
  stroke-dasharray: 2400;
  animation: drawLine 620ms var(--ease) forwards;
}
@keyframes drawLine { from { stroke-dashoffset: 2400; } to { stroke-dashoffset: 0; } }
.record-chart.drawing path[fill^="url"] { animation: fadeIn 520ms ease-out both; }
.record-chart.drawing circle { animation: popIn 300ms var(--ease) 330ms both; }
.record-chart.drawing rect {
  transform-box: fill-box;
  transform-origin: bottom;
  animation: barGrow 440ms var(--ease) both;
}
@keyframes barGrow { from { transform: scaleY(0.02); opacity: 0.4; } }
@keyframes popIn { from { transform: scale(0); opacity: 0; } }

.quest-activity .bar { transform-origin: bottom; animation: barGrow 400ms var(--ease) both; }
.quest-activity .bar:nth-child(1) { animation-delay: 0ms; }
.quest-activity .bar:nth-child(2) { animation-delay: 22ms; }
.quest-activity .bar:nth-child(3) { animation-delay: 44ms; }
.quest-activity .bar:nth-child(4) { animation-delay: 66ms; }
.quest-activity .bar:nth-child(5) { animation-delay: 88ms; }
.quest-activity .bar:nth-child(6) { animation-delay: 110ms; }
.quest-activity .bar:nth-child(7) { animation-delay: 132ms; }
.quest-activity .bar:nth-child(8) { animation-delay: 154ms; }

.hb-fill, .recap-row .rbar i, .fbd-bar i {
  transform-origin: left;
  animation: growX 520ms var(--ease) both;
}
@keyframes growX { from { transform: scaleX(0); } }

/* focus mode: the moment of completion */
#focus-overlay.bloom::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 47%, rgba(246, 205, 109, 0.32), transparent 58%);
  animation: bloom 620ms var(--ease) forwards;
}
@keyframes bloom {
  0% { opacity: 0; transform: scale(0.8); }
  28% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.25); }
}

/* quest cards and blocks arrive with a little life */
.quest-card { animation: rowRise 300ms var(--ease) both; }
.quest-card:nth-child(2) { animation-delay: 33ms; }
.quest-card:nth-child(3) { animation-delay: 66ms; }
.quest-card:nth-child(4) { animation-delay: 99ms; }
.fb-chip { animation: popIn 240ms var(--ease) both; }
.fbd-task { animation: rowRise 240ms var(--ease) both; }

/* ============================================================
   RESPONSIVE - the sidebar folds away, the ledger keeps working
   ============================================================ */

/* nav toggle: defined first so the media query below can turn it on */
#nav-toggle {
  display: none;
  place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--muted);
  font-size: 15px;
  flex: none;
  align-self: center;
}
#nav-toggle:hover { color: var(--text); }

@media (max-width: 900px) {
  #view { padding: 22px 20px 60px; }
  #topbar { padding: 14px 20px 12px; }
  .hero-meta { display: none; }
  .quest-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  #app { grid-template-columns: 1fr; }

  #sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 232px;
    z-index: 400;
    transform: translateX(-100%);
    transition: transform 0.24s var(--ease);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.6);
  }
  body.nav-open #sidebar { transform: translateX(0); }
  /* The dimmer belongs inside #app: #app is its own stacking context (z-index 1), so a
     dimmer hung on body sat above the whole app - sidebar included - and swallowed every tap. */
  body.nav-open #app::after {
    content: "";
    position: fixed; inset: 0;
    background: rgba(8, 7, 5, 0.55);
    z-index: 390;
  }

  #nav-toggle { display: grid; }

  #topbar {
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 12px;
  }
  .top-date { font-size: 15px; margin-right: 0; }
  #instant-focus { margin: 0 0 0 auto; padding: 6px 12px; font-size: 12px; }
  #live-chip { order: 3; width: 100%; margin: 0; max-width: none; }
  .lc-title { max-width: none; }
  #hero-metric { order: 4; width: 100%; text-align: left; }
  .hero-label { margin-bottom: 0; }
  .hero-row { gap: 12px; }
  .hero-num { font-size: 32px; }
  .hero-num .hero-unit { font-size: 19px; }
  .hero-figs { gap: 14px; }
  .hero-fig + .hero-fig { padding-left: 14px; }
  .hero-num.hero-num-day { font-size: 21px; }
  .hero-num.hero-num-day .hero-unit { font-size: 13px; }

  #view { padding: 18px 14px 70px; }
  h2.view-title { font-size: 22px; }
  .view-sub { margin-bottom: 16px; }

  /* touch targets and room to breathe */
  .task-row { flex-wrap: wrap; gap: 8px 10px; padding: 11px 12px; }
  .task-body { flex: 1 1 100%; }
  .task-check { width: 22px; height: 22px; }
  .task-del, .task-sched { opacity: 1; }
  .task-focus-btn { width: 30px; height: 30px; }
  .quest-tag { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }

  .record-card, .recap-card { padding: 16px 14px 14px; }
  .recap-row .rname { width: 110px; }
  .recap-head { flex-direction: column; gap: 8px; }
  .recap-hours { text-align: left; }

  .view-head-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .tl-toolbar { flex-wrap: wrap; }
  .tl-toolbar-hint { display: none; }
  .tl-hours, .tl-heads-spacer { width: 42px; }
  .tl-form, .fb-pop { width: min(260px, 78vw); left: 12% !important; }

  .fbd-sheet { max-width: none; border-radius: 14px; }
  #fb-detail { padding: 4vh 12px 30px; }
  .fbd-time { font-size: 24px; }

  .focus-task { font-size: 23px; max-width: 88vw; }
  .focus-task-input { width: 88vw; font-size: 23px; }
  .focus-ring-wrap { width: min(300px, 78vw); height: min(300px, 78vw); }
  .focus-timer { font-size: min(62px, 17vw); }
  .focus-controls { margin-top: 32px; }
  .focus-btn { padding: 12px 24px; }
  .focus-hints { display: none; }

  #palette { width: min(520px, 92vw); }
  .habit-pop { width: min(262px, 90vw); }
  .jar-grid { grid-template-columns: 1fr; }
  #toasts { left: 12px; right: 12px; transform: none; }
  .toast { width: 100%; }
  .toast-text { max-width: none; }
}

@media (max-width: 380px) {
  .hero-num { font-size: 27px; }
  .hero-num.hero-num-day { font-size: 19px; }
  #hero-spark { display: none; }
}

@media (max-width: 320px) {
  #instant-focus .if-label { display: none; }
}

/* visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============ LIVE TIMER CHIP (background focus, Toggl-style) ============ */

#live-chip {
  display: flex;
  align-items: center;
  margin-bottom: 2px;
  gap: 8px;
  background: var(--gold-dim);
  border: 1px solid rgba(226, 179, 78, 0.35);
  border-radius: 20px;
  padding: 6px 8px 6px 13px;
  cursor: pointer;
  max-width: 320px;
  transition: all 0.15s;
}
#live-chip:hover { border-color: rgba(226, 179, 78, 0.6); background: rgba(226, 179, 78, 0.2); }
.lc-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--quest-color, var(--gold));
  animation: lcPulse 1.6s ease-in-out infinite;
  flex: none;
}
@keyframes lcPulse { 50% { opacity: 0.35; } }
.lc-title {
  font-size: 12.5px; font-weight: 600;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 160px;
}
.lc-time { font-size: 12.5px; font-weight: 700; color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.lc-stop {
  display: grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  color: var(--muted);
  font-size: 9px;
  transition: all 0.15s;
}
.lc-stop:hover { background: rgba(217, 108, 90, 0.18); color: var(--red); }

/* live growing block on the timeline */
.tl-block.live {
  pointer-events: none;
  border-left-style: solid;
  box-shadow: 0 0 0 1px rgba(226, 179, 78, 0.25);
  animation: liveGlow 2s ease-in-out infinite;
  z-index: 6;
}
@keyframes liveGlow { 50% { box-shadow: 0 0 16px rgba(226, 179, 78, 0.35); } }

/* recording state on task rows */
.task-focus-btn.rec { color: var(--gold-bright); animation: lcPulse 1.6s ease-in-out infinite; }

/* ============ TASK EDITING & UNDO ============ */

.task-del {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--faint);
  font-size: 11px;
  opacity: 0;
  transition: all 0.15s;
}
.task-row:hover .task-del { opacity: 1; }
.task-del:hover { color: var(--red); background: rgba(217, 108, 90, 0.1); }

.title-edit {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
}

.toast { pointer-events: auto; }
.toast-undo {
  margin-left: 8px;
  padding: 3px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  transition: all 0.15s;
}
.toast-undo:hover { background: var(--gold-dim); border-color: rgba(226, 179, 78, 0.4); }

/* ============ WEEK RECAP (Quests) ============ */

.recap-card { padding: 20px 22px 16px; margin-bottom: 18px; }
.recap-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.recap-title { font-family: var(--serif); font-size: 20px; font-weight: 550; }
.recap-sub { font-size: 12px; color: var(--faint); margin-top: 3px; }
.recap-hours {
  font-family: var(--serif);
  font-size: 30px; font-weight: 550;
  color: var(--gold-bright);
  text-align: right;
  line-height: 1;
}
.recap-hours span {
  display: block;
  font-family: var(--sans);
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--faint);
  margin-top: 4px;
}
.honesty-bar { height: 10px; border-radius: 5px; background: rgba(255, 246, 226, 0.07); overflow: hidden; }
.hb-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  border-radius: 5px;
  transition: width 0.6s var(--ease);
}
.honesty-label { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.honesty-label b { color: var(--gold-bright); }
.recap-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px; }
.recap-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.recap-row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.recap-row .rname { width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recap-row .rbar { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 246, 226, 0.05); overflow: hidden; }
.recap-row .rbar i { display: block; height: 100%; border-radius: 3px; }
.recap-row .rh { width: 46px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.recap-foot { display: flex; gap: 18px; font-size: 12px; color: var(--faint); }
.recap-foot .up { color: var(--green); }
.recap-foot .down { color: var(--red); }

/* ============ QUEST DETAIL ============ */

.qd-back { font-size: 12px; color: var(--faint); padding: 5px 0; margin-bottom: 10px; transition: color 0.15s; }
.qd-back:hover { color: var(--gold); }

.qd-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.qd-head-main { min-width: 0; }
.qd-parent { font-size: 11px; color: var(--quest-color, var(--faint)); padding: 2px 0 4px; opacity: 0.8; }
.qd-parent:hover { opacity: 1; text-decoration: underline; }
.qd-name { color: var(--quest-color); margin-bottom: 8px; }
.qd-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.qd-edit { cursor: pointer; }
.qd-edit:hover { color: var(--text); border-color: var(--line-strong); }
.qd-hours {
  font-family: var(--serif);
  font-size: 40px; font-weight: 550;
  color: var(--quest-color);
  line-height: 1; text-align: right; white-space: nowrap;
}
.qd-hours .u { font-size: 22px; font-style: italic; opacity: 0.7; }
.qd-hours-sub {
  display: block; font-family: var(--sans); font-size: 10.5px; font-weight: 400;
  color: var(--faint); margin-top: 6px;
}

.qd-level { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; }

.qd-section {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--faint);
  margin: 26px 0 10px;
}

.qd-block { padding: 14px 16px 10px; margin-top: 20px; }
.qd-block-title { font-size: 11px; color: var(--faint); margin-bottom: 4px; }

.qd-subs { display: flex; flex-direction: column; gap: 6px; }
.qd-sub-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--quest-color);
  border-radius: 10px;
  text-align: left;
  transition: border-color 0.15s, transform 0.12s;
}
.qd-sub-row:hover { border-color: var(--line-strong); transform: translateX(2px); }
.qd-sub-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--quest-color); flex: none; }
.qd-sub-name { flex: 1; font-size: 13.5px; }
.qd-sub-lvl { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.07em; }
.qd-sub-hours { font-size: 12.5px; color: var(--quest-color); font-variant-numeric: tabular-nums; }
.qd-add-sub { align-self: flex-start; margin-top: 4px; }

.qd-manual { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.qd-manual input[type="text"] { font-size: 14px; }
.qd-manual-row { display: flex; align-items: center; gap: 8px; }
.qd-manual-row input[type="date"] { color-scheme: dark; font-size: 12.5px; }
.qd-manual-row input[type="number"] { width: 78px; font-size: 12.5px; }
.qm-unit { font-size: 12px; color: var(--faint); margin-right: auto; }

.qd-done { display: flex; flex-direction: column; gap: 5px; }
.qd-done-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: rgba(26, 23, 18, 0.5);
  border: 1px solid var(--line);
  border-left: 3px solid var(--quest-color);
  border-radius: 9px;
  font-size: 13px;
}
.qd-check { color: var(--quest-color); font-size: 11px; }
.qd-done-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qd-done-sub {
  font-size: 10px; color: var(--quest-color);
  border: 1px solid color-mix(in srgb, var(--quest-color) 35%, transparent);
  border-radius: 4px; padding: 2px 6px;
}
.qd-done-time { font-size: 11.5px; color: var(--gold); font-variant-numeric: tabular-nums; }

/* sub-quest chips on the overview card */
.quest-subs { display: flex; flex-wrap: wrap; gap: 5px; margin: 12px 0 4px; }
.sub-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 12px;
  color: var(--quest-color);
  background: color-mix(in srgb, var(--quest-color) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--quest-color) 26%, transparent);
  cursor: pointer;
  transition: background 0.15s;
}
.sub-chip:hover { background: color-mix(in srgb, var(--quest-color) 24%, transparent); }
.sub-chip .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--quest-color); }
.sub-chip b { font-variant-numeric: tabular-nums; opacity: 0.75; }

.quest-card { cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.quest-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }

/* ============ FOCUS MODE: BLOCK TASK LIST ============ */

.focus-block-list { margin-top: 34px; width: min(440px, 84vw); display: flex; flex-direction: column; gap: 7px; }
.fbl-head {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--faint); text-align: center; margin-bottom: 4px;
}
.fbl-list { display: flex; flex-direction: column; gap: 5px; }
.fbl-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 246, 226, 0.07);
  border-left: 3px solid var(--quest-color, var(--line-strong));
  border-radius: 9px;
  font-size: 13px;
  color: var(--muted);
  text-align: left;
  transition: all 0.16s var(--ease);
}
.fbl-item:hover { border-color: var(--line-strong); color: var(--text); }
.fbl-item.current { background: rgba(226, 179, 78, 0.06); color: var(--text); }
.fbl-item.done { opacity: 0.42; }
.fbl-item.done .fbl-title { text-decoration: line-through; }
.fbl-check {
  width: 17px; height: 17px; flex: none;
  display: grid; place-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
  font-size: 10px;
  color: #17120a;
}
.fbl-item.done .fbl-check { background: var(--quest-color, var(--gold)); border-color: var(--quest-color, var(--gold)); }
.fbl-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbl-now { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold); }

/* ============ FOCUS HEATMAP ============ */

.heat-card { padding: 17px 20px 14px; margin-bottom: 18px; }
.heat-card.compact { padding: 12px 15px 10px; margin-bottom: 16px; }
.heat-card.compact .heat-title { font-size: 13.5px; }
.heat-card.compact .heat-head { margin-bottom: 8px; }
.heat-card.compact .heat-foot { margin-top: 7px; font-size: 10.5px; }
.heat-card.compact .heat-chart svg { min-width: 400px; }
.heat-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.heat-title { font-family: var(--serif); font-size: 16px; font-weight: 550; }
.heat-sub { font-size: 11.5px; color: var(--faint); margin-left: auto; text-align: right; }

.heat-chart { overflow-x: auto; }
.heat-chart svg { display: block; min-width: 460px; }
.heat-chart rect { transition: fill 0.2s; }

.heat-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--faint);
}
.heat-legend { display: flex; align-items: center; gap: 4px; }
.heat-legend i { width: 11px; height: 11px; border-radius: 2.5px; display: inline-block; }

/* ============ DAY-LOG NAVIGATION ============ */

.view-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tl-nav { display: flex; align-items: center; gap: 6px; }
.tl-nav-btn {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
  font-size: 15px;
  transition: all 0.15s;
}
.tl-nav-btn:hover { color: var(--gold); border-color: rgba(226, 179, 78, 0.4); }
.tl-nav-date {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  min-width: 92px;
  text-align: center;
}

/* ============ FOCUS BLOCK - FULL VIEW ============ */

#fb-detail {
  position: fixed; inset: 0;
  z-index: 550;
  background: rgba(8, 7, 5, 0.66);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 8vh 20px 40px;
  overflow-y: auto;
  animation: fadeIn 0.14s;
}
.fbd-sheet {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: paletteIn 0.2s var(--ease);
}
.fbd-top {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(226, 179, 78, 0.07), transparent);
  position: relative;
}
.fbd-label {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--gold);
}
.fbd-time {
  font-family: var(--serif);
  font-size: 30px; font-weight: 500;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.fbd-time small { font-size: 16px; font-style: italic; color: var(--muted); margin-left: 8px; }
.fbd-close {
  position: absolute; top: 16px; right: 16px;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--faint);
  font-size: 13px;
  transition: all 0.15s;
}
.fbd-close:hover { color: var(--text); background: rgba(255, 246, 226, 0.07); }

.fbd-progress { margin-top: 16px; }
.fbd-bar { height: 8px; border-radius: 4px; background: rgba(255, 246, 226, 0.06); overflow: hidden; }
.fbd-bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  border-radius: 4px;
  transition: width 0.5s var(--ease);
}
.fbd-progress-label { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.fbd-progress-label b { color: var(--gold-bright); }

.fbd-body { padding: 18px 24px 22px; }
.fbd-section {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--faint);
  margin: 0 0 10px;
}
.fbd-section + .fbd-section, .fbd-list + .fbd-section { margin-top: 22px; }

.fbd-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 22px; }
.fbd-controls input[type="time"] {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  padding: 6px 9px;
  color-scheme: dark;
}
.fbd-dur { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.fbd-chip {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
  color: var(--muted);
  transition: all 0.15s;
}
.fbd-chip:hover { color: var(--text); border-color: var(--line-strong); }
.fbd-chip.on { background: var(--gold-dim); border-color: rgba(226, 179, 78, 0.45); color: var(--gold-bright); font-weight: 600; }
.fbd-step {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 14px;
  transition: all 0.15s;
}
.fbd-step:hover { color: var(--gold); border-color: rgba(226, 179, 78, 0.4); }

.fbd-list { display: flex; flex-direction: column; gap: 5px; }
.fbd-task {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-left: 3px solid var(--quest-color, var(--line-strong));
  border-radius: 9px;
  transition: border-color 0.15s;
}
.fbd-task.unpacked { background: none; border-left-style: dashed; }
.fbd-task .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--quest-color, var(--faint)); flex: none; }
.fbd-task-title { flex: 1; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbd-task.done .fbd-task-title { text-decoration: line-through; color: var(--faint); }
.fbd-task-time { font-size: 11.5px; color: var(--gold); font-variant-numeric: tabular-nums; }
.fbd-icon-btn {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  color: var(--faint);
  font-size: 11px;
  transition: all 0.15s;
}
.fbd-icon-btn:hover { color: var(--gold-bright); background: var(--gold-dim); }
.fbd-icon-btn.rm:hover { color: var(--red); background: rgba(217, 108, 90, 0.1); }

.fbd-add-row { display: flex; gap: 8px; margin-top: 10px; }
.fbd-add-row input { flex: 1; font-size: 13px; }

.fbd-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--bg-raise);
}
.fbd-foot .spacer { flex: 1; }

/* ============ QUEST MANAGEMENT ============ */

.quest-edit {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--faint);
  font-size: 12px;
  opacity: 0;
  transition: all 0.15s;
}
.quest-card:hover .quest-edit { opacity: 1; }
.quest-edit:hover { color: var(--text); background: rgba(255, 246, 226, 0.07); }

.form-btn.ghost.danger:hover { color: var(--red); background: rgba(217, 108, 90, 0.08); }

.archived-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 6px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.archived-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--quest-color); opacity: 0.6; flex: none; }
.aq-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aq-hours { font-variant-numeric: tabular-nums; color: var(--faint); }

/* ============ DEADLINES ============ */

.chip.deadline { font-variant-numeric: tabular-nums; }
.chip.deadline.ok { color: var(--muted); }
.chip.deadline.soon { color: var(--gold-bright); border-color: rgba(226, 179, 78, 0.4); background: var(--gold-dim); }
.chip.deadline.over { color: var(--red); border-color: rgba(217, 108, 90, 0.35); background: rgba(217, 108, 90, 0.08); }

.qf-deadline-row { gap: 10px; align-items: center; }
.qf-deadline-row label { font-size: 12.5px; color: var(--muted); }
.qf-deadline-row input[type="date"] { color-scheme: dark; font-size: 12.5px; }

/* ============ WEEKLY GOALS IN TODAY ============ */

.wg-card { padding: 14px 16px 12px; margin-bottom: 18px; }
.wg-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 9px; }
.wg-title {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--faint);
}
.wg-score { margin-left: auto; font-size: 11px; color: var(--gold); font-variant-numeric: tabular-nums; }
.wg-list { display: flex; flex-direction: column; gap: 5px; }
.wg-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--quest-color, var(--line-strong));
  border-radius: 9px;
  background: var(--bg-raise);
  font-size: 13.5px;
  color: var(--text);
  text-align: left;
  transition: all 0.15s;
}
.wg-item:hover { border-color: var(--line-strong); }
.wg-item.done { opacity: 0.5; }
.wg-item.done .wg-text { text-decoration: line-through; }
.wg-check {
  width: 17px; height: 17px; flex: none;
  display: grid; place-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
  font-size: 10px;
  color: #17120a;
}
.wg-item.done .wg-check { background: var(--quest-color, var(--gold)); border-color: var(--quest-color, var(--gold)); }
.wg-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-quest { font-size: 10px; color: var(--quest-color); white-space: nowrap; }

/* ============ WEEKLY REVIEW ============ */

#review-overlay {
  position: fixed; inset: 0;
  z-index: 880;
  background: rgba(8, 7, 5, 0.72);
  backdrop-filter: blur(5px);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 6vh 20px 40px;
  overflow-y: auto;
  animation: fadeIn 0.2s;
}
#review-overlay.leaving { animation: fadeOutRv 0.36s var(--ease) forwards; }
@keyframes fadeOutRv { to { opacity: 0; transform: scale(0.99); } }

.rv-sheet {
  width: 100%; max-width: 620px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.7);
  animation: paletteIn 0.24s var(--ease);
}
.rv-body { padding: 26px 28px 22px; }

.rv-top { margin-bottom: 20px; }
.rv-eyebrow {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--faint);
  margin-bottom: 8px;
}
.rv-title { font-family: var(--serif); font-size: 25px; font-weight: 550; line-height: 1.25; }
.rv-lede { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

.rv-stats { display: flex; gap: 10px; margin-bottom: 8px; }
.rv-stat {
  flex: 1;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 12px 10px;
}
.rv-stat b {
  display: block;
  font-family: var(--serif);
  font-size: 25px; font-weight: 550;
  color: var(--gold-bright);
  line-height: 1.1;
}
.rv-stat span {
  display: block;
  font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--faint);
  margin-top: 3px;
}
.rv-stat i { display: block; font-size: 10.5px; font-style: normal; margin-top: 5px; }
.rv-stat i.up { color: var(--green); }
.rv-stat i.down { color: var(--red); }

.rv-section {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--faint);
  margin: 22px 0 9px;
}

.rv-habits { display: flex; flex-direction: column; gap: 5px; }
.rv-habit {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
}
.rv-habit-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-week { display: flex; gap: 3px; }
.rv-week i { width: 12px; height: 12px; border-radius: 3px; background: rgba(255, 246, 226, 0.06); }
.rv-week i.on { background: var(--gold); }
.rv-week i.future { background: transparent; border: 1px dashed rgba(255, 246, 226, 0.08); }
.rv-habit-hit { font-size: 11.5px; font-variant-numeric: tabular-nums; width: 30px; text-align: right; }
.rv-habit-hit.good { color: var(--green); }
.rv-habit-hit.mid { color: var(--gold); }
.rv-habit-hit.low { color: var(--faint); }

.rv-goals-review { display: flex; flex-direction: column; gap: 5px; }
.rv-goal-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.rv-goal-row.hit { border-color: rgba(143, 181, 115, 0.3); background: rgba(143, 181, 115, 0.06); }
.rv-goal-row.miss { opacity: 0.75; }
.rv-goal-mark { width: 16px; text-align: center; }
.rv-goal-row.hit .rv-goal-mark { color: var(--green); }
.rv-goal-row.miss .rv-goal-mark { color: var(--red); }
.rv-goal-text { flex: 1; }
.rv-goal-quest { font-size: 10px; color: var(--quest-color); }
.rv-goal-score { font-size: 11.5px; color: var(--muted); margin-top: 6px; text-align: right; }

.rv-causes { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.rv-cause {
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-raise);
  transition: all 0.15s;
}
.rv-cause b { display: block; font-size: 13.5px; color: var(--text); margin-bottom: 3px; }
.rv-cause span { font-size: 12px; color: var(--faint); line-height: 1.45; }
.rv-cause:hover { border-color: var(--line-strong); }
.rv-cause.on { border-color: rgba(226, 179, 78, 0.5); background: var(--gold-dim); }
.rv-cause.on b { color: var(--gold-bright); }

.rv-textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.55;
  padding: 11px 12px;
  resize: vertical;
}
.rv-textarea.big { font-family: var(--serif); font-size: 17px; }

.rv-goal-inputs { display: flex; flex-direction: column; gap: 9px; }
.rv-goal-input { display: flex; align-items: center; gap: 9px; }
.rv-goal-n {
  width: 22px; height: 22px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-size: 11px;
  color: var(--faint);
}
.rv-goal-text-in { flex: 1; font-size: 13.5px; }
.rv-goal-quest-in { width: 130px; font-size: 12px; }

.rv-nav { display: flex; align-items: center; gap: 10px; margin-top: 24px; }
.rv-dots { display: flex; gap: 5px; margin-right: auto; }
.rv-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255, 246, 226, 0.12);
  transition: background 0.2s;
}
.rv-dot.past { background: rgba(226, 179, 78, 0.4); }
.rv-dot.on { background: var(--gold-bright); }

@media (max-width: 720px) {
  .rv-body { padding: 20px 16px 18px; }
  .rv-stats { flex-direction: column; }
  .rv-goal-input { flex-wrap: wrap; }
  .rv-goal-quest-in { width: 100%; }
  .rv-nav { flex-wrap: wrap; }
}

/* ============ METRICS ============ */

.qd-metrics { display: flex; flex-direction: column; gap: 7px; }

.metric-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--quest-color);
  border-radius: 10px;
  padding: 11px 13px 10px;
}
.metric-row.reached { background: color-mix(in srgb, var(--quest-color) 7%, var(--panel)); }

.metric-top { display: flex; align-items: baseline; gap: 9px; margin-bottom: 8px; }
.metric-name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric-auto {
  font-size: 8.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 5px;
  flex: none;
}
.metric-val {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--quest-color);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.metric-sep { color: var(--faint); }
.metric-unit { color: var(--faint); font-size: 11px; }
.metric-row.reached .metric-val { font-weight: 700; }

.metric-btns { display: flex; gap: 4px; flex: none; }
.metric-btn {
  min-width: 26px; height: 24px;
  padding: 0 7px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11px;
  color: var(--muted);
  transition: all 0.15s;
}
.metric-btn:hover { border-color: var(--quest-color); color: var(--quest-color); }
.metric-btn.plus { font-weight: 700; }

.metric-del {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 5px;
  color: var(--faint);
  font-size: 10px;
  opacity: 0;
  flex: none;
  transition: all 0.15s;
}
.metric-row:hover .metric-del { opacity: 1; }
.metric-del:hover { color: var(--red); background: rgba(217, 108, 90, 0.1); }

.metric-bar { height: 5px; border-radius: 3px; background: rgba(255, 246, 226, 0.06); overflow: hidden; }
.metric-bar i {
  display: block; height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--quest-color) 55%, transparent), var(--quest-color));
  transform-origin: left;
  animation: growX 520ms var(--ease) both;
}

.metric-form { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.metric-form input[type="text"] { font-size: 14px; }
.metric-form-row { display: flex; align-items: center; gap: 8px; }
.metric-form-row label { font-size: 12.5px; color: var(--muted); }
.metric-form-row input[type="number"] { width: 84px; font-size: 12.5px; }
.metric-form-row input[type="text"] { flex: 1; font-size: 12.5px; }
.pill-toggle button:disabled { opacity: 0.35; cursor: not-allowed; }

/* quest picker next to a quick-add field */
.quick-quest {
  font-size: 11.5px;
  padding: 6px 7px;
  max-width: 100%;
}
.tray-add-row { display: flex; flex-direction: column; gap: 6px; }
.fbd-add-row .quick-quest { width: 100%; }
.fbd-add-row { flex-wrap: wrap; }

/* ============ TICKING OFF INSIDE THE DAY LOG ============ */

.tray-check, .fbd-check {
  width: 17px; height: 17px;
  flex: none;
  display: grid; place-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
  font-size: 10px;
  color: transparent;
  transition: all 0.18s var(--ease);
}
.tray-check:hover, .fbd-check:hover { border-color: var(--quest-color, var(--gold)); transform: scale(1.1); }
.tray-check.done, .fbd-check.done {
  background: var(--quest-color, var(--gold));
  border-color: var(--quest-color, var(--gold));
  color: #17120a;
}
.tray-check.done.flash, .fbd-check.done.flash { animation: checkSpring 0.36s var(--ease); }

.tray-item.is-done { opacity: 0.45; }
.tray-item.is-done .tray-item-title { text-decoration: line-through; }

/* the quest picker sitting on the row itself */
.tray-quest {
  width: 20px; height: 20px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 5px;
  transition: background 0.15s;
}
.tray-quest:hover { background: rgba(255, 246, 226, 0.07); }
.tray-quest .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--quest-color, transparent);
}
.tray-quest.none .dot { border: 1px dashed var(--line-strong); background: transparent; }

.fbd-quest {
  display: inline-flex; align-items: center; gap: 5px;
  flex: none;
  max-width: 40%;
  font-size: 10.5px;
  color: var(--quest-color, var(--faint));
  background: color-mix(in srgb, var(--quest-color, #6f6656) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--quest-color, #6f6656) 26%, transparent);
  border-radius: 12px;
  padding: 3px 8px;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  transition: background 0.15s;
}
.fbd-quest:hover { background: color-mix(in srgb, var(--quest-color, #6f6656) 24%, transparent); }
.fbd-quest.none { color: var(--faint); background: none; border-style: dashed; }
.fbd-quest .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--quest-color, var(--faint)); flex: none; }

/* ============ POMODORO RHYTHM ============ */

.pomo-presets {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap; justify-content: center;
  margin-top: 12px;
}
.pomo-chip {
  font-size: 11px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px 11px;
  font-variant-numeric: tabular-nums;
  transition: all 0.15s;
}
.pomo-chip:hover { color: var(--muted); border-color: var(--line-strong); }
.pomo-chip.on { color: var(--gold-bright); border-color: rgba(226, 179, 78, 0.45); background: var(--gold-dim); }
.pomo-chip.apply { color: var(--gold); border-color: rgba(226, 179, 78, 0.35); }

.pomo-custom-fields { display: inline-flex; align-items: center; gap: 5px; color: var(--faint); font-size: 11px; }
.pomo-custom-fields input {
  width: 52px;
  font-size: 11.5px;
  padding: 4px 6px;
  text-align: center;
}

/* ============ SOMEDAY ============ */

.someday-add {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 10px 6px 16px; margin-bottom: 10px;
}
.someday-add input#someday-input { min-width: 180px; }
.someday-date { color-scheme: dark; font-size: 11.5px; padding: 5px 7px; }
.someday-add .plus { color: var(--gold); font-size: 18px; font-weight: 300; }
.someday-add input { flex: 1; background: none; border: none; font-size: 14px; padding: 11px 0; }
.someday-bucket { flex: none; }
.someday-bucket button { font-size: 11px; padding: 4px 10px; }

/* the Someday supply inside the day log tray */
.tray-pool-head {
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--faint);
  margin-top: 4px;
}
.tray-pool { display: flex; flex-direction: column; gap: 5px; max-height: 170px; overflow-y: auto; }
.tray-item.from-pool {
  border-left-style: dotted;
  background: rgba(26, 23, 18, 0.45);
  cursor: grab;
}
.tray-pull {
  width: 20px; height: 20px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 5px;
  color: var(--faint);
  font-size: 13px;
  transition: all 0.15s;
}
.tray-item.from-pool:hover .tray-pull { color: var(--gold); }
.tray-pull:hover { background: var(--gold-dim); color: var(--gold-bright) !important; }

/* ============ DAY TOTAL + MERGED SITTINGS ============ */

.tl-day-total {
  margin-left: 12px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: default;
}
.tl-day-total.has-quest { color: var(--gold-bright); border-color: rgba(226, 179, 78, 0.35); background: var(--gold-dim); }
.tl-day-total-label {
  margin-left: 5px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
}
.tl-day-total.has-quest .tl-day-total-label { color: rgba(226, 179, 78, 0.65); }

.tl-merged-note { color: var(--faint); font-size: 9.5px; margin-left: 4px; }

.tl-offgrid {
  margin-left: 8px;
  font-size: 10.5px;
  color: var(--faint);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 3px 8px;
  white-space: nowrap;
  cursor: default;
}

/* ============ WEEKLY GOALS: EDIT ============ */

.wg-item { cursor: default; }
.wg-text { cursor: text; }
.wg-text:hover { color: var(--gold-bright); }
.wg-edit { flex: 1; font-size: 13.5px; padding: 4px 8px; border-radius: 6px; }
.wg-empty { padding: 10px 4px; font-size: 12.5px; }
.wg-quest-btn {
  display: inline-flex; align-items: center; gap: 5px;
  flex: none;
  font-size: 10px;
  color: var(--quest-color, var(--faint));
  border: 1px solid color-mix(in srgb, var(--quest-color, #6f6656) 26%, transparent);
  border-radius: 11px;
  padding: 2px 8px;
  white-space: nowrap;
  transition: background 0.15s;
}
.wg-quest-btn:hover { background: color-mix(in srgb, var(--quest-color, #6f6656) 20%, transparent); }
.wg-quest-btn.none { border-style: dashed; }
.wg-quest-btn .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--quest-color, var(--faint)); }
.wg-del {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 5px;
  color: var(--faint);
  font-size: 10px;
  opacity: 0;
  transition: all 0.15s;
}
.wg-item:hover .wg-del { opacity: 1; }
.wg-del:hover { color: var(--red); background: rgba(217, 108, 90, 0.1); }
.wg-add { display: flex; align-items: center; gap: 9px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.wg-add .plus { color: var(--gold); font-size: 15px; }
.wg-add input { flex: 1; background: none; border: none; font-size: 13px; padding: 4px 0; }

/* ============ REVIEW HISTORY ============ */

.rvh-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.rvh-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid rgba(226, 179, 78, 0.3);
  border-radius: 10px;
  padding: 11px 13px;
  animation: rowRise 260ms var(--ease) both;
}
.rvh-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rvh-week { font-family: var(--serif); font-size: 14px; font-weight: 550; }
.rvh-stats { margin-left: auto; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.rvh-line { font-size: 12.5px; color: var(--muted); margin-top: 7px; line-height: 1.5; }
.rvh-line b { color: var(--faint); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; }
.rvh-line.correction { color: var(--gold-bright); }

/* ============ DEEP WORK DIALOG ============ */

.dw-box { max-width: 420px; }
.dw-row { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.dw-row label { font-size: 13px; color: var(--muted); }
.dw-row input { width: 86px; font-size: 14px; text-align: center; }
.dw-unit { font-size: 12.5px; color: var(--faint); }

.dw-lists { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.dw-check {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-raise);
  cursor: pointer;
  transition: border-color 0.15s;
}
.dw-check:hover { border-color: var(--line-strong); }
.dw-check input { accent-color: var(--gold); width: 15px; height: 15px; margin: 0; flex: none; }
.dw-check span { display: flex; flex-direction: column; gap: 1px; }
.dw-check b { font-size: 13px; font-weight: 500; color: var(--text); }
.dw-check i { font-size: 11px; font-style: normal; color: var(--faint); }
.dw-check:has(input:checked) { border-color: rgba(226, 179, 78, 0.45); background: var(--gold-dim); }

.dw-actions { align-items: center; }
.dw-never {
  display: flex; align-items: center; gap: 6px;
  margin-right: auto;
  font-size: 11px;
  color: var(--faint);
  cursor: pointer;
}
.dw-never input { accent-color: var(--gold); width: 13px; height: 13px; margin: 0; }

.rvh-goals { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.rvh-goal {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 7px;
  border-left: 2px solid var(--quest-color, var(--line-strong));
  background: rgba(255, 246, 226, 0.03);
}
.rvh-goal.hit { color: var(--green); }
.rvh-goal.miss { color: var(--faint); }

.dw-keys {
  display: flex; gap: 16px; justify-content: center;
  margin: 4px 0 14px;
  font-size: 11px;
  color: var(--faint);
}
.dw-box:focus { outline: none; }
