/* SpicyNext design system — light default (warm paper), dark optional.
   Toggle by setting data-theme="dark" on <html>. Owner-inspired direction:
   deep restaurant green is the single primary action color; SpicyNext orange
   is demoted to a brand-mark accent only. */

:root,
:root[data-theme="light"] {
  /* surfaces — warm paper, not cool gray */
  --bg:           #faf8f3;
  --bg-surface:   #ffffff;
  --bg-alt:       #f3f1ea;
  --bg-panel:     #eceae1;
  --bg-input:     #f0eee7;
  --bg-elevated:  #ffffff;

  --border:       rgba(28, 26, 22, 0.09);
  --border-strong:rgba(28, 26, 22, 0.17);

  --text:         #1c1a17;
  --text-strong:  #0c0b0a;
  --text-dim:     #6a6860;
  --text-faint:   #9a988e;

  /* PRIMARY — deep restaurant green, the only CTA color */
  --primary:      #1e5435;
  --primary-hover:#173f28;
  --primary-soft: rgba(30, 84, 53, 0.10);
  --primary-ring: rgba(30, 84, 53, 0.20);
  --on-primary:   #ffffff;

  /* ACCENT — SpicyNext brand orange, brand marks + tiny highlights only */
  --accent:       #e5481f;
  --accent-soft:  rgba(229, 72, 31, 0.10);
  --accent-glow:  rgba(229, 72, 31, 0.20);
  --accent-dim:   #b8390f;

  /* status — used sparingly */
  --success:      #2e7d46;
  --success-soft: rgba(46, 125, 70, 0.10);
  --warn:         #c2860f;
  --warn-soft:    rgba(194, 134, 15, 0.12);
  --danger:       #c23b2b;
  --danger-soft:  rgba(194, 59, 43, 0.10);

  --shadow-sm:    0 1px 2px rgba(20, 18, 14, 0.04);
  --shadow:       0 4px 16px rgba(20, 18, 14, 0.07);
  --shadow-lg:    0 16px 48px rgba(20, 18, 14, 0.13);
}

:root[data-theme="dark"] {
  --bg:           #0a0a0d;
  --bg-surface:   #121217;
  --bg-alt:       #16161d;
  --bg-panel:     #1c1c25;
  --bg-input:     #1e1e28;
  --bg-elevated:  #232330;

  --border:       rgba(255, 255, 255, 0.07);
  --border-strong:rgba(255, 255, 255, 0.14);

  --text:         #ececef;
  --text-strong:  #ffffff;
  --text-dim:     #8d8d99;
  --text-faint:   #5f5f6c;

  --primary:      #3fa968;
  --primary-hover:#4fbe78;
  --primary-soft: rgba(63, 169, 104, 0.14);
  --primary-ring: rgba(63, 169, 104, 0.30);
  --on-primary:   #0a0a0d;

  --accent:       #ff3600;
  --accent-soft:  rgba(255, 54, 0, 0.12);
  --accent-glow:  rgba(255, 54, 0, 0.28);
  --accent-dim:   #8a2810;

  --success:      #3fb950;
  --success-soft: rgba(63, 185, 80, 0.12);
  --warn:         #d4a017;
  --warn-soft:    rgba(212, 160, 23, 0.12);
  --danger:       #e3553a;
  --danger-soft:  rgba(227, 85, 58, 0.12);

  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow:       0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg:    0 18px 40px rgba(0, 0, 0, 0.5);
}

:root {
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  --sidebar-w: 240px;
  --topbar-h:  56px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout (sidebar + topbar + content) ─────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.layout.no-sidebar { grid-template-columns: 1fr; }
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
}

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
@media (max-width: 880px) { .sidebar { display: none; } }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-logo {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #ff5b1f 0%, #ff3600 100%);
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.5px;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.sidebar-brand-name {
  font-size: 15px; font-weight: 700; letter-spacing: -0.3px;
  color: var(--text-strong);
}

.sidebar-section { display: flex; flex-direction: column; gap: 1px; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 6px 12px;
  margin-top: 4px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.sidebar-link:hover { background: var(--bg-panel); color: var(--text); text-decoration: none; }
.sidebar-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.sidebar-link-icon {
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; opacity: 0.8;
}
.sidebar-link.active .sidebar-link-icon { opacity: 1; }
.sidebar-link-suffix {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar-user {
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--mono);
  word-break: break-all;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-h);
}
.topbar .breadcrumb { font-size: 13px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
.topbar .breadcrumb a { color: var(--text-dim); }
.topbar .breadcrumb a:hover { color: var(--text); text-decoration: none; }
.topbar .breadcrumb .sep { color: var(--text-faint); }
.topbar .breadcrumb strong { color: var(--text); font-weight: 500; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar .me { color: var(--text-dim); font-size: 12px; font-family: var(--mono); }

.content { padding: 8px 0 80px; }
.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}
@media (max-width: 880px) {
  .shell { padding: 22px 18px 60px; }
}

/* Public pages without a sidebar use a centered shell + minimal topbar. */
.layout.no-sidebar .topbar { padding: 14px 28px; }

/* ── Theme toggle button ──────────────────────────────────────────────────── */
.icon-btn {
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-alt);
}
.icon-btn svg { width: 16px; height: 16px; }
.theme-toggle .sun-icon, .theme-toggle .moon-icon { transition: opacity 0.15s; }
:root[data-theme="dark"]  .theme-toggle .sun-icon  { display: block; }
:root[data-theme="dark"]  .theme-toggle .moon-icon { display: none; }
:root[data-theme="light"] .theme-toggle .sun-icon  { display: none; }
:root[data-theme="light"] .theme-toggle .moon-icon { display: block; }

/* ── Typography ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  letter-spacing: -0.3px;
  color: var(--text-strong);
  font-weight: 700;
}
h1 { font-size: 26px; margin: 0 0 6px; line-height: 1.25; letter-spacing: -0.4px; }
h2 {
  font-size: 18px;
  margin: 30px 0 14px;
  font-weight: 700;
}
h3 { font-size: 14.5px; margin: 20px 0 8px; font-weight: 600; }

/* Display heading — onboarding hero, public surfaces */
.display {
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.6px;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0 0 10px;
}

/* Eyebrow — small pill above a display heading */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-panel);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary);
}
.eyebrow.warn .dot { background: var(--warn); }
.eyebrow.warn { color: var(--warn); }

p { margin: 8px 0; }
p.muted, .muted { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: 12px; }
code { font-family: var(--mono); font-size: 0.92em; }

/* ── Cards & layout primitives ────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin: 14px 0;
  box-shadow: var(--shadow-sm);
}
.card.tight { padding: 14px 18px; }
.card.elevated { box-shadow: var(--shadow); }
.card-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

.kv {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 18px;
  font-size: 13px;
}
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; color: var(--text); }

.chip {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-right: 4px;
  letter-spacing: 0.3px;
}
.chip.accent  { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.chip.ok      { color: var(--success); border-color: var(--success); background: var(--success-soft); }
.chip.warn    { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.chip.danger  { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

/* ── Pill — friendly status label (sentence case, sans, client surfaces) ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-panel);
  color: var(--text-dim);
  vertical-align: middle;
  line-height: 1.5;
}
.pill::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.pill.ok      { background: var(--success-soft); color: var(--success); }
.pill.warn    { background: var(--warn-soft);    color: var(--warn); }
.pill.info    { background: var(--primary-soft); color: var(--primary); }
.pill.neutral { background: var(--bg-panel);     color: var(--text-dim); }

/* ── Forms ────────────────────────────────────────────────────────────────── */
form { display: block; }
.field { margin: 14px 0; }
.field label, .field .lbl {
  display: block;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 6px;
}
/* Technical fields keep the micro uppercase label */
.field.tech label, .field.tech .lbl, .label-micro {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.field .help { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.field.req label::after { content: " *"; color: var(--accent); }

input[type="text"], input[type="url"], input[type="email"], input[type="number"],
input[type="date"], select, textarea {
  width: 100%;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

/* Large focal input — onboarding hero field */
.input-lg {
  border-radius: var(--radius-xl) !important;
  padding: 16px 18px !important;
  font-size: 15px !important;
  background: var(--bg-input) !important;
}

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .row2, .row3 { grid-template-columns: 1fr; } }

.checkbox-list, .pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-list label, .pill-list label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-input);
  cursor: pointer;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
  color: var(--text-dim);
  font-weight: 500;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  user-select: none;
}
.checkbox-list label:hover, .pill-list label:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
/* Hide the native checkbox; the pill itself is the toggle. */
.checkbox-list input, .pill-list input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0; margin: 0;
}
/* Active state via :has() — checked checkbox lights up the parent pill. */
.checkbox-list label:has(input:checked),
.pill-list label:has(input:checked),
.checkbox-list label.active, .pill-list label.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.checkbox-list label:has(input:checked)::before,
.pill-list label:has(input:checked)::before {
  content: '✓';
  font-weight: 700;
  font-size: 11px;
  margin-right: 2px;
}

.tags-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; min-height: 38px; }
.tag-pill {
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
.tag-pill .x { color: var(--text-dim); cursor: pointer; }
.tag-pill .x:hover { color: var(--danger); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  background: var(--primary);
  color: var(--on-primary);
  border: 0;
  border-radius: var(--radius);
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, transform 0.05s, border-color 0.12s, color 0.12s;
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn.lg { padding: 14px 24px; font-size: 15px; border-radius: var(--radius-lg); }
.btn.secondary {
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
.btn.secondary:hover { border-color: var(--primary); background: var(--bg-surface); }
.btn.danger { background: var(--danger); color: #fff; box-shadow: none; }
.btn.danger:hover { background: var(--danger); filter: brightness(0.92); }
.btn.ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn.ghost:hover { color: var(--text); border-color: var(--primary); background: var(--bg-alt); }
.btn.sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }

/* Round submit affordance — Owner-style circular arrow */
.btn-round {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  border: 0;
  cursor: pointer;
  display: inline-grid; place-items: center;
  font-size: 18px; line-height: 1;
  transition: background 0.12s, transform 0.05s;
}
.btn-round:hover { background: var(--primary-hover); }
.btn-round:active { transform: translateY(1px); }

/* ── Stepper (onboarding) ─────────────────────────────────────────────────── */
.stepper { display: flex; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; }
.stepper .step {
  flex: 1; min-width: 90px;
  padding: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}
.stepper .step .n { font-family: var(--mono); color: var(--text-faint); margin-right: 4px; }
.stepper .step.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.stepper .step.done { color: var(--success); }
.stepper .step.done .n { color: var(--success); }
.step-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  margin-top: 24px;
  gap: 10px;
}
.step-actions #prev-btn { justify-self: start; }
.step-actions #step-counter { justify-self: center; white-space: nowrap; }
.step-actions #next-btn { justify-self: end; white-space: nowrap; }
@media (max-width: 520px) {
  .step-actions {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "counter counter"
      "prev next";
    gap: 12px;
  }
  .step-actions #step-counter { grid-area: counter; }
  .step-actions #prev-btn { grid-area: prev; }
  .step-actions #next-btn {
    grid-area: next;
    justify-self: end;
    max-width: 100%;
  }
}

/* ── Upload picker ───────────────────────────────────────────────────────── */
.uploader {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-surface);
  transition: border-color 0.12s, background 0.12s;
}
.uploader:hover, .uploader.drag { border-color: var(--primary); background: var(--primary-soft); }
.uploader .icon { font-size: 32px; color: var(--text-faint); margin-bottom: 8px; }
.uploader input[type=file] { display: none; }

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.asset-tile {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  font-size: 12px;
  position: relative;
}
.asset-tile .name { font-family: var(--mono); font-size: 11px; color: var(--text); word-break: break-all; }
.asset-tile .meta { color: var(--text-dim); font-size: 11px; margin-top: 4px; }
.asset-tile .rm {
  position: absolute; top: 4px; right: 6px;
  cursor: pointer; color: var(--text-dim); font-size: 14px;
}
.asset-tile .rm:hover { color: var(--danger); }

/* ── Status / banners ────────────────────────────────────────────────────── */
.banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin: 10px 0;
  font-size: 13px;
  border: 1px solid transparent;
  background: var(--bg-surface);
}
.banner.ok      { border-color: var(--success); background: var(--success-soft); color: var(--text); }
.banner.warn    { border-color: var(--warn); background: var(--warn-soft); color: var(--text); }
.banner.err     { border-color: var(--danger); background: var(--danger-soft); color: var(--text); }
.banner.info    { border-color: var(--border); background: var(--bg-surface); color: var(--text); }

.missing-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(212, 160, 23, 0.30);
  border-radius: var(--radius);
  background: rgba(212, 160, 23, 0.08);
}
.missing-summary-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.missing-summary-main strong { color: var(--text-strong); font-size: 13px; }
.missing-summary-main span { color: var(--text-dim); font-size: 12px; }

.missing-panel {
  margin: 22px 0 30px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}
.missing-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.missing-panel-head h2 {
  margin: 0 0 4px;
  padding: 0;
  border: 0;
}
.missing-panel-head p { margin: 0; max-width: 720px; }
.missing-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.missing-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  padding: 14px;
  min-width: 0;
}
.missing-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.missing-group-head h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 14px;
}
.missing-why {
  margin: 0;
  color: var(--text-dim);
  font-size: 12.5px;
}
.missing-how {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
}
.missing-how-label {
  margin-bottom: 3px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.missing-how p {
  margin: 0;
  color: var(--text);
  font-size: 12.5px;
}
.missing-how ol {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-dim);
  font-size: 12px;
}
.missing-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
}
.missing-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.missing-item:first-child { border-top: 0; padding-top: 0; }
.missing-item > div { min-width: 0; }
.missing-item strong {
  display: block;
  color: var(--text);
  font-size: 12.5px;
}
.missing-item span {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
}
.missing-item .btn { flex: 0 0 auto; }

@media (max-width: 720px) {
  .missing-summary, .missing-panel-head {
    align-items: stretch;
    flex-direction: column;
  }
  .missing-item {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 6px 0;
}
table.tbl th, table.tbl td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.tbl th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--bg-alt);
}
table.tbl tbody tr { transition: background 0.1s; }
table.tbl tbody tr:hover td { background: var(--bg-alt); }
table.tbl .row-link { cursor: pointer; }

/* ── Stage progress bar ──────────────────────────────────────────────────── */
.stages { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.stage {
  flex: 1; min-width: 110px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  position: relative;
}
.stage .n { color: var(--text-faint); font-family: var(--mono); font-size: 10px; }
.stage .name { color: var(--text); margin-top: 2px; font-weight: 600; }
.stage .st { color: var(--text-dim); margin-top: 4px; font-size: 11px; font-family: var(--mono); }
.stage.running { border-color: var(--primary); background: var(--primary-soft); }
.stage.completed { border-color: var(--success); }
.stage.completed .st { color: var(--success); }
.stage.failed { border-color: var(--danger); background: var(--danger-soft); }
.stage.failed .st { color: var(--danger); }
.stage.skipped { opacity: 0.55; }

/* ── Spinner (dual arc, accent glow) ─────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  position: relative;
  vertical-align: middle;
  margin-right: 6px;
}
.spinner::before, .spinner::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%; border: 2px solid transparent;
  box-sizing: border-box;
}
.spinner::before {
  border-top-color: var(--primary);
  border-left-color: var(--primary);
  animation: ca-spin 0.85s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
.spinner::after {
  border-bottom-color: var(--primary);
  opacity: 0.5;
  animation: ca-spin-reverse 1.4s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
.spinner.lg { width: 22px; height: 22px; }
.spinner.lg::before, .spinner.lg::after { border-width: 2.5px; }
.spinner.xl { width: 36px; height: 36px; }
.spinner.xl::before, .spinner.xl::after { border-width: 3px; }
@keyframes ca-spin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(0.92); }
  100% { transform: rotate(360deg) scale(1); }
}
@keyframes ca-spin-reverse {
  0%   { transform: rotate(0deg) scale(0.55); }
  100% { transform: rotate(-360deg) scale(0.55); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Markdown rendering ──────────────────────────────────────────────────── */
.md { max-width: 760px; line-height: 1.75; color: var(--text); }
.md h1, .md h2, .md h3, .md h4 { color: var(--text-strong); }
.md h1 { font-size: 26px; margin-top: 0; border-bottom: none; padding-bottom: 0; }
.md h2 { font-size: 19px; margin-top: 32px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.md h3 { font-size: 15px; margin-top: 24px; }
.md p  { margin: 12px 0; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 4px 0; }
.md code {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 12.5px;
}
.md pre {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
}
.md pre code { background: transparent; padding: 0; border: 0; }
.md blockquote {
  border-left: 3px solid var(--primary);
  margin: 14px 0; padding: 6px 16px;
  color: var(--text); background: var(--bg-alt);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.md table { border-collapse: collapse; margin: 14px 0; font-size: 13px; }
.md th, .md td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.md th { background: var(--bg-panel); color: var(--text-dim); font-weight: 600; }
.md a { color: var(--primary); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

.hidden { display: none !important; }

/* ── Page tabs (within-page nav, e.g. dashboard Overview/Knowledge/Runs) ── */
.tabs {
  display: flex;
  gap: 2px;
  margin: 22px 0 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tabs a {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
  transition: color 0.15s, border-color 0.15s;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--primary); }

/* ── Knowledge-base reader (two-pane: category sidebar + markdown reader) ─ */
.kb-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  margin-top: 14px;
  align-items: start;
}
@media (max-width: 880px) { .kb-layout { grid-template-columns: 1fr; } }

.kb-sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 14px);
  max-height: calc(100vh - var(--topbar-h) - 28px);
  overflow-y: auto;
  padding-right: 4px;
}
.kb-cat { margin-bottom: 22px; }
.kb-cat-head { padding: 0 4px 8px; }
.kb-cat-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 4px;
}
.kb-cat-desc { font-size: 12px; color: var(--text-faint); line-height: 1.5; }
.kb-cat-tech .kb-cat-title { color: var(--warn); }

.kb-files { list-style: none; padding: 0; margin: 8px 0 0; }
.kb-files li { margin: 4px 0; }
.kb-files a {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text);
  transition: border-color 0.12s, background 0.12s;
}
.kb-files a:hover {
  border-color: var(--border-strong);
  background: var(--bg-alt);
  text-decoration: none;
}
.kb-files a.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.kb-file-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.kb-file-meta {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.kb-file-desc { display: block; font-size: 11.5px; color: var(--text-dim); line-height: 1.45; }
.kb-files a.active .kb-file-meta { color: var(--primary); }

.kb-reader {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  min-height: 480px;
  box-shadow: var(--shadow-sm);
}
.kb-reader-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; margin: 0 0 18px;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.kb-reader-title { margin: 0; font-size: 22px; letter-spacing: -0.3px; }
.kb-reader-path {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  background: var(--bg-panel);
  padding: 3px 8px;
  border-radius: 4px;
}
.kb-reader-body { max-width: 720px; }

.kb-empty { text-align: center; padding: 80px 20px; color: var(--text-faint); }
.kb-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.kb-empty-title { font-size: 16px; color: var(--text-dim); margin-bottom: 4px; font-weight: 600; }
.kb-empty-sub { font-size: 13px; }

/* ── Per-post cards (run-detail page) ────────────────────────────────────── */
.post-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
}
.post-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: baseline;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.post-day {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.post-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text-strong);
  flex: 1;
  min-width: 200px;
}
.post-meta { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

.post-hook {
  font-size: 17px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text-strong);
  padding: 14px 18px;
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 0 0 18px;
}

.post-section { margin: 18px 0; }
.post-section + .post-section { padding-top: 6px; }
.post-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.post-caption {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  margin: 0;
  white-space: pre-wrap;
}
.hashtag-list { display: flex; flex-wrap: wrap; gap: 4px; }

.cta-link {
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}

.slide-list, .clip-list { display: flex; flex-direction: column; gap: 10px; }
.slide {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.slide-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.slide-num {
  display: inline-grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.slide-role {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.slide-layout {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.slide-layout-label {
  font-weight: 600;
  color: var(--text);
  margin-right: 4px;
}

.prompt-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 10px;
}
.prompt-box summary {
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 6px 4px;
  list-style: none;
  user-select: none;
}
.prompt-box summary::-webkit-details-marker { display: none; }
.prompt-box summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s;
  color: var(--text-faint);
}
.prompt-box[open] summary::before { transform: rotate(90deg); }
.prompt-box summary:hover { color: var(--primary); }
.prompt-text {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 6px 0 4px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow-y: auto;
}

.raw-plan {
  margin: 30px 0 10px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.raw-plan summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  padding: 6px 4px;
  list-style: none;
  user-select: none;
}
.raw-plan summary::-webkit-details-marker { display: none; }
.raw-plan summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.15s;
  color: var(--text-faint);
}
.raw-plan[open] summary::before { transform: rotate(90deg); }
.raw-plan summary:hover { color: var(--primary); }

/* ── Settings tab ────────────────────────────────────────────────────────── */
.menu-current {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
}
.menu-current code {
  background: transparent; border: 0; padding: 0;
  font-weight: 600; color: var(--text);
}

.link-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.link-row {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 8px;
  align-items: center;
}
@media (max-width: 720px) {
  .link-row { grid-template-columns: 1fr; }
}
.link-row input { font-size: 12.5px; }
.link-row .link-rm {
  width: 32px; height: 32px;
  font-size: 13px;
}

.link-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.set-result-ok  { color: var(--success); font-weight: 500; }
.set-result-err { color: var(--danger); font-weight: 500; }

.field-lock {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  filter: grayscale(0.4);
  opacity: 0.7;
  text-transform: none;
  letter-spacing: 0;
}
.locked-field {
  width: 100%;
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  cursor: not-allowed;
  user-select: none;
}

/* ── Modal (confirm dialogs) ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  color: var(--text);
}
.modal h2 { margin: 0 0 12px; font-size: 18px; }
.modal p { margin: 8px 0; font-size: 13px; line-height: 1.55; color: var(--text-dim); }
.modal.danger { border-color: var(--danger); }
.modal.danger h2 { color: var(--danger); }
.modal .del-list {
  margin: 8px 0 4px;
  padding-left: 20px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}
.modal .del-list code { background: var(--bg-surface); padding: 1px 5px; border-radius: 4px; }
.modal input[type=text] {
  width: 100%;
  margin-top: 6px;
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 13px;
}
.modal input[type=text]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 18px;
}
.btn.ghost.danger-text { color: var(--danger); }
.btn.ghost.danger-text:hover { border-color: var(--danger); color: var(--danger); }

/* ── Chat companion (Phase 3) ─────────────────────────────────────────── */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  margin-top: 14px;
  align-items: stretch;
  min-height: calc(100vh - 280px);
}
.chat-sidebar {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}
.chat-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chat-conv-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-conv-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}
.chat-conv-item:hover { background: var(--surface-hover, rgba(127,127,127,0.08)); }
.chat-conv-item.active {
  background: var(--surface-hover, rgba(127,127,127,0.12));
  border-color: var(--border);
}
.chat-conv-item.expired { opacity: 0.6; }
.chat-conv-title {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-conv-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.chat-empty-aside {
  padding: 14px 6px;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}
.chat-main {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  min-height: 480px;
}
.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chat-empty {
  margin: auto 0;
  padding: 30px 20px;
  text-align: center;
}
.chat-empty-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}
.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 80%;
}
.chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-msg.agent { align-self: flex-start; align-items: flex-start; }
.chat-msg-author {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.chat-msg-body {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-hover, rgba(127,127,127,0.08));
  border: 1px solid var(--border);
  line-height: 1.5;
  font-size: 14px;
}
.chat-msg.user .chat-msg-body {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.chat-msg-body p:first-child { margin-top: 0; }
.chat-msg-body p:last-child { margin-bottom: 0; }
.chat-msg-body code {
  font-family: var(--mono);
  font-size: 12px;
  padding: 1px 4px;
  background: rgba(127,127,127,0.15);
  border-radius: 3px;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-input-row textarea {
  flex: 1;
  resize: vertical;
  min-height: 44px;
  max-height: 200px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--bg);
  color: var(--text);
}
.chat-input-row textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.chat-input-row .btn { align-self: flex-end; }
.chat-input-row #chat-attach-btn { align-self: flex-end; }

/* xs button — used by artifact card actions and upload pill close */
.btn.xs { padding: 3px 8px; font-size: 11px; border-radius: 5px; line-height: 1.2; }

/* pending upload pill (between thread and input row) */
.chat-pending-upload {
  padding: 6px 12px 0 12px;
  background: var(--surface);
  border-top: 1px dashed var(--border);
}
.chat-upload-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  font-size: 12px;
}

/* user-message reference attachments (thumb pill list) */
.chat-msg-attachments {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 6px;
}
.chat-att-thumb {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.15);
  color: var(--text);
}

/* generated image artifacts under assistant messages */
.chat-msg-artifacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 10px;
  width: 100%;
  max-width: 640px;
}
.chat-msg-artifacts.pending {
  display: block;
  padding: 10px 0;
}
.chat-artifact {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}
.chat-artifact img {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
}
.chat-artifact-meta {
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.chat-artifact-sub {
  font-size: 12px;
  color: var(--muted, #888);
}
.chat-artifact-actions {
  display: inline-flex;
  gap: 4px;
}
.chat-artifact.failed {
  border-color: #c54;
  padding: 12px;
}
.chat-artifact-head { font-weight: 600; margin-bottom: 4px; color: #c54; }
.chat-artifact-error { font-size: 12px; color: var(--muted, #888); }

/* ═══════════════════════════════════════════════════════════════════════════
   Batch 1 redesign — Owner-inspired client surfaces
   (onboarding status scan + dashboard readiness cockpit)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Shared primitives ──────────────────────────────────────────────────── */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
}
.lead {
  font-size: 15px;
  color: var(--text-dim);
  margin: 0;
  max-width: 580px;
  line-height: 1.55;
}
.tech-details { margin-top: 26px; font-size: 12px; }
.tech-details > summary {
  cursor: pointer;
  color: var(--text-faint);
  list-style: none;
}
.tech-details > summary::-webkit-details-marker { display: none; }
.tech-details > summary::before { content: '▸ '; }
.tech-details[open] > summary::before { content: '▾ '; }
.tech-details .kv { margin-top: 10px; }

/* ── Progress bar (flat, green) ──────────────────────────────────────────── */
.progress {
  height: 8px;
  background: var(--bg-panel);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin: 14px 0 20px;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Onboarding status — scan layout ─────────────────────────────────────── */
.scan {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  margin: 24px 0;
  align-items: start;
}
@media (max-width: 880px) { .scan { grid-template-columns: 1fr; } }

.scan-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.scan-panel-head h2 { margin: 0; }
.time-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-panel);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.scan-checklist { display: flex; flex-direction: column; }
.scan-step {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 9px 0;
  align-items: flex-start;
}
.scan-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 10.25px;
  top: 25px;
  bottom: -2px;
  width: 1.5px;
  background: var(--border);
}
.scan-step.done:not(:last-child)::before { background: var(--primary); }
.scan-step-marker {
  position: relative;
  z-index: 1;
  width: 22px; height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  display: grid;
  place-items: center;
  margin-top: 1px;
  color: var(--on-primary);
  font-size: 11px;
}
.scan-step-marker .spinner { margin: 0; }
.scan-step-body { min-width: 0; padding-top: 1px; }
.scan-step-label { font-size: 13.5px; color: var(--text-dim); }
.scan-step-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.scan-step.active .scan-step-label { color: var(--text-strong); font-weight: 600; }
.scan-step.active .scan-step-marker { border-color: transparent; background: transparent; }
.scan-step.done .scan-step-marker { background: var(--primary); border-color: var(--primary); }
.scan-step.done .scan-step-label { color: var(--text); }

/* ── Onboarding status — proof panel ─────────────────────────────────────── */
.scan-proof {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 380px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
}
.scan-proof-stack {
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
}
.proof-empty {
  margin: auto;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  padding: 40px 20px;
}
.proof-card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  animation: proof-in 0.4s ease;
}
@keyframes proof-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.proof-card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--bg-panel);
  display: grid; place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.proof-card.done .proof-card-icon { background: var(--success-soft); color: var(--success); }
.proof-card-body { min-width: 0; }
.proof-card-title { font-size: 13.5px; font-weight: 600; color: var(--text-strong); }
.proof-card-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.proof-card-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.listing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: proof-in 0.4s ease;
}
.listing-card-map {
  height: 104px;
  display: grid; place-items: center;
  color: var(--text-faint);
  font-size: 22px;
  background:
    repeating-linear-gradient(0deg,  transparent 0 19px, var(--border) 19px 20px),
    repeating-linear-gradient(90deg, transparent 0 19px, var(--border) 19px 20px),
    var(--bg-alt);
}
.listing-card-body { padding: 13px 16px 15px; }
.listing-card-name { font-size: 16px; font-weight: 700; color: var(--text-strong); }
.listing-card-rating {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-dim);
  margin-top: 4px;
}
.listing-card-rating .stars { color: var(--warn); letter-spacing: 1px; }
.listing-card-desc { font-size: 12.5px; color: var(--text-dim); margin-top: 6px; }

.photo-collage {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 4px;
  animation: proof-in 0.4s ease;
}
.photo-tile {
  width: 76px; height: 94px;
  border-radius: 8px;
  background: var(--bg-panel);
  border: 3px solid var(--bg-surface);
  box-shadow: var(--shadow-sm);
  display: grid; place-items: center;
  color: var(--text-faint);
  font-size: 18px;
}
.photo-tile:nth-child(2n) { transform: rotate(2.5deg); }
.photo-tile:nth-child(3n) { transform: rotate(-3deg); }

.scan-line {
  position: absolute;
  left: 0; right: 0;
  top: 4%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.5;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .scan-line { animation: scan-sweep 2.8s ease-in-out infinite; }
}
@keyframes scan-sweep {
  0%   { top: 4%; }
  50%  { top: 94%; }
  100% { top: 4%; }
}

/* ── Dashboard — readiness cockpit ───────────────────────────────────────── */
.cockpit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.stat-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.stat-tile-label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 10px;
}
.stat-tile-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.25;
}
.stat-tile-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 6px; }
.stat-tile.gauge-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: border-color 0.12s;
}
.stat-tile.gauge-tile:hover { border-color: var(--border-strong); }
.stat-tile-gauge-meta { min-width: 0; }

.gauge {
  --pct: 0;
  --gauge-color: var(--primary);
  width: 88px; height: 88px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(var(--gauge-color) calc(var(--pct) * 1%), var(--bg-panel) 0);
  display: grid;
  place-items: center;
  position: relative;
}
.gauge::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--bg-surface);
}
.gauge-value {
  position: relative;
  font-size: 21px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1;
}
.gauge.indeterminate { --pct: 25; --gauge-color: var(--border-strong); }
.gauge.indeterminate .gauge-value { font-size: 13px; color: var(--text-dim); }

.source-list { display: flex; flex-direction: column; gap: 9px; }
.source-row {
  display: grid;
  grid-template-columns: 8px max-content minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  font-size: 13px;
  min-width: 0;
}
.source-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
}
.source-row.connected .source-dot { background: var(--success); }
.source-name { font-weight: 600; color: var(--text); flex-shrink: 0; }
.source-value {
  color: var(--text-dim);
  margin-left: auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: right;
}

/* ── Dashboard — next-action banner ──────────────────────────────────────── */
.next-action {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  margin: 16px 0;
}
.next-action.warn { border-left-color: var(--warn); }
.next-action-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid; place-items: center;
  font-size: 19px;
  flex-shrink: 0;
}
.next-action.warn .next-action-icon { background: var(--warn-soft); color: var(--warn); }
.next-action-body { flex: 1; min-width: 0; }
.next-action-title { font-size: 16px; font-weight: 700; color: var(--text-strong); }
.next-action-sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.next-action .btn { flex-shrink: 0; }
@media (max-width: 620px) {
  .next-action {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
  }
  .next-action .btn {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
  }
  .source-row {
    grid-template-columns: 8px minmax(0, 1fr);
    gap: 6px 10px;
  }
  .source-value {
    grid-column: 2;
    margin-left: 0;
    text-align: left;
  }
}

/* ── Dashboard — setup checklist ─────────────────────────────────────────── */
.setup-checklist {
  margin: 18px 0 26px;
  padding: 22px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.setup-checklist-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.setup-checklist-head h2 { margin: 0; }
.setup-checklist-count { font-size: 13px; color: var(--warn); font-weight: 600; }
.setup-checklist-intro {
  margin: 6px 0 4px;
  color: var(--text-dim);
  font-size: 13px;
  max-width: 640px;
}
.setup-checklist-tech { font-size: 12px; color: var(--text-faint); }
.task-group { margin-top: 18px; }
.task-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 4px;
}
.task-list { list-style: none; margin: 0; padding: 0; }
.task-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.task-row:first-child { border-top: 0; }
.task-marker {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--warn);
  margin-top: 2px;
}
.task-body { min-width: 0; }
.task-title { font-size: 13.5px; font-weight: 600; color: var(--text-strong); }
.task-why { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.task-how { margin-top: 8px; font-size: 12.5px; }
.task-how > summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
  list-style: none;
}
.task-how > summary::-webkit-details-marker { display: none; }
.task-how > summary::before { content: '▸ '; }
.task-how[open] > summary::before { content: '▾ '; }
.task-how-body {
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  color: var(--text-dim);
}
.task-how-body ol { margin: 6px 0 0; padding-left: 18px; }
.task-actions {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-shrink: 0;
}
.task-editor {
  grid-column: 2 / -1;
  display: grid;
  gap: 10px;
  margin: 2px 0 4px;
  padding: 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.task-editor[hidden] { display: none; }
.task-editor .field label {
  font-size: 11.5px;
  text-transform: none;
  letter-spacing: 0;
}
.task-editor textarea {
  min-height: 92px;
}
.task-editor-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.task-editor-result {
  min-height: 16px;
  font-size: 12px;
}
.setup-complete-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--success);
  font-weight: 600;
}
@media (max-width: 620px) {
  .task-row { grid-template-columns: 18px 1fr; }
  .task-actions { grid-column: 2; }
  .task-editor { grid-column: 2; }
}

/* Honor reduced-motion for the one-shot entrance animations. */
@media (prefers-reduced-motion: reduce) {
  .proof-card, .listing-card, .photo-collage { animation: none; }
}
