:root {
  --bg: #0a0b0e;
  --surface: #131519;
  --surface-2: #1b1e24;
  --surface-3: #23272e;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef0f3;
  --muted: #8b909b;
  --faint: #5c616b;
  --accent: #57c9a6;
  --accent-2: #4aa8d8;
  --accent-soft: rgba(87, 201, 166, 0.14);
  --gold: #e2b45a;
  --danger: #ef6f66;
  --ok: #57c9a6;
  --warn: #e2b45a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --ease: cubic-bezier(0.22, 0.8, 0.26, 0.99);
  --spring: cubic-bezier(0.34, 1.4, 0.44, 1);
}
* { box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100%;
  font: 14px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.006em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.layout { display: flex; gap: 14px; padding: 14px; min-height: 100vh; min-height: 100dvh; }

button, a, input, select, textarea, label { touch-action: manipulation; }
body { -webkit-tap-highlight-color: transparent; }
::selection { background: rgba(87, 201, 166, 0.28); }

/* inline icons */
.ic { width: 14px; height: 14px; vertical-align: -2px; display: inline-block; flex-shrink: 0; }
.ic-lg { width: 18px; height: 18px; vertical-align: -3px; }
.q-icon .ic, .q-icon { width: 17px; height: 17px; color: var(--muted); }
.quest.done .q-icon { color: var(--ok); }
.o-emoji .ic { width: 20px; height: 20px; color: var(--muted); }
.pill .ic { width: 11px; height: 11px; vertical-align: -1.5px; }
.streak-chip .ic { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- entry animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
  to { opacity: 1; transform: none; }
}
.sidebar, .capture-bar, .panel { animation: panelIn 0.5s var(--ease) backwards; }
.capture-bar { animation-delay: 0.05s; }
.panel { animation-delay: 0.1s; }

#view.view-enter > * { animation: fadeUp 0.4s var(--ease) backwards; }
#view.view-enter > *:nth-child(1) { animation-delay: 0.02s; }
#view.view-enter > *:nth-child(2) { animation-delay: 0.05s; }
#view.view-enter > *:nth-child(3) { animation-delay: 0.08s; }
#view.view-enter > *:nth-child(4) { animation-delay: 0.11s; }
#view.view-enter > *:nth-child(5) { animation-delay: 0.14s; }
#view.view-enter > *:nth-child(6) { animation-delay: 0.17s; }
#view.view-enter > *:nth-child(7) { animation-delay: 0.2s; }
#view.view-enter > *:nth-child(8) { animation-delay: 0.23s; }
#view.view-enter > *:nth-child(9) { animation-delay: 0.26s; }
#view.view-enter > *:nth-child(10) { animation-delay: 0.29s; }
#view.view-enter > *:nth-child(n+11) { animation-delay: 0.32s; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 208px; flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 10px 12px;
  display: flex; flex-direction: column; gap: 1px;
  position: sticky; top: 14px;
  height: calc(100vh - 28px);
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 14.5px;
  padding: 2px 8px 16px;
}
.brand-badge {
  width: 26px; height: 26px; flex-shrink: 0;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #06231c;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-badge svg { width: 14px; height: 14px; }
.sidebar-spacer { flex: 1; }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  text-align: left; background: none; border: none;
  color: var(--muted); font-size: 14px; font-family: inherit;
  padding: 8px 10px; border-radius: 9px; cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.nav-btn svg {
  width: 17px; height: 17px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
  transition: color 0.18s var(--ease), transform 0.25s var(--spring);
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.045); color: var(--text); }
.nav-btn:active { transform: scale(0.97); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-btn.active svg { color: var(--accent); }
.badge {
  background: var(--accent); color: #06231c; border-radius: 10px;
  font-size: 11px; font-weight: 700; padding: 1px 7px; margin-left: auto;
  animation: fadeUp 0.3s var(--ease);
}
.badge:empty { display: none; }

/* ---------- main column ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.capture-bar {
  display: flex; gap: 10px; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px 8px 6px 16px;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.capture-bar:focus-within {
  border-color: rgba(87, 201, 166, 0.5);
  box-shadow: 0 0 0 4px rgba(87, 201, 166, 0.12);
}
.capture-icon {
  width: 16px; height: 16px; flex-shrink: 0;
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
  transition: stroke 0.2s, transform 0.3s var(--spring);
}
.capture-bar:focus-within .capture-icon { stroke: var(--accent); transform: rotate(90deg); }
.capture-bar input {
  flex: 1; background: none; border: none; color: var(--text);
  padding: 9px 2px; font-size: 15px; font-family: inherit; outline: none;
}
.capture-bar input::placeholder { color: var(--muted); }
#micBtn {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
  width: 38px; height: 38px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.2s var(--spring), background 0.2s;
}
#micBtn:hover { transform: scale(1.06); background: var(--surface-3); }
#micBtn:active { transform: scale(0.92); }
#micBtn svg {
  width: 17px; height: 17px; fill: none; stroke: var(--text);
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 111, 102, 0.5); }
  60% { box-shadow: 0 0 0 9px rgba(239, 111, 102, 0); }
}
#micBtn.recording { background: var(--danger); border-color: var(--danger); animation: micPulse 1.4s ease-out infinite; }
#micBtn.recording svg { stroke: #fff; }
#captureStatus { color: var(--muted); font-size: 13px; padding-right: 8px; white-space: nowrap; animation: fadeUp 0.25s var(--ease); }
#captureStatus:empty { display: none; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 30px 44px;
  flex: 1;
}

h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.4px; margin: 0 0 2px; text-wrap: balance; }
h2 { font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 30px 0 12px; }
.eyebrow {
  display: inline-block; font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); padding: 0; margin: 0;
}
.sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  background: var(--surface-2); border-radius: 5px;
  padding: 1px 5px; font-size: 13px; color: var(--text);
}

/* ---------- brief header ---------- */
.brief-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

/* ---------- Oura-style hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 30px 24px 26px;
  margin-bottom: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(87, 201, 166, 0.30), transparent 55%),
    radial-gradient(120% 110% at 88% 12%, rgba(74, 140, 216, 0.32), transparent 55%),
    radial-gradient(140% 130% at 60% 130%, rgba(126, 96, 200, 0.28), transparent 55%),
    linear-gradient(165deg, #141a20 0%, #0e1115 100%);
}
.hero-ring { position: relative; width: 168px; height: 168px; }
.hero-ring svg { display: block; }
.hero-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.hero-num { font-size: 46px; font-weight: 700; letter-spacing: -1.5px; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-den { font-size: 12.5px; color: var(--muted); }
.hero-cap { margin-top: 7px; font-size: 10px; font-weight: 700; letter-spacing: 0.18em; color: var(--accent); }
.hero-level { width: 100%; max-width: 340px; }
.hero-level-top { font-size: 14px; margin-bottom: 8px; text-align: center; }
.hero-level-top b { font-weight: 700; }
.game-meta { font-size: 12px; color: var(--muted); margin-top: 6px; text-align: center; font-variant-numeric: tabular-nums; }
.xp-bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.xp-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.8s var(--ease);
}

.streak-chip {
  flex-shrink: 0; font-size: 13.5px; font-weight: 700;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 13px;
  font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; gap: 5px;
  opacity: 0.85;
}
.streak-chip.lit {
  opacity: 1; color: var(--gold);
  background: rgba(226, 180, 90, 0.12); border-color: rgba(226, 180, 90, 0.3);
}

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px; margin-bottom: 8px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease),
              opacity 0.25s var(--ease), background 0.25s var(--ease);
}
.card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.card .grow { flex: 1; min-width: 0; }
.card .title { font-weight: 500; overflow-wrap: break-word; transition: color 0.25s var(--ease); }
.card .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.card.done { background: transparent; }
.card.done .title { text-decoration: line-through; color: var(--muted); }
.card.removing { opacity: 0; transform: scale(0.97) translateY(-2px); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; flex-shrink: 0; }
.pill {
  display: inline-block; font-size: 12px; font-weight: 500;
  padding: 2px 9px; border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted); margin-right: 6px;
  border: 1px solid var(--border);
}
.pill.overdue { background: rgba(239, 111, 102, 0.14); color: var(--danger); border-color: transparent; }
.pill.today { background: rgba(226, 180, 90, 0.14); color: var(--warn); border-color: transparent; }

button.small {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 6px 13px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: background 0.18s var(--ease), transform 0.18s var(--spring), border-color 0.18s var(--ease);
}
button.small:hover { background: var(--surface-3); border-color: var(--border-strong); transform: translateY(-1px); }
button.small:active { transform: scale(0.94); }
button.small.primary { background: var(--accent); color: #06231c; border-color: transparent; }
button.small.primary:hover { background: #66d6b3; }
button.small.danger { color: var(--muted); }
button.small.danger:hover { background: rgba(239, 111, 102, 0.14); color: var(--danger); border-color: transparent; }

/* custom round checkbox */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 22px; height: 22px; margin-top: 1px; flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.22); border-radius: 50%;
  background: transparent; cursor: pointer;
  display: inline-grid; place-content: center;
  transition: transform 0.2s var(--spring), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
input[type="checkbox"]::before {
  content: "✓"; font-size: 13px; font-weight: 800; color: #06231c; line-height: 1;
  transform: scale(0); transition: transform 0.2s var(--spring);
}
input[type="checkbox"]:hover { border-color: var(--accent); transform: scale(1.08); }
input[type="checkbox"]:active { transform: scale(0.85); }
input[type="checkbox"]:checked { background: var(--ok); border-color: var(--ok); animation: checkPop 0.35s var(--spring); }
input[type="checkbox"]:checked::before { transform: scale(1); }
@keyframes checkPop { 0% { transform: scale(0.8); } 55% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* ---------- forms ---------- */
.form-row { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; align-items: flex-start; }
.form-row input, .form-row select, .form-row textarea,
.edit-form .edit-fields input, .edit-form .edit-fields select, .edit-form .edit-fields textarea,
details.disclosure .disclosure-body input, details.disclosure .disclosure-body select {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 9px; font-size: 14px; font-family: inherit;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.form-row input::placeholder, .form-row textarea::placeholder { color: var(--faint); }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus,
.edit-form .edit-fields input:focus, .edit-form .edit-fields select:focus, .edit-form .edit-fields textarea:focus,
details.disclosure .disclosure-body input:focus, details.disclosure .disclosure-body select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(87, 201, 166, 0.15);
}
.form-row input.wide, .form-row textarea.wide { flex: 1; min-width: 200px; }
.form-row button.small { padding: 10px 16px; }
select option { background: var(--surface-2); color: var(--text); }

.empty {
  color: var(--muted); padding: 30px 16px; text-align: center; font-size: 14px;
  border: 1.5px dashed var(--border-strong); border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

/* ---------- inline edit ---------- */
.edit-form {
  flex-direction: column; align-items: stretch; gap: 12px;
  border-color: rgba(87, 201, 166, 0.5);
  box-shadow: 0 0 0 3px rgba(87, 201, 166, 0.12);
}
.edit-form .edit-fields { margin-bottom: 0; }
.edit-form .edit-fields input.wide, .edit-form .edit-fields textarea.wide { flex: 1; min-width: 200px; }
.edit-actions { display: flex; gap: 8px; }

/* ---------- stat tiles ---------- */
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px 20px; min-width: 118px;
  transition: transform 0.25s var(--spring), border-color 0.25s var(--ease);
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }

/* ---------- ring labels (shared) ---------- */
.ring-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-variant-numeric: tabular-nums;
}
.ring-label b { font-size: 13px; }
.ring-label span { color: var(--muted); }

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 16px) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.xp-toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border-strong);
  font-size: 13.5px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 200; pointer-events: none;
  animation: toastIn 0.35s var(--spring);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.xp-toast.leaving { opacity: 0; transform: translate(-50%, 10px); }

.levelup {
  position: fixed; inset: 0; z-index: 210; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.levelup-card {
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border-strong);
  font-size: 18px; font-weight: 700; letter-spacing: -0.3px;
  padding: 18px 30px; border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.45s var(--spring);
  display: flex; align-items: center; gap: 8px;
}
.levelup-card .ic { color: var(--gold); }
@keyframes confettiFly {
  0% { opacity: 0; transform: translate(0, 0) scale(0.4); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.15) rotate(24deg); }
}
.confetti {
  position: absolute; width: 8px; height: 8px; border-radius: 2px;
  animation: confettiFly 1.5s var(--ease) forwards;
}

/* ---------- stoic quote ---------- */
.stoic {
  margin: 0 0 8px; padding: 16px 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  position: relative;
}
.stoic::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 3px; background: var(--accent);
}
.stoic blockquote { margin: 0; font-size: 15px; font-style: italic; color: var(--text); line-height: 1.55; text-wrap: pretty; }
.stoic figcaption { margin-top: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- daily quests ---------- */
.quests { display: grid; gap: 8px; margin-top: 12px; }
.quests-h { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 8px 0 2px 2px; }
.quest {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 13px 15px;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), opacity 0.3s var(--ease);
}
.quest.done { background: rgba(87, 201, 166, 0.08); border-color: rgba(87, 201, 166, 0.3); }
.q-icon { flex-shrink: 0; display: inline-flex; }
.q-label { font-size: 14px; font-weight: 600; }
.quest.done .q-label { color: var(--muted); text-decoration: line-through; }
.q-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin-top: 7px; max-width: 260px; }
.q-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.6s var(--ease); }
.quest.done .q-fill { background: var(--ok); }
.q-bonus { font-size: 12.5px; font-weight: 700; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.quest.done .q-bonus { color: var(--ok); }

/* ---------- task groups + XP bounty ---------- */
.tgroup-h {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); margin: 24px 2px 10px;
}
.tgroup-h.overdue { color: var(--danger); }
.tgroup-h.today { color: var(--warn); }
.tcount { background: var(--surface-2); border-radius: 99px; padding: 1px 8px; font-size: 11px; color: inherit; }
.xp-pill { background: rgba(226, 180, 90, 0.14); color: var(--gold); font-weight: 600; border-color: transparent; }

/* ---------- disclosures ---------- */
details.disclosure { width: 100%; }
details.disclosure summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border); padding: 7px 14px; border-radius: 999px;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
details.disclosure summary:hover { background: var(--surface-3); color: var(--text); }
details.disclosure summary::-webkit-details-marker { display: none; }
details.disclosure summary::before { content: "▸"; font-size: 11px; transition: transform 0.2s var(--ease); }
details.disclosure[open] summary::before { transform: rotate(90deg); }
details.disclosure .disclosure-body { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: flex-start; }
details.disclosure .disclosure-body input.wide { flex: 1; min-width: 200px; }
details.filters { margin-bottom: 16px; }
.badge.filter-count { position: static; }

/* ---------- integrations / oura strip ---------- */
.oura-strip {
  display: flex; align-items: center; gap: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 20px; margin-top: 12px;
  background:
    radial-gradient(120% 130% at 12% 20%, rgba(90, 200, 224, 0.16), transparent 60%),
    radial-gradient(120% 130% at 90% 80%, rgba(99, 210, 155, 0.14), transparent 60%),
    var(--surface);
}
.oura-strip .o-emoji { display: inline-flex; }
.oura-strip .o-meta { color: var(--muted); font-size: 13px; line-height: 1.5; }
.oura-strip .o-meta b { color: var(--text); }
.oura-ring { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.oura-ring .ring-wrap { position: relative; width: 52px; height: 52px; }
.oura-ring .ring-label { font-size: 13px; font-weight: 700; }
.oura-ring .o-label {
  font-size: 9.5px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
}

/* ---------- trend charts ---------- */
.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px 8px; margin-bottom: 10px;
  position: relative;
}
.chart-card h3 { font-size: 13px; font-weight: 600; margin: 0 0 4px; }
.chart-card .legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.chart-card .legend .dot { width: 8px; height: 8px; margin-right: 5px; }
.chart-card svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-band { fill: transparent; outline: none; }
.chart-band:focus-visible { fill: rgba(87, 201, 166, 0.08); }
.xhair { stroke: rgba(255, 255, 255, 0.25); stroke-width: 1; pointer-events: none; }
.chart-bar { transition: opacity 0.15s var(--ease); }
.chart-bar.lift { opacity: 0.72; }
.hm-cell { outline: none; transition: opacity 0.15s var(--ease); }
.hm-cell:hover { opacity: 0.75; }
.hm-cell:focus-visible { stroke: var(--accent); stroke-width: 1.5; }
.chart-tip {
  position: absolute; top: 0; left: 0;
  transform: translate(-50%, -100%);
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border-strong);
  font-size: 12px; line-height: 1.45;
  padding: 7px 11px; border-radius: 9px;
  box-shadow: var(--shadow-lg);
  pointer-events: none; white-space: nowrap; z-index: 5;
  opacity: 0; transition: opacity 0.15s var(--ease);
}
.chart-tip.show { opacity: 1; }
.chart-tip .t-date { color: var(--muted); font-size: 10.5px; margin-bottom: 2px; }
.chart-tip .t-row { display: flex; align-items: center; gap: 6px; }
.chart-tip .t-row span { color: var(--muted); }
.chart-tip .t-key { width: 10px; height: 2px; border-radius: 1px; display: inline-block; flex-shrink: 0; }
.chart-tip b { font-variant-numeric: tabular-nums; }
.chart-card text { fill: var(--muted); }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kanban .col {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 12px;
}
.kanban .col h3 {
  font-size: 12px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 10px 4px;
}
.kanban .card { flex-direction: column; gap: 6px; }

/* ---------- tablet: icon-only rail ---------- */
@media (min-width: 801px) and (max-width: 1080px) {
  .sidebar { width: 64px; padding: 14px 8px 10px; align-items: center; }
  .brand { padding-bottom: 14px; }
  .brand-badge + * { display: none; }
  .brand { font-size: 0; gap: 0; }
  .nav-btn { font-size: 0; gap: 0; justify-content: center; padding: 10px; position: relative; width: 44px; }
  .nav-btn svg { width: 19px; height: 19px; }
  .badge { position: absolute; top: 2px; right: 2px; margin: 0; font-size: 9px; padding: 0 5px; }
}

/* ---------- mobile ---------- */
@media (max-width: 800px) {
  .layout {
    flex-direction: column;
    padding: 10px 10px calc(88px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  /* sidebar becomes a floating bottom tab bar */
  .sidebar {
    position: fixed; left: 10px; right: 10px; top: auto;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto; height: 64px; z-index: 100;
    flex-direction: row; align-items: stretch; gap: 0;
    padding: 6px; overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none;
    background: rgba(19, 21, 25, 0.82);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-strong);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .brand, .sidebar-spacer { display: none; }
  .nav-btn {
    flex-direction: column; justify-content: center; gap: 3px;
    font-size: 9.5px; font-weight: 500; padding: 4px 11px;
    flex-shrink: 0; position: relative; border-radius: 12px;
  }
  .nav-btn.active { background: transparent; color: var(--accent); }
  .nav-btn svg { width: 21px; height: 21px; }
  .badge {
    position: absolute; top: 3px; right: 6px; margin: 0;
    font-size: 9px; padding: 0 5px;
  }

  .capture-bar { position: sticky; top: 8px; z-index: 90;
    background: rgba(19, 21, 25, 0.9);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  }

  .panel { padding: 20px 16px 30px; border-radius: 18px; }
  h1 { font-size: 22px; }

  /* hero scales down a touch */
  .hero { padding: 26px 18px 24px; }
  .hero-ring { width: 150px; height: 150px; }
  .hero-num { font-size: 40px; }

  /* stats scroll horizontally */
  .stat-row {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-left: -16px; margin-right: -16px; padding: 2px 16px 6px;
  }
  .stat-row::-webkit-scrollbar { display: none; }
  .stat { min-width: 112px; flex-shrink: 0; padding: 13px 16px; }

  button.small { padding: 9px 15px; font-size: 13.5px; }
  input[type="checkbox"] { width: 24px; height: 24px; }
  .card { padding: 14px 15px; }

  /* forms: 2-col grid */
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .form-row input, .form-row select, .form-row textarea { width: 100%; min-width: 0; font-size: 16px; padding: 11px 13px; }
  .form-row input.wide, .form-row textarea.wide, .form-row label { grid-column: 1 / -1; }
  .form-row button.small { grid-column: 1 / -1; justify-self: start; padding: 11px 22px; }

  .task-add { grid-template-columns: 1fr auto; }
  .task-add input.wide { grid-column: 1 / 2; }
  .task-add button.small { grid-column: 2 / 3; grid-row: 1; justify-self: end; margin: 0; }
  .task-add details.disclosure { grid-column: 1 / -1; }
  details.disclosure .disclosure-body { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  details.disclosure .disclosure-body input, details.disclosure .disclosure-body select { width: 100%; min-width: 0; font-size: 16px; padding: 11px 13px; }
  details.disclosure .disclosure-body input.wide { grid-column: 1 / -1; }
  details.disclosure .disclosure-body button.small { grid-column: 1 / -1; justify-self: start; }

  .q-bar { max-width: none; }
  .kanban { grid-template-columns: 1fr; }
  .xp-toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
}

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

/* ---------- Oura fidelity pass: serif editorial + vitals + pill bar ---------- */
:root { --serif: "Newsreader", "Iowan Old Style", Georgia, serif; }

.editorial { margin: 2px 0 16px; }
.e-head {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(22px, 5.5vw, 27px); line-height: 1.25;
  letter-spacing: 0.1px; text-wrap: balance;
}
.e-sub { margin: 7px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; max-width: 52ch; }

.stoic blockquote { font-family: var(--serif); font-size: 16.5px; }

/* vitals cards */
.vitals { display: grid; gap: 8px; }
.vital {
  display: flex; align-items: center; gap: 18px;
  border: 1px solid var(--border); border-radius: 14px; padding: 14px 18px;
  background: radial-gradient(130% 150% at 0% 50%, rgba(87, 201, 166, 0.10), transparent 55%), var(--surface);
}
.v-info { flex: 1; min-width: 0; }
.v-label { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.v-label .ic { width: 13px; height: 13px; }
.v-status { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.v-ok { color: var(--accent); }
.v-warn { color: var(--gold); }
.v-low { color: var(--danger); }
.v-num { font-size: 34px; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; margin-top: 3px; }
.v-range { width: 44%; max-width: 220px; flex-shrink: 0; }
.v-track { position: relative; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); }
.v-band { position: absolute; left: 70%; width: 20%; top: 0; bottom: 0; background: rgba(255, 255, 255, 0.26); border-radius: 99px; }
.v-dot {
  position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
  transition: left 0.6s var(--ease);
}
.v-ends { display: flex; justify-content: space-between; margin: 7px 0 0 70%; width: 20%; font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums; }
.v-meta { display: flex; gap: 5px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); padding: 3px 6px 0; }
.v-meta b { color: var(--text); }
.v-date { margin-left: auto; }

/* the + button lives only in the mobile tab bar */
.nav-plus { display: none; }

@media (max-width: 800px) {
  /* Oura-style floating pill */
  .sidebar {
    left: 50%; right: auto; transform: translateX(-50%);
    width: auto; max-width: calc(100vw - 20px);
    border-radius: 999px; height: 62px; padding: 6px 7px;
  }
  .nav-btn { border-radius: 999px; padding: 4px 12px; }

  .nav-plus {
    display: flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; align-self: center; flex-shrink: 0;
    margin-left: 2px; padding: 0;
    border-radius: 50%;
    background: var(--surface-3); border: 1px solid var(--border-strong);
    color: var(--text);
  }
  .nav-plus svg { width: 20px; height: 20px; stroke-width: 2; }
  .nav-plus:active { transform: scale(0.92); }

  .vital { gap: 12px; padding: 13px 15px; }
  .v-num { font-size: 30px; }
  .v-range { width: 40%; }
}

/* ---------- Craft-style alignment + controls pass ---------- */

/* stat tiles read centered, like score tiles */
.stat { text-align: center; flex: 1; }
.stat .n { line-height: 1.15; }

/* quests: label and reward share one aligned row, bar sits underneath */
.q-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.q-top .q-label { min-width: 0; }
.q-top .q-bonus { flex-shrink: 0; }

/* review cards: actions live on their own row, titles never get crushed */
.card.task-review { flex-wrap: wrap; }
.card.task-review .r-actions {
  flex-basis: 100%; display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 10px; padding-left: 34px;
}

/* selects: custom chevron, no native chrome */
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b909b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 13px;
  padding-right: 32px !important;
}

/* number/date/time inputs match select height for tidy rows */
.form-row input, .form-row select, details.disclosure .disclosure-body input, details.disclosure .disclosure-body select { min-height: 40px; }

/* vitals: keep the range labels off the card edge */
.vital { padding-right: 22px; }

/* icon-only buttons (edit / delete) stay compact and centered */
button.small.danger, button.small[data-act="edit"] { min-width: 38px; text-align: center; }

@media (max-width: 800px) {
  .card.task-review .r-actions { padding-left: 36px; }
  .card.task-review .r-actions button.small { flex: 1; max-width: 110px; }
  .form-row input, .form-row select, details.disclosure .disclosure-body input, details.disclosure .disclosure-body select { min-height: 46px; }
  .stat .n { font-size: 24px; }
}

/* ---------- Craft-style bottom dock + hidden capture (mobile) ---------- */
.nav-group { display: contents; } /* desktop: wrapper is invisible */

@media (max-width: 800px) {
  /* the fixed container becomes an invisible dock holding detached clusters */
  .sidebar {
    left: 10px; right: 10px; transform: none; max-width: none; width: auto;
    background: transparent; border: none; box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    height: auto; padding: 0; border-radius: 0;
    display: flex; align-items: center; gap: 10px;
    overflow: visible;
  }

  /* left cluster: icon-only nav pill */
  .nav-group {
    display: flex; flex: 1; min-width: 0; align-items: stretch;
    justify-content: space-between; gap: 0;
    background: rgba(19, 21, 25, 0.86);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-strong);
    border-radius: 999px; height: 56px; padding: 5px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    overflow-x: auto; scrollbar-width: none;
  }
  .nav-group::-webkit-scrollbar { display: none; }
  .nav-group .nav-btn {
    flex: 1 1 0; min-width: 40px;
    flex-direction: row; justify-content: center; align-items: center;
    font-size: 0; gap: 0; padding: 0; border-radius: 999px;
  }
  .nav-group .nav-btn svg { width: 22px; height: 22px; }
  .nav-group .nav-btn.active { background: rgba(255, 255, 255, 0.08); color: var(--accent); }
  .nav-group .badge { top: 6px; right: 4px; }

  /* right cluster: settings circle + white capture circle */
  .nav-btn[data-view="settings"] {
    order: 2; flex: 0 0 auto; width: 50px; height: 50px;
    justify-content: center; font-size: 0; gap: 0; padding: 0;
    border-radius: 50%;
    background: rgba(19, 21, 25, 0.86);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-strong);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  }
  .nav-btn[data-view="settings"] svg { width: 21px; height: 21px; }
  .nav-plus {
    order: 3; width: 54px; height: 54px; margin: 0; align-self: center;
    background: #fff; color: #0a0b0e; border: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  }
  .nav-plus svg { width: 22px; height: 22px; stroke-width: 2.4; }
  .nav-plus:active { transform: scale(0.9); }

  /* capture hidden until the + summons the quick-add sheet */
  .capture-bar { display: none; }
  body.qa-open .qa-pane[data-pane="capture"] .capture-bar {
    display: flex; position: static; margin: 0;
    border-color: var(--border-strong);
  }

  /* spacing + centering polish */
  .layout { padding: 12px 12px calc(96px + env(safe-area-inset-bottom)); }
  .panel { padding: 22px 18px 34px; border-radius: 20px; }
  h1 { margin-bottom: 6px; }
  .sub { margin-bottom: 18px; }
  .brief-head { margin-bottom: 14px; }
  .card { align-items: center; }
  .card .grow { align-self: center; }
  .card > button.small { align-self: center; }
  .tgroup-h { margin: 20px 2px 8px; }
  .quests-h { margin: 10px 0 4px 2px; }
  .stat { padding: 14px 12px; }
  .stat .l { white-space: nowrap; }
}

/* ---------- polish round: ring size/centering, stat grid, hidden gear ---------- */
.hero-ring { width: 140px; height: 140px; }
.hero-center { transform: translateY(-2px); }
.hero-num { font-size: 38px; }
.hero-den { font-size: 12px; line-height: 1.2; }
.hero-cap { margin-top: 5px; }
.hero { gap: 18px; padding: 26px 22px 24px; }

.v-meta { display: block; font-variant-numeric: tabular-nums; }

@media (max-width: 800px) {
  .hero-ring { width: 124px; height: 124px; }
  .hero-num { font-size: 34px; }
  .hero { padding: 24px 16px 22px; }

  /* stat tiles: fixed grid inside the panel, no edge-bleed, no clipping */
  .stat-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(102px, 1fr));
    gap: 8px; margin: 16px 0 0; padding: 0; overflow: visible;
  }
  .stat { min-width: 0; padding: 13px 8px; }
  .stat .l { white-space: normal; font-size: 11.5px; line-height: 1.3; }

  /* settings rarely used on the phone: hide the gear, dock stays two clusters */
  .nav-btn[data-view="settings"] { display: none; }
}

/* ---------- ring re-center + headline one-liner + quote air ---------- */
.hero-ring { width: 120px; height: 120px; }
.hero-center { transform: none; gap: 0; }
.hero-num { font-size: 34px; letter-spacing: -1px; }
.hero-den { font-size: 11.5px; margin-top: 2px; }
.hero-cap {
  margin: -4px 0 0; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent);
}
.hero-cap.met { color: var(--gold); }
.hero { gap: 14px; }

.e-head { font-size: clamp(19px, 5vw, 24px); line-height: 1.3; }

.stoic { margin: 24px 0 20px; padding: 18px 20px 16px; }
.stoic::before { top: 16px; bottom: 16px; }

button.small.ghost-link {
  background: none; border: none; color: var(--accent);
  padding: 6px 2px; margin-top: 2px;
}
button.small.ghost-link:hover { background: none; transform: none; text-decoration: underline; }

@media (max-width: 800px) {
  .hero-ring { width: 112px; height: 112px; }
  .hero-num { font-size: 31px; }
  .hero { padding: 22px 16px 20px; }
}

/* ---------- calendar events + people date fields ---------- */
.events {
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); padding: 3px 0; margin-bottom: 4px;
}
.event-row { display: flex; gap: 14px; align-items: baseline; padding: 11px 16px; }
.event-row + .event-row { border-top: 1px solid var(--border); }
.e-time { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 650; font-size: 13px; min-width: 54px; flex-shrink: 0; }
.e-title { font-size: 14px; min-width: 0; overflow-wrap: break-word; }

.f-label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.02em;
}
.f-label input { width: 100%; }
.card .title .ic { color: var(--muted); margin-right: 2px; }

/* ---------- ring centering: wrapper hugs the svg exactly ---------- */
.hero-ring, .hero-ring svg { display: block; }
.hero-ring { position: relative; width: auto; height: auto; }

/* vitals: the optimal-zone band stays, the cryptic numbers go */
.v-ends { display: none; }

@media (max-width: 800px) {
  .hero-ring { width: auto; height: auto; }

  /* + matches the frosted nav pill */
  .nav-plus {
    background: rgba(19, 21, 25, 0.86);
    color: var(--text);
    border: 1px solid var(--border-strong);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
  }
}

/* ---------- plan / eisenhower matrix ---------- */
.matrix { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.mx-quad {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-height: 110px;
}
.mx-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.mx-head b { font-size: 13.5px; }
.mx-head span { font-size: 11px; color: var(--faint); white-space: nowrap; }
.q-do .mx-head b { color: var(--danger); }
.q-plan .mx-head b { color: var(--accent); }
.q-quick .mx-head b { color: var(--gold); }
.q-later .mx-head b { color: var(--muted); }
.mx-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.mx-item + .mx-item { border-top: 1px solid var(--border); }
.mx-title { font-size: 13px; line-height: 1.35; }
.mx-item .meta { font-size: 11.5px; }
.mx-add { white-space: nowrap; flex-shrink: 0; }
.mx-empty { color: var(--faint); font-size: 12.5px; padding: 10px 0 4px; }
.mx-more { color: var(--faint); font-size: 12px; padding-top: 8px; }

.mx-star {
  background: none; border: none; cursor: pointer;
  color: var(--faint); padding: 2px; flex-shrink: 0;
  transition: color 0.15s var(--ease), transform 0.15s var(--spring);
}
.mx-star .ic { width: 15px; height: 15px; }
.mx-star:hover { color: var(--gold); }
.mx-star.on { color: var(--gold); }
.mx-star.on .ic { fill: currentColor; }
.mx-star:active { transform: scale(0.85); }

.star-btn { color: var(--faint); }
.star-btn.on { color: var(--gold); border-color: rgba(226, 180, 90, 0.4); }
.star-btn.on .ic { fill: currentColor; }

.plan-num {
  width: 21px; height: 21px; border-radius: 50%;
  background: var(--surface-3); color: var(--muted);
  font-size: 11.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.plan-ctl { display: flex; gap: 4px; flex-shrink: 0; }
.plan-ctl .small[disabled] { opacity: 0.35; cursor: default; }

@media (max-width: 800px) {
  .matrix { grid-template-columns: 1fr; }
}

/* ---------- card overflow menu ---------- */
/* one ⋯ instead of a row of buttons, so titles get the full card width */
.cmenu { position: relative; flex-shrink: 0; align-self: center; }
.cmenu-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  background: none; border: none; border-radius: 9px;
  color: var(--faint); cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.cmenu-btn:hover, .cmenu.open .cmenu-btn { background: var(--surface-3); color: var(--text); }
.cmenu-btn .ic { width: 18px; height: 18px; }

.cmenu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  min-width: 196px; padding: 5px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong); border-radius: 13px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6);
  animation: cmenuIn 0.16s var(--ease);
}
.cmenu.up .cmenu-pop { top: auto; bottom: calc(100% + 6px); }
@keyframes cmenuIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }

.cmenu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 11px; border: none; border-radius: 9px;
  background: none; color: var(--text);
  font: 500 13.5px/1.2 inherit; text-align: left; cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.cmenu-item .ic { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.cmenu-item:hover { background: rgba(255, 255, 255, 0.07); }
.cmenu-item.on .ic { color: var(--gold); fill: currentColor; }
.cmenu-item.danger:hover { background: rgba(239, 111, 102, 0.14); color: var(--danger); }
.cmenu-item.danger:hover .ic { color: var(--danger); }
.cmenu-item[disabled] { opacity: 0.32; pointer-events: none; }

/* important stays visible now that the star button is gone */
.star-flag { color: var(--gold); display: flex; align-items: center; flex-shrink: 0; align-self: center; }
.star-flag .ic { width: 14px; height: 14px; fill: currentColor; }

/* ---------- quick add sheet ---------- */
.qa {
  position: fixed; z-index: 130;
  top: 11vh; left: 50%; transform: translateX(-50%);
  width: min(540px, calc(100vw - 40px));
  background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: 20px;
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  animation: qaIn 0.22s var(--ease);
}
@keyframes qaIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } }
.qa[hidden] { display: none; }

body.qa-open::before {
  content: ""; position: fixed; inset: 0; z-index: 120;
  background: rgba(4, 5, 7, 0.62);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
body.qa-open .sidebar { z-index: 125; } /* keep the + reachable above the scrim */

.qa-tabs {
  display: flex; gap: 3px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
}
.qa-tab {
  flex: 1; padding: 8px 10px; border: none; border-radius: 8px;
  background: none; color: var(--muted);
  font: 600 13px/1 inherit; cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.qa-tab:hover { color: var(--text); }
.qa-tab.active { background: var(--surface-3); color: var(--text); }
.qa-tab-capture { display: none; } /* desktop keeps the inline capture bar */

.qa-pane { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.qa-pane[hidden] { display: none; }
.qa-pane > input, .qa-grid > input, .qa-grid > select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text);
  font-family: inherit; font-size: 14px; padding: 11px 13px;
  width: 100%; min-width: 0;
}
.qa-pane > input:focus, .qa-grid > input:focus, .qa-grid > select:focus {
  outline: none; border-color: var(--accent);
}
.qa-pane > input::placeholder { color: var(--faint); }
.qa-pane > input[name="title"], .qa-pane > input[name="name"] { font-size: 15.5px; font-weight: 500; }
.qa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }

.qa-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.qa-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.qa-check input[type="checkbox"] { width: 19px; height: 19px; margin: 0; }
.qa-hint { font-size: 12.5px; color: var(--faint); }

@media (max-width: 800px) {
  .qa {
    top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 10px;
    width: auto; transform: none; border-radius: 18px;
  }
  @keyframes qaIn { from { opacity: 0; transform: translateY(-10px); } }
  .qa-tab-capture { display: block; }
  .qa-pane > input, .qa-grid > input, .qa-grid > select { font-size: 16px; padding: 12px 13px; }
  /* the ⋯ needs a real touch target but still costs far less width than 3 buttons */
  .cmenu-btn { width: 36px; height: 36px; }
  .cmenu-pop { min-width: 208px; }
}

/* the + is the only way in to task/habit creation, so it must exist on desktop too */
.nav-plus {
  display: flex; align-items: center; gap: 10px;
  margin: 6px 0 2px; padding: 9px 10px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(87, 201, 166, 0.28); border-radius: 9px;
  font-weight: 600;
}
.nav-plus:hover { background: rgba(87, 201, 166, 0.2); color: var(--accent); }
.nav-plus svg { width: 17px; height: 17px; stroke-width: 2.2; }

@media (max-width: 800px) {
  /* back to the round frosted dock button — the label would blow out the pill */
  .nav-plus {
    margin: 0; padding: 0; justify-content: center;
    border-radius: 50%;
    background: rgba(19, 21, 25, 0.86);
    color: var(--text);
    border: 1px solid var(--border-strong);
  }
  .nav-plus svg { width: 22px; height: 22px; stroke-width: 2.4; }
  .np-label { display: none; }
}
