/*
 * hud.css — the main page (index.php): HUD, sticky header, Planner layer and the task editor overlay.
 * Loaded after base.css. Moved verbatim out of index.php's inline <style> (ROADMAP #32); the only rule change is
 * the recurring type colours, which now key on recurring_fixed / recurring_rolling (the retired scheduled_* names
 * never matched a task type, so recurring tasks showed no colour).
 */
:root {
  --tile-h: 560px;
}
body {
  transition: background-color 0.35s ease;
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;   /* top-aligned: short pages no longer float in the middle or jump as panels appear */
  padding: 24px;
}
.marquee {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  letter-spacing: 0.04em;
  margin: 0 0 8px;
}
.clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  color: var(--muted);
  margin: 0 0 32px;
  letter-spacing: 0.02em;
}
.card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 40px 32px;
  text-align: center;
}
.mission-label { font-size: 0.8rem; color: var(--muted); margin: 0 0 8px; }
.mission-type {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 6px;
}
.mission-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: 1.4rem;
  line-height: 1.3;
  margin: 0 0 28px;
  max-width: 30ch;
  margin-left: auto;
  margin-right: auto;
}
.mission-name.one-time { color: var(--accent); font-weight: 700; }
.countdown {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 3rem;
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 0 0 4px;
}
.countdown.overtime { color: var(--err); }
.time-label {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0 0 4px;
  height: 1em;
}
.overtime-label {
  font-size: 0.75rem;
  color: var(--err);
  letter-spacing: 0.05em;
  margin: 0 0 20px;
  height: 1em;
}
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; position: relative; z-index: 5; }
.add-time-row {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 18px;   /* sits directly under the time left, above Complete / Snooze / Skip */
}
.add-time-label { font-size: 0.7rem; color: var(--muted); margin-right: 2px; }
.add-time-row button {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}
.add-time-row button:hover { color: var(--text); }
.add-time-row .custom-complete { margin-left: 8px; }
/* The task's description, under the buttons: a few lines, then it scrolls. */
.mission-description {
  margin: 20px auto 0; max-width: 48ch; max-height: 7.5em; overflow-y: auto;
  padding: 10px 12px; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: 0.85rem; line-height: 1.5; color: var(--text);
  border: 1px solid var(--panel-border); border-radius: 8px; background: rgba(255, 255, 255, 0.03);
}
.mission-description:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.complete-btn, button.snooze-btn, button.skip-btn {
  padding: 10px 22px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
button.complete-btn { background: var(--accent); color: #1A1400; }
button.snooze-btn { background: transparent; border: 1px solid var(--panel-border); color: var(--text); }
button.skip-btn { background: transparent; border: 1px solid var(--err); color: var(--err); }
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 4px;
  z-index: 20;
  min-width: 140px;
  text-align: left;
}
.dropdown-menu { z-index: 100; }
.dropdown-menu.open { display: flex; flex-direction: column; }
.dropdown-menu button {
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 4px;
  white-space: nowrap;
}
.dropdown-menu button:hover { background: rgba(255, 255, 255, 0.06); }
/* A task title that opens the editor (Inbox, Future). */
.title-link { cursor: pointer; }
.title-link:hover, .title-link:focus-visible { text-decoration: underline; text-underline-offset: 3px; outline: none; }
.dropdown-menu .menu-head {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  padding: 9px 12px 3px; border-top: 1px solid var(--panel-border); margin-top: 4px;
}
.dropdown-menu .menu-head:first-child { border-top: none; margin-top: 0; }
a.tasks-link {
  display: inline-block;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
  border-bottom: 1px dotted var(--panel-border);
}
.diagnostics {
  margin-top: 40px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.diagnostics .status-line { display: flex; align-items: center; gap: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--err); }
.dot.ok { background: var(--ok); }
.queue-panel {
  width: 100%;
  max-width: 420px;
  margin-top: 20px;
}
.queue-panel h2 {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 10px;
}
.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.queue-item { flex-wrap: wrap; gap: 8px 12px; }
.queue-item-main { display: block; flex: 1 1 200px; min-width: 0; }
.queue-item > span:last-child { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
@media (max-width: 640px) {
  .queue-item > span:last-child { flex: 1 1 100%; margin-left: 0; }
}
/* Tag chips under a row's name (Later today, Future, Daily Goals). */
.chip-line { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.queue-item .tag {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 8px;
}
.queue-item button {
  background: none;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}
.queue-item button:hover { color: var(--text); }
.daily-goal-tile {
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--type-daily_goal);
  background: var(--type-daily_goal-bg);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.daily-goal-tile.eligible { border-color: var(--ok); border-left-color: var(--type-daily_goal); }
/* Line 1: name + counts. Line 2: actions. Two lines, always. */
.daily-goal-line1 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.daily-goal-name { font-weight: 600; font-size: 0.88rem; min-width: 0; }
.daily-goal-tile.cooldown .daily-goal-name { color: var(--muted); }
.daily-goal-counts { font-size: 0.72rem; color: var(--muted); flex-shrink: 0; white-space: nowrap; }
.daily-goal-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.daily-goal-actions button, .daily-goal-actions a {
  background: none;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.daily-goal-tile.eligible .daily-goal-actions button:not([disabled]), .daily-goal-actions a:hover { color: var(--text); }
.daily-goal-actions button[disabled] { opacity: 0.4; cursor: not-allowed; }
.panel-tile > header .end-day-btn { flex-shrink: 0; margin-top: -2px; }
.end-day-btn {
  background: none;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}
.end-day-btn:hover { color: var(--text); }
.settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--muted);
}
.settings-row .header-link { display: flex; align-items: center; color: var(--muted); font-size: 0.8rem; text-decoration: none; }
.settings-row .header-link:hover { color: var(--text); }
.settings-row .header-gear svg { width: 20px; height: 20px; }

/* Only .queue-box drags (touch-action:none is required for touch drags —
   without it the browser claims the gesture as a scroll). Keeping the
   buttons and the gaps outside it leaves generous inert area to start a
   page scroll from, which matters most on a phone. */
.queue-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.queue-box {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.queue-icon-col { display: flex; flex-direction: column; gap: 4px; }
.queue-box-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.queue-task-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.queue-box-pills { display: flex; gap: 4px; flex-shrink: 0; }
.queue-reason { font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-row.dragging .queue-box {
  cursor: grabbing;
  background: var(--panel);
  border-color: var(--accent);
  transform: scale(1.03) rotate(-0.6deg);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
}
/* So elementFromPoint sees the row underneath rather than the dragged one. */
.queue-row.dragging { position: relative; z-index: 10; pointer-events: none; }
.queue-source {
  flex-shrink: 0;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  min-width: 52px;
  text-align: right;
}
.q-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  background: none;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}
.q-icon:hover { color: var(--text); border-color: var(--accent); }
.q-icon.placeholder { visibility: hidden; }

/* ---- Planner layer (revealed while paused) ---- */
.pause-row { margin-bottom: 14px; }
.paused-banner {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  text-align: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-size: 0.85rem;
}
.paused-banner .paused-for {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 4px;
}
#plannerLayer { width: 100%; max-width: var(--page-max); margin-top: 28px; }
/* Planner panels flow into as many columns as fit (each at least ~620px). The working surface, All tasks, always
   takes the full width; Inbox / Future above it and Done / Archive below sit side by side on a wide screen. */
.planner-grid {
  display: grid; gap: 18px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 620px), 1fr));
}
.planner-grid > .panel { margin-bottom: 0; min-width: 0; }
.planner-grid > #tasksPanel { grid-column: 1 / -1; }
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
}
.panel h2 { font-size: 0.85rem; color: var(--muted); font-weight: 500; margin: 0 0 12px; }
.panel label { display: block; font-size: 0.8rem; color: var(--muted); margin: 12px 0 4px; }
.panel input[type=text], .panel input[type=number], .panel textarea, .panel select {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
}
.panel textarea { min-height: 60px; resize: vertical; }
.panel .row { display: flex; gap: 12px; }
.panel .row > div { flex: 1; }
button.primary {
  margin-top: 18px;
  padding: 10px 20px;
  background: var(--accent);
  color: #1A1400;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}
button.secondary {
  margin-top: 18px;
  margin-left: 8px;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}
.tag-choices { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.tag-choice {
  padding: 4px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.tag-choice.selected { border-color: var(--accent); color: var(--accent); }
.task-item {
  display: flex;
  flex-wrap: wrap;          /* the buttons drop under the text when there isn't room, instead of squeezing it to nothing */
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--panel-border);
}
.task-item:last-child { border-bottom: none; }
.task-item .name { font-size: 0.95rem; font-weight: 500; }
.task-item .name.is-inactive { color: var(--muted); }
.task-item .name.is-active { color: var(--text); }
.task-item .meta { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.task-item .recurrence-schedule { color: var(--accent, #6aa5ff); }
.recurrence-summary {
  font-size: 0.85rem; color: var(--accent, #6aa5ff); background: rgba(106, 165, 255, 0.08);
  border-radius: 6px; padding: 6px 10px; margin-bottom: 8px;
}
.task-item .tags-list { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.random-heading {
  font-family: inherit; font-size: 0.85rem; font-weight: 400; color: var(--text);
  margin: 12px 0 4px; padding-top: 8px; border-top: 1px solid var(--panel-border);
}
.random-row { padding: 4px 0; transition: opacity 0.4s ease; }
/* After a Random reveal lands, the losing rows fade back so the winner stands out. */
.random-tile.dim-losers .random-row:not(.winner) { opacity: 0.35; }
.random-row + .random-row { border-top: 1px solid var(--panel-border); }
.random-row.winner { animation: randomRowWinner 0.9s ease; transform-origin: center; }
@keyframes randomRowWinner {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.3); }
  100% { filter: brightness(1); }
}
/* Value bar: fill width is proportional to the pool's weight relative to the largest weight
   shown, so the biggest pool always fills 100%. The bar's own container spans the full row;
   label and stats sit on top of the fill (not clipped by it), so they stay readable even when
   the fill itself is narrow. --tag-color falls back to a dark grey (Other/Priority, which have
   no tag color) so the bar is still visible as a value bar. */
.random-bar { position: relative; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; }
.random-bar-fill { position: absolute; top: 0; left: 0; bottom: 0; border-radius: 6px; background: var(--tag-color, #3a3f4a); }
.random-bar-label, .random-bar-stats { position: relative; font-size: 0.85rem; color: var(--text); white-space: nowrap; }
.random-bar-stats { color: var(--muted); font-size: 0.8rem; }

@property --spin-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: true;
}

/* The whole Random section — a square tile (width tracks the Queue panel via aspect-ratio,
   no JS measurement needed), its BORDER doing all the animating; the weight-bar rows live
   inside it permanently and never get replaced by anything else. Three border states:
     idle       — proportional bands (real live weights, or the fixed palette when no Block
                  is active), spinning slowly and continuously via the CSS keyframe below.
     spin-fast  — a pick is being revealed: WAAPI (not the CSS keyframe) drives --spin-angle
                  through several fast turns, decelerating to land the real winning band
                  exactly under the fixed marker (same roll_fraction math as the old wheel
                  version, just applied to this ring instead of a separate disc).
     landed     — brief solid hold in the winning color once it stops, before settling back.
   Saturation boost is permanent (Aaron: "vibrancy always"), not tied to any one state. */
.random-tile {
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 14%;
  background: var(--panel); padding: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  overflow: hidden;
  transition: transform 0.4s ease;
}
.random-tile.spin-fast, .random-tile.landed { transform: scale(1.07); }
.random-tile::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0;
  padding: var(--ring-width, 3px);
  background: conic-gradient(from var(--spin-angle, 0deg), var(--ring-colors, #5AA9E6, #49C08C, #F2B705, #E0607A, #B48EE8, #5AA9E6));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  filter: saturate(1.5);
  transition: padding 0.3s ease;
  pointer-events: none;
}
.random-tile.idle::before { animation: randomRingSpin 9s linear infinite; }
.random-tile.spin-fast::before, .random-tile.landed::before { --ring-width: 6px; }
@keyframes randomRingSpin {
  from { --spin-angle: 0deg; }
  to   { --spin-angle: 360deg; }
}

.random-tile > * { position: relative; z-index: 1; }
.random-tile-label { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1rem; }
/* Random Task Picker heading (2026-09-26): fixed title, the running template, the blocks in effect (or the next one).
   The template and block lines link into the Blocks editor. */
.random-head { width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.random-head .random-tile-label { font-size: 2.1rem; line-height: 1.15; }
.random-template { font-family: 'Space Grotesk', sans-serif; font-size: 1.6rem; line-height: 1.2; }
.random-blocks { display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: 100%; }
.random-block-line, .random-next {
  font-size: 1.1rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.random-block-more { font-size: 0.85rem; color: var(--muted); }
.random-next-in { color: var(--accent); }
a.random-link { color: inherit; text-decoration: none; border-radius: 4px; }
a.random-link:hover, a.random-link:focus-visible { text-decoration: underline; text-underline-offset: 3px; outline: none; }
a.random-template { color: var(--text); }
/* Full random: "No block weighting active", centred and larger. */
.random-row-note { text-align: center; font-family: 'Space Grotesk', sans-serif; font-size: 1.15rem; color: var(--text); padding: 18px 0; }
/* Break and full random: slow-turning borders (Break in calm muted tones — its palette is set by hud.js). */
.random-tile.idle.mode-full::before { animation-duration: 20s; }
.random-tile.idle.mode-off::before { animation-duration: 30s; filter: saturate(0.9); }
.random-tile-sub { font-size: 0.75rem; color: var(--muted); min-height: 1em; }
.random-tile-rows { width: 100%; overflow-y: auto; }

.random-marker {
  position: absolute; top: -1px; left: 50%; z-index: 2;
  width: 0; height: 0;
  border-left: 8px solid transparent; border-right: 8px solid transparent;
  border-top: 13px solid var(--accent);
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4));
  opacity: 0; transform: translate(-50%, -8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.random-marker.show { opacity: 1; transform: translate(-50%, 0); }
/* Full-random reveal: the ring spins but has no band to point at (2026-09-26). */
.random-tile.no-marker .random-marker { display: none; }
.mission-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.mission-pick-info { font-size: 0.8rem; color: var(--muted); margin: 2px 0 6px; }
.pill {
  padding: 2px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  font-size: 0.7rem;
  color: var(--muted);
}
/* Filled tag colors. --tag-color / --tag-tint / --tag-text are set inline
   per tag by tagColorVars() (tags.js). Pills are solid; form chips are a
   tint until selected, then solid with a checkmark. */
.pill.has-color { background: var(--tag-color); border-color: var(--tag-color); color: var(--tag-text); font-weight: 500; }
.tag-choice.has-color { border-color: var(--tag-color); background: var(--tag-tint); color: #9AA1B0; }
.tag-choice.selected::before { content: "\2713"; margin-right: 6px; }
.tag-choice.has-color.selected { background: var(--tag-color); color: var(--tag-text); }
.task-item .name.clickable { cursor: pointer; }
.task-item .name.clickable:hover { text-decoration: underline; }
.task-item .name.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
@media (max-width: 640px) {
  /* Narrow: the buttons sit on their own line under the title and info, left-aligned, and long titles wrap. */
  .task-actions { flex: 1 1 100%; justify-content: flex-start; margin-left: 0; }
  .task-title .name { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
}
.task-actions button {
  background: none;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
}
.task-actions button:hover { color: var(--text); }
.empty { color: var(--muted); font-size: 0.9rem; }
.dg-counts-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--muted);
}
.dg-counts-row button {
  background: none;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  cursor: pointer;
}
.dg-edit-row { margin-top: 8px; align-items: flex-end; gap: 12px; font-size: 0.75rem; color: var(--muted); }
.dg-edit-row label { display: flex; flex-direction: column; gap: 4px; }
.dg-edit-row input {
  width: 70px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
  font-family: inherit;
}
.dg-edit-row button {
  background: var(--accent);
  color: #1A1400;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  height: fit-content;
}

/* ---------- Panel grid (slice 2) ----------
   auto-fit + minmax reflows on its own: one column when narrow, more as
   width allows, no hand-tuned breakpoints. */
.topbar {
  width: 100%;
  max-width: var(--page-max);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 18px;
}
.topbar .marquee { margin: 0; flex: 0 0 auto; }
.topbar .clock {
  margin: 0;
  flex: 1 1 auto;
  text-align: center;
  font-size: 2rem;
  color: var(--text);
}
.topbar .settings-row { flex: 0 0 auto; }
/* When it wraps, the clock takes its own full-width line and stays centred. */
@media (max-width: 640px) {
  .topbar .clock { flex-basis: 100%; order: 3; font-size: 1.6rem; }
}
.settings-row { position: static; }

.hud-grid {
  width: 100%;
  max-width: var(--page-max);
  display: grid;
  /* Every HUD panel caps at 500px; the row of panels is centred on wide screens (2026-09-26). */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 500px));
  justify-content: center;
  gap: 16px;
  align-items: stretch;      /* side-by-side tiles match heights */
}
/* Single column (below the 720px two-column break): Task Queue right under the Mission, then
   Daily Goals, then Later today. The DOM order stays as is — this only reorders the grid. */
@media (max-width: 719px) {
  #queuePanel { order: 1; }
  #dailyGoalPanel { order: 2; }
  #upcomingPanel { order: 3; }
}

.paused-badge {
  color: var(--accent);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}
.paused-badge .paused-for {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}
.pause-row { margin-top: 18px; text-align: center; }
.panel-tile {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.panel-tile > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.panel-tile > header h2 {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 10px;
}
.panel-body { flex: 1; min-height: 0; }

/* Internal scrolling only matters when a tile is side-by-side with another
   and has to match its height. In single-column (narrow) the tile just grows
   — nothing to match, and scrolling inside a full-width panel is worse UX.
   720px is where auto-fit(340px) stops fitting two columns. */
/* One shared height so a list tile never ends up taller than the Mission
   panel beside it — the list scrolls inside instead of stretching the row. */
.panel-body.scrolls { overflow-y: auto; flex: 1; min-height: 0; }
/* Queue is exempt: it must always show every item so a drag can reach any
   position, and so the page (not a nested box) is what you scroll. */
.panel-tile:not(.mission-tile):not(.queue-tile) { max-height: var(--tile-h); }
@media (min-width: 720px) {
  .mission-tile { min-height: var(--tile-h); }
}
/* Scrollbar styled to the panel palette rather than the OS default. */
.panel-body.scrolls { scrollbar-width: thin; scrollbar-color: var(--panel-border) transparent; }
.panel-body.scrolls::-webkit-scrollbar { width: 8px; }
.panel-body.scrolls::-webkit-scrollbar-track { background: transparent; }
.panel-body.scrolls::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 4px; }
.panel-body.scrolls::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Mission tile: the card inside is no longer its own centred box. */
.panel-tile .card {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  max-width: none;
  width: 100%;
}

/* Queue rows need inert margin either side, otherwise there's nowhere to
   start a page scroll on touch (the rows themselves are touch-action:none). */
#queueList .queue-item { margin-left: 10px; margin-right: 10px; }

/* ---------- Quick Add bar ---------- */
.quickadd-bar {
  width: 100%;
  max-width: var(--page-max);
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.quickadd-bar input {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
}
.qa-primary, .qa-secondary {
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.qa-primary { background: var(--accent); color: #1A1400; border: none; }
.qa-secondary { background: transparent; border: 1px solid var(--panel-border); color: var(--text); }

/* ---------- Task form overlay ---------- */
.form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 20px;
}
.form-overlay-box {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 22px 24px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-border) transparent;
}
.form-overlay-box h2 { font-size: 0.95rem; margin: 0 0 4px; }
.form-overlay-box label { display: block; font-size: 0.8rem; color: var(--muted); margin: 12px 0 4px; }
.form-overlay-box input[type=text],
.form-overlay-box input[type=number],
.form-overlay-box textarea,
.form-overlay-box select {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
}
.form-overlay-box textarea { min-height: 60px; resize: vertical; }
.form-overlay-box .row { display: flex; gap: 12px; }
.form-overlay-box .row > div { flex: 1; }
/* Planned duration + presets get the room; Weight is a narrow box. On phones
   Weight drops to its own line so the presets keep their space. */
/* Subtask editor: reads as one bordered field; each row is [grip][greyed checkbox][text][trash]. */
.subtask-field { background: var(--bg); border: 1px solid var(--panel-border); border-radius: 6px; padding: 3px 8px 3px 4px; box-sizing: border-box; }
.subtask-field:focus-within { border-color: var(--muted); }
.subtask-row { display: flex; align-items: flex-start; gap: 6px; border-radius: 6px; transition: transform 0.12s ease; }
.subtask-row.dragging { position: relative; z-index: 2; background: var(--panel); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); transition: none; }
/* A blank line has nothing to drag or delete; keep the space so the text stays aligned. */
.subtask-row.is-blank .subtask-handle, .subtask-row.is-blank .subtask-del { visibility: hidden; }
/* Wide touch target; the icon inside never takes the touch itself. */
.subtask-handle { flex: 0 0 auto; width: 28px; height: 33px; display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.subtask-handle * { pointer-events: none; }
.subtask-handle .ico { width: 14px; height: 14px; stroke-width: 3; }
.subtask-row.dragging .subtask-handle { cursor: grabbing; }
.subtask-box { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 9px; box-sizing: border-box; border: 1.5px solid var(--muted); border-radius: 4px; opacity: 0.4; background: rgba(124, 131, 148, 0.15); }
.form-overlay-box .subtask-field textarea.subtask-input {
  flex: 1; min-width: 0; width: auto; min-height: 0; height: auto; display: block; resize: none; overflow: hidden;
  background: transparent; border: none; border-radius: 0; padding: 7px 0; outline: none;
  color: var(--text); font: inherit; font-size: 0.9rem; line-height: 1.35;
}
.subtask-del { flex: 0 0 auto; width: 28px; height: 28px; margin-top: 3px; padding: 0; display: flex; align-items: center; justify-content: center; background: none; border: none; border-radius: 6px; color: var(--muted); opacity: 0.7; cursor: pointer; }
.subtask-del:hover { color: var(--err); opacity: 1; }
.duration-input-row { display: flex; gap: 6px; align-items: stretch; }
.duration-input-row input[type=text] { flex: 1; min-width: 0; }
.dur-preset {
  background: none; border: 1px solid var(--panel-border); color: var(--muted);
  padding: 0 10px; border-radius: 6px; font-family: inherit; font-size: 0.8rem; cursor: pointer;
}
.dur-preset:hover { color: var(--text); }
.form-overlay-box .row > .weight-col { flex: 0 0 84px; }
@media (max-width: 520px) {
  .form-overlay-box .duration-row { flex-wrap: wrap; }
  .form-overlay-box .duration-row > .duration-col { flex: 1 1 100%; }
  .form-overlay-box .row > .weight-col { flex: 0 0 100px; }
}
.form-overlay-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; align-items: center; }
/* Limited series: compact Total field with its progress beside it (done · left · finishes). */
.form-overlay-box .total-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.form-overlay-box .total-row input[type=number] { width: 84px; flex: 0 0 84px; }
.series-progress { flex: 1 1 220px; font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.sp-done, .series-count { color: var(--done); font-weight: 500; }
.sp-skipped, .series-skipped { color: var(--muted); }
.sp-left, .series-left { color: var(--text); }
.series-last { color: var(--accent); font-weight: 600; }
.sp-date, .series-end { color: var(--accent); }
.sp-warn { color: var(--err); }
.sp-muted { color: var(--muted); }
.stale-banner {
  align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px;
  margin: 10px 0 4px; padding: 10px 12px; font-size: 0.8rem; color: var(--text);
  border: 1px solid var(--accent); border-radius: 8px; background: rgba(242, 183, 5, 0.08);
}
.stale-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stale-actions button {
  background: none; border: 1px solid var(--panel-border); color: var(--text);
  padding: 5px 12px; border-radius: 6px; font-size: 0.78rem; cursor: pointer; font-family: inherit;
}
.stale-actions button:last-child { border-color: var(--accent); color: var(--accent); }
.link-btn { background: none; border: none; padding: 0; color: var(--muted); font: inherit; font-size: 0.8rem; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--text); }
.form-overlay-actions .link-btn { margin-right: auto; }

/* ---------- Paused shrink ----------
   Controls that can't be used while paused fold away, genuinely reclaiming
   vertical space for the Planner rather than just scaling the HUD down. */
.marquee, .countdown, .clock {
  transition: font-size 0.3s ease, margin 0.3s ease;
}
body.is-paused .marquee { font-size: 1.4rem; margin-bottom: 4px; }
body.is-paused .clock { font-size: 1rem; margin-bottom: 14px; }
body.is-paused .countdown { font-size: 2rem; }
body.is-paused .mission-name { margin-bottom: 12px; }

/* ---------- Sticky header ---------- */
html { scroll-padding-top: calc(var(--header-h, 0px) + 12px); }   /* jumps and scrollIntoView clear the header */
.site-header {
  position: sticky; top: 0; z-index: 300;
  width: calc(100% + 48px); margin: -24px -24px 18px;             /* full-bleed across the body's padding */
  padding: 12px 24px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--panel-border);
  transition: background-color 0.35s ease;
}
body.is-paused .site-header { background: var(--bg-planner); border-bottom-color: #46242A; }
.site-header-inner {
  max-width: var(--page-max); margin: 0 auto;
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "pause top" "pause add" "mission mission" "jump jump";
  gap: 8px 16px; align-items: center;
}
.site-header .topbar { grid-area: top; width: auto; max-width: none; margin: 0; }
.site-header .quickadd-bar { grid-area: add; width: auto; max-width: none; margin: 0; }
.site-header .marquee { font-size: clamp(1.4rem, 4vw, 2rem); }
.site-header .topbar .clock { font-size: 1.5rem; }
@media (max-width: 640px) {
  /* Narrow: the switch only spans the title row; Add task gets the full width beneath. */
  .site-header { padding: 8px 14px 8px; }
  .site-header-inner { grid-template-areas: "pause top" "add add" "mission mission" "jump jump"; }
  .site-header .topbar .clock { font-size: 1.2rem; }
}

/* Current Mission as the header's bottom row while in the Planner: one line on a wide screen, two on a narrow one. */
.hdr-mission {
  grid-area: mission; display: none; align-items: center; flex-wrap: wrap; gap: 6px 12px; min-width: 0;
  padding: 6px 12px; border: 1px solid #46242A; border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}
body.is-paused .hdr-mission { display: flex; }
.hdr-mission-badge { color: var(--accent); flex: 0 0 auto; }
.hdr-mission-chev { flex: 0 0 auto; color: var(--muted); font-size: 0.8rem; margin-left: -6px; transition: transform 0.15s ease; }
.hdr-mission.open .hdr-mission-chev { transform: rotate(180deg); }
.hdr-mission-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
/* Full Current Mission, dropped down over the page under the header (doesn't push the content). */
.hdr-mission-detail {
  display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 310;
  max-height: calc(100vh - var(--header-h, 120px) - 12px); overflow-y: auto;
  padding: 12px 24px 18px; background: var(--bg-planner);
  border-bottom: 1px solid #46242A; box-shadow: 0 14px 28px rgba(0, 0, 0, 0.5);
}
.hdr-mission-detail.open { display: block; }
.hdr-mission-detail-body { max-width: 720px; margin: 0 auto; }
.hdr-mission-detail .mission-tile { max-height: none; min-height: 0; }
/* The first 15 seconds of a mission: Skip is free, and says so by flashing. */
@keyframes skipGrace {
  0%, 100% { background: transparent; }
  50%      { background: rgba(73, 192, 140, 0.35); }
}
.skip-btn.grace, .hdr-mission-actions .hm-skip.grace { border-color: var(--ok); animation: skipGrace 1s ease-in-out infinite; }
.hdr-mission-name {
  flex: 1 1 12em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; font-size: 0.9rem; cursor: pointer;
}
.hdr-mission-progress { flex: 0 0 auto; color: var(--subtask); font-size: 0.8rem; font-weight: 600; }
.hdr-mission-time { flex: 0 0 auto; font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 0.95rem; }
.hdr-mission-time.overtime { color: var(--err); }
.hdr-mission-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.hdr-mission-actions button {
  background: none; border: 1px solid var(--panel-border); color: var(--text); border-radius: 6px;
  padding: 3px 10px; font-size: 0.75rem; cursor: pointer; font-family: inherit;
}
.hdr-mission-actions button:hover { border-color: var(--muted); }
.hdr-mission-actions .hm-complete { border-color: var(--ok); color: var(--ok); }
@media (max-width: 640px) { .hdr-mission-actions { flex: 1 1 100%; } }

/* Jump chips (Planner only). */
.jump-bar { grid-area: jump; display: none; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
body.is-paused .jump-bar { display: flex; }
.jump-chip {
  flex: 0 0 auto; background: none; border: 1px solid var(--panel-border); color: var(--muted);
  border-radius: 999px; padding: 4px 12px; font-size: 0.75rem; cursor: pointer; font-family: inherit;
}
.jump-chip:hover { color: var(--text); }
.jump-chip.on { border-color: var(--accent); color: var(--accent); }

.to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 250;
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.2rem; cursor: pointer;
  background: var(--panel); border: 1px solid var(--panel-border); color: var(--text);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
body.is-paused .to-top { border-color: #46242A; }

/* ---------- Pause / Planner switch: a big square spanning both header rows ---------- */
.pause-btn {
  grid-area: pause; align-self: stretch;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 124px; padding: 8px 14px;
  background: transparent;
  border: 2px solid var(--panel-border);
  color: var(--text);
  border-radius: 10px;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.pause-glyph { font-size: 2.8rem; line-height: 1; }
.pause-text {
  display: flex; flex-direction: column; text-align: left;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.25;
}
@media (max-width: 640px) {
  .pause-btn { min-width: 96px; gap: 6px; padding: 6px 8px; }
  .pause-glyph { font-size: 2.2rem; }
}
.pause-btn:hover { border-color: var(--err); color: var(--err); }
body.is-paused .pause-btn {
  border-color: var(--ok);
  background: var(--ok);
  color: #06210F;
}
body.is-paused .pause-btn:hover { border-color: var(--ok); color: #06210F; }

/* Planner mode reads as a different place, not just a taller page. */
body.is-paused { background: var(--bg-planner); }
body.is-paused .panel-tile,
body.is-paused .quickadd-bar input { border-color: #46242A; }

/* Daily Goals panel sits in its own shade so the blue reads as "this type". */
.panel-tile[data-panel="dailyGoals"] { background: #181F27; }

/* Mission panel picks up the running task's type colour. */
.mission-tile.type-one_time { border-color: var(--type-one_time); background: var(--type-one_time-bg); }
.mission-tile.type-ongoing { border-color: var(--type-ongoing); background: var(--type-ongoing-bg); }
.mission-tile.type-daily_goal { border-color: var(--type-daily_goal); background: var(--type-daily_goal-bg); }
.mission-tile.type-daily { border-color: var(--type-daily); background: var(--type-daily-bg); }
.mission-tile.type-recurring_fixed { border-color: var(--type-recurring_fixed); background: var(--type-recurring_fixed-bg); }
.mission-tile.type-recurring_rolling { border-color: var(--type-recurring_rolling); background: var(--type-recurring_rolling-bg); }

/* Controls that only make sense while the Planner is open. */
body:not(.is-paused) .planner-only { display: none !important; }

/* All Tasks, grouped by type */
.inbox-panel { border-color: var(--type-inbox); background: rgba(124, 131, 148, 0.06); }
.inbox-panel h2 { color: var(--text); }
.task-group-head {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 16px 0 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--panel-border);
}
.task-group-head:first-child { margin-top: 0; }
.task-item {
  border-left: 3px solid var(--panel-border);
  padding-left: 10px;
  border-radius: 4px;
}
.task-item.type-one_time { border-left-color: var(--type-one_time); background: var(--type-one_time-bg); }
.task-item.type-ongoing { border-left-color: var(--type-ongoing); background: var(--type-ongoing-bg); }
.task-item.type-daily_goal { border-left-color: var(--type-daily_goal); background: var(--type-daily_goal-bg); }
.task-item.type-daily { border-left-color: var(--type-daily); background: var(--type-daily-bg); }
.task-item.type-recurring_fixed { border-left-color: var(--type-recurring_fixed); background: var(--type-recurring_fixed-bg); }
.task-item.type-recurring_rolling { border-left-color: var(--type-recurring_rolling); background: var(--type-recurring_rolling-bg); }

/* ---- Planner panels: bigger titles, count badges, collapsible Done/Archive ---- */
.panel-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel h2.panel-title, .panel-toggle .panel-title {
  font-size: 1.15rem; font-weight: 600; color: var(--text); margin: 0;
  display: flex; align-items: center; gap: 10px;
}
.count-badge {
  font-size: 0.72rem; font-weight: 500; color: var(--muted);
  background: rgba(255, 255, 255, 0.06); border-radius: 999px;
  padding: 1px 9px; min-width: 1.8em; text-align: center;
}
.panel-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin: 0 0 12px; padding: 0; background: none; border: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.panel-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.panel-toggle .chev {
  width: 0; height: 0; flex-shrink: 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 7px solid var(--muted);
  transition: transform 0.15s ease;
}
.panel-toggle .panel-icon { display: inline-flex; }
.panel-toggle .panel-icon .ico { width: 1.15rem; height: 1.15rem; }
#donePanel .panel-icon { color: var(--done); }
#archivePanel .panel-icon { color: var(--muted); }
.panel.collapsed .panel-toggle { margin-bottom: 0; }
.panel.collapsed .panel-toggle .chev { transform: rotate(-90deg); }
.panel.collapsed .panel-collapse-body { display: none; }

/* ---- Filter / search / sort toolbar, active-filter chips, bulk-select bar ---- */
.pl-toolbar { position: relative; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.pl-search {
  flex: 1 1 180px; min-width: 0; background: #14171F; border: 1px solid var(--panel-border); color: var(--text);
  padding: 7px 10px; border-radius: 6px; font-size: 0.85rem; font-family: inherit;
}
.pl-search:focus { outline: none; border-color: var(--accent); }
.pl-btn {
  background: none; border: 1px solid var(--panel-border); color: var(--muted);
  padding: 6px 12px; border-radius: 6px; font-size: 0.78rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; font-family: inherit;
}
.pl-btn:hover { color: var(--text); }
.pl-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.pl-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pl-btn:disabled:hover { color: var(--muted); }
.pl-btn-danger { color: var(--err); border-color: var(--err); }
.pl-btn-danger:hover { color: var(--err); }
.pl-btn .ico { width: 1em; height: 1em; }
.pl-badge { color: var(--accent); font-weight: 600; }
/* Menus anchor to the toolbar (not their button) so the filter popover can't overflow a phone screen. */
.pl-toolbar .dropdown { position: static; }
/* Filter panel: a normal block under the toolbar — opening it pushes the rows down instead of covering them. */
.pl-filter-panel {
  display: flex; flex-direction: column; gap: 14px; padding: 12px; margin-bottom: 10px;
  border: 1px solid var(--panel-border); border-radius: 8px; background: rgba(255, 255, 255, 0.03);
}
.pl-filter-panel[hidden] { display: none; }
.pl-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.dropdown-menu.pl-sort-menu { left: auto; right: 0; top: 100%; }
.dropdown-menu.pl-sort-menu button.sel { color: var(--accent); }
.dropdown-menu.pl-sort-menu button.sel::before { content: "\2713"; margin-right: 6px; }
.pl-facet-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px;
}
.pl-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pl-seg { display: inline-flex; border: 1px solid var(--panel-border); border-radius: 6px; overflow: hidden; }
.pl-seg button { background: none; border: none; padding: 2px 10px; font-size: 0.7rem; color: var(--muted); cursor: pointer; font-family: inherit; }
.pl-seg button.on { background: rgba(242, 183, 5, 0.15); color: var(--accent); }
.pl-active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.pl-active-filters:empty { display: none; }
.pl-af {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 10px;
  border: 1px solid var(--accent); border-radius: 999px; font-size: 0.72rem; color: var(--accent);
}
.pl-af button { background: none; border: none; color: inherit; cursor: pointer; font-size: 0.95rem; line-height: 1; padding: 0 7px; }
.pl-clear { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.75rem; text-decoration: underline; padding: 0 4px; font-family: inherit; }
.pl-bulkbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px; margin-bottom: 10px;
  border: 1px solid var(--panel-border); border-radius: 8px; background: rgba(255, 255, 255, 0.03); font-size: 0.8rem;
}
.pl-selectall { display: flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
.pl-selectall input, .row-check input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); cursor: pointer; }
.pl-picked { color: var(--muted); }
.pl-bulk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
/* The checkbox column is also the drag/shift-click handle: big touch target, no scroll or text-select while dragging. */
.row-check { display: flex; align-items: center; align-self: stretch; padding: 0 12px 0 2px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.pl-hint { flex-basis: 100%; font-size: 0.7rem; color: var(--muted); }

/* ---- Task rows: status icon + name + duration pill on one line ---- */
.task-main { flex: 1 1 220px; min-width: 0; }   /* 220px basis: below that the actions wrap beneath */
.task-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.task-title .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st { display: inline-flex; align-items: center; justify-content: center; width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.st .ico { width: 1.15rem; height: 1.15rem; }
.st-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: currentColor; }
.st-active { color: var(--ok); }
.st-inactive, .st-archived { color: var(--muted); }
.st-done { color: var(--done); }
.st-held { color: var(--accent); }
.dur-pill {
  flex-shrink: 0; font-size: 0.72rem; font-weight: 600; color: var(--text);
  background: rgba(255, 255, 255, 0.08); border-radius: 999px; padding: 1px 9px;
}
.subtask-count { color: var(--subtask); font-weight: 500; }
.subtask-count.all { color: var(--ok); }

/* Mission checklist: under the buttons, scrolls if it's long. */
.mission-checklist {
  margin: 20px auto 0; max-width: 48ch; text-align: left;
  border: 1px solid var(--panel-border); border-radius: 8px; background: rgba(255, 255, 255, 0.03);
}
.checklist-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  border-bottom: 1px solid var(--panel-border);
}
.checklist-count { color: var(--subtask); font-weight: 600; margin-left: 4px; }
.checklist-count.all { color: var(--ok); }
.checklist-complete {
  background: var(--ok); border: none; color: #06210F; border-radius: 6px; padding: 4px 10px;
  font-size: 0.72rem; font-weight: 700; cursor: pointer; text-transform: none; letter-spacing: 0;
}
.checklist-items { list-style: none; margin: 0; padding: 4px 0; max-height: 11em; overflow-y: auto; }
.checklist-items li label { display: flex; align-items: flex-start; gap: 10px; padding: 7px 12px; font-size: 0.9rem; cursor: pointer; }
.checklist-items input[type="checkbox"] { width: 1.1rem; height: 1.1rem; margin-top: 2px; accent-color: var(--ok); cursor: pointer; flex-shrink: 0; }
.checklist-items input:checked + span { color: var(--muted); text-decoration: line-through; }

.ico { width: 1em; height: 1em; vertical-align: -0.12em; flex-shrink: 0; }
.task-actions button, .daily-goal-actions button, .btn-row button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-row .ico { width: 1.05em; height: 1.05em; margin-right: 6px; }
.q-icon .ico, .task-actions .ico, .daily-goal-actions .ico { width: 1.05em; height: 1.05em; }
.q-icon { display: inline-flex; align-items: center; justify-content: center; }

/* ---- Idle alerting: paused too long, or overtime with no action ---- */
@keyframes missionPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 96, 122, 0); }
  50%      { box-shadow: 0 0 0 6px rgba(224, 96, 122, 0.28); }
}
@keyframes resumeFlash {
  0%, 100% { background: var(--accent); border-color: var(--accent); color: #1A1400; }
  50%      { background: transparent; border-color: var(--accent); color: var(--accent); }
}
body.idle-alert .mission-tile { animation: missionPulse 1.5s ease-in-out infinite; }
body.idle-alert .pause-btn { animation: resumeFlash 0.9s ease-in-out infinite; }

.returning-kind { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; }
.returning-kind.hold { color: #b389f9; }
.returning-kind.snooze { color: var(--accent); }
.returning-kind.scheduled_fixed, .returning-kind.scheduled_for { color: #22d3ee; }
.returning-kind.scheduled_rolling { color: #f87171; }
.returning-kind.daily, .returning-kind.daily_wait { color: var(--type-daily); }
#startAfterTime:disabled { opacity: 0.4; cursor: not-allowed; }
.field-hint { font-size: 0.75rem; color: var(--muted); margin-top: 2px; margin-bottom: 8px; line-height: 1.4; }
.field-hint.is-error { color: var(--err, #E0607A); }
