/* ==========================================================================
   Design tokens (light default, dark via data-theme or system preference)
   ========================================================================== */

:root {
  --font: "Segoe UI", "Rubik", "Heebo", "Assistant", Arial, sans-serif;
  --radius: 14px;
  --radius-sm: 9px;

  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --hover: rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 14px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.25);
  --primary: #4f46e5;
  --primary-contrast: #ffffff;
  --danger: #dc2626;
  --success: #16a34a;

  /* Status colors */
  --st-todo: #64748b;
  --st-in_progress: #0284c7;
  --st-waiting: #d97706;
  --st-done: #16a34a;

  color-scheme: light;
}

/* Dark tokens: applied by the theme toggle, or by the OS preference before JS sets data-theme */
:root[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #0f172a;
  --border: #1f2a3c;
  --border-strong: #334155;
  --text: #e5e7eb;
  --text-muted: #94a3b8;
  --hover: rgba(255, 255, 255, 0.06);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
  --primary: #818cf8;
  --primary-contrast: #0b1120;
  --danger: #f87171;
  --success: #4ade80;
  --st-todo: #94a3b8;
  --st-in_progress: #38bdf8;
  --st-waiting: #fbbf24;
  --st-done: #4ade80;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #0f172a;
    --border: #1f2a3c;
    --border-strong: #334155;
    --text: #e5e7eb;
    --text-muted: #94a3b8;
    --hover: rgba(255, 255, 255, 0.06);
    --primary: #818cf8;
    --primary-contrast: #0b1120;
    color-scheme: dark;
  }
}

/* A themed world of the people view (app.js sets html[data-world] and --world-accent) tints the accent;
   a holiday's color (below) still wins over it. */
:root[data-world] { --primary: var(--world-accent); }
:root[data-theme="dark"][data-world] { --primary: var(--world-accent-dark); }

/* Seasonal themes (seasons.js sets html[data-season]): accent color, a bunting under the top bar and a soft glow.
   --season-a/b/c are the bunting colors. Dark variants only lighten the accent. */
:root[data-season="rosh-hashana"] { --primary: #be123c; --season-a: #be123c; --season-b: #f59e0b; --season-c: #15803d; }
:root[data-season="sukkot"] { --primary: #15803d; --season-a: #15803d; --season-b: #ca8a04; --season-c: #84cc16; }
:root[data-season="hanukkah"] { --primary: #1d4ed8; --season-a: #1d4ed8; --season-b: #eab308; --season-c: #60a5fa; }
:root[data-season="tu-bishvat"] { --primary: #be185d; --season-a: #f9a8d4; --season-b: #16a34a; --season-c: #a16207; }
:root[data-season="purim"] { --primary: #9333ea; --season-a: #9333ea; --season-b: #f59e0b; --season-c: #ec4899; }
:root[data-season="pesach"] { --primary: #4d7c0f; --season-a: #84cc16; --season-b: #d4a373; --season-c: #f472b6; }
:root[data-season="atzmaut"] { --primary: #1d4ed8; --season-a: #1d4ed8; --season-b: #ffffff; --season-c: #60a5fa; }
:root[data-season="lag-baomer"] { --primary: #ea580c; --season-a: #ea580c; --season-b: #facc15; --season-c: #92400e; }
:root[data-season="shavuot"] { --primary: #a16207; --season-a: #facc15; --season-b: #ffffff; --season-c: #22c55e; }

:root[data-theme="dark"][data-season="rosh-hashana"] { --primary: #fb7185; }
:root[data-theme="dark"][data-season="sukkot"] { --primary: #4ade80; }
:root[data-theme="dark"][data-season="hanukkah"] { --primary: #60a5fa; }
:root[data-theme="dark"][data-season="tu-bishvat"] { --primary: #f9a8d4; }
:root[data-theme="dark"][data-season="purim"] { --primary: #c084fc; }
:root[data-theme="dark"][data-season="pesach"] { --primary: #a3e635; }
:root[data-theme="dark"][data-season="atzmaut"] { --primary: #60a5fa; }
:root[data-theme="dark"][data-season="lag-baomer"] { --primary: #fb923c; }
:root[data-theme="dark"][data-season="shavuot"] { --primary: #facc15; }

[data-status="todo"] { --st: var(--st-todo); }
[data-status="in_progress"] { --st: var(--st-in_progress); }
[data-status="waiting"] { --st: var(--st-waiting); }
[data-status="done"] { --st: var(--st-done); }

/* ==========================================================================
   Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.icon { flex: none; display: block; }
.muted { color: var(--text-muted); }
.small { font-size: 0.86rem; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.noscript { text-align: center; padding: 40px; }

/* Screens: only the one matching body[data-view] is shown */
body:not([data-view="app"]) .topbar,
body:not([data-view="app"]) .layout,
body:not([data-view="app"]) .fab { display: none; }

/* ==========================================================================
   Buttons and form controls
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, filter 0.15s;
}
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost:hover { background: var(--hover); }
.btn-soft { background: var(--surface-2); border-color: var(--border); }
.btn-soft:hover { border-color: var(--border-strong); background: var(--hover); }
.btn-link { padding: 4px 6px; color: var(--primary); }
.btn-link:hover { text-decoration: underline; }
.btn-inline { padding: 0 6px; font-size: 0.8rem; font-weight: 600; }
.btn-block { width: 100%; padding-block: 10px; }
.btn-danger-soft { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-danger-soft:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.btn-sm { padding: 6px 10px; font-size: 0.88rem; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
/* Looks disabled but stays clickable, so a click can explain why the action is not available */
.icon-btn.is-unavailable { opacity: 0.4; }
.icon-btn.is-unavailable:hover { background: transparent; color: var(--text-muted); }

.select,
.field input,
.field textarea,
.category-form input[type="text"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.select:focus,
.field input:focus,
.field textarea:focus,
.category-form input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
option { color: var(--text); background: var(--surface); }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
}
.toggle input { width: 16px; height: 16px; accent-color: var(--primary); }

/* Text that edits in place: looks like plain text until hovered or focused */
.inline-edit {
  width: 100%;
  min-width: 0;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  text-overflow: ellipsis;
}
.inline-edit:hover { border-color: var(--border); }
.inline-edit:focus { outline: none; border-color: var(--primary); background: var(--surface); }

.color-input {
  width: 38px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
}

/* ==========================================================================
   Loading and login screens
   ========================================================================== */

.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-muted);
}
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-card {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.4rem; }
.auth-card > p { margin: 0 0 6px; }
.auth-form { width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: start; }
.auth-form input { font-size: 1rem; }
.auth-message { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 0.9rem; }
.auth-message[data-tone="error"] { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.auth-message[data-tone="info"] { color: var(--text); background: color-mix(in srgb, var(--primary) 10%, transparent); }
.auth-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; }

/* ==========================================================================
   Top bar and layout
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { font-size: 1.25rem; font-weight: 800; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.sync-status[data-sync-status="synced"] { color: var(--success); }
.sync-status[data-sync-status="saving"] .icon,
.sync-status[data-sync-status="connecting"] .icon { animation: pulse-opacity 1s ease-in-out infinite; }
.sync-status[data-sync-status="error"] { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
@keyframes pulse-opacity { 50% { opacity: 0.35; } }

.layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 24px 100px;
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

.dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dash-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--st);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s, background-color 0.15s;
}
.dash-card:hover { transform: translateY(-1px); }
.dash-card.is-active {
  background: color-mix(in srgb, var(--st) 7%, var(--surface));
  outline: 2px solid var(--st);
  outline-offset: -1px;
}
.dash-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 11px;
  color: var(--st);
  background: color-mix(in srgb, var(--st) 14%, transparent);
}
.dash-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dash-title { font-weight: 700; font-size: 0.95rem; }
.dash-sub { color: var(--text-muted); font-size: 0.8rem; }
.dash-value { font-size: 1.9rem; font-weight: 800; color: var(--st); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Filters
   ========================================================================== */

.filters { display: flex; flex-direction: column; gap: 10px; }
.filters-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters-selects { display: flex; gap: 8px; }

.search {
  display: flex;
  flex: 1 1 260px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.search:focus-within { border-color: var(--primary); }
.search input { flex: 1; min-width: 0; padding: 9px 0; border: none; outline: none; background: transparent; color: var(--text); }

.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.chip:hover { border-color: var(--border-strong); }
.chip.is-active {
  color: var(--text);
  border-color: var(--chip-color, var(--primary));
  background: color-mix(in srgb, var(--chip-color, var(--primary)) 13%, var(--surface));
}
.dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--chip-color, var(--st)); }
.chip-edit { color: var(--primary); border-style: dashed; }
.chip-edit:hover { border-color: var(--primary); }

/* ==========================================================================
   Backup banner and empty state
   ========================================================================== */

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: var(--radius-sm);
}
.banner .icon { color: var(--primary); }
.banner-text { flex: 1; min-width: 200px; font-size: 0.92rem; }

.empty-state {
  grid-column: 1 / -1;
  padding: 48px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-state h2 { font-size: 1.15rem; margin-bottom: 6px; }
.empty-state p { margin: 0 auto 16px; max-width: 460px; color: var(--text-muted); }
.empty-actions { display: flex; justify-content: center; gap: 8px; }

/* ==========================================================================
   Task grid: square tiles
   ========================================================================== */

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

.task-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px 14px;
  overflow: hidden;
  /* Top: category color (stripe + a short fade). Body and frame: status color (data-status sets --st).
     To-do stays a plain card, so the active statuses stand out clearly against it. */
  --tile-tint: 17%;
  --tile-frame: 50%;
  background:
    linear-gradient(to bottom, color-mix(in srgb, var(--cat-color) 14%, transparent), transparent 26%),
    color-mix(in srgb, var(--st, var(--st-todo)) var(--tile-tint), var(--surface));
  border: 1px solid color-mix(in srgb, var(--st, var(--st-todo)) var(--tile-frame), var(--border));
  border-top: 5px solid var(--cat-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: box-shadow 0.15s, transform 0.15s;
}
.task-tile:hover {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--st, var(--st-todo)) 55%, var(--border-strong)), var(--shadow);
  transform: translateY(-1px);
}
.task-tile[data-status="todo"] { --tile-tint: 0%; --tile-frame: 20%; }
.task-tile.is-done { opacity: 0.75; }
.task-tile.is-done .tile-title { text-decoration: line-through; }

.tile-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 0.8rem; }
.cat-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-weight: 700; color: var(--text); }
.tile-grip { color: var(--text-muted); opacity: 0.55; }
.task-tile:hover .tile-grip { opacity: 1; }

/* The title button covers the whole tile, so a click anywhere opens the task details */
.tile-open {
  padding: 0;
  text-align: start;
  background: none;
  border: none;
  cursor: inherit;
}
.tile-open::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.tile-open:focus-visible { outline: none; }
.tile-open:focus-visible::after { outline: 2px solid var(--primary); outline-offset: -2px; }
.tile-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.3;
}
/* Controls inside a tile sit above the stretched title button */
.no-drag, .tile-subtask .done-toggle { position: relative; z-index: 2; }

.tile-subtasks {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
}
.tile-subtask { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 0.86rem; }
.tile-subtask-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tile-subtask:is([data-status="in_progress"], [data-status="waiting"]) .tile-subtask-title { color: var(--st); font-weight: 600; }
.tile-subtask[data-status="done"] .tile-subtask-title { color: var(--text-muted); text-decoration: line-through; }
.tile-more { font-size: 0.78rem; color: var(--text-muted); }

/* Small status button at the end of each tile subtask: a status-colored dot and an arrow.
   The real control is a native select stretched over it and made invisible. */
.status-mini {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
  height: 20px;
  margin-inline-start: auto;
  padding-inline: 6px 4px;
  color: var(--st);
  background: color-mix(in srgb, var(--st) 13%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--st) 38%, transparent);
  border-radius: 999px;
}
.status-mini .dot { width: 8px; height: 8px; background: var(--st); }
.status-mini:hover { background: color-mix(in srgb, var(--st) 24%, var(--surface)); }
.status-mini:focus-within { outline: 2px solid var(--primary); outline-offset: 1px; }
.status-mini-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.tile-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Drag and drop (drag.js): the tile floats under the pointer, a dashed square marks where it will land */
.tile-placeholder {
  aspect-ratio: 1 / 1;
  border: 2px dashed color-mix(in srgb, var(--primary) 45%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary) 7%, transparent);
}
.task-tile.is-floating {
  position: fixed;
  z-index: 100;
  margin: 0;
  aspect-ratio: auto;
  pointer-events: none;
  cursor: grabbing;
  box-shadow: var(--shadow-lg);
  transform: rotate(2deg) scale(1.04);
  transition: none;
}
body.is-dragging-tile { cursor: grabbing; user-select: none; -webkit-user-select: none; }

/* ==========================================================================
   Shared small parts: status pill, progress, done toggle, time in progress
   ========================================================================== */

.since { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.progress { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.progress-bar { width: 56px; height: 6px; overflow: hidden; border-radius: 999px; background: var(--border); }
.progress-fill { display: block; height: 100%; width: var(--pct); background: var(--st-done); border-radius: inherit; }

/* Status pill: a colored chip wrapping a native select */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding-inline: 10px 4px;
  color: var(--st);
  background: color-mix(in srgb, var(--st) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--st) 32%, transparent);
  border-radius: 999px;
}
.status-chip .dot { width: 8px; height: 8px; background: var(--st); }
.status-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 0 0 18px;
  border: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat left 2px center / 12px;
  color: inherit;
  font-size: 0.84rem;
  font-weight: 700;
}
.status-select:focus { outline: none; }
.status-chip:focus-within { outline: 2px solid var(--primary); outline-offset: 1px; }
/* A task's status is derived from its subtasks, so its pill is a label, not a select */
.status-chip.is-readonly { padding-inline: 10px; }
.status-label { font-size: 0.84rem; font-weight: 700; white-space: nowrap; }

.done-toggle {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  padding: 0;
  color: transparent;
  background: transparent;
  border: 2px solid var(--border-strong);
  border-radius: 7px;
}
.done-toggle.is-mini { width: 18px; height: 18px; border-radius: 6px; }
.done-toggle:hover { border-color: var(--st-done); color: color-mix(in srgb, var(--st-done) 70%, transparent); }
.done-toggle.is-checked { color: #fff; background: var(--st-done); border-color: var(--st-done); }

/* ==========================================================================
   Task detail dialog
   ========================================================================== */

.detail-head { display: flex; align-items: center; gap: 8px; }
.detail-color { width: 6px; align-self: stretch; flex: none; border-radius: 3px; background: var(--cat-color); }
.detail-title { font-size: 1.2rem; font-weight: 800; }

.detail-subtasks { display: flex; flex-direction: column; gap: 8px; }
.detail-subtasks h3 { font-size: 0.98rem; }

.subtasks { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.subtask {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
}
.subtask:hover { background: var(--surface-2); }
.subtask[data-status="done"] .subtask-title { text-decoration: line-through; color: var(--text-muted); }
.subtask-main { display: flex; flex: 1; align-items: center; min-width: 0; }
.subtask-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; font-size: 0.8rem; color: var(--text-muted); }

.add-subtask { display: flex; align-items: center; gap: 8px; }
.add-subtask-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: 9px;
}
.add-subtask-input:focus { outline: none; border-style: solid; border-color: var(--primary); background: var(--surface); }

/* ==========================================================================
   Dialogs
   ========================================================================== */

dialog {
  width: min(580px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}
dialog.detail-dialog { width: min(680px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px); }

.dialog-body { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-head h2 { font-size: 1.2rem; }
.dialog-foot { display: flex; align-items: center; gap: 8px; padding-top: 4px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { display: flex; align-items: center; gap: 4px; font-weight: 600; font-size: 0.9rem; }
.field-label small { color: var(--text-muted); font-weight: 400; }
.field-value { display: flex; align-items: center; gap: 10px; min-height: 38px; color: var(--text-muted); font-size: 0.86rem; }
.field-hint { margin: 0; color: var(--text-muted); font-size: 0.8rem; }
.field-row .field.is-wide { flex-grow: 2; }
.field textarea { resize: vertical; min-height: 70px; }
.field-row { display: flex; flex-wrap: wrap; gap: 12px; }
.field-row .field { flex: 1 1 200px; }

.categories-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.category-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
}
.category-row.is-palette-open { border-color: var(--border-strong); }
.category-main { display: flex; align-items: center; gap: 8px; }
/* Connects the category to an agent profile (engine + account) */
.category-agent { display: flex; align-items: center; gap: 8px; padding-inline-start: 38px; color: var(--text-muted); }
.category-agent .icon { color: var(--primary); }
.category-agent .select { flex: 1; min-width: 0; padding: 5px 8px; }
/* The name is always shown as a field, so it is clear it can be edited */
.category-name { flex: 1; padding: 6px 8px; font-weight: 600; border-color: var(--border); background: var(--surface); }
.category-usage { white-space: nowrap; }
.swatch.color-btn { width: 30px; height: 30px; flex: none; }
.color-btn[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--text); }
.category-palette { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-inline-start: 38px; padding-bottom: 2px; }
.custom-color { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; color: var(--text-muted); cursor: pointer; }
.custom-color .color-input { width: 34px; height: 30px; }

.category-form { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.category-form h3 { font-size: 0.98rem; }
.category-form-row { display: flex; align-items: center; gap: 8px; }
.category-form-row input[type="text"] { flex: 1; min-width: 0; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--swatch);
  border: 2px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border-strong);
}
.swatch.is-selected { box-shadow: 0 0 0 2px var(--text); }

.settings-section { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.settings-section h3 { font-size: 0.98rem; }
.settings-section p { margin: 0; }
.setting-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.92rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ==========================================================================
   Floating "new task" button (phones) and toasts
   ========================================================================== */

.fab {
  position: fixed;
  inset-inline-start: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 20;
  display: none;
  place-items: center;
  width: 58px;
  height: 58px;
  color: var(--primary-contrast);
  background: var(--primary);
  border: none;
  border-radius: 50%;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 45%, transparent);
}
.fab .icon { width: 26px; height: 26px; }

.toast-region {
  position: fixed;
  inset-inline: 0;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  color: #f8fafc;
  background: #1e293b;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.2s ease-out;
}
.toast-success { background: #166534; }
.toast-warning { background: #92400e; }
.toast-error { background: #991b1b; }
.toast-action {
  padding: 4px 10px;
  color: #fff;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.16);
  border: none;
  border-radius: 8px;
}
.toast-action:hover { background: rgba(255, 255, 255, 0.28); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Seasonal theme: bunting under the top bar, background glow, badge, emblems
   ========================================================================== */

:root[data-season] body {
  background-image:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--season-a) 11%, transparent), transparent 45%),
    radial-gradient(circle at 0 100%, color-mix(in srgb, var(--season-c) 9%, transparent), transparent 40%);
  background-attachment: fixed;
}
/* Small triangular flags in the three season colors, hanging from the top bar */
:root[data-season] .topbar::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 100%;
  height: 9px;
  pointer-events: none;
  background:
    conic-gradient(from 135deg at 50% 0, var(--season-a) 90deg, transparent 0) 0 0 / 72px 9px repeat-x,
    conic-gradient(from 135deg at 50% 0, var(--season-b) 90deg, transparent 0) 24px 0 / 72px 9px repeat-x,
    conic-gradient(from 135deg at 50% 0, var(--season-c) 90deg, transparent 0) 48px 0 / 72px 9px repeat-x;
  filter: drop-shadow(0 1px 0 rgba(15, 23, 42, 0.12));
}

.season-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 2px 10px 2px 4px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 11%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 999px;
  animation: pop-in 0.35s ease-out;
}
.season-greeting { overflow: hidden; text-overflow: ellipsis; }
.season-emblem { flex: none; display: block; }
.season-emblem .flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flicker 1.1s ease-in-out infinite alternate; }
@keyframes flicker {
  from { transform: scale(1, 1); opacity: 0.9; }
  to { transform: scale(0.85, 1.15); opacity: 1; }
}

/* ==========================================================================
   Today bar: "my day", "what now?", status report
   ========================================================================== */

.today-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 14px;
  background: linear-gradient(to left, color-mix(in srgb, #f59e0b 10%, var(--surface)), var(--surface) 60%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.today-bar.is-tools-only { padding: 0; background: none; border: none; box-shadow: none; }
.today-head { display: flex; align-items: center; gap: 8px; }
.today-head h2 { font-size: 1rem; white-space: nowrap; }
.today-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #f59e0b;
  background: color-mix(in srgb, #f59e0b 16%, transparent);
  border-radius: 9px;
}
.today-count {
  padding: 1px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.today-list { display: flex; flex: 1; flex-wrap: wrap; gap: 6px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.today-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 320px;
  min-width: 0;
  padding-block: 3px;
  padding-inline: 8px 2px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--chip-color) 40%, var(--border));
  border-radius: 999px;
  animation: pop-in 0.25s ease-out;
}
.today-item-open {
  display: inline-flex;
  flex: 1;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 0;
  text-align: start;
  background: none;
  border: none;
}
.today-item-open .dot { align-self: center; }
.today-item-title { overflow: hidden; font-size: 0.88rem; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.today-item-task { overflow: hidden; max-width: 130px; font-size: 0.76rem; color: var(--text-muted); white-space: nowrap; text-overflow: ellipsis; }
.today-item.is-done .today-item-title { color: var(--text-muted); text-decoration: line-through; }
.today-item-remove { width: 26px; height: 26px; }
.today-empty { flex: 1; min-width: 220px; margin: 0; font-size: 0.86rem; color: var(--text-muted); }
.today-tools { display: flex; gap: 6px; margin-inline-start: auto; }

/* "My day" marks: a sun on tile subtasks, an "on" sun button in the task dialog */
.tile-myday { display: inline-grid; flex: none; place-items: center; color: #f59e0b; }
.icon-btn.my-day-btn.is-on,
.icon-btn.my-day-btn.is-on:hover { color: #d97706; background: color-mix(in srgb, #f59e0b 16%, transparent); }
.btn.is-on { color: #b45309; background: color-mix(in srgb, #f59e0b 14%, var(--surface)); border-color: #f59e0b; }
:root[data-theme="dark"] .btn.is-on { color: #fbbf24; }

/* ==========================================================================
   Dust: open tasks nobody touched for 14 / 30 / 60 days
   ========================================================================== */

.task-tile[data-dust="1"] { filter: saturate(0.75) sepia(0.12); }
.task-tile[data-dust="2"] { filter: saturate(0.55) sepia(0.28); }
.task-tile[data-dust="3"] { filter: saturate(0.35) sepia(0.42) brightness(0.97); }
.tile-dust {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  background-image:
    radial-gradient(circle, rgba(120, 113, 108, 0.45) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(120, 113, 108, 0.3) 0 1.2px, transparent 1.8px);
  background-size: 23px 19px, 31px 27px;
  background-position: 0 0, 11px 7px;
  opacity: 0.55;
}
.task-tile[data-dust="2"] .tile-dust { opacity: 0.8; }
.task-tile[data-dust="3"] .tile-dust { opacity: 1; background-size: 17px 15px, 23px 21px; }

/* A cobweb in the corner (two levels of dust and up) */
.tile-cobweb,
.person-cobweb {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 48px;
  height: 48px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60' fill='none' stroke='rgb(120,113,108)' stroke-opacity='0.6' stroke-width='0.9'%3E%3Cpath d='M0 0L60 0M0 0L55 23M0 0L42 42M0 0L23 55M0 0L0 60'/%3E%3Cpath d='M18 0Q15 3 16.6 6.9Q13.5 9.5 12.7 12.7Q9.5 13.5 6.9 16.6Q3 15 0 18'/%3E%3Cpath d='M34 0Q29 5 31.4 13Q26 18 24 24Q18 26 13 31.4Q5 29 0 34'/%3E%3Cpath d='M50 0Q44 8 46.2 19.2Q39 28 35.4 35.4Q28 39 19.2 46.2Q8 44 0 50'/%3E%3C/svg%3E") no-repeat 0 0 / contain;
}
.tile-cobweb { border-top-left-radius: var(--radius); }
.dust-label { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; color: #a8a29e; }

.dust-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 12px;
  background: color-mix(in srgb, #a8a29e 15%, var(--surface));
  border: 1px dashed #a8a29e;
  border-radius: var(--radius-sm);
}
.dust-banner > .icon { color: #78716c; }
.dust-banner-text { flex: 1; min-width: 200px; font-size: 0.9rem; }
.dust-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ==========================================================================
   Voice dictation buttons
   ========================================================================== */

.input-with-mic { display: flex; align-items: center; gap: 6px; }
.input-with-mic input { flex: 1; min-width: 0; }
.mic-btn.is-recording,
.mic-btn.is-recording:hover { color: #fff; background: var(--danger); animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 50%, transparent); }
  50% { box-shadow: 0 0 0 7px transparent; }
}

/* ==========================================================================
   Celebration canvas, "what now?" and the status report
   ========================================================================== */

.effects-canvas { position: fixed; inset: 0; z-index: 300; width: 100%; height: 100%; pointer-events: none; }

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: none; }
}

dialog.next-dialog { width: min(480px, calc(100vw - 24px)); }
.next-reel,
.next-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 12px;
  text-align: center;
  border-radius: var(--radius);
}
.next-result { background: linear-gradient(to bottom, color-mix(in srgb, var(--cat-color) 13%, transparent), transparent); }
.next-dice {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 4px;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 18px;
}
.next-reel.is-spinning .next-dice { animation: dice-roll 0.45s linear infinite; }
.next-dice.is-landed { animation: dice-land 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes dice-roll { to { transform: rotate(360deg); } }
@keyframes dice-land {
  from { transform: scale(0.6) rotate(-120deg); }
  to { transform: none; }
}
.next-reel-text { max-width: 100%; min-height: 1.5em; overflow: hidden; font-size: 1.15rem; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
.next-kicker { font-size: 0.86rem; font-weight: 600; color: var(--text-muted); }
.next-subtask { font-size: 1.35rem; line-height: 1.3; animation: pop-in 0.35s ease-out; }
.next-task { font-size: 0.9rem; color: var(--text-muted); }
.next-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 4px; font-size: 0.84rem; }
.next-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.next-empty { margin: 8px 0; color: var(--text-muted); }

.report-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
#report-text { min-height: 230px; font-size: 0.9rem; line-height: 1.55; }
.report-actions { flex-wrap: wrap; }

/* ==========================================================================
   People view: an office of little characters (people-view.js, art.js, world-layout.js)
   ========================================================================== */

.people-scene {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.people-scene:has(> .empty-state) { overflow: visible; background: none; border: none; box-shadow: none; }
/* Full screen: the office covers the page (dialogs and toasts still open above it) */
.people-scene.is-fullscreen { position: fixed; inset: 0; z-index: 30; overflow: auto; border: none; border-radius: 0; }
body:has(.people-scene.is-fullscreen) { overflow: hidden; }
.people-root { display: flex; flex-direction: column; }

.scene-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.scene-title { font-size: 1.02rem; font-weight: 800; }
.scene-count { padding: 2px 10px; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; }
.scene-note { margin: 0; padding: 10px 16px; font-size: 0.84rem; color: var(--text-muted); border-top: 1px solid var(--border); }

/* The room: a wall with a trim on top, a wooden floor below. Its own stacking context keeps the
   characters' depth (z-index = how low they stand) inside it. */
.people-world {
  --wall: #e0e7ff;
  --wall-trim: #c7d2fe;
  --floor-a: #f1e3cf;
  --floor-b: #e8d6bd;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(to bottom, var(--wall) 0 calc(var(--wall-h, 120px) - 8px), var(--wall-trim) calc(var(--wall-h, 120px) - 8px) var(--wall-h, 120px), transparent var(--wall-h, 120px)),
    repeating-linear-gradient(90deg, var(--floor-a) 0 88px, var(--floor-b) 88px 90px),
    var(--floor-a);
}
:root[data-theme="dark"] .people-world { --wall: #1e293b; --wall-trim: #334155; --floor-a: #2b2533; --floor-b: #241f2b; }
:root[data-season] .people-world { --wall: color-mix(in srgb, var(--season-a) 13%, #eef2ff); --wall-trim: color-mix(in srgb, var(--season-a) 35%, #c7d2fe); }
:root[data-theme="dark"][data-season] .people-world { --wall: color-mix(in srgb, var(--season-a) 14%, #1e293b); --wall-trim: color-mix(in srgb, var(--season-a) 30%, #334155); }
.people-world > * { position: absolute; top: 0; left: 0; }
.decor, .station { pointer-events: none; }
:is(.decor, .station) > svg { display: block; width: 100%; height: auto; overflow: visible; }

/* Windows show the time of day; the clock tells the real time (people-view.js) */
.win-sky { fill: #7dd3fc; }
.people-world[data-time="morning"] .win-sky { fill: #fde68a; }
.people-world[data-time="evening"] .win-sky { fill: #fb923c; }
.people-world[data-time="night"] .win-sky { fill: #1e1b4b; }
.win-sun { fill: #fde047; }
.people-world[data-time="evening"] .win-sun { fill: #f97316; transform: translateY(16px); }
.win-moon { fill: #f1f5f9; }
.win-city { fill: #94a3b8; }
.people-world[data-time="night"] .win-city { fill: #312e81; }
.people-world:not([data-time="night"]) :is(.win-moon, .win-stars) { display: none; }
.people-world[data-time="night"] .win-sun { display: none; }
.people-world[data-time="night"] .win-cloud { opacity: 0.2; }
.win-cloud { animation: cloud-sway 14s ease-in-out infinite alternate; }
@keyframes cloud-sway { to { transform: translateX(9px); } }
.decor-coffee .p-steam { animation: steam 1.8s ease-in-out infinite; }
.cooler-bubble { animation: bubble-rise 3s ease-in infinite; }
.cooler-bubble-2 { animation-delay: 1.4s; }
@keyframes bubble-rise {
  0% { opacity: 0; transform: translateY(6px); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-18px); }
}
/* A desk of a task untouched for weeks gathers cobwebs too */
.station.is-dusty::after {
  content: "";
  position: absolute;
  top: 30%;
  right: 0;
  width: 46%;
  aspect-ratio: 1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60' fill='none' stroke='rgb(120,113,108)' stroke-opacity='0.6' stroke-width='0.9'%3E%3Cpath d='M60 0L0 0M60 0L5 23M60 0L18 42M60 0L37 55M60 0L60 60'/%3E%3Cpath d='M42 0Q45 3 43.4 6.9Q46.5 9.5 47.3 12.7Q50.5 13.5 53.1 16.6Q57 15 60 18'/%3E%3Cpath d='M26 0Q31 5 28.6 13Q34 18 36 24Q42 26 47 31.4Q55 29 60 34'/%3E%3C/svg%3E") no-repeat 0 0 / contain;
}

/* --- A character: a button positioned by people-view.js; only its drawn shapes and its name tag
       catch the pointer, so empty space around it does not block the ones behind --- */
.character {
  width: var(--character-w, 80px);
  margin: 0;
  padding: 0;
  color: var(--text);
  background: none;
  border: none;
  pointer-events: none;
  will-change: transform;
}
.character .person-art { display: block; width: 100%; height: auto; overflow: visible; }
.character .person-art :is(path, rect, circle, ellipse, line) { pointer-events: visiblePainted; cursor: pointer; }
.character .person-art :is(.p-shadow, .p-overlay *) { pointer-events: none; }
.character:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 14px; }
.character.is-leaving, .character.is-leaving * { pointer-events: none !important; }
.character-tag {
  position: absolute;
  top: calc(100% - 6px);
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 150px;
  padding: 1px 7px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat-color) 50%, transparent);
  border-radius: 999px;
  transform: translateX(-50%);
  pointer-events: auto;
  cursor: pointer;
}
.character-tag-text { overflow: hidden; text-overflow: ellipsis; }
.character-tag .dot { width: 6px; height: 6px; background: var(--st); }
.character-tag .icon { color: #f59e0b; }
.character[data-dust] .person-art { filter: grayscale(0.45) sepia(0.3); }
.character[data-dust="3"] .person-art { filter: grayscale(0.8) sepia(0.4); opacity: 0.85; }

/* Speech bubbles, above the head. --bubble-shift (people-view.js) slides a bubble back inside the
   office near its walls; the tail stays on the head. */
.bubble {
  position: absolute;
  top: calc(var(--character-w, 80px) * 0.22);
  left: 50%;
  z-index: 5;
  width: max-content;
  max-width: 200px;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  color: #0f172a;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16);
  pointer-events: none;
  transform: translate(calc(-50% + var(--bubble-shift, 0px)), -100%);
  animation: bubble-in 0.25s ease-out both;
}
.bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: calc(50% - var(--bubble-shift, 0px));
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-right: 1.5px solid #cbd5e1;
  border-bottom: 1.5px solid #cbd5e1;
  transform: translate(-50%, -5px) rotate(45deg);
}
@keyframes bubble-in {
  from { opacity: 0; transform: translate(calc(-50% + var(--bubble-shift, 0px)), -85%) scale(0.85); }
  to { opacity: 1; transform: translate(calc(-50% + var(--bubble-shift, 0px)), -100%); }
}

/* --- The figure's parts. Transform origins are in viewBox units (art.js): shoulders, hips, neck --- */
.person-art .p-shadow { fill: rgba(15, 23, 42, 0.16); }
.person-art .p-torso { fill: var(--cat-color); }
.person-art .p-torso-dark { fill: color-mix(in srgb, var(--cat-color) 70%, #000); }
.person-art .p-torso-dark-stroke { stroke: color-mix(in srgb, var(--cat-color) 62%, #000); }
.person-art .p-sleeve { stroke: color-mix(in srgb, var(--cat-color) 85%, #000); }
/* The figure kit's category-colored parts (figure-kit.js paint / stroke / limb), with an outline */
.person-art .p-cat { fill: var(--cat-color); }
.person-art .p-cat-dark { fill: color-mix(in srgb, var(--cat-color) 68%, #000); }
.person-art .p-cat-light { fill: color-mix(in srgb, var(--cat-color) 55%, #fff); }
.person-art :is(.p-cat, .p-cat-dark, .p-cat-light) { stroke: color-mix(in srgb, var(--cat-color) 50%, #000); stroke-width: 0.9; stroke-linejoin: round; }
.person-art .p-no-outline { stroke: none; }
.person-art .p-cat-stroke { stroke: var(--cat-color); }
.person-art .p-cat-dark-stroke { stroke: color-mix(in srgb, var(--cat-color) 68%, #000); }
.person-art .p-cat-light-stroke { stroke: color-mix(in srgb, var(--cat-color) 55%, #fff); }
.person-art .p-cat-outline-stroke { stroke: color-mix(in srgb, var(--cat-color) 50%, #000); }
.person-art :is(.p-bob, .p-figure, .p-arm, .p-leg, .p-head) { transform-box: view-box; }
.person-art .p-figure { transform-origin: 46px 0; }
.person-art .p-arm-back { transform-origin: 37px 62px; }
.person-art .p-arm-front { transform-origin: 55px 62px; }
.person-art .p-leg-back { transform-origin: 41px 88px; }
.person-art .p-leg-front { transform-origin: 51px 88px; }
.person-art .p-head { transform-origin: 46px 55px; }
.person-art :is(.p-blink, .p-mouth, .p-hourglass, .p-sparkle, .p-z, .p-screen-line, .p-sweat, .p-paint) { transform-box: fill-box; transform-origin: center; }
.station-art :is(.p-screen-line, .p-paint, .p-check) { transform-box: fill-box; transform-origin: center; }
.station-art .p-screen-line { transform-origin: left center; }

.character[data-facing="left"] .p-figure { transform: scaleX(-1); }

/* What shows when: the activity's prop only at the desk, the cup on a break, the thought while
   looking around, the sweat while working, z-z-z when sitting or asleep */
.character:not([data-pose="work"]) :is(.p-hand-prop, .p-sweat) { display: none; }
.person-art .p-cup { display: none; }
.character[data-pose="sip"] .p-cup { display: inline; }
.character:not(:is([data-pose="look"], [data-pose="think"])) .p-thought { display: none; }
.character:not(:is([data-pose="sit"], [data-pose="sleep"])) .p-z { display: none; }

/* Always: blink and breathe (delays vary so the office is not in sync) */
.person-art .p-blink { animation: blink 4.6s infinite; }
.person-art .p-bob { animation: bob 3.2s ease-in-out infinite; }
.character:nth-of-type(3n + 1) .p-blink { animation-delay: -1.7s; }
.character:nth-of-type(3n + 2) .p-blink { animation-delay: -3.1s; }
.character:nth-of-type(2n) .p-bob { animation-delay: -1.3s; }
.person-art .p-antenna { animation: antenna 1.6s steps(2) infinite; }
@keyframes blink {
  0%, 93%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}
@keyframes bob { 50% { transform: translateY(1.5px); } }
@keyframes antenna { 50% { opacity: 0.35; } }

/* Walking */
.character[data-pose="walk"] :is(.p-leg-back, .p-arm-front) { animation: swing 0.42s ease-in-out infinite alternate; }
.character[data-pose="walk"] :is(.p-leg-front, .p-arm-back) { animation: swing 0.42s ease-in-out infinite alternate-reverse; }
.character[data-pose="walk"] .p-bob { animation: walk-bob 0.21s ease-in-out infinite alternate; }
@keyframes swing {
  from { transform: rotate(-16deg); }
  to { transform: rotate(16deg); }
}
@keyframes walk-bob { to { transform: translateY(-2px); } }

/* Looking around and thinking (with a "?" thought for to-do characters) */
.character[data-pose="look"] .p-head { animation: look-around 5s ease-in-out infinite; }
.character[data-pose="think"] .p-arm-front { transform: rotate(-145deg); }
.character[data-pose="think"] .p-head { transform: rotate(6deg); }
.person-art .p-thought { animation: thought 6s ease-in-out infinite; }
@keyframes thought {
  0%, 20% { opacity: 0; }
  30%, 75% { opacity: 1; }
  85%, 100% { opacity: 0; }
}

/* Working at the desk: hands busy towards it, a pose per activity, and the desk comes alive */
.character[data-pose="work"] .p-arm-front { transform: rotate(-62deg); animation: type-front 0.34s ease-in-out infinite alternate; }
.character[data-pose="work"] .p-arm-back { transform: rotate(-46deg); animation: type-back 0.34s ease-in-out infinite alternate-reverse; }
.character[data-pose="work"] .p-head { animation: nod 1.6s ease-in-out infinite; }
.person-art .p-sweat { animation: sweat 1.6s ease-in infinite; }
.station.is-busy .p-screen-line { animation: screen-type 1.2s steps(3) infinite; }
.station.is-busy .p-fly { animation: fly 2.4s ease-in infinite; }
.station.is-busy .p-steam { animation: steam 1.8s ease-in-out infinite; }
.station.is-busy .p-check { animation: check-in 3s ease-out infinite; }
.station.is-busy .p-check-1 { animation-delay: 0.6s; }
.station.is-busy .p-check-2 { animation-delay: 1.2s; }
.station.is-busy .p-paint { animation: paint-pulse 2s ease-in-out infinite; }
@keyframes type-front {
  from { transform: rotate(-56deg); }
  to { transform: rotate(-70deg); }
}
@keyframes type-back {
  from { transform: rotate(-40deg); }
  to { transform: rotate(-52deg); }
}
@keyframes nod { 50% { transform: rotate(4deg); } }
@keyframes screen-type {
  from { transform: scaleX(0.3); }
  to { transform: scaleX(1); }
}
@keyframes fly {
  0% { opacity: 0; transform: translate(-10px, 18px) scale(0.6); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(18px, -16px) scale(1); }
}
@keyframes steam {
  0%, 100% { opacity: 0.2; transform: translateY(1px); }
  50% { opacity: 1; transform: translateY(-2px); }
}
@keyframes check-in {
  0%, 10% { opacity: 0; transform: scale(0.4); }
  25%, 85% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}
@keyframes paint-pulse { 50% { transform: scale(1.18); } }
@keyframes sweat {
  0% { opacity: 0; transform: translateY(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(10px); }
}
.character[data-pose="work"][data-activity="phone"] .p-arm-front { transform: rotate(-152deg); animation: phone-hold 2.2s ease-in-out infinite; }
.character[data-pose="work"][data-activity="phone"] .p-arm-back { transform: rotate(-30deg); animation: gesture 1.6s ease-in-out infinite alternate; }
.character[data-pose="work"][data-activity="cleaning"] :is(.p-arm-front, .p-arm-back) { transform: rotate(-25deg); animation: sweep 0.55s ease-in-out infinite alternate; }
.character[data-pose="work"][data-activity="design"] .p-arm-front { transform: rotate(-100deg); animation: paint-stroke 1.4s ease-in-out infinite; }
.character[data-pose="work"][data-activity="testing"] .p-arm-front { transform: rotate(-90deg); animation: inspect 1.9s ease-in-out infinite; }
.character[data-pose="work"][data-activity="sport"] .p-arm-front { transform: rotate(-80deg); animation: curl 0.9s ease-in-out infinite alternate; }
.character[data-pose="work"][data-activity="coffee"] .p-arm-front { transform: rotate(-40deg); animation: sip 4s ease-in-out infinite; }
.character[data-pose="work"][data-activity="people"] .p-arm-front { transform: rotate(-55deg); animation: none; }
.character[data-pose="work"][data-activity="people"] .p-arm-back { transform: rotate(-20deg); animation: gesture 1.4s ease-in-out infinite alternate; }
.character[data-pose="work"][data-activity="delivery"] :is(.p-arm-front, .p-arm-back) { transform: rotate(-72deg); animation: none; }
@keyframes phone-hold { 50% { transform: rotate(-158deg); } }
@keyframes gesture {
  from { transform: rotate(-15deg); }
  to { transform: rotate(-55deg); }
}
@keyframes sweep {
  from { transform: rotate(-8deg); }
  to { transform: rotate(-42deg); }
}
@keyframes paint-stroke {
  0%, 100% { transform: rotate(-92deg); }
  50% { transform: rotate(-118deg); }
}
@keyframes inspect {
  0%, 100% { transform: rotate(-80deg); }
  50% { transform: rotate(-105deg); }
}
@keyframes curl {
  from { transform: rotate(-20deg); }
  to { transform: rotate(-150deg); }
}
@keyframes sip {
  0%, 60%, 100% { transform: rotate(-40deg); }
  70%, 86% { transform: rotate(-138deg); }
}

/* A coffee break */
.character[data-pose="sip"] .p-arm-front { transform: rotate(-40deg); animation: sip 3.4s ease-in-out infinite; }

/* Waiting: tapping a foot, checking the watch, looking around; the hourglass turns */
.character[data-pose="wait"] .p-leg-front { animation: tap 0.45s ease-in-out infinite alternate; }
.character[data-pose="wait"] .p-arm-front { animation: check-watch 5s ease-in-out infinite; }
.character[data-pose="wait"] .p-head { animation: look-around 5s ease-in-out infinite; }
.person-art .p-hourglass { animation: hourglass-flip 3s ease-in-out infinite; }
@keyframes tap { to { transform: rotate(-10deg); } }
@keyframes check-watch {
  0%, 55%, 100% { transform: none; }
  65%, 85% { transform: rotate(-95deg); }
}
@keyframes look-around {
  30% { transform: rotate(-6deg); }
  65%, 85% { transform: rotate(8deg); }
}
@keyframes hourglass-flip {
  0%, 70% { transform: none; }
  85%, 100% { transform: rotate(180deg); }
}

/* Sitting (the sofa) and sleeping (at its dusty desk): legs out, body down; asleep, the head drops */
.character:is([data-pose="sit"], [data-pose="sleep"]) :is(.p-leg-back, .p-leg-front) { transform: rotate(-82deg); }
.character:is([data-pose="sit"], [data-pose="sleep"]) .p-bob { transform: translateY(13px); animation: none; }
.character:is([data-pose="sit"], [data-pose="sleep"]) :is(.p-arm-front, .p-arm-back) { transform: rotate(-22deg); }
.character[data-pose="sleep"] .p-head { transform: rotate(16deg) translateY(2px); }
.character[data-mood="bored"][data-pose="sit"] .p-head { transform: rotate(9deg) translateY(1px); }
.person-art .p-z { animation: z-float 3s ease-in infinite; }
.person-art .p-z-1 { animation-delay: 1s; }
.person-art .p-z-2 { animation-delay: 2s; }
@keyframes z-float {
  0% { opacity: 0; transform: translate(0, 4px); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translate(5px, -8px); }
}

/* Dancing (done): jumping with the arms up, sparkles around */
.character[data-pose="dance"] .p-bob { animation: jump 0.7s cubic-bezier(0.3, 0.7, 0.4, 1) infinite; }
.character[data-pose="dance"] .p-arm-front { transform: rotate(-160deg); animation: dance-front 0.7s ease-in-out infinite alternate; }
.character[data-pose="dance"] .p-arm-back { transform: rotate(150deg); animation: dance-back 0.7s ease-in-out infinite alternate; }
.person-art .p-sparkle { animation: sparkle 1.4s ease-in-out infinite; }
.person-art .p-sparkle-1 { animation-delay: 0.45s; }
.person-art .p-sparkle-2 { animation-delay: 0.9s; }
@keyframes jump {
  0%, 45%, 100% { transform: translateY(0); }
  22% { transform: translateY(-12px); }
}
@keyframes dance-front {
  from { transform: rotate(-165deg); }
  to { transform: rotate(-115deg); }
}
@keyframes dance-back {
  from { transform: rotate(155deg); }
  to { transform: rotate(110deg); }
}
@keyframes sparkle {
  0%, 100% { opacity: 0.3; transform: scale(0.4); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* Chatting: hands talk too; the mouth moves while a bubble is up */
.character[data-pose="chat"] .p-arm-back { animation: gesture 1.3s ease-in-out infinite alternate; }
.character[data-pose="chat"] .p-head { animation: nod 2.2s ease-in-out infinite; }
.character.is-talking .p-mouth { animation: talk 0.22s ease-in-out infinite alternate; }
@keyframes talk { to { transform: scaleY(1.9); } }

/* A task finished just now: a quick victory jump with the arms up (beats any pose) */
.character.is-cheering .p-bob { animation: jump 0.55s cubic-bezier(0.3, 0.7, 0.4, 1) 3; }
.character.character.is-cheering .p-arm-front { transform: rotate(-160deg); animation: none; }
.character.character.is-cheering .p-arm-back { transform: rotate(150deg); animation: none; }

/* The bar's theme picker */
.world-picker { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 700; color: var(--text-muted); }
.world-picker .select { width: auto; max-width: 210px; padding-block: 5px; font-size: 0.85rem; }

/* Themed scenery that moves (art-worlds.js classes; its stations' p-fly / p-steam / p-screen-line use the office's rules) */
:is(.station-art, .decor-art) .flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flicker 0.9s ease-in-out infinite alternate; }
:is(.station-art, .decor-art, .person-art) :is(.p-bubble, .p-glow, .p-spark, .p-holo, .p-wobble, .p-dial, .p-sway, .p-rain) { transform-box: fill-box; transform-origin: center; }
.station-art .p-bubble { animation: cauldron-bubble 1.6s ease-in infinite; }
:is(.station-art, .decor-art) .p-glow { animation: glow 2.2s ease-in-out infinite; }
.station-art .p-spark { animation: sparkle 1.1s ease-in-out infinite; }
.station-art .p-holo { animation: holo 2.4s ease-in-out infinite; }
.station.is-busy .p-wobble { transform-origin: 50% 100%; animation: wobble 1.6s ease-in-out infinite; }
.station.is-busy .p-dial { animation: dial 3s steps(8) infinite; }
:is(.station-art, .decor-art) .p-blink-led { animation: antenna 1.3s steps(2) infinite; }
:is(.station-art, .decor-art) .p-blink-dot { animation: antenna 2s steps(2) infinite; }
.decor-art .p-sway { transform-origin: 50% 100%; animation: sway 3.4s ease-in-out infinite alternate; }
.decor-art .p-sway-2 { animation-delay: -1.7s; }
.decor-art .p-rain { animation: rain 0.9s linear infinite; }
.decor-art .p-pour { animation: glow 1.4s ease-in-out infinite; }
.person-art .p-torso-glow { stroke: var(--cat-color); }
/* Every animated shape repaints its whole drawing: a station rests while its task is not in progress (as the
   office's do), and characters keep their glows and flames still - 48 busy scenes stay smooth. */
.station:not(.is-busy) .station-art * { animation: none; }
@keyframes cauldron-bubble {
  0% { opacity: 0; transform: translateY(4px) scale(0.6); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px) scale(1.1); }
}
@keyframes glow { 50% { opacity: 0.55; } }
@keyframes holo {
  0%, 100% { opacity: 0.9; }
  45% { opacity: 0.5; }
  50% { opacity: 0.8; }
}
@keyframes wobble {
  0%, 60%, 100% { transform: rotate(0); }
  70% { transform: rotate(-9deg); }
  80% { transform: rotate(8deg); }
  90% { transform: rotate(-4deg); }
}
@keyframes dial { to { transform: rotate(360deg); } }
@keyframes sway {
  from { transform: skewX(-6deg); }
  to { transform: skewX(6deg); }
}
@keyframes rain {
  from { transform: translateY(-6px); }
  to { transform: translateY(6px); }
}

/* Ghosts, merfolk and cloud creatures float instead of walking (sitting, dancing and cheering keep their own moves) */
.character:is([data-kind="ghost"], [data-kind="merfolk"], [data-kind="cloud"]):not(.is-cheering, [data-pose="sit"], [data-pose="sleep"], [data-pose="dance"]) .p-bob { animation: ghost-float 3s ease-in-out infinite; }
.character:is([data-kind="ghost"], [data-kind="merfolk"], [data-kind="cloud"])[data-pose="walk"]:not(.is-cheering) .p-bob { animation: ghost-float 1.4s ease-in-out infinite; }
.character:is([data-kind="ghost"], [data-kind="merfolk"], [data-kind="cloud"]) .p-shadow { opacity: 0.4; }
@keyframes ghost-float { 50% { transform: translateY(-6px); } }

@media (max-width: 760px) {
  .season-badge { padding: 2px; }
  .season-greeting { display: none; }
  .today-bar { gap: 8px; padding: 10px; }
  .today-tools { width: 100%; margin-inline-start: 0; }
  .today-tools .btn { flex: 1; }
  .today-list { flex-basis: 100%; }
  .today-item { flex: 1 1 100%; max-width: 100%; }
  .tile-bottom .dust-label { display: none; }
  .scene-bar { padding: 8px 10px; }
  .character-tag { max-width: 96px; font-size: 0.6rem; }
  .bubble { max-width: 150px; font-size: 0.72rem; }
  .world-picker-label { display: none; }
  .world-picker .select { max-width: 150px; }
  .report-actions .btn { flex: 1 1 40%; }
}


/* ==========================================================================
   Agent farm: agent marks on tiles, the agent button of a subtask, the agent window, the machines list
   ========================================================================== */

/* Job states: queued - grey, running - amber (like "waiting"), done - blue (like "on me"), failed - red */
[data-job-status="queued"] { --job: var(--st-todo); }
[data-job-status="running"] { --job: var(--st-waiting); }
[data-job-status="done"] { --job: var(--st-in_progress); }
[data-job-status="failed"] { --job: var(--danger); }
[data-job-status="cancelled"] { --job: var(--text-muted); }

.tile-agent { display: inline-grid; place-items: center; margin-inline-end: auto; color: var(--primary); }
.tile-agent-mark { display: inline-grid; flex: none; place-items: center; color: var(--job); }
.tile-agent-mark:is([data-job-status="queued"], [data-job-status="running"]) { animation: agent-pulse 1.4s ease-in-out infinite; }
@keyframes agent-pulse { 50% { opacity: 0.35; } }

.agent-btn { gap: 5px; padding: 4px 9px; font-size: 0.8rem; }
.agent-btn[data-job-status] { color: var(--job); border-color: color-mix(in srgb, var(--job) 45%, var(--border)); }
.agent-btn:is([data-job-status="queued"], [data-job-status="running"]) .icon { animation: agent-pulse 1.4s ease-in-out infinite; }

dialog.agent-dialog { width: min(680px, calc(100vw - 24px)); }
#agent-dialog-title { display: inline-flex; align-items: center; gap: 8px; }
#agent-dialog-title .icon { color: var(--primary); }

.agent-context { display: flex; flex-direction: column; gap: 6px; }
.agent-subject { margin: 0; }
.agent-project { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text-muted); }
.agent-note { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.agent-note.is-warning { background: color-mix(in srgb, var(--st-waiting) 12%, transparent); }
.agent-note.is-quiet { color: var(--text-muted); }

.online-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--border-strong); }
.online-dot.is-online { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 20%, transparent); }

.agent-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: min(50vh, 460px);
  margin: 0;
  padding: 2px;
  overflow-y: auto;
  list-style: none;
}
.agent-empty { padding: 10px 0; }
.agent-turn { display: flex; flex-direction: column; gap: 8px; }
.agent-msg { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.agent-msg.is-me { align-self: flex-start; max-width: 92%; background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.agent-msg.is-agent { align-self: flex-end; width: 92%; background: var(--surface-2); border-inline-start: 4px solid var(--job); }
.agent-msg-who { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); }
.agent-msg-text { margin: 0; max-height: 280px; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9rem; unicode-bidi: plaintext; }
.agent-msg-error { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.86rem; color: var(--danger); unicode-bidi: plaintext; }
.agent-msg p.muted { margin: 0; }
.agent-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  color: var(--job);
  background: color-mix(in srgb, var(--job) 14%, transparent);
}
.agent-spinner { width: 10px; height: 10px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
.agent-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 0.8rem; color: var(--text-muted); }
.agent-meta-item { display: inline-flex; align-items: center; gap: 5px; }
.agent-meta code { padding: 1px 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); font-size: 0.78rem; }
.agent-cancel { align-self: flex-start; gap: 5px; color: var(--danger); font-size: 0.86rem; }

.agent-compose textarea { min-height: 90px; }
.field-hint.is-warning { color: color-mix(in srgb, var(--st-waiting) 75%, var(--text)); }
#agent-send:disabled { cursor: not-allowed; }

.runners-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.runner-row { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; }
.runner-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.runner-projects { margin: 0; padding-inline-start: 26px; color: var(--text-muted); }

/* ==========================================================================
   Mobile
   ========================================================================== */

@media (max-width: 760px) {
  .topbar { padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
  .brand h1 { font-size: 1.1rem; }
  .topbar .btn-label, .sync-label { display: none; }
  .topbar-new { display: none; }
  .fab { display: grid; }
  .layout { gap: 12px; padding: 12px 12px 110px; }
  .dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* four status cards: 2 x 2 */

  .filters-selects { flex: 1 1 100%; }
  .filters-selects .select { flex: 1; min-width: 0; }
  /* Category chips scroll sideways instead of wrapping into several rows */
  .chips-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -12px; padding-inline: 12px; }
  .chips-row::-webkit-scrollbar { display: none; }

  .task-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .task-tile { gap: 6px; padding: 10px 11px; border-top-width: 4px; }
  .task-tile:hover { transform: none; }
  .tile-top { font-size: 0.74rem; }
  .tile-title { font-size: 0.95rem; }
  .tile-subtask { font-size: 0.8rem; }
  .tile-subtask:nth-child(n + 3), .tile-more { display: none; }
  .tile-bottom .since { display: none; }
  .tile-bottom .status-chip { height: 28px; }
  .tile-bottom .status-label { font-size: 0.78rem; }
  .progress-bar { width: 40px; }

  /* Dialogs become full-screen sheets */
  dialog, dialog.detail-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: none;
    border-radius: 0;
  }
  .dialog-body { min-height: 100%; padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .dialog-foot { margin-top: auto; }
  .subtask { flex-wrap: wrap; padding: 8px 6px; }
  .subtask-side { width: 100%; justify-content: flex-start; padding-inline-start: 30px; }
  .done-toggle { width: 26px; height: 26px; }
  .done-toggle.is-mini { width: 20px; height: 20px; }
  .status-mini { padding-inline: 9px 6px; } /* wider to tap, same height as the checkbox so rows do not grow */
  .icon-btn { width: 40px; height: 40px; }
}

@media (max-width: 460px) {
  /* Six controls on the top bar: tighter spacing keeps the app name whole */
  .brand { gap: 6px; }
  .brand h1 { min-width: 0; overflow: hidden; font-size: 1rem; text-overflow: ellipsis; }
  .topbar-actions { flex: none; gap: 2px; }
  .dashboard { gap: 8px; }
  .dash-card { gap: 8px; padding: 10px 12px; }
  .dash-icon, .dash-sub { display: none; }
  .dash-title { font-size: 0.86rem; }
  .dash-value { font-size: 1.5rem; }
}

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