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

:root {
  /* Tokens ported from docs/archive/wire-up-proposal.md's Focus mockup mapping table */
  --bg: #07070d;
  --surface-1: #0c0c15;   /* rail */
  --surface-2: #100f1a;   /* panel */
  --surface-3: #0b0a14;   /* panel2 */
  --card: #16131f;
  --card-active: #241a2e;
  --text: #f3e9d8;
  --text-muted: #9a8fb5;
  --text-faint: #6a6080;
  --border: #2e2640;
  --border-soft: #1b1730;
  --accent: #ff9f43;
  --accent-secondary: #c98bdb;
  --accent-tertiary: #5aa0e0;
  --priority-critical: #ff3b3b;
  --priority-high: #ff6b6b;
  --priority-medium: #ffcc66;
  --priority-low: var(--text-faint);

  /* Polish: gradient, depth, motion, type (grounded in the Focus mockup) */
  --accent-gradient: linear-gradient(135deg, #ffb55f 0%, #ff9f43 45%, #e07d4f 100%);
  --accent-soft: rgba(255, 159, 67, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.25), 0 6px 16px -4px rgba(0, 0, 0, 0.38);
  --shadow-pop: 0 10px 30px -8px rgba(0, 0, 0, 0.55);
  --glow-accent: 0 0 0 1px rgba(255, 159, 67, 0.45), 0 6px 22px -4px rgba(255, 159, 67, 0.20);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --radius-card: 13px;
  --radius: 9px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --rail-width: 64px;
  --sidebar-width: 220px;
  --right-panel-width: 300px;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; }

/* Custom thin scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: padding-box; }

/* ── Shell: rail + sidebar + stage + right panel ───────── */

#app {
  display: grid;
  transition: grid-template-columns 0.2s var(--ease);
  grid-template-columns: var(--rail-width) var(--sidebar-width) 1fr var(--right-panel-width);
  grid-template-rows: 100vh;
  height: 100vh;
}
#app.right-panel-hidden {
  grid-template-columns: var(--rail-width) var(--sidebar-width) 1fr;
}

/* ── Rail (cross-tool switcher) ─────────────────────────── */

#rail {
  background: var(--surface-1);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 0;
}
.rail-tool {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  background: var(--surface-3);
  color: var(--text-muted);
  cursor: default;
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.rail-tool.active {
  background: var(--accent-gradient);
  color: var(--bg);
  font-family: var(--font-mono);
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--glow-accent);
}
.rail-tool.active:hover { transform: translateY(-1px); }
.rail-tool.inert {
  background: transparent;
  border: 1px dashed var(--border);
  opacity: 0.45;
}

/* ── Sidebar ─────────────────────────────────────────────── */

#sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1rem 0.5rem;
}
.sidebar-header h1 {
  font-family: var(--font-mono);
  font-size: 0.95rem; font-weight: 700; letter-spacing: 0.01em;
  color: var(--text);
}

.sidebar-group { padding: 0.5rem 0.6rem; }
.sidebar-group-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0.4rem 0.6rem 0.3rem;
}
.sidebar-list {
  position: relative;
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  text-align: left;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.sidebar-list:hover { background: var(--card); color: var(--text); }
.sidebar-list.active {
  background: var(--card-active);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 159, 67, 0.28);
}
.sidebar-list.active::before {
  content: ""; position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 58%;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.sidebar-list-icon { font-size: 0.95rem; }
.sidebar-empty { padding: 1rem; color: var(--text-faint); font-size: 0.85rem; }

/* ── Stage (center) ─────────────────────────────────────── */

#stage {
  background: radial-gradient(130% 90% at 50% -20%, #0d0b18 0%, var(--bg) 55%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#stage-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
}
#stage-title { font-size: 1.05rem; font-weight: 600; letter-spacing: 0.01em; }
.stage-actions { display: flex; align-items: center; gap: 0.85rem; }
.toggle-done {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.8rem; color: var(--text-muted);
  cursor: pointer;
}
.toggle-done input { accent-color: var(--accent); cursor: pointer; }
.btn-primary {
  padding: 0.42rem 0.85rem;
  border: none; border-radius: var(--radius);
  background: var(--accent-gradient);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 2px 8px -2px rgba(255, 159, 67, 0.5);
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), filter 0.16s var(--ease);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 5px 16px -3px rgba(255, 159, 67, 0.6); filter: brightness(1.05); }
.btn-primary:active { transform: translateY(0); }

#task-list {
  flex: 1; overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.6rem;
}

.icon-btn {
  border: none; background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: color 0.15s var(--ease), background 0.15s var(--ease), transform 0.1s var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn.active { color: var(--accent); filter: drop-shadow(0 0 5px rgba(255, 159, 67, 0.5)); }

/* ── Task card ───────────────────────────────────────────── */

.task-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), border-color 0.16s var(--ease);
}
.task-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-pop); border-color: var(--border); }
.task-card.expanded {
  transform: none;
  border-color: rgba(255, 159, 67, 0.5);
  box-shadow: var(--glow-accent), var(--shadow-card);
}

.task-row {
  display: flex; align-items: flex-start; gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
}
.task-card.done { opacity: 0.72; }
.task-card.done .task-title { text-decoration: line-through; color: var(--text-faint); }

.task-checkbox {
  width: 1.05rem; height: 1.05rem; margin-top: 0.15rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 0.92rem; margin-bottom: 0.25rem; color: var(--text); }
.task-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  font-size: 0.72rem; color: var(--text-muted);
}
.priority-badge {
  padding: 0.1rem 0.5rem; border-radius: 999px;
  font-weight: 600; font-size: 0.66rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--surface-3);
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
}
.priority-critical { background: rgba(255, 59, 59, 0.16);  color: #ff7a7a; border-color: rgba(255, 59, 59, 0.38); }
.priority-high     { background: rgba(255, 107, 107, 0.15); color: #ff8e8e; border-color: rgba(255, 107, 107, 0.34); }
.priority-medium   { background: rgba(255, 204, 102, 0.15); color: #ffd98a; border-color: rgba(255, 204, 102, 0.32); }
.priority-low      { background: var(--surface-3); color: var(--text-faint); border-color: var(--border-soft); }
.tag {
  padding: 0.1rem 0.5rem;
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 0.66rem;
  color: var(--text-muted);
}
.due-date { color: var(--text-muted); }

/* ── Task detail / steps (expanded card) ────────────────── */

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

.task-detail {
  padding: 0 0.85rem 0.85rem;
  border-top: 1px solid var(--border-soft);
  animation: detail-in 0.18s var(--ease);
}

/* ── Ambiguity fields collapse ─────────────────────────── */

.ambiguity-collapse {
  margin-bottom: 0.75rem;
}
.ambiguity-toggle {
  all: unset;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  cursor: pointer;
  padding: 0.25rem 0;
  border-radius: var(--radius-sm);
  transition: background 0.12s var(--ease);
}
.ambiguity-toggle:hover {
  background: var(--surface-3);
}
.ambiguity-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.ambiguity-caret {
  display: inline-flex;
  font-size: 0.8rem;
  color: var(--text-faint);
  transition: transform 0.2s var(--ease);
  min-width: 1em;
}
.ambiguity-collapse.collapsed .ambiguity-caret {
  transform: rotate(-0.5turn);
}
.ambiguity-toggle-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ambiguity-summary {
  font-size: 0.7rem;
  color: var(--text-faint);
  margin-left: auto;
  opacity: 0.7;
}
.ambiguity-collapse.collapsed .ambiguity-fields {
  display: none;
}

.ambiguity-fields {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.ambiguity-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.ambiguity-label {
  font-size: 0.72rem;
  color: var(--text-faint);
  min-width: 5.8rem;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ambiguity-input {
  flex: 1;
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.3rem 0.5rem;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.ambiguity-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ambiguity-input::placeholder {
  color: var(--text-faint);
  font-size: 0.78rem;
}

.task-description {
  width: 100%;
  margin-top: 0.7rem;
  min-height: 3.2rem;
  resize: vertical;
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.6rem;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.task-description:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.steps-section { margin-top: 0.8rem; }
.steps-loading { color: var(--text-faint); font-size: 0.8rem; }

.steps-progress { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.6rem; }
.steps-progress-bar {
  flex: 1; height: 6px; border-radius: 999px;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--border-soft);
  overflow: hidden;
}
.steps-progress-fill { height: 100%; background: var(--accent-gradient); border-radius: 999px; transition: width 0.25s var(--ease); }
.steps-progress-label { font-size: 0.72rem; font-family: var(--font-mono); color: var(--text-muted); white-space: nowrap; }

.step-phase { margin-bottom: 0.5rem; }
.step-phase-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-secondary);
  margin-bottom: 0.25rem;
}
.step-row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.85rem; color: var(--text);
  cursor: pointer;
}
.step-row input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }
.step-done { text-decoration: line-through; color: var(--text-faint); }
.step-row span:not(.step-done) { flex: 1; }
.step-delete { margin-left: 0.5rem; opacity: 0; transition: opacity 0.15s var(--ease); }
.step-row:hover .step-delete { opacity: 1; }

.add-step-form { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.add-step-form input {
  flex: 1;
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit; font-size: 0.82rem;
  padding: 0.35rem 0.55rem;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.add-step-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.add-step-form button {
  border: none; border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.add-step-form button:hover { color: var(--text); background: var(--card-active); }

/* ── New task form ───────────────────────────────────────── */

.new-task-form {
  display: flex; gap: 0.5rem;
  background: var(--card);
  border: 1px solid rgba(255, 159, 67, 0.5);
  border-radius: var(--radius-card);
  box-shadow: var(--glow-accent);
  padding: 0.6rem 0.7rem;
  animation: detail-in 0.18s var(--ease);
}
.new-task-form input[type="text"] {
  flex: 1;
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit; font-size: 0.88rem;
  padding: 0.4rem 0.6rem;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.new-task-form select {
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit; font-size: 0.82rem;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
}
.new-task-form input:focus, .new-task-form select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ── Right panel ─────────────────────────────────────────── */

#right-panel {
  background: var(--surface-2);
  border-left: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s var(--ease), opacity 0.2s var(--ease);
}
#right-panel.hidden {
  width: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0;
  border: none;
}

.rp-toggle {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s var(--ease);
  margin-left: 0.5rem;
}
.rp-toggle:hover { color: var(--text); }
#app.right-panel-hidden .rp-toggle { transform: rotate(180deg); }

.right-panel-tabs {
  display: flex; gap: 0.3rem;
  padding: 0.75rem 0.75rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.rp-tab {
  position: relative;
  flex: 1;
  padding: 0.45rem 0;
  border: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  color: var(--text-faint);
  font-size: 0.78rem; font-weight: 600;
  cursor: default;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.rp-tab.active { background: var(--surface-3); color: var(--accent); }
.rp-tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--accent); border-radius: 2px 2px 0 0;
}
.rp-tab.inert { opacity: 0.45; }

#focus-queue { flex: 1; overflow-y: auto; padding: 0.85rem; display: flex; flex-direction: column; gap: 0.5rem; }

#harness-panel { flex: 1; overflow-y: auto; padding: 0.85rem; display: flex; flex-direction: column; gap: 0.5rem; }

.harness-panel { display: flex; flex-direction: column; gap: 0.75rem; }
.harness-section { display: flex; flex-direction: column; gap: 0.4rem; }
.harness-section-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 600; }

.harness-action-btn {
  background: var(--accent); color: var(--bg); border: none; border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem; font: inherit; font-size: 0.82rem; cursor: pointer;
  transition: opacity 0.15s var(--ease);
}
.harness-action-btn:hover { opacity: 0.85; }

.harness-run-row {
  display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem;
  padding: 0.35rem 0.4rem; border-radius: var(--radius-sm); background: var(--surface-2);
}
.harness-run-row.succeeded { border-left: 3px solid var(--green, #4caf50); }
.harness-run-row.failed { border-left: 3px solid var(--red, #f44336); }
.harness-run-row.timed_out { border-left: 3px solid var(--yellow, #ff9800); }
.harness-run-row.cancelled { border-left: 3px solid var(--text-faint); }
.harness-run-status { text-transform: capitalize; font-weight: 600; min-width: 5rem; }
.harness-run-action { flex: 1; text-transform: capitalize; color: var(--text-dim); }
.harness-run-time { color: var(--text-faint); font-size: 0.7rem; }
.harness-run-tokens { color: var(--text-faint); font-size: 0.7rem; }

.harness-provider-status { font-size: 0.82rem; padding: 0.35rem 0.5rem; border-radius: var(--radius-sm); }
.harness-provider-status.configured { color: var(--green, #4caf50); }
.harness-provider-status.not-configured { color: var(--text-faint); }

/* Change review */
.change-review {
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  background: var(--surface-2); overflow: hidden;
}
.change-review-header {
  display: flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.5rem;
  background: var(--surface-3); font-size: 0.72rem;
}
.change-review-status { text-transform: capitalize; font-weight: 600; }
.change-review-status.status-created { color: var(--accent); }
.change-review-status.status-accepted { color: var(--green, #4caf50); }
.change-review-status.status-rejected { color: var(--text-faint); }
.change-review-status.status-conflicted { color: var(--yellow, #ff9800); }
.change-review-ops { flex: 1; color: var(--text-dim); }
.change-review-time { color: var(--text-faint); }
.change-review-ops-list { display: flex; flex-direction: column; }
.change-op {
  padding: 0.35rem 0.5rem; font-size: 0.78rem; display: flex; flex-direction: column;
  gap: 0.15rem; border-bottom: 1px solid var(--border-soft);
}
.change-op:last-child { border-bottom: none; }
.change-op-type { font-weight: 600; color: var(--text-dim); }
.change-op-detail { color: var(--text); }
.change-op-conflict { color: var(--yellow, #ff9800); font-size: 0.75rem; }
.change-review-actions { display: flex; gap: 0.35rem; padding: 0.4rem 0.5rem; }

.harness-btn {
  border: none; border-radius: var(--radius-sm); padding: 0.3rem 0.55rem;
  font: inherit; font-size: 0.75rem; cursor: pointer; transition: opacity 0.15s var(--ease);
}
.harness-btn.accept { background: var(--green, #4caf50); color: white; }
.harness-btn.reject { background: transparent; border: 1px solid var(--border-soft); color: var(--text-dim); }
.harness-btn:hover { opacity: 0.8; }

.focus-card {
  display: flex; align-items: flex-start; gap: 0.55rem;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  padding: 0.6rem 0.7rem;
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), border-color 0.16s var(--ease);
}
.focus-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-card); border-color: var(--border); }
.focus-card-order {
  width: 1.45rem; height: 1.45rem;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px -1px rgba(255, 159, 67, 0.45);
}
.focus-card-body { flex: 1; min-width: 0; }
.focus-card-title { font-size: 0.85rem; color: var(--text); }
.focus-card-notes { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }
.focus-card-actions { display: flex; gap: 0.15rem; }
.focus-empty { color: var(--text-faint); font-size: 0.82rem; padding: 0.5rem; }

/* ── Empty state ─────────────────────────────────────────── */

.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-faint); font-size: 0.9rem;
}
.empty-state::before {
  content: "📋";
  display: block;
  font-size: 2.4rem;
  margin-bottom: 0.6rem;
  opacity: 0.5;
}
.hidden { display: none !important; }

/* ── Sidebar list actions (rename, delete) ───────────── */

.sidebar-list-row {
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: var(--radius);
  transition: background 0.16s var(--ease);
}
.sidebar-list-row:hover { background: var(--card); }
.sidebar-list-row.active { background: var(--card-active); box-shadow: inset 0 0 0 1px rgba(255, 159, 67, 0.28); }
.sidebar-list-row.active .sidebar-list { color: var(--text); }

.sidebar-list-row .sidebar-list {
  flex: 1;
  background: transparent;
  border: none;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  text-align: left;
  transition: color 0.16s var(--ease);
}
.sidebar-list-row .sidebar-list:hover { color: var(--text); background: transparent; }
.sidebar-list-row .sidebar-list.active { background: transparent; box-shadow: none; }
.sidebar-list-row .sidebar-list.active::before { display: none; }

.sidebar-list-actions {
  display: none;
  gap: 0.1rem;
  padding-right: 0.3rem;
}
.sidebar-list-row:hover .sidebar-list-actions { display: flex; }
.sidebar-list-act {
  font-size: 0.75rem;
  padding: 0.15rem 0.25rem;
  opacity: 0.5;
}
.sidebar-list-act:hover { opacity: 1; }

/* ── Modal (new list) ─────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fade-in 0.15s var(--ease);
}
.modal-content {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.25rem;
  min-width: 300px;
  box-shadow: var(--shadow-pop);
}
.modal-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.modal-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.modal-label input,
.modal-label select {
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  padding: 0.4rem 0.6rem;
}
.modal-label input:focus,
.modal-label select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Task detail fields ───────────────────────────────── */

.detail-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.detail-field-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.detail-field-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 6.5rem;
  flex-shrink: 0;
}
.detail-input {
  flex: 1;
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.detail-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.detail-input[type="number"] {
  max-width: 5rem;
}
.detail-input[type="date"] {
  max-width: 9rem;
  color-scheme: dark;
}
.detail-select {
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  transition: border-color 0.16s var(--ease);
}
.detail-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Step editing ─────────────────────────────────────── */

.step-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
}
.step-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.step-label-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.2rem 0.35rem;
  width: 100%;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.step-label-input:hover { background: var(--surface-3); border-color: var(--border-soft); }
.step-label-input:focus {
  outline: none;
  background: var(--surface-3);
  border-color: var(--accent);
}
.step-meta {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
.step-phase-select {
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.7rem;
  padding: 0.15rem 0.25rem;
  cursor: pointer;
}
.step-phase-select:focus {
  outline: none;
  border-color: var(--accent);
}
.step-est-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font: inherit;
  font-size: 0.7rem;
  padding: 0.15rem 0.25rem;
  width: 3.2rem;
  text-align: right;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.step-est-input:hover { background: var(--surface-3); border-color: var(--border-soft); }
.step-est-input:focus {
  outline: none;
  background: var(--surface-3);
  border-color: var(--accent);
}
.step-reorder {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.step-reorder .icon-btn {
  font-size: 0.65rem;
  padding: 0.05rem 0.2rem;
  line-height: 1;
}
.step-done .step-label-input { text-decoration: line-through; opacity: 0.6; }

.step-assignee-select {
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.7rem;
  padding: 0.15rem 0.25rem;
  cursor: pointer;
}
.step-assignee-select:focus {
  outline: none;
  border-color: var(--accent);
}
.step-result-display {
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
  margin: 0.2rem 0;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.step-result-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.2rem 0.35rem;
  width: 100%;
  resize: vertical;
  min-height: 1.5em;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
  margin-top: 0.15rem;
  font-family: var(--font-mono);
}
.step-result-input:hover { background: var(--surface-3); border-color: var(--border-soft); }
.step-result-input:focus {
  outline: none;
  background: var(--surface-3);
  border-color: var(--accent);
}

/* Update the add-step form to accommodate the phase select */
.add-step-form {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.5rem;
}
.add-step-form input[type="text"] {
  flex: 1;
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
}
.add-step-form select {
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  padding: 0.35rem 0.4rem;
  cursor: pointer;
}
.add-step-form input:focus, .add-step-form select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Timer panel ──────────────────────────────────────── */

#timer-panel {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}
.timer-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding-top: 0.5rem;
}
.timer-mode {
  display: flex;
  gap: 0.35rem;
  background: var(--surface-3);
  border-radius: var(--radius);
  padding: 0.25rem;
}
.timer-mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.timer-mode-btn.active {
  background: var(--card);
  color: var(--accent);
}
.timer-display {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.timer-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.timer-ring-track {
  stroke: var(--border);
}
.timer-ring-progress {
  stroke: var(--accent);
  transition: stroke-dashoffset 0.5s linear;
}
.timer-ring-progress.break {
  stroke: var(--accent-secondary);
}
.timer-time {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
  z-index: 1;
}
.timer-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 160px;
}
.timer-btn {
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem;
  cursor: pointer;
  transition: opacity 0.16s var(--ease), transform 0.1s var(--ease);
}
.timer-btn:hover { opacity: 0.85; }
.timer-btn:active { transform: scale(0.97); }
.timer-btn.start {
  background: var(--accent-gradient);
  color: var(--bg);
}
.timer-btn.pause {
  background: var(--accent-secondary);
  color: var(--bg);
}
.timer-btn.reset {
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
}
.timer-empty {
  color: var(--text-faint);
  font-size: 0.82rem;
  padding: 0.5rem;
  text-align: center;
}
