:root {
  color-scheme: light dark;
  --page: #ffffff;
  --ink: #121212;
  --ink-soft: #5f5b56;
  --ink-faint: #6f6a62;
  --line: #dedbd5;
  --line-soft: #ece9e4;
  --paper: #f6f5f2;
  --paper-strong: #efede8;
  --accent: #0b66d8;
  --accent-soft: #eaf2ff;
  --done: #716b62;
  --shadow: 0 18px 44px rgba(18, 18, 18, 0.08);
  --control-bg: #fff;
  --control-hover-bg: var(--paper);
  --control-hover-border: #c7c1b8;
  --control-quiet: #3e3a35;
  --control-active-bg: var(--ink);
  --control-active-text: #fff;
  --control-active-hover-bg: #000;
  --check-bg: #fff;
  --check-border: #bdb8b0;
  --code-ink: #1b1b1a;
  --success-bg: #f5f9ec;
  --success-border: #c9d8b9;
  --success-ring: #e4eed1;
  --success-accent: #8eb867;
  --complete-step-bg: #f3f7ec;
  --complete-step-border: #dde6cf;
  --complete-step-hover: rgba(120, 170, 80, 0.06);
  --complete-step-check-border: #b3c69e;
  --complete-step-check: #6b8854;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 19px;
  line-height: 1.58;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  padding: 14px clamp(22px, 4vw, 56px);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.topbar-title {
  display: none;
}

/* Path of the campaign file, rendered as the first item in the Scope section's
   body — keeps the topbar quiet and tucks the path away with the orientation
   content. Visible while Scope is expanded, hidden when collapsed. */
.document-path-inline {
  margin: 0 0 14px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(20px, 1.9vw, 25px);
  line-height: 1.1;
  letter-spacing: 0;
}

.path-label {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.35;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 980px);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 32px clamp(18px, 4vw, 56px) 80px;
}

.overview {
  position: sticky;
  top: 80px;
}

.overview-card {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.overview-active-indicator {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 54px;
  height: 54px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.overview-active-indicator[hidden] {
  display: none;
}

.campaign-logo {
  display: block;
  width: 60px;
  height: 60px;
  margin: -2px 0 14px;
  border-radius: 13px;
  background: var(--paper-strong);
  border: 1px solid var(--line-soft);
  object-fit: cover;
}

.campaign-logo[hidden] {
  display: none;
}

.overview-kicker {
  margin: 0 0 4px;
  color: var(--ink-faint);
  font-size: 13px;
  font-weight: 760;
}

.overview-card strong {
  display: block;
  font-size: 23px;
  line-height: 1.2;
}

.progress-track {
  height: 8px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

#progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  transition: width 180ms ease-out;
}

.save-status {
  margin: 13px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.35;
}

.save-status-inline {
  align-self: center;
  margin-right: 4px;
  color: var(--ink-faint);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: color 120ms ease-out;
}

.save-status-inline:empty {
  display: none;
}

.save-status-inline[data-state="dirty"] {
  color: var(--ink-soft);
}

.save-status-inline[data-state="saving"] {
  color: var(--ink-faint);
}

.save-status-inline[data-state="error"] {
  color: #b3261e;
}

.save-status-inline[data-state="saved"] {
  color: var(--ink-faint);
}

/* ---------- Resume card on cold load ---------- */

.resume-card {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 8px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-size: 14px;
  line-height: 1.4;
}

.resume-card[hidden] {
  display: none;
}

.resume-card-text {
  flex: 1;
  min-width: 0;
  color: var(--ink-soft);
}

.resume-card-text strong {
  color: var(--ink);
  font-weight: 720;
}

@media (max-width: 720px) {
  .resume-card {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
}

/* ---------- Resume button + hover preview ---------- */

.resume-button {
  position: relative;
}

.resume-preview {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 5;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--control-bg);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 120ms ease-out,
    transform 120ms ease-out;
}

.resume-preview:empty {
  display: none;
}

.resume-preview .resume-meta {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.resume-button:hover .resume-preview,
.resume-button:focus-visible .resume-preview {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Filter chips (inline in checklist section) ---------- */

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -8px 0 26px;
}

.filter-chip {
  min-height: 30px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control-bg);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    color 120ms ease-out,
    background 120ms ease-out,
    border-color 120ms ease-out;
}

.filter-chip[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--control-active-bg);
  color: var(--control-active-text);
}

.filter-chip:hover {
  color: var(--ink);
  border-color: var(--control-hover-border);
  background: var(--control-hover-bg);
}

.filter-chip[aria-pressed="true"]:hover {
  color: var(--control-active-text);
  border-color: var(--ink);
  background: var(--control-active-bg);
}

/* ---------- Phase groups (collapse) ---------- */

.phase-group {
  margin: 18px 0 22px;
}

.phase-group .phase-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.phase-group .phase-summary:hover .phase-title {
  color: var(--ink);
}

.phase-group .phase-chevron {
  display: inline-block;
  width: 12px;
  margin-right: 2px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-2px);
  transition: transform 140ms ease-out;
}

.phase-group[data-collapsed="false"] .phase-chevron {
  transform: translateY(-2px) rotate(90deg);
}

.phase-group .phase-title {
  margin: 0;
  flex: 1;
  font-size: clamp(20px, 1.7vw, 24px);
  font-weight: 720;
  line-height: 1.2;
  letter-spacing: 0;
  color: inherit;
  transition: color 120ms ease-out;
}

.phase-group .phase-progress {
  flex-shrink: 0;
  color: var(--ink-faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.phase-group[data-state="done"] .phase-title {
  color: var(--done);
}

.phase-group[data-collapsed="true"] .phase-body {
  display: none;
}

.phase-group .phase-body {
  margin-top: 6px;
  padding-left: 20px;
}

/* Filter visibility flags. Body class drives which states to hide. */
body.filter-hide-todo .phase-group[data-state="todo"],
body.filter-hide-flight .phase-group[data-state="flight"],
body.filter-hide-done .phase-group[data-state="done"] {
  display: none;
}

/* ---------- Focus mode (one-step-at-a-time) ---------- */

body.focus-mode .overview {
  display: none;
}

body.focus-mode .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body.focus-mode .document > *:not([data-step-id]),
body.focus-mode .document > [data-step-id]:not(.step-active) {
  display: none;
}

/* ---------- Save status state ---------- */

.save-status[data-state="saving"] {
  color: var(--ink-faint);
}

.save-status[data-state="error"] {
  color: #b3261e;
}

/* ---------- Clickable check labels (jump to step section) ---------- */

.check-label .step-link {
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: border-color 120ms ease-out;
}

.check-label .step-link:hover {
  border-bottom-color: var(--ink-faint);
}

/* ---------- Today delta ---------- */

.today-delta {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  vertical-align: 4px;
}

/* ---------- Placeholder fill bar inside prompt cards ---------- */

.prompt-placeholders {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 4px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.6);
}

.prompt-card-editing > .prompt-placeholders {
  margin: 14px 18px 0;
  padding: 10px 12px;
  gap: 10px 14px;
}

.placeholder-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.placeholder-field label {
  color: var(--ink-faint);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
}

.placeholder-field input {
  min-width: 160px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--control-bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color 120ms ease-out;
}

.placeholder-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Highlight where placeholders were substituted in the rendered prompt. */
.prompt-code .placeholder-fill {
  padding: 0.05em 0.36em;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.prompt-code .placeholder-empty {
  padding: 0.05em 0.36em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink-soft);
}

/* ---------- Phase completion banner ---------- */

.phase-banner {
  position: fixed;
  top: 92px;
  left: 50%;
  z-index: 28;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--ink);
  box-shadow: var(--shadow);
  color: var(--control-active-text);
  font-size: 14px;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition:
    opacity 180ms ease-out,
    transform 180ms ease-out;
  pointer-events: none;
}

.phase-banner.visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.phase-banner strong {
  font-weight: 760;
}

.phase-banner .phase-banner-meta {
  color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
}

.phase-banner .phase-banner-close {
  margin-left: auto;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--control-active-text) 70%, transparent);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.phase-banner .phase-banner-close:hover {
  color: var(--control-active-text);
}

/* ---------- Mobile bottom bar (≤ 980px) ---------- */

.mobile-bottombar {
  display: none;
}

@media (max-width: 980px) {
  .mobile-bottombar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 24;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--page) 94%, transparent);
    backdrop-filter: blur(14px);
  }

  .mobile-bottombar:empty {
    display: none;
  }

  .mobile-bottombar .bottom-button {
    min-height: 40px;
    min-width: 56px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--control-bg);
    color: var(--control-quiet);
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
  }

  .mobile-bottombar .bottom-button:disabled {
    color: var(--ink-faint);
    background: var(--paper);
    border-color: var(--line-soft);
    cursor: not-allowed;
  }

  .document {
    padding-bottom: 92px;
  }
}

/* ---------- Conflict (merge) modal ---------- */

.conflict-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 18, 18, 0.45);
}

.conflict-modal[hidden] {
  display: none;
}

.conflict-modal .conflict-card {
  width: min(880px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 24px;
  border-radius: 12px;
  background: var(--control-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.conflict-card h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.conflict-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.conflict-diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.conflict-diff label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.conflict-diff textarea {
  flex: 1;
  min-height: 200px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.4;
  resize: vertical;
}

.conflict-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 720px) {
  .conflict-diff {
    grid-template-columns: 1fr;
  }
}

.document {
  min-width: 0;
  max-width: 980px;
  padding-bottom: 96px;
}

.document > *:first-child {
  margin-top: 0;
}

.document h1,
.document h2,
.document h3,
.document h4 {
  scroll-margin-top: 132px;
  margin: 1.75em 0 0.55em;
  line-height: 1.12;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.document h1 {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
  font-size: clamp(40px, 4.2vw, 56px);
}

.document h2 {
  padding-top: 30px;
  border-top: 1px solid var(--line);
  font-size: clamp(31px, 3vw, 40px);
}

.document h3 {
  font-size: clamp(24px, 2.2vw, 32px);
}

.document h4 {
  font-size: 22px;
}

.document p {
  margin: 0 0 1.1em;
}

.document a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.14em;
}

.document strong {
  font-weight: 760;
}

.document em {
  color: #2f2c28;
}

.document hr {
  margin: 34px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.quote {
  margin: 22px 0 30px;
  padding: 0 0 0 18px;
  border-left: 3px solid var(--line);
  color: var(--ink-soft);
  font-size: 21px;
  overflow-wrap: anywhere;
}

.quote p:last-child {
  margin-bottom: 0;
}

.plain-list,
.ordered-list {
  margin: 0 0 1.15em;
  padding-left: 1.45em;
}

.plain-list li,
.ordered-list li {
  margin: 0.28em 0;
  padding-left: 0.15em;
}

.check-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin: 8px 0;
  color: var(--ink);
}

.check-row .check-button {
  width: 22px;
  height: 22px;
  margin-top: 4px;
  padding: 0;
  border: 2px solid var(--check-border);
  border-radius: 50%;
  background: var(--check-bg);
  cursor: pointer;
}

.check-row .check-button:hover {
  border-color: var(--ink);
}

.check-row.done {
  color: var(--done);
}

.check-row.done .check-button {
  display: grid;
  place-items: center;
  border-color: transparent;
  background: var(--control-active-bg);
  color: var(--control-active-text);
}

.check-row.done .check-button::before {
  content: "✓";
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.check-row.done .check-label {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  text-decoration-color: var(--check-border);
}

code {
  padding: 0.12em 0.38em;
  border-radius: 6px;
  background: var(--paper-strong);
  color: var(--code-ink);
  font-family: var(--mono);
  font-size: 0.88em;
}

.prompt-card {
  position: relative;
  scroll-margin-top: 132px;
  margin: 24px 0 28px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 1px 0 rgba(18, 18, 18, 0.02);
}

details.prompt-card > summary.prompt-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

details.prompt-card > summary.prompt-summary::-webkit-details-marker {
  display: none;
}

details.prompt-card > summary.prompt-summary:hover {
  background: rgba(18, 18, 18, 0.025);
}

.prompt-chevron {
  display: inline-block;
  width: 16px;
  color: var(--ink-faint);
  font-size: 22px;
  line-height: 1;
  text-align: center;
  transition: transform 0.15s ease;
}

details.prompt-card[open] .prompt-chevron {
  transform: rotate(90deg);
  color: var(--ink-soft);
}

.prompt-card-label {
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

details.prompt-card .prompt-toolbar {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.prompt-card-editing .prompt-toolbar {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4c4945;
  cursor: pointer;
}

.icon-button:hover {
  background: #e8e5df;
  color: var(--ink);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.text-button {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4c4945;
  cursor: pointer;
  font-size: 14px;
  font-weight: 720;
}

.text-button:hover {
  background: #e8e5df;
  color: var(--ink);
}

.prompt-code {
  margin: 0;
  padding: 18px 24px 24px;
  overflow-x: auto;
  white-space: pre-wrap;
  color: #303235;
  font-family: var(--mono);
  font-size: 18px;
  line-height: 1.5;
  border-top: 1px solid var(--line-soft);
}

details.prompt-card:not([open]) > .prompt-code {
  display: none;
}

details.prompt-card.prompt-template > summary.prompt-summary {
  background: rgba(18, 18, 18, 0.015);
}

.prompt-editor {
  display: block;
  width: calc(100% - 28px);
  min-height: 300px;
  margin: 58px 14px 14px;
  padding: 18px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: var(--control-bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.5;
}

.prompt-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.table-wrap {
  max-width: 100%;
  margin: 22px 0 30px;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 17px;
  line-height: 1.4;
}

th,
td {
  padding: 13px 16px;
  border-right: 2px solid var(--page);
  border-bottom: 2px solid var(--page);
  background: var(--paper);
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 760;
}

tr:first-child th:first-child {
  border-top-left-radius: 6px;
}

tr:first-child th:last-child {
  border-top-right-radius: 6px;
}

tr:last-child td:first-child {
  border-bottom-left-radius: 6px;
}

tr:last-child td:last-child {
  border-bottom-right-radius: 6px;
}

.glyph-check {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1.7px solid var(--check-border);
  border-radius: 5px;
  background: var(--check-bg);
  color: transparent;
  cursor: pointer;
}

.glyph-check.done {
  border-color: var(--ink);
  background: var(--control-active-bg);
  color: var(--control-active-text);
}

.glyph-check.done::before {
  content: "✓";
  color: var(--control-active-text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--control-bg);
  color: var(--control-quiet);
  cursor: pointer;
  font-size: 14px;
  font-weight: 740;
  line-height: 1;
  text-decoration: none;
}

.button:hover {
  border-color: var(--control-hover-border);
  background: var(--control-hover-bg);
  color: var(--ink);
}

.button-primary {
  border-color: var(--ink);
  background: var(--control-active-bg);
  color: var(--control-active-text);
}

.button-primary:hover {
  border-color: var(--control-active-hover-bg);
  background: var(--control-active-hover-bg);
  color: var(--control-active-text);
}

.button-danger {
  border-color: rgba(179, 38, 30, 0.55);
  background: rgba(179, 38, 30, 0.12);
  color: #b3261e;
}

.button-danger:hover {
  border-color: rgba(179, 38, 30, 0.9);
  background: rgba(179, 38, 30, 0.22);
  color: #7d1f1f;
}

/* File-path line shown in the delete confirm modal. Tight, monospace, soft. */
.nudge-confirm-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--ink-faint);
  word-break: break-all;
  margin-top: -8px;
}

.button-quiet {
  color: var(--control-quiet);
}

.button-wide {
  width: 100%;
}

.button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--control-active-bg);
  color: var(--control-active-text);
}

.button[aria-pressed="true"]:hover {
  border-color: var(--control-active-hover-bg);
  background: var(--control-active-hover-bg);
  color: var(--control-active-text);
}

.step-complete-button {
  margin: 18px 0 32px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 14px;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 160ms ease-out,
    transform 160ms ease-out;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 980px) {
  body {
    font-size: 18px;
  }

  .topbar {
    position: relative;
    z-index: 50;
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .workspace {
    display: block;
    padding-top: 22px;
  }

  .overview {
    position: static;
    margin-bottom: 34px;
  }

  .document h1 {
    font-size: 42px;
  }

  .prompt-code {
    font-size: 16px;
  }

  .document h1,
  .document h2,
  .document h3,
  .document h4,
  .prompt-card {
    scroll-margin-top: 24px;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 17px;
  }

  .topbar {
    padding: 18px;
  }

  .topbar-actions,
  .button {
    width: 100%;
  }

  .workspace {
    padding-inline: 16px;
  }

  .document h1 {
    font-size: 32px;
  }

  .document h2 {
    font-size: 30px;
  }

  .quote {
    padding-left: 14px;
    font-size: 19px;
  }

  .check-row {
    grid-template-columns: 26px minmax(0, 1fr);
  }
}

/* ---------- Switch dropdown (campaign view) ---------- */

.switch-wrapper {
  position: relative;
}

#switch-button[hidden] {
  display: none;
}

.switch-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  z-index: 25;
  min-width: min(280px, calc(100vw - 32px));
  max-width: min(360px, calc(100vw - 32px));
  max-height: 70vh;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
  box-shadow: var(--shadow);
}

.switch-menu[hidden] {
  display: none;
}

.switch-menu a,
.switch-menu .switch-current {
  display: block;
  padding: 9px 12px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.3;
  transition: background 100ms ease-out;
}

.switch-menu a:hover {
  background: var(--paper);
}

.switch-menu a:focus {
  outline: none;
}

.switch-menu a:focus-visible {
  background: var(--paper);
  outline: 2px solid var(--accent, currentColor);
  outline-offset: -2px;
}

.switch-menu .switch-title {
  display: block;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switch-menu .switch-item-with-logo {
  display: flex;
  align-items: center;
  gap: 9px;
}

.switch-menu .switch-item-text {
  flex: 1;
  min-width: 0;
}

.switch-menu .switch-item-logo {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--paper-strong);
  border: 1px solid var(--line-soft);
  object-fit: cover;
}

.switch-menu .switch-meta {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switch-menu .switch-current {
  background: var(--paper-strong);
  cursor: default;
}

.switch-menu .switch-divider {
  margin: 6px 0;
  height: 1px;
  background: var(--line-soft);
}

.switch-menu .switch-all {
  font-weight: 600;
  color: var(--ink-soft);
}

.switch-menu .switch-item.complete .switch-title {
  color: #2a7d3a;
}

.switch-menu .switch-item.complete .switch-meta {
  color: #2a7d3a;
}

.switch-menu .switch-item.missing {
  opacity: 0.5;
}

/* ---------- Library page ---------- */

body.view-library .app-shell,
body.view-library #mobile-bottombar,
body.view-library #phase-banner,
body.view-library #conflict-modal {
  display: none;
}

/* Quiet top-level tab pair (Campaigns | Workflows) shared by the two landing
   screens. Reuses .button-quiet so it reads as one control, not a second nav. */
.topbar-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
}

.library {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 64px clamp(20px, 4vw, 56px) 96px;
}

.library[hidden] {
  display: none;
}

.library-header {
  margin-bottom: 36px;
}

.library-eyebrow {
  margin: 0 0 6px;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.library-title {
  margin: 0;
  font-size: clamp(36px, 5vw, 56px);
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.library-lessons {
  margin: -12px 0 28px;
  padding: 16px 0 18px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.library-lessons[hidden] {
  display: none;
}

.library-lessons-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.library-lessons-title {
  font-size: 14px;
  font-weight: 760;
  line-height: 1.2;
}

.library-lessons-meta,
.library-lessons-unavailable {
  color: var(--ink-faint);
  font-size: 12.5px;
  line-height: 1.45;
}

.library-lessons-unavailable {
  margin: 0;
}

.library-lessons-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line-soft);
}

.library-lessons-metric {
  min-width: 0;
  padding: 12px 14px 0;
  border-left: 1px solid var(--line-soft);
}

.library-lessons-metric:first-child {
  border-left: 0;
  padding-left: 0;
}

.library-lessons-metric-label {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.library-lessons-metric-value {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.library-lessons-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
}

.library-lessons-tags-label {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.library-lessons-tag,
.library-lessons-tags-empty {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}

.library-lessons-tag {
  padding: 0 9px;
  font-family: var(--mono);
}

.library-lessons-tag.legacy {
  opacity: 0.72;
}

.library-lessons-tags-empty {
  padding: 0 10px;
}

@media (max-width: 960px) {
  .library-lessons-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 12px;
  }

  .library-lessons-metric:nth-child(3n + 1) {
    border-left: 0;
    padding-left: 0;
  }
}

@media (max-width: 639px) {
  .library-lessons {
    margin-bottom: 22px;
  }

  .library-lessons-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-lessons-metric {
    border-left: 1px solid var(--line-soft);
    padding-left: 14px;
  }

  .library-lessons-metric:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }
}

.library-lessons--settings {
  margin: 0;
  padding: 0;
  border: 0;
}

.library-lessons--settings .library-lessons-header {
  margin-bottom: 10px;
}

.library-lessons--settings .library-lessons-metrics {
  display: flex;
  flex-direction: column;
  border-top: 0;
}

.library-lessons--settings .library-lessons-metric,
.library-lessons--settings .library-lessons-metric:first-child,
.library-lessons--settings .library-lessons-metric:nth-child(3n + 1),
.library-lessons--settings .library-lessons-metric:nth-child(odd) {
  padding: 10px 0;
  border-left: 0;
}

.library-lessons--settings .library-lessons-metric + .library-lessons-metric {
  border-top: 1px solid var(--line-soft);
}

.library-lessons--settings .library-lessons-tags {
  align-items: flex-start;
  margin-top: 10px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  align-items: start;
  gap: 16px;
}

.library-grid[hidden] {
  display: none;
}

.library-parked-divider {
  grid-column: 1 / -1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 40px;
  margin: 8px 0 4px;
}

.library-parked-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--line-soft);
}

.library-parked-toggle {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--page);
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 760;
  line-height: 1;
  transition: border-color 120ms ease-out, color 120ms ease-out, background-color 120ms ease-out,
    transform 120ms ease-out;
}

.library-parked-toggle:hover,
.library-parked-toggle:focus-visible {
  border-color: var(--accent);
  background: var(--control-bg);
  color: var(--accent);
}

.library-parked-toggle:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 34%, transparent);
  outline-offset: 2px;
}

.library-parked-toggle:active {
  transform: scale(0.96);
}

.library-parked-symbol {
  display: inline-flex;
  width: 14px;
  justify-content: center;
  font-size: 18px;
  font-weight: 560;
  transform: translateY(-1px);
}

.library-divider-label {
  white-space: nowrap;
}

.library-divider-count {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
}

.library-parked-divider[data-expanded="true"] .library-parked-toggle {
  color: var(--accent);
}

.library-complete-toggle:hover,
.library-complete-toggle:focus-visible {
  border-color: var(--complete-step-check);
  color: var(--complete-step-check);
}

.library-complete-divider[data-expanded="true"] .library-complete-toggle {
  color: var(--complete-step-check);
}

.library-collection-section {
  position: relative;
  grid-column: 1 / -1;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--paper) 70%, var(--page));
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out, background-color 160ms ease-out;
}

.library-collection-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 78px 12px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.library-collection-title {
  font-size: 14px;
  font-weight: 760;
  line-height: 1.2;
}

.library-collection-meta {
  color: var(--ink-faint);
  font-size: 12px;
}

.library-collection-collapse {
  margin-left: auto;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control-bg);
  color: var(--ink-faint);
  font-size: 17px;
  line-height: 1;
}

.library-collection-header:hover .library-collection-collapse,
.library-collection-header:focus-visible .library-collection-collapse {
  border-color: var(--accent);
  color: var(--accent);
}

.library-collection-header:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 34%, transparent);
  outline-offset: 2px;
}

.library-collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.library-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 22px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--control-bg);
  color: inherit;
  transition: border-color 120ms ease-out, transform 120ms ease-out, box-shadow 120ms ease-out,
    background-color 160ms ease-out, padding 160ms ease-out;
}

.library-card:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(18, 18, 18, 0.06);
}

.library-card.is-dragging {
  opacity: 0.46;
  transform: scale(0.99);
}

.library-card.is-drop-target,
.library-collection-section.is-drop-target {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 44%, var(--control-bg));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.library-collection-card {
  min-height: 148px;
  gap: 6px;
  padding-right: 66px;
  cursor: pointer;
  overflow: hidden;
}

.library-collection-card::before,
.library-collection-card::after {
  content: "";
  position: absolute;
  top: 18px;
  right: 16px;
  width: 42px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.library-collection-card::before {
  transform: translate(-6px, 6px);
  background: var(--paper-strong);
}

.library-collection-card::after {
  background: var(--control-bg);
}

.library-collection-card > * {
  position: relative;
  z-index: 1;
}

.library-collection-card .library-card-title {
  padding-right: 142px;
}

.library-collection-card .library-card-path {
  direction: ltr;
}

.library-collection-automate-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.2;
  white-space: nowrap;
}

.library-collection-automate-status span:not(.automate-indicator) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-collection-card .library-collection-automate-status {
  position: absolute;
  top: 27px;
  right: 74px;
  z-index: 2;
  max-width: 86px;
  margin-top: 0;
  justify-content: flex-end;
}

.library-collection-header .library-collection-automate-status {
  margin-left: 2px;
}

.library-collection-automate-status .automate-indicator {
  width: 12px;
  height: 12px;
}

.library-collection-count {
  position: absolute;
  top: 25px;
  right: 29px;
  z-index: 2;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--control-active-text);
  font-size: 10px;
  font-weight: 760;
  line-height: 16px;
  text-align: center;
}

.library-collection-copy-button,
.library-collection-park-button,
.library-card-copy-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 120ms ease-out, color 120ms ease-out, background-color 120ms ease-out,
    border-color 120ms ease-out;
}

.library-collection-copy-button svg,
.library-collection-park-button svg,
.library-card-copy-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.library-collection-section > .library-collection-copy-button {
  top: 12px;
  bottom: auto;
}

.library-collection-park-button {
  right: 48px;
}

.library-collection-section > .library-collection-park-button {
  top: 12px;
  bottom: auto;
}

.library-collection-card:hover .library-collection-copy-button,
.library-collection-card:hover .library-collection-park-button,
.library-collection-section:hover > .library-collection-copy-button,
.library-collection-section:hover > .library-collection-park-button,
.library-card:hover .library-card-copy-button,
.library-collection-copy-button:focus-visible,
.library-collection-park-button:focus-visible,
.library-card-copy-button:focus-visible {
  opacity: 1;
}

.library-collection-copy-button:hover,
.library-collection-copy-button:focus-visible,
.library-collection-park-button:hover,
.library-collection-park-button:focus-visible,
.library-card-copy-button:hover,
.library-card-copy-button:focus-visible {
  border-color: var(--line);
  background: var(--paper-strong);
  color: var(--ink);
}

.library-card-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: inherit;
  text-decoration: none;
}

.library-card-chrome {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 5px;
}

.library-card-logo {
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--paper-strong);
  object-fit: cover;
  border: 1px solid var(--line-soft);
  pointer-events: none;
}

.library-card-logo-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.library-card:has(.library-card-chrome) .library-card-title {
  box-sizing: border-box;
  max-width: calc(100% - 72px);
  padding-right: 0;
}

.library-card:has(.library-card-trash-button):is(:hover, :focus-within) .library-card-title {
  max-width: calc(100% - 106px);
}

.library-card-title {
  font-size: 17px;
  font-weight: 720;
  line-height: 1.3;
  padding-right: 32px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.library-card-path {
  margin-top: 2px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
  text-align: left;
}

.library-card-progress {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.library-card-progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.library-card-progress-fill {
  height: 100%;
  background: var(--ink);
  border-radius: inherit;
}

.library-card-progress-label {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  white-space: nowrap;
}

.library-card-automate-status {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.2;
}

.library-card-automate-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-card-automate-warning {
  width: 12px;
  height: 12px;
}

.library-card-time {
  margin-top: 6px;
  color: var(--ink-faint);
  font-size: 12px;
}

.library-card:has(.library-card-copy-button) .library-card-time {
  padding-right: 36px;
}

.library-card.complete,
.library-collection-section.complete {
  border-color: #2a7d3a;
  background: #f3faf4;
}

.library-card.complete .library-card-progress-fill {
  background: #2a7d3a;
}

.library-card.complete .library-card-progress-label {
  color: #2a7d3a;
  font-weight: 700;
}

.library-card.missing {
  opacity: 0.55;
}

.library-card-park-button,
.library-card-delete-button,
.library-card-trash-button {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 120ms ease-out, color 120ms ease-out, background-color 120ms ease-out,
    border-color 120ms ease-out;
}

.library-card-trash-button {
  width: 0;
  min-width: 0;
  border-width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.library-card:hover .library-card-trash-button,
.library-card:focus-within .library-card-trash-button,
.library-card-trash-button:focus-visible {
  width: 28px;
  border-width: 1px;
  opacity: 1;
  pointer-events: auto;
}

.library-card-park-button svg,
.library-card-delete-button svg,
.library-card-trash-button svg {
  width: 14px;
  height: 14px;
}

.library-card:hover .library-card-park-button,
.library-card:hover .library-card-delete-button,
.library-card:hover .library-card-trash-button,
.library-card-park-button:focus-visible,
.library-card-delete-button:focus-visible,
.library-card-trash-button:focus-visible {
  opacity: 1;
}

.library-card-park-button:hover,
.library-card-delete-button:hover {
  color: var(--ink);
  background: var(--paper-strong);
  border-color: var(--line);
}

.library-card-delete-button {
  color: #9f3535;
}

.library-card-delete-button:hover {
  color: #7d1f1f;
}

/* Trash button — same neutral resting state as park, but turns red on hover
   to signal destructive intent. Distinct from delete-missing (which is always
   red because the file is already gone). */
.library-card-trash-button:hover {
  color: #b3261e;
  background: rgba(179, 38, 30, 0.08);
  border-color: rgba(179, 38, 30, 0.3);
}

.library-card-collection-remove {
  align-self: flex-start;
  margin-top: 12px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--control-bg);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
}

.library-card-collection-remove:hover,
.library-card-collection-remove:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.library-card-collection-remove:disabled {
  opacity: 0.55;
  cursor: progress;
}

.library-card.parked,
.library-collection-section.parked {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.library-card.parked:hover,
.library-collection-section.parked:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(11, 102, 216, 0.12);
}

.library-card.parked .library-card-title,
.library-collection-section.parked .library-collection-title {
  color: var(--accent);
}

.library-card.parked .library-card-park-button,
.library-card.parked .library-collection-park-button,
.library-collection-section.parked > .library-collection-park-button {
  opacity: 1;
  color: var(--accent);
  border-color: rgba(11, 102, 216, 0.22);
}

.library-card.parked .library-card-park-button:hover,
.library-card.parked .library-collection-park-button:hover,
.library-collection-section.parked > .library-collection-park-button:hover {
  background: rgba(11, 102, 216, 0.12);
  color: var(--accent);
}

/* Narrow viewport: collapse parked card to title only. The library grid is
   single-column below ~640px viewport — collapsing there saves real vertical
   scroll without creating awkward row gaps next to full-size active cards. */
@media (max-width: 639px) {
  .library-card.parked {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .library-card.parked .library-card-link {
    gap: 0;
  }

  .library-card.parked .library-card-title {
    -webkit-line-clamp: 1;
  }

  .library-card.parked .library-card-path,
  .library-card.parked .library-card-progress,
  .library-card.parked .library-card-time {
    display: none;
  }
}

.library-empty {
  margin: 32px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 560px;
}

.library-empty[hidden] {
  display: none;
}

.library-empty-title {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.01em;
}

.library-empty-body {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}

.library-empty-aside {
  margin: 0;
  color: var(--ink-faint);
  font-size: 13.5px;
  line-height: 1.5;
}

.library-empty code {
  background: var(--paper-strong);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 13px;
}

/* ---------- Dark mode (follows system) ---------- */

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #1b1c1f;
    --ink: #d4cebc;
    --ink-soft: #aaa294;
    --ink-faint: #817a70;
    --line: #303137;
    --line-soft: #24262a;
    --paper: #22242a;
    --paper-strong: #2a2d34;
    --accent: #82a9e6;
    --accent-soft: rgba(130, 169, 230, 0.16);
    --done: #ada596;
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
    --control-bg: var(--paper-strong);
    --control-hover-bg: var(--paper);
    --control-hover-border: #3a3d44;
    --control-quiet: var(--ink-soft);
    --control-active-bg: var(--ink);
    --control-active-text: var(--page);
    --control-active-hover-bg: #e9e1ca;
    --check-bg: var(--paper-strong);
    --check-border: #4a4d54;
    --code-ink: var(--ink);
    --success-bg: rgba(125, 156, 94, 0.14);
    --success-border: #526842;
    --success-ring: rgba(125, 156, 94, 0.2);
    --success-accent: #91b96e;
    --complete-step-bg: rgba(125, 156, 94, 0.13);
    --complete-step-border: #475a3a;
    --complete-step-hover: rgba(145, 185, 110, 0.08);
    --complete-step-check-border: #6f8b59;
    --complete-step-check: #9cc27b;
  }

  body {
    background: var(--page);
  }

  /* Translucent app chrome */
  .topbar {
    background: rgba(21, 23, 26, 0.94);
  }

  .mobile-bottombar {
    background: rgba(21, 23, 26, 0.96);
  }

  /* Floating / elevated surfaces (white in light mode → dark elevated in dark mode).
     Excludes .button-primary so it keeps its inverted (ink-bg) treatment. */
  .resume-preview,
  .toast,
  .conflict-modal .conflict-card,
  .switch-menu,
  .library-card,
  .button:not(.button-primary),
  .filter-chip,
  .placeholder-field input,
  .prompt-editor,
  .check-row .check-button,
  .glyph-check {
    background: var(--paper-strong);
  }

  .prompt-placeholders {
    background: rgba(255, 255, 255, 0.03);
  }

  .conflict-modal {
    background: rgba(0, 0, 0, 0.6);
  }

  .conflict-diff textarea {
    color: var(--ink);
  }

  /* Inverted surfaces — ink background + light text. In dark mode ink is light, so text inverts. */
  .button-primary,
  .button[aria-pressed="true"],
  .filter-chip[aria-pressed="true"],
  .phase-banner {
    color: var(--page);
  }

  .check-row.done .check-button,
  .glyph-check.done,
  .glyph-check.done::before {
    color: var(--page);
  }

  .button-primary:hover,
  .button[aria-pressed="true"]:hover {
    background: var(--control-active-hover-bg);
    border-color: var(--control-active-hover-bg);
  }

  .phase-banner .phase-banner-meta {
    color: rgba(0, 0, 0, 0.55);
  }

  .phase-banner .phase-banner-close {
    color: rgba(0, 0, 0, 0.6);
  }

  .phase-banner .phase-banner-close:hover {
    color: var(--page);
  }

  /* Quiet, icon, and text buttons */
  .button-quiet {
    color: var(--ink-soft);
  }

  .button:not(.button-primary):hover {
    border-color: var(--control-hover-border);
    background: var(--control-hover-bg);
    color: var(--ink);
  }

  .icon-button,
  .text-button {
    color: var(--ink-soft);
  }

  .icon-button:hover,
  .text-button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ink);
  }

  /* Document text + code colors that were hard-coded for light surfaces */
  .document em {
    color: #d8d4c2;
  }

  .prompt-code {
    color: #cfcdb8;
  }

  .prompt-editor {
    color: var(--ink);
  }

  /* Check button neutral borders */
  .check-row .check-button {
    border-color: #4a4d54;
  }

  .glyph-check {
    border-color: #4a4d54;
  }

  .check-row.done .check-label {
    text-decoration-color: #5a564f;
  }

  /* Library "complete" state — green tuned for dark surfaces */
  .library-card.complete,
  .library-collection-section.complete {
    border-color: var(--success-border);
    background: var(--success-bg);
  }

  .library-card.complete .library-card-progress-fill {
    background: var(--success-accent);
  }

  .library-card.complete .library-card-progress-label {
    color: var(--complete-step-check);
  }

  .switch-menu .switch-item.complete .switch-title,
  .switch-menu .switch-item.complete .switch-meta {
    color: var(--complete-step-check);
  }

  /* Library "parked" state — blue tuned for dark surfaces */
  .library-card.parked,
  .library-collection-section.parked {
    border-color: var(--accent);
    background: var(--accent-soft);
  }

  .library-card.parked .library-card-title,
  .library-card.parked .library-card-park-button,
  .library-card.parked .library-collection-park-button,
  .library-collection-section.parked .library-collection-title,
  .library-collection-section.parked > .library-collection-park-button {
    color: var(--accent);
  }

  .library-card.parked:hover,
  .library-collection-section.parked:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  }

  .library-card.parked .library-card-park-button:hover,
  .library-card.parked .library-collection-park-button:hover,
  .library-collection-section.parked > .library-collection-park-button:hover {
    background: rgba(130, 169, 230, 0.16);
  }

  .library-collection-park-button:hover,
  .library-card-park-button:hover,
  .library-card-delete-button:hover {
    background: var(--control-hover-bg);
    border-color: var(--control-hover-border);
  }

  .library-card-delete-button {
    color: #ff7370;
  }

  /* Save error text */
  .save-status[data-state="error"],
  .save-status-inline[data-state="error"] {
    color: #ff7370;
  }
}

/* --- Review cards (step + phase) ------------------------------------------ */

/* Per-step review cards inherit prompt-card chrome (paper bg, faint label) so
   the "PROMPT" and "REVIEW" cards look like siblings — only the label name
   differentiates them. Phase review cards take a distinct accent treatment
   to mark phase-end milestones. */

details.prompt-card.prompt-phase-review {
  margin-top: 56px;
  margin-bottom: 12px;
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

details.prompt-card.prompt-phase-review > summary.prompt-summary:hover {
  background: rgba(11, 102, 216, 0.06);
}

details.prompt-card.prompt-phase-review .prompt-card-label {
  color: var(--accent);
  font-size: 13px;
}

details.prompt-card.prompt-phase-review[data-completed="true"] {
  border-color: var(--success-border);
  background: var(--success-bg);
  box-shadow: none;
}

details.prompt-card.prompt-phase-review[data-completed="true"] .prompt-card-label {
  color: var(--ink-soft);
}

.phase-complete-button {
  margin: 8px 0 56px;
}

/* --- Phase header (chapter break: thick line + numbered circle + title) -- */

/* Strong visual break between phases. A thick line cuts the page; a black
   circle with the phase number sits centred on it; the eyebrow + descriptive
   title are centred below. */

.phase-header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 80px 0 40px;
  padding-top: 36px;
}

.phase-header::before {
  content: '';
  position: absolute;
  top: 26px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--ink);
}

.phase-header-circle {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--control-active-text);
  font-size: 24px;
  font-weight: 800;
  font-feature-settings: "tnum";
  line-height: 1;
}

.phase-header-eyebrow {
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.phase-header-title {
  color: var(--ink);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.005em;
  text-align: center;
}

/* --- Work divider (transition from passive checklist into active work) ---- */

.work-divider {
  display: flex;
  justify-content: center;
  margin: 64px 0 16px;
  padding: 24px 0;
  border-top: 4px solid var(--ink);
  border-bottom: 4px solid var(--ink);
}

.work-divider-label {
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* --- Step group (wraps each step's H2 + content + cards + complete) ------- */

.step-group {
  scroll-margin-top: 24px;
}

/* Active (incomplete) step — flat layout. */
section.step-group[data-completed="false"] {
  display: block;
}

/* Completed step — collapsible compact summary, faint green tint.
   Body shows description paragraph + impl prompt card if expanded. The
   step-review card is hidden because the review has already happened. */

details.step-group[data-completed="true"] {
  margin: 8px 0;
  padding: 0;
  border: 1px solid var(--complete-step-border);
  border-radius: 6px;
  background: var(--complete-step-bg);
}

details.step-group[data-completed="true"] > summary.step-group-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

details.step-group[data-completed="true"] > summary.step-group-summary::-webkit-details-marker {
  display: none;
}

details.step-group[data-completed="true"] > summary.step-group-summary:hover {
  background: var(--complete-step-hover);
}

.step-group-checkmark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--complete-step-check-border);
  border-radius: 50%;
  background: var(--control-bg);
  color: var(--complete-step-check);
  font-size: 11px;
  line-height: 1;
}

.step-group-title {
  flex: 1;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

.step-group-chevron {
  color: var(--ink-faint);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.15s ease;
}

details.step-group[data-completed="true"][open] .step-group-chevron {
  transform: rotate(90deg);
}

/* Expanded body for completed step: paragraph + impl prompt card.
   Review cards stay hidden — the review's already happened. */

details.step-group[data-completed="true"] > * {
  /* default reset, then targeted */
}

details.step-group[data-completed="true"] > p {
  padding: 4px 14px 14px;
  margin: 0;
  font-size: 15px;
  color: var(--ink-soft);
}

details.step-group[data-completed="true"] .prompt-step-review,
details.step-group[data-completed="true"] .step-complete-button {
  display: none;
}

details.step-group[data-completed="true"] .prompt-card {
  margin: 0 14px 14px;
}

/* --- Step metadata chips (Model + Parallel, under each step heading) ----- */

/* Chips render directly under the step H2 heading. Two chips side by side,
   compact, no visual noise — they're informational, not decorative. */

.step-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 16px;
}

details.step-group[data-completed="true"] .step-meta {
  margin: 8px 14px 4px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.005em;
  white-space: nowrap;
}

/* Model chip — two segments (Claude Code + Codex) split by a thin divider.
   Each segment leads with a tiny mono glyph in a distinct tone so the eye
   can tell the agents apart at a glance. */

.meta-model {
  font-family: var(--mono);
  cursor: help;
}

.meta-model .agent-glyph {
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.06em;
}

.meta-model .agent-glyph-cc {
  color: var(--accent);
}

.meta-model .agent-glyph-cx {
  color: color-mix(in srgb, var(--ink) 58%, transparent);
}

.meta-model .agent-spec {
  color: var(--ink);
}

.meta-model .agent-divider {
  width: 1px;
  height: 12px;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
}

/* Parallel chip — subtle accent tint for the YES form; clickable sibling
   step references reuse the existing step-link dashed-underline idiom. */

.meta-parallel {
  background: color-mix(in srgb, var(--accent) 7%, var(--paper));
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--ink);
}

.meta-parallel .meta-parallel-label {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.meta-parallel .meta-parallel-sep {
  color: color-mix(in srgb, var(--ink) 35%, transparent);
}

.meta-parallel .meta-step-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: border-color 120ms ease-out;
  cursor: pointer;
}

.meta-parallel .meta-step-link:hover {
  border-bottom-color: color-mix(in srgb, var(--accent) 60%, transparent);
}

/* Sequential variant — the deliberate, muted opposite of YES. No accent,
   no links, signals "this step waits its turn". */

.meta-sequential {
  background: var(--paper);
  border-color: color-mix(in srgb, var(--ink) 10%, transparent);
  color: color-mix(in srgb, var(--ink) 55%, transparent);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 11px;
}

/* --- Doc section (collapsible top-level intro/protocol H2 sections) ------- */

/* Collapsible H2 sections (Scope, Context, How prompts work, Review protocol).
   Default open for most; "Review protocol" defaults closed because it's long
   reference material. Open/closed state persists per section in prefs. */

details.doc-section {
  margin: 24px 0;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--paper);
}

details.doc-section > summary.doc-section-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

details.doc-section > summary.doc-section-summary::-webkit-details-marker {
  display: none;
}

details.doc-section > summary.doc-section-summary:hover {
  background: rgba(18, 18, 18, 0.025);
}

.doc-section-chevron {
  color: var(--ink-faint);
  font-size: 22px;
  line-height: 1;
  transition: transform 0.15s ease;
}

details.doc-section[open] .doc-section-chevron {
  transform: rotate(90deg);
  color: var(--ink-soft);
}

.doc-section-title {
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.005em;
}

.doc-section-copy {
  margin-left: auto;
}

.doc-section-body {
  padding: 0 18px 18px;
}

.doc-section-body > :first-child {
  margin-top: 0;
}

/* --- FINAL REVIEW checkbox row (closes a phase) --------------------------- */

/* The phase's last item in the progress checklist. Visually marked apart from
   regular step rows: an accent-coloured separator above and uppercase label
   in accent so it reads as the gate that closes the phase. */

.check-row.check-row-final-review {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--accent);
}

.check-row.check-row-final-review .check-label,
.check-row.check-row-final-review .check-label .step-link {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.check-row.check-row-final-review.done .check-label,
.check-row.check-row-final-review.done .check-label .step-link {
  color: var(--ink-soft);
}

/* --- FINAL REVIEW card (campaign-level gate) ------------------------------ */

/* The final review card sits at the bottom of new-shape campaigns. It's the
   single gate that closes the whole campaign, so it's visually heavier than
   per-phase review cards: ink border, paper background with an accent
   shoulder, a strong eyebrow + title, and a prominent "Close campaign"
   button below. */

.final-review-card {
  position: relative;
  scroll-margin-top: 132px;
  margin: 96px 0 64px;
  padding: 32px 32px 28px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  box-shadow:
    0 0 0 4px var(--accent-soft),
    var(--shadow);
}

.final-review-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 4px;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
}

.final-review-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.final-review-eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.final-review-title {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.final-review-blurb {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.5;
}

.final-review-prompt {
  position: relative;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
  overflow: hidden;
}

.final-review-toolbar {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: flex;
  gap: 6px;
}

.final-review-prompt-code {
  margin: 0;
  padding: 22px 26px 26px;
  background: var(--control-bg);
  border-top: 0;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
}

.final-review-prompt-code.final-review-prompt-empty {
  color: var(--ink-faint);
  font-style: italic;
}

.close-campaign-button {
  min-height: 44px;
  padding: 0 22px;
  font-size: 15px;
  font-weight: 760;
  letter-spacing: 0.02em;
}

.final-review-card[data-completed="true"] {
  border-color: var(--success-border);
  background: var(--success-bg);
  box-shadow: 0 0 0 4px var(--success-ring);
}

.final-review-card[data-completed="true"]::before {
  background: var(--success-accent);
}

.final-review-card[data-completed="true"] .final-review-eyebrow {
  color: var(--ink-soft);
}

.final-review-card[data-completed="true"] .close-campaign-button {
  cursor: default;
  opacity: 0.82;
}

/* ---------- Settings Button & Drawer Styles ---------- */

.button-icon {
  width: 38px;
  padding: 0;
}

#companion-button {
  gap: 8px;
}

#settings-button svg {
  transition: transform 180ms ease-out;
}

#settings-button:hover svg {
  transform: rotate(18deg);
}

.settings-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  visibility: hidden;
  transition: visibility 180ms ease-out;
}

.settings-drawer:not([hidden]) {
  visibility: visible;
}

.settings-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 18, 18, 0.36);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.settings-drawer:not([hidden]) .settings-drawer-backdrop {
  opacity: 1;
}

.settings-drawer-content {
  position: relative;
  width: min(390px, 100vw);
  height: 100%;
  background: color-mix(in srgb, var(--page) 88%, var(--paper));
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 44px rgba(18, 18, 18, 0.14);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--ink);
}

.settings-drawer:not([hidden]) .settings-drawer-content {
  transform: translateX(0);
}

.settings-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 720;
}

.settings-close-button {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.72;
  transition:
    background 120ms ease-out,
    border-color 120ms ease-out,
    opacity 120ms ease-out;
}

.settings-close-button:hover {
  border-color: var(--line);
  background: var(--paper);
  opacity: 1;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-section h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 8px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-group label {
  font-size: 14px;
  font-weight: 600;
}

.settings-select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.settings-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.settings-row-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 44px;
}

.toggle-label-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.toggle-label-wrap strong {
  font-size: 15px;
  font-weight: 600;
}

.toggle-label-wrap span,
.field-desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.35;
}

.settings-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-field-group strong {
  font-size: 15px;
  display: block;
}

.input-with-button {
  display: flex;
  gap: 8px;
}

.input-with-button input {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  min-width: 0;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.input-with-button .button {
  flex: 0 0 auto;
  width: auto;
}

.input-with-button input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--line);
  transition: background 140ms ease-out;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: transform 140ms cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
  width: 100vw;
  height: 100vh;
}

/* ---------- Automation status indicator (library cards + campaign view) ---------- */

.automate-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  color: var(--accent);
  line-height: 1;
}

.automate-indicator--running {
  border: 2px solid color-mix(in srgb, currentColor 22%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: automate-spin 820ms linear infinite;
}

.automate-indicator--attention {
  border: 1.5px solid currentColor;
  border-radius: 50%;
  color: #b3261e;
  font-size: 9px;
  font-weight: 850;
}

.automate-indicator--complete {
  color: #1e7e34;
  font-size: 12px;
  font-weight: 850;
}

.automate-indicator--idle {
  display: none;
}

@keyframes automate-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .automate-indicator--running {
    animation: none;
  }
}

.library-card-automate-dot {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
}

.automate-status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.automate-status-line[hidden] {
  display: none;
}

.automate-status-line .automate-indicator {
  width: 12px;
  height: 12px;
}

.automate-status-text {
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .automate-indicator--attention {
    color: #ff7370;
  }
}

body.theme-graphite .automate-indicator--attention,
body.theme-blueprint .automate-indicator--attention {
  color: #ff7370;
}

/* ---------- Theme Overrides ---------- */

body.theme-graphite {
  color-scheme: dark;
  --page: #1b1814;
  --paper: #242018;
  --paper-strong: #2e281f;
  --ink: #d3c8b3;
  --ink-soft: #aa9e8b;
  --ink-faint: #817565;
  --line: #42392d;
  --line-soft: #2d271f;
  --accent: #c39a4a;
  --accent-soft: rgba(195, 154, 74, 0.16);
  --done: #ada18f;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.56);
  --control-bg: var(--paper-strong);
  --control-hover-bg: var(--paper);
  --control-hover-border: #50483b;
  --control-quiet: var(--ink-soft);
  --control-active-bg: var(--ink);
  --control-active-text: var(--page);
  --control-active-hover-bg: #e6dbc3;
  --check-bg: var(--paper-strong);
  --check-border: #574f42;
  --code-ink: var(--ink);
  --success-bg: rgba(129, 157, 86, 0.14);
  --success-border: #607246;
  --success-ring: rgba(129, 157, 86, 0.2);
  --success-accent: #9fbd6b;
  --complete-step-bg: rgba(129, 157, 86, 0.13);
  --complete-step-border: #52633e;
  --complete-step-hover: rgba(159, 189, 107, 0.08);
  --complete-step-check-border: #728952;
  --complete-step-check: #abc878;
}

body.theme-graphite .topbar {
  background: rgba(27, 24, 20, 0.94);
}

body.theme-blueprint {
  color-scheme: dark;
  --page: #151d1e;
  --paper: #1a2526;
  --paper-strong: #243031;
  --ink: #cfdbd3;
  --ink-soft: #a2b3ab;
  --ink-faint: #7d9289;
  --line: #2c4240;
  --line-soft: #1c2d2c;
  --accent: #83b9a8;
  --accent-soft: rgba(131, 185, 168, 0.15);
  --done: #9bb2aa;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.52);
  --control-bg: var(--paper-strong);
  --control-hover-bg: var(--paper);
  --control-hover-border: #36514f;
  --control-quiet: var(--ink-soft);
  --control-active-bg: var(--ink);
  --control-active-text: var(--page);
  --control-active-hover-bg: #dde8df;
  --check-bg: var(--paper-strong);
  --check-border: #415a57;
  --code-ink: var(--ink);
  --success-bg: rgba(113, 163, 139, 0.14);
  --success-border: #4e6f63;
  --success-ring: rgba(113, 163, 139, 0.2);
  --success-accent: #83b9a8;
  --complete-step-bg: rgba(113, 163, 139, 0.13);
  --complete-step-border: #435f56;
  --complete-step-hover: rgba(131, 185, 168, 0.08);
  --complete-step-check-border: #5f8378;
  --complete-step-check: #98c8ba;
}

body.theme-blueprint .topbar {
  background: rgba(21, 29, 30, 0.94);
}

body.theme-signal {
  color-scheme: light;
  --page: #f8f4ea;
  --paper: #fffdf7;
  --paper-strong: #eee7d8;
  --ink: #171512;
  --ink-soft: #5f574b;
  --ink-faint: #6e6355;
  --line: #d7ccbb;
  --line-soft: #e8dfd1;
  --accent: #b2462d;
  --accent-soft: rgba(178, 70, 45, 0.12);
  --done: #756b5f;
  --shadow: 0 18px 44px rgba(69, 52, 35, 0.12);
  --control-bg: #fffdf7;
  --control-hover-bg: #eee7d8;
  --control-hover-border: #c5b7a2;
  --control-quiet: #50483d;
  --control-active-bg: var(--ink);
  --control-active-text: #fffdf7;
  --control-active-hover-bg: #000;
  --check-bg: #fffdf7;
  --check-border: #bfb19d;
  --code-ink: var(--ink);
  --success-bg: #edf4df;
  --success-border: #b2c99a;
  --success-ring: #dce9c9;
  --success-accent: #789957;
  --complete-step-bg: #edf4df;
  --complete-step-border: #c8d9b3;
  --complete-step-hover: rgba(120, 153, 87, 0.08);
  --complete-step-check-border: #abc08f;
  --complete-step-check: #5f7e41;
}

body.theme-signal .topbar {
  background: rgba(248, 244, 234, 0.94);
}

body.theme-graphite .button:not(.button-primary),
body.theme-blueprint .button:not(.button-primary) {
  background: var(--paper-strong);
}

body.theme-graphite .button-quiet,
body.theme-blueprint .button-quiet {
  color: var(--ink-soft);
}

body.theme-graphite .button:not(.button-primary):hover,
body.theme-blueprint .button:not(.button-primary):hover {
  background: var(--paper);
  border-color: var(--line);
  color: var(--ink);
}

body.theme-graphite .button-primary,
body.theme-blueprint .button-primary {
  color: var(--page);
}

/* ---------- Automate drawer (right-side activity panel) ---------- */

.automate-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.automate-drawer[hidden] {
  display: none;
}

.automate-drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(18, 18, 18, 0.36);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
}

@media (max-width: 899px) {
  .automate-drawer:not([hidden]) .automate-drawer-scrim {
    opacity: 1;
    pointer-events: auto;
  }
}

.automate-drawer-resize {
  flex: 0 0 6px;
  cursor: ew-resize;
  user-select: none;
  pointer-events: auto;
  position: relative;
}

.automate-drawer-resize::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 32px;
  border-radius: 2px;
  background: var(--line);
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease-out, background 180ms ease-out;
}

.automate-drawer-resize:hover::before,
.automate-drawer-resize.is-dragging::before {
  opacity: 1;
  background: var(--ink-faint);
}

.automate-drawer-panel {
  display: flex;
  flex-direction: column;
  width: var(--drawer-width, 420px);
  min-width: 320px;
  max-width: 720px;
  height: 100%;
  background: color-mix(in srgb, var(--page) 88%, var(--paper));
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 36px rgba(18, 18, 18, 0.12);
  pointer-events: auto;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.automate-drawer:not([hidden]) .automate-drawer-panel {
  transform: translateX(0);
}

.automate-drawer-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.automate-drawer-title {
  margin: 0;
  font-size: 17px;
  font-weight: 720;
}

.automate-drawer-close {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.72;
  transition:
    background 120ms ease-out,
    border-color 120ms ease-out,
    opacity 120ms ease-out;
}

.automate-drawer-close:hover {
  border-color: var(--line);
  background: var(--paper);
  opacity: 1;
}

.automate-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.automate-drawer-empty {
  margin: 0;
  padding: 48px 0;
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
}

/* Status indicator on the drawer toggle button */
#automate-drawer-toggle {
  position: relative;
}

#automate-drawer-toggle .drawer-indicator {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 14px;
  height: 14px;
  background: var(--paper);
}

/* Very narrow: drawer takes full width */
@media (max-width: 559px) {
  .automate-drawer-panel {
    width: 100vw;
    max-width: none;
  }

  .automate-drawer-resize {
    display: none;
  }
}

/* Dark mode tweaks for drawer */
@media (prefers-color-scheme: dark) {
  .automate-drawer-panel {
    box-shadow: -12px 0 36px rgba(0, 0, 0, 0.5);
  }

  .automate-drawer-scrim {
    background: rgba(0, 0, 0, 0.5);
  }

  #automate-drawer-toggle .drawer-indicator {
    background: var(--paper-strong);
  }
}

body.theme-graphite .automate-drawer-panel,
body.theme-blueprint .automate-drawer-panel {
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.5);
}

body.theme-graphite #automate-drawer-toggle .drawer-indicator,
body.theme-blueprint #automate-drawer-toggle .drawer-indicator {
  background: var(--paper-strong);
}

/* ---------- Drawer content sections ---------- */

.drawer-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
}

.drawer-status-pill--active {
  background: rgba(52, 168, 83, 0.12);
  color: #1e7e34;
}
.drawer-status-pill--active .automate-indicator {
  color: #34a853;
}

.drawer-status-pill--stalled {
  background: rgba(251, 188, 4, 0.14);
  color: #a66d00;
}
.drawer-status-pill--stalled .automate-indicator { color: #a66d00; }

.drawer-status-pill--halted {
  background: rgba(128, 128, 128, 0.1);
  color: var(--ink-faint);
}
.drawer-status-pill--halted .automate-indicator { color: var(--ink-faint); }

.drawer-status-pill--completed {
  background: rgba(52, 168, 83, 0.08);
  color: #1e7e34;
}
.drawer-status-pill--completed .automate-indicator { color: #34a853; }

.drawer-status-pill--failed {
  background: rgba(179, 38, 30, 0.1);
  color: #b3261e;
}
.drawer-status-pill--failed .automate-indicator { color: #b3261e; }

/* Current step block — legacy fallback (drawer-now subsumes this for
   campaigns with parsed live_activity). */
.drawer-current-step {
  padding: 14px 16px;
  background: var(--surface, rgba(128, 128, 128, 0.06));
  border-radius: 10px;
  margin-bottom: 18px;
}

.drawer-current-step-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.drawer-current-step-id {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent, #3b82f6);
  white-space: nowrap;
}

.drawer-current-step-name {
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-current-step-elapsed {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.drawer-step-prompt-toggle {
  margin-top: 10px;
}

.drawer-step-prompt-toggle summary {
  font-size: 12px;
  color: var(--ink-faint);
  cursor: pointer;
  user-select: none;
}

.drawer-step-prompt-code {
  margin-top: 8px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.5;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}

/* "Now" block — what the agent is doing right this moment.
   Subsumes the old current-step header AND replaces the raw log
   as the primary observable surface during a running step. */
.drawer-now {
  padding: 14px 16px 12px;
  background: var(--surface, rgba(128, 128, 128, 0.06));
  border-radius: 10px;
  margin-bottom: 18px;
}

.drawer-now-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.drawer-now-step-id {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent, #3b82f6);
  white-space: nowrap;
}

.drawer-now-step-name {
  font-size: 13px;
  color: var(--ink);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-now-elapsed {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* The agent's voice — most recent assistant text from the stream. */
.drawer-now-voice {
  margin: 0 0 12px;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
  font-style: italic;
  color: var(--ink-soft, var(--ink-faint));
}

.drawer-now-voice--legacy {
  font-style: normal;
  font-size: 12px;
  color: var(--ink-faint);
}

.drawer-eta {
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 0;
  margin: 0 0 12px;
}

.drawer-eta-header {
  display: grid;
  grid-template-columns: max-content 1fr max-content;
  align-items: center;
  gap: 8px;
}

.drawer-eta-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.drawer-eta-window {
  font-size: 15px;
  font-weight: 750;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-eta-confidence {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--paper);
  border: 1px solid var(--line-soft);
}

.drawer-eta-confidence--high {
  color: #1e7e34;
}

.drawer-eta-confidence--medium {
  color: #8a5a00;
}

.drawer-eta-suggestion {
  margin: 7px 0 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft, var(--ink-faint));
}

.drawer-eta-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.drawer-eta-facts span {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}

/* Tool-call chips — recent actions stream. */
.drawer-now-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.drawer-now-action {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 11px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  color: var(--ink);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Subtle tool-category tints — drawn via left border so the chip body stays
   calm. One pixel of color is enough to scan a stream of mixed actions. */
.drawer-now-action--read,
.drawer-now-action--glob,
.drawer-now-action--grep { border-left: 2px solid rgba(59, 130, 246, 0.55); }

.drawer-now-action--edit,
.drawer-now-action--write,
.drawer-now-action--multiedit { border-left: 2px solid rgba(251, 188, 4, 0.7); }

.drawer-now-action--bash { border-left: 2px solid rgba(155, 155, 155, 0.7); }

.drawer-now-action--task { border-left: 2px solid rgba(168, 85, 247, 0.6); }

.drawer-now-action--webfetch,
.drawer-now-action--websearch { border-left: 2px solid rgba(20, 184, 166, 0.6); }

.drawer-now-action--todowrite { border-left: 2px solid rgba(34, 197, 94, 0.5); }

/* Effort row — small numerics that prove the agent is doing work. */
.drawer-now-effort {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
  letter-spacing: 0.01em;
}

.drawer-now-prompt-toggle {
  margin-top: 10px;
}

.drawer-now-prompt-toggle summary {
  font-size: 12px;
  color: var(--ink-faint);
  cursor: pointer;
  user-select: none;
}

/* Section titles */
.drawer-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin: 0 0 10px;
  cursor: pointer;
  user-select: none;
}

h3.drawer-section-title {
  cursor: default;
}

/* Timeline */
.drawer-timeline {
  margin-bottom: 18px;
}

.drawer-timeline-empty {
  font-size: 12px;
  color: var(--ink-faint);
  margin-bottom: 18px;
}

.drawer-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-timeline-chip {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.4;
}

.drawer-timeline-time {
  flex-shrink: 0;
  width: 56px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.drawer-timeline-event {
  color: var(--ink);
  word-break: break-word;
}

.drawer-show-all-btn {
  margin-top: 6px;
  font-size: 11px;
  color: var(--accent, #3b82f6);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
}
.drawer-show-all-btn:hover { text-decoration: underline; }

/* Receipts */
.drawer-receipts {
  margin-bottom: 18px;
}

.drawer-receipts-empty {
  display: none;
}

.drawer-receipt-item {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
}

.drawer-receipt-item[open] {
  border-color: var(--line);
}

.drawer-receipt-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}

.drawer-receipt-id {
  font-weight: 700;
  font-size: 12px;
  color: var(--accent, #3b82f6);
  flex-shrink: 0;
}

.drawer-receipt-name {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-receipt-content {
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.6;
  border-top: 1px solid var(--line-soft);
  max-height: 400px;
  overflow-y: auto;
}

.drawer-receipt-content h3,
.drawer-receipt-content h4 {
  font-size: 13px;
  margin: 8px 0 4px;
}

.drawer-receipt-content code {
  font-size: 11px;
  padding: 1px 4px;
  background: rgba(128, 128, 128, 0.1);
  border-radius: 3px;
}

.drawer-receipt-content ul {
  margin: 4px 0;
  padding-left: 18px;
}

.drawer-receipt-content li {
  margin: 2px 0;
}

.drawer-receipt-empty {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--ink-faint);
  border-top: 1px solid var(--line-soft);
  margin: 0;
}

/* Log tail */
.drawer-log-tail {
  margin-bottom: 12px;
}

.drawer-log-tail > summary {
  list-style: none;
}

.drawer-log-tail > summary::-webkit-details-marker {
  display: none;
}

.drawer-log-container {
  position: relative;
  max-height: 320px;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  margin-top: 8px;
}

.drawer-log-pre {
  margin: 0;
  padding: 12px;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono, ui-monospace, 'SF Mono', SFMono-Regular, Menlo, monospace);
}

.drawer-log-rejoin {
  position: sticky;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: block;
  margin: 0 auto;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.drawer-log-rejoin[hidden] { display: none; }

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .drawer-status-pill--active { background: rgba(52, 168, 83, 0.15); color: #6dd58c; }
  .drawer-status-pill--active .automate-indicator { color: #6dd58c; }
  .drawer-status-pill--stalled { background: rgba(251, 188, 4, 0.15); color: #fdd663; }
  .drawer-status-pill--stalled .automate-indicator { color: #fdd663; }
  .drawer-status-pill--completed { background: rgba(52, 168, 83, 0.1); color: #6dd58c; }
  .drawer-status-pill--completed .automate-indicator { color: #6dd58c; }
  .drawer-status-pill--failed { background: rgba(255, 115, 112, 0.12); color: #ff7370; }
  .drawer-status-pill--failed .automate-indicator { color: #ff7370; }
}

body.theme-graphite .drawer-status-pill--active,
body.theme-blueprint .drawer-status-pill--active { background: rgba(52, 168, 83, 0.15); color: #6dd58c; }
body.theme-graphite .drawer-status-pill--active .automate-indicator,
body.theme-blueprint .drawer-status-pill--active .automate-indicator { color: #6dd58c; }
body.theme-graphite .drawer-status-pill--completed,
body.theme-blueprint .drawer-status-pill--completed { background: rgba(52, 168, 83, 0.1); color: #6dd58c; }
body.theme-graphite .drawer-status-pill--completed .automate-indicator,
body.theme-blueprint .drawer-status-pill--completed .automate-indicator { color: #6dd58c; }
body.theme-graphite .drawer-status-pill--failed,
body.theme-blueprint .drawer-status-pill--failed { background: rgba(255, 115, 112, 0.12); color: #ff7370; }
body.theme-graphite .drawer-status-pill--failed .automate-indicator,
body.theme-blueprint .drawer-status-pill--failed .automate-indicator { color: #ff7370; }

/* ---------- Drawer nudge section ---------- */

.drawer-nudge {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: rgba(251, 188, 4, 0.08);
  border: 1px solid rgba(251, 188, 4, 0.25);
  border-radius: 10px;
}

.drawer-nudge-header {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}

.drawer-nudge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.drawer-nudge-btn {
  font-size: 13px;
  min-height: 34px;
  padding: 0 14px;
}

.drawer-nudge-btn--secondary {
  border-color: var(--line);
  background: var(--control-bg);
  color: var(--ink-soft);
}

.drawer-nudge-btn--secondary:hover {
  border-color: var(--control-hover-border);
  background: var(--control-hover-bg);
  color: var(--ink);
}

.drawer-nudge-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Nudge confirm modal ---------- */

.nudge-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 18, 18, 0.45);
  backdrop-filter: blur(3px);
}

.nudge-confirm-card {
  width: min(420px, 100%);
  padding: 22px 24px;
  border-radius: 12px;
  background: var(--control-bg);
  box-shadow: var(--shadow);
}

.nudge-confirm-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 720;
}

.nudge-confirm-desc {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.nudge-confirm-check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  cursor: pointer;
}

.nudge-confirm-checkbox {
  margin-top: 2px;
  flex-shrink: 0;
}

.nudge-confirm-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.nudge-confirm-footer .button {
  font-size: 13px;
}

/* Timeline chip pulse after nudge */
.drawer-timeline-chip.drawer-timeline-chip--pulse {
  animation: nudge-chip-pulse 600ms ease-out;
}

@keyframes nudge-chip-pulse {
  0% { background: rgba(251, 188, 4, 0.2); }
  100% { background: transparent; }
}

/* Dark mode nudge adjustments */
@media (prefers-color-scheme: dark) {
  .drawer-nudge {
    background: rgba(251, 188, 4, 0.06);
    border-color: rgba(251, 188, 4, 0.18);
  }

  .drawer-nudge-btn--secondary {
    background: var(--paper-strong);
  }

  .nudge-confirm-modal {
    background: rgba(0, 0, 0, 0.6);
  }

  .nudge-confirm-card {
    background: var(--paper-strong);
  }
}

body.theme-graphite .drawer-nudge,
body.theme-blueprint .drawer-nudge {
  background: rgba(251, 188, 4, 0.06);
  border-color: rgba(251, 188, 4, 0.18);
}

body.theme-graphite .nudge-confirm-card,
body.theme-blueprint .nudge-confirm-card {
  background: var(--paper-strong);
}

/* ---------- Drawer finalize-halt section ---------- */

.drawer-finalize-halt {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: rgba(255, 115, 112, 0.08);
  border: 1px solid rgba(255, 115, 112, 0.25);
  border-radius: 10px;
}

.drawer-finalize-halt-header {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 640;
  color: var(--ink);
}

.drawer-finalize-halt-body {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.drawer-finalize-halt-preview {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
  max-height: 200px;
  overflow-y: auto;
}

.drawer-finalize-halt-preview h3,
.drawer-finalize-halt-preview h4 {
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 640;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.drawer-finalize-halt-preview ul {
  margin: 0;
  padding-left: 18px;
}

.drawer-finalize-halt-preview strong {
  color: var(--ink);
}

.drawer-finalize-halt-preview code {
  font-size: 11.5px;
  background: var(--control-bg);
  padding: 1px 5px;
  border-radius: 4px;
}

.drawer-finalize-halt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.drawer-finalize-halt-btn {
  font-size: 13px;
  min-height: 34px;
  padding: 0 14px;
}

.drawer-finalize-halt-btn--secondary {
  border-color: var(--line);
  background: var(--control-bg);
  color: var(--ink-soft);
}

.drawer-finalize-halt-btn--secondary:hover {
  border-color: var(--control-hover-border);
  background: var(--control-hover-bg);
  color: var(--ink);
}

.drawer-finalize-halt-btn--tertiary {
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.drawer-finalize-halt-btn--tertiary:hover {
  color: var(--ink);
  text-decoration-color: var(--ink-soft);
}

@media (prefers-color-scheme: dark) {
  .drawer-finalize-halt {
    background: rgba(255, 115, 112, 0.06);
    border-color: rgba(255, 115, 112, 0.18);
  }

  .drawer-finalize-halt-preview {
    background: var(--paper-strong);
  }
}

body.theme-graphite .drawer-finalize-halt,
body.theme-blueprint .drawer-finalize-halt {
  background: rgba(255, 115, 112, 0.06);
  border-color: rgba(255, 115, 112, 0.18);
}

body.theme-graphite .drawer-finalize-halt-preview,
body.theme-blueprint .drawer-finalize-halt-preview {
  background: var(--paper-strong);
}

/* ---------- Finalize review modal ---------- */

.finalize-review-modal {
  position: fixed;
  inset: 0;
  z-index: 960;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 18, 18, 0.5);
  backdrop-filter: blur(3px);
}

.finalize-review-card {
  width: min(720px, 100%);
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: var(--control-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.finalize-review-header {
  position: relative;
  padding: 18px 24px 12px;
  border-bottom: 1px solid var(--line);
}

.finalize-review-title {
  margin: 0;
  font-size: 16px;
  font-weight: 720;
  padding-right: 32px;
}

.finalize-review-path {
  margin: 6px 0 0;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11.5px;
  color: var(--ink-soft);
  word-break: break-all;
}

.finalize-review-close {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 28px;
  height: 28px;
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
}

.finalize-review-close:hover {
  color: var(--ink);
}

.finalize-review-body {
  padding: 16px 24px 24px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
}

.finalize-review-body h3,
.finalize-review-body h4 {
  margin: 16px 0 6px;
  font-size: 13.5px;
  font-weight: 640;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.finalize-review-body h3:first-child,
.finalize-review-body h4:first-child {
  margin-top: 0;
}

.finalize-review-body ul {
  margin: 0 0 12px;
  padding-left: 20px;
}

.finalize-review-body strong {
  color: var(--ink);
}

.finalize-review-body code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  background: var(--paper);
  padding: 1px 5px;
  border-radius: 4px;
}

@media (prefers-color-scheme: dark) {
  .finalize-review-modal {
    background: rgba(0, 0, 0, 0.65);
  }

  .finalize-review-card {
    background: var(--paper-strong);
  }

  .finalize-review-body code {
    background: var(--paper);
  }
}

body.theme-graphite .finalize-review-card,
body.theme-blueprint .finalize-review-card {
  background: var(--paper-strong);
}

/* ---------- Drawer status pill: abandoned ---------- */

.drawer-status-pill--abandoned {
  background: var(--control-bg);
  color: var(--ink-soft);
}

.drawer-status-pill--abandoned .automate-indicator {
  color: var(--ink-soft);
}

/* ============================ Away Mode ================================== */
/* Quiet, dense execution-board styling — no lifestyle-app flourish. */

/* Drawer entry button under the inline ETA readout. */
.drawer-eta-away {
  width: 100%;
  min-height: 32px;
  margin-top: 10px;
  font-size: 12px;
}

/* Library header now carries the global all-running entry. */
.library-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.away-all-button {
  flex: 0 0 auto;
  min-height: 34px;
  margin-top: 6px;
  font-size: 13px;
}

.away-all-button[hidden] {
  display: none;
}

/* Small moon entry button on cards and stacks. */
.away-entry-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--control-bg);
  color: var(--ink-faint);
  cursor: pointer;
  opacity: 0.62;
  transition: opacity 120ms ease-out, color 120ms ease-out, border-color 120ms ease-out, background-color 120ms ease-out;
}

.away-entry-button:hover,
.away-entry-button:focus-visible {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.away-entry-button .away-icon {
  display: inline-flex;
}

.away-entry-label {
  font-size: 11px;
  font-weight: 700;
}

.library-card-away-button {
  min-height: 22px;
  padding: 2px 5px;
  margin-left: 2px;
  border-radius: 6px;
}

.library-collection-away-button {
  margin-left: 6px;
}

/* ---- overlay ---- */
.away-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 18px;
}

.away-overlay[hidden] {
  display: none;
}

.away-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 18, 18, 0.34);
  backdrop-filter: blur(1.5px);
}

.away-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(86vh, 760px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--page);
  box-shadow: var(--shadow);
}

.away-panel:focus {
  outline: none;
}

.away-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.away-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.away-title-icon {
  display: inline-flex;
  color: var(--ink);
}

.away-close {
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.away-close:hover {
  color: var(--ink);
  background: var(--paper);
}

.away-source {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- window block ---- */
.away-window {
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--paper);
  overflow: hidden;
}

.away-window--blocked {
  border-color: rgba(179, 38, 30, 0.4);
  background: rgba(179, 38, 30, 0.06);
}

/* Nothing-running is benign — a quiet, neutral empty state (not an alert). */
.away-window--idle {
  padding: 16px 18px;
}

.away-window--idle .away-window-headline {
  color: var(--ink);
}

.away-window--idle .away-window-sub {
  margin-top: 4px;
  padding: 0;
  border-top: 0;
}

.away-window-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.away-window-metric {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line-soft);
}

.away-window-metric:last-child {
  border-right: 0;
}

.away-window-metric-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 620;
  color: var(--ink-faint);
}

.away-window-metric-value {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  font-size: 24px;
  font-weight: 760;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.away-confidence {
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  background: rgba(52, 168, 83, 0.1);
  border: 1px solid rgba(52, 168, 83, 0.28);
}

.away-confidence--high { color: #1e7e34; }
.away-confidence--medium { color: #8a5a00; }

.away-window-headline {
  margin: 0;
  font-size: 15px;
  font-weight: 760;
  color: #8a2018;
}

.away-window-sub {
  margin: 0;
  padding: 10px 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-soft, var(--ink-faint));
}

.away-window-ignored-label {
  margin: 12px 0 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

.away-attention {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.away-attention li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.away-attention-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.away-attention-status {
  flex: 0 0 auto;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #8a2018;
  background: rgba(179, 38, 30, 0.1);
}

/* ---- shared section heading ---- */
.away-h3 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.away-h3-combos {
  margin-top: 14px;
}

.away-empty {
  margin: 0;
  font-size: 12px;
  color: var(--ink-faint);
}

.away-task-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.away-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms ease-out, background-color 120ms ease-out;
}

.away-suggestion--card {
  min-height: 92px;
  display: grid;
  grid-template-columns: 34px 1fr 28px;
  grid-template-rows: 1fr auto;
  align-items: center;
  gap: 4px 10px;
  padding: 12px;
}

.away-task-icon {
  grid-row: 1 / span 2;
  display: inline-flex;
  color: var(--ink);
}

.away-suggestion-time {
  grid-column: 2;
  font-size: 18px;
  font-weight: 560;
  color: var(--ink-soft, var(--ink-faint));
  font-variant-numeric: tabular-nums;
}

.away-suggestion-plus {
  grid-row: 1 / span 2;
  grid-column: 3;
  align-self: end;
  justify-self: center;
  font-size: 26px;
  line-height: 1;
  color: var(--ink);
}

.away-combo-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
}

.away-suggestion--combo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content 34px;
  min-height: 48px;
  padding: 0 8px 0 14px;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
}

.away-suggestion--combo:last-child {
  border-bottom: 0;
}

.away-combo-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  font-weight: 640;
  color: var(--ink);
  overflow: hidden;
  white-space: nowrap;
}

.away-combo-name .away-task-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.away-combo-name .away-task-icon svg {
  width: 20px;
  height: 20px;
}

.away-combo-plus {
  color: var(--ink-faint);
  font-weight: 520;
}

.away-suggestion:hover {
  border-color: var(--control-hover-border);
  background: var(--control-hover-bg);
}

.away-suggestion.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

.away-suggestion.is-over:not(.is-selected) {
  border-color: rgba(138, 90, 0, 0.28);
}

.away-suggestion-name {
  font-size: 13px;
  font-weight: 640;
  color: var(--ink);
}

.away-suggestion-fit {
  flex: 0 0 auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}

.away-suggestion.is-over .away-suggestion-fit {
  color: #8a5a00;
  font-weight: 700;
}

.away-suggestion-plus--small {
  grid-row: auto;
  grid-column: auto;
  align-self: center;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  font-size: 21px;
}

.away-combo-note {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--ink-faint);
}

/* ---- timer ---- */
.away-timer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.away-timer.is-active {
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--paper);
  align-items: stretch;
  text-align: left;
}

.away-timer-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.away-timer-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.away-timer-state::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--line);
}

.away-timer-state.is-running::after {
  background: #34a853;
}

.away-timer-task {
  margin: 0;
  font-size: 13px;
  font-weight: 660;
  color: var(--ink);
}

.away-timer-readout {
  font-size: 40px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-family: var(--mono);
}

.away-timer-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line-soft);
}

.away-timer-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #34a853;
  transition: width 180ms ease-out;
}

.away-timer-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.away-timer-readout.is-paused {
  color: var(--ink-faint);
}

.away-timer-delta {
  margin: 0;
  font-size: 11px;
  color: var(--ink-faint);
  min-height: 14px;
}

.away-timer-controls {
  display: flex;
  gap: 8px;
  width: 100%;
}

.away-timer-controls .button {
  flex: 1 1 auto;
  min-height: 36px;
}

.away-timer-note {
  margin: 0;
  font-size: 11px;
  color: var(--ink-faint);
}

/* ---- task manager ---- */
.away-add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.away-input {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--control-bg);
  color: var(--ink);
  font-size: 13px;
}

.away-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.away-input-name { flex: 1 1 auto; min-width: 0; }
.away-input-min { flex: 0 0 64px; width: 64px; text-align: center; }
.away-add-form .button { flex: 0 0 auto; min-height: 36px; }

.away-task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.away-task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line-soft);
}

.away-task-item:last-child {
  border-bottom: none;
}

.away-task-name {
  flex: 1 1 auto;
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.away-task-est {
  flex: 0 0 auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}

.away-task-est.is-adaptive {
  color: var(--accent);
  font-weight: 700;
}

.away-task-est.is-adaptive::after {
  content: "~";
  margin-left: 1px;
  opacity: 0.7;
}

.away-task-delete {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-faint);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.5;
}

.away-task-delete:hover,
.away-task-delete:focus-visible {
  opacity: 1;
  color: #b3261e;
  border-color: rgba(179, 38, 30, 0.4);
  background: rgba(179, 38, 30, 0.1);
}

body.away-open {
  overflow: hidden;
}

@media (prefers-color-scheme: dark) {
  .away-confidence--high { color: #5fcf80; }
  .away-confidence--medium { color: #e0b75f; }
  .away-window-headline,
  .away-attention-status { color: #ff8a85; }
  .away-backdrop { background: rgba(0, 0, 0, 0.55); }
}

@media (max-width: 640px) {
  .away-panel {
    padding: 16px;
  }

  .away-window-summary,
  .away-task-cards {
    grid-template-columns: 1fr;
  }

  .away-window-metric {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .away-window-metric:last-child {
    border-bottom: 0;
  }

  .away-suggestion--combo {
    grid-template-columns: minmax(0, 1fr) max-content;
    padding: 9px 10px;
  }

  .away-suggestion--combo .away-suggestion-plus {
    display: none;
  }

  .away-timer-controls {
    flex-direction: column;
  }
}
