/* ===================================================================
   COMPANIES SCREEN STYLES
   Screen-specific styles for the Companies feature (hub view,
   interview, and canvas). Reconciled with project design tokens.
   All design tokens reference var(--ds-*) from design-system.css.
   =================================================================== */

/* ── Status chip variants (companies-specific) ───────────────────── */
.ds-chip--draft   { background: var(--ds-parchment); color: var(--ds-graphite); }
.ds-chip--live    { background: var(--ds-mint); color: #15803d; border-color: rgba(34,197,94,0.30); }
.ds-chip--archived { background: rgba(148,163,184,0.12); color: var(--ds-ash); border-color: rgba(148,163,184,0.28); }
.ds-chip--imported { background: rgba(59,130,246,0.10); color: var(--ds-blue); border-color: rgba(59,130,246,0.28); }
.ds-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 6px;
  opacity: 0.85;
  flex-shrink: 0;
}

/* ── Green stat number variant ──────────────────────────────────── */
.list-card-stat-num--green { color: var(--ds-green); }

/* ── Hover-revealed row action (e.g. Clone button on community cards) */
.list-card .row-action {
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ds-transition);
  z-index: 2;
}
.list-card:hover .row-action {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none) {
  .list-card .row-action {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ── Sidebar pinned mini tiles ──────────────────────────────────── */
.sidebar-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ds-graphite);
  font-size: var(--ds-text-sm);
  cursor: pointer;
  transition: background var(--ds-transition), color var(--ds-transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--ds-font-body);
}
.sidebar-mini:hover {
  background: var(--ds-parchment);
  color: var(--ds-ink);
}
.sidebar-mini .mini-mono {
  width: 22px;
  height: 22px;
  border-radius: var(--ds-radius-xs);
  background: var(--ds-parchment);
  border: 1px solid var(--ds-stone);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ds-font-serif);
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
  color: var(--ds-graphite);
}
.sidebar-mini .mini-mono.tone-green {
  background: var(--ds-mint);
  border-color: rgba(34,197,94,0.30);
  color: #15803d;
}
.sidebar-mini .mini-mono.tone-amber {
  background: rgba(245,158,11,0.10);
  border-color: rgba(245,158,11,0.30);
  color: #92400e;
}
.sidebar-mini .mini-mono.tone-blue {
  background: rgba(59,130,246,0.10);
  border-color: rgba(59,130,246,0.30);
  color: var(--ds-blue);
}
.sidebar-mini .mini-mono.tone-rose {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.28);
  color: #b91c1c;
}
.sidebar-mini .mini-mono.tone-stone {
  background: var(--ds-parchment);
}
.sidebar-mini .mini-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* ── Companies hub: loading and empty states ────────────────────── */
.companies-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--ds-ash);
  font-family: var(--ds-font-serif);
  font-style: italic;
  background: var(--ds-white);
  border: 1px dashed var(--ds-stone);
  border-radius: var(--ds-radius-sm);
}

/* ── Interview view (/companies/new) ────────────────────────────── */

/* Body-level mode switch (driven by JS: document.body.dataset.view = 'interview') */
body[data-view="interview"] {
  overflow: hidden;
}
body[data-view="interview"] #app > .iv-layout,
body[data-view="interview"] #companies-layout {
  height: calc(100vh - var(--ds-header-h));
  min-height: 0;
}
body[data-view="interview"] .iv-content,
body[data-view="interview"] .comm-content {
  height: 100%;
  padding: 24px 0 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
body[data-view="interview"] .gen-conversation {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 0 200px;
  scrollbar-width: thin;
  scrollbar-color: var(--ds-stone) transparent;
}
body[data-view="interview"] .gen-conversation::-webkit-scrollbar {
  width: 6px;
}
body[data-view="interview"] .gen-conversation::-webkit-scrollbar-thumb {
  background: var(--ds-stone);
  border-radius: var(--ds-radius-pill);
}

/* Interview layout container */
.iv-layout {
  display: flex;
  max-width: var(--ds-layout-max);
  margin: 0 auto;
  padding: 0 var(--ds-outer-px);
  gap: 64px;
  min-height: calc(100vh - var(--ds-header-h));
  transition: gap 320ms ease;
}

.iv-content {
  flex: 1;
  min-width: 0;
  max-width: var(--ds-content-max);
  padding: 28px 0 64px;
}


/* Sticky interview head */
.gen-sticky-head {
  padding: 0 0 6px;
}
.gen-sticky-head h1 {
  font-family: var(--ds-font-serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--ds-ink);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.gen-sticky-head h1 em {
  font-style: italic;
  color: var(--ds-graphite);
}
.gen-sticky-head .pitch {
  font-family: var(--ds-font-serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ds-graphite);
  line-height: 1.5;
  margin-top: 6px;
}

/* Conversation stream */
.gen-conversation {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 8px 0 220px;
  position: relative;
}

/* Bot/user message bubbles */
.cv-msg {
  display: flex;
  gap: 10px;
  max-width: 100%;
  animation: cv-fade-in 0.4s ease-out;
}
@keyframes cv-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cv-msg.is-bot  { align-self: flex-start; max-width: 92%; }
.cv-msg.is-user { align-self: flex-end;   max-width: 78%; flex-direction: row-reverse; }

.cv-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ds-font-serif);
  font-size: 14px;
  background: var(--ds-ink);
  color: var(--ds-linen);
  margin-top: 2px;
}
.cv-avatar.is-user {
  background: var(--ds-mint);
  color: #15803d;
  font-family: var(--ds-font-body);
  font-weight: 600;
  font-size: 11px;
}

.cv-bubble {
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: 20px;
  padding: 14px 18px;
  box-shadow: var(--ds-shadow-sm);
  line-height: 1.55;
  font-size: 14.5px;
  color: var(--ds-ink);
}
.cv-bubble.is-bot  { border-top-left-radius: 6px; }
.cv-bubble.is-user {
  background: var(--ds-ink);
  color: var(--ds-linen);
  border-color: var(--ds-ink);
  border-top-right-radius: 6px;
}
.cv-bubble .q {
  font-family: var(--ds-font-serif);
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ds-ink);
  margin-bottom: 8px;
  font-weight: 400;
}
.cv-bubble .q em { font-style: italic; color: var(--ds-ash); }
.cv-bubble .helper {
  font-size: 13px;
  color: var(--ds-graphite);
  line-height: 1.55;
}
.cv-bubble.is-naked {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  width: 100%;
}

/* Multiple-choice options (shared prototype class) */
.cv-mc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.cv-mc-opt {
  font-family: var(--ds-font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ds-ink);
  background: var(--ds-linen);
  border: 1px solid var(--ds-stone);
  padding: 9px 14px;
  border-radius: var(--ds-radius-pill);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  line-height: 1.35;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cv-mc-opt:hover { border-color: var(--ds-ink); background: var(--ds-white); transform: translateY(-1px); }
.cv-mc-opt .key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ds-ash);
  font-family: var(--ds-font-mono);
}
.cv-mc-opt:hover .key { background: var(--ds-ink); color: var(--ds-linen); border-color: var(--ds-ink); }
.cv-mc-opt.is-rec { border-color: rgba(34,197,94,0.35); background: var(--ds-mint); }
.cv-mc-opt.is-active { border-color: var(--ds-ink); background: var(--ds-parchment); }

/* Text input for free-text questions */
.iv-text-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  background: var(--ds-white);
  border: 1.5px solid var(--ds-stone);
  border-radius: 18px;
  padding: 8px 8px 8px 16px;
  box-shadow: var(--ds-shadow-sm);
  transition: border-color var(--ds-transition);
}
.iv-text-wrap:focus-within { border-color: var(--ds-stone-dark); }

.iv-text-input,
.iv-text-area {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--ds-font-body);
  font-size: 14px;
  color: var(--ds-ink);
  padding: 6px 0;
  min-width: 0;
  resize: none;
}
.iv-text-input::placeholder,
.iv-text-area::placeholder { color: var(--ds-ash); }

.iv-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ds-ink);
  color: var(--ds-linen);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.iv-send-btn:hover { transform: scale(1.05); }
.iv-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.iv-other-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  background: var(--ds-white);
  border: 1.5px solid var(--ds-stone);
  border-radius: 18px;
  padding: 8px 8px 8px 16px;
}

/* Multi-select confirm button area */
.iv-multi-wrap { margin-top: 14px; }
.iv-multi-actions { margin-top: 10px; }

/* cv-btn variants (reused from prototype) */
.cv-btn {
  font-family: var(--ds-font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--ds-radius-pill);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cv-btn-primary {
  background: var(--ds-ink);
  color: var(--ds-linen);
  border-color: var(--ds-ink);
}
.cv-btn-primary:hover:not(:disabled) {
  background: var(--ds-void, #0c0c0c);
  transform: translateY(-1px);
}
.cv-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.cv-btn-ghost {
  background: transparent;
  color: var(--ds-graphite);
  border-color: var(--ds-stone);
}
.cv-btn-ghost:hover:not(:disabled) {
  background: var(--ds-parchment);
  color: var(--ds-ink);
}
.cv-btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.cv-btn-mint {
  background: var(--ds-mint);
  color: #15803d;
  border-color: rgba(34,197,94,0.35);
}

/* Final card (.cv-final) */
.cv-final {
  background: var(--ds-white);
  border: 1.5px solid rgba(34,197,94,0.35);
  border-radius: var(--ds-radius);
  padding: 22px;
  box-shadow: 0 12px 40px rgba(34,197,94,0.08);
  position: relative;
  overflow: hidden;
}
.cv-final::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--ds-green);
}
.cv-final-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.cv-final-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ds-mint);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #15803d;
}
.cv-final-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #15803d;
}
.cv-final h3 {
  font-family: var(--ds-font-serif);
  font-size: 26px;
  letter-spacing: -0.015em;
  margin-bottom: 4px;
  font-weight: 400;
}
.cv-final .summary-line { font-size: 13.5px; color: var(--ds-graphite); margin-bottom: 18px; }
.cv-final-counts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.cv-count {
  background: var(--ds-linen);
  border: 1px solid var(--ds-stone);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cv-count-num { font-family: var(--ds-font-serif); font-size: 24px; line-height: 1; color: var(--ds-ink); }
.cv-count-label { font-size: 11px; color: var(--ds-ash); letter-spacing: 0.04em; }
.cv-final-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Review card */
.iv-review-card { width: 100%; }
.iv-review-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ds-ash);
  margin-bottom: 8px;
}

/* Composer wrap (fixed at bottom) */
.gen-composer-wrap {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  padding: 22px 0 18px;
  background: linear-gradient(to bottom, transparent 0, var(--ds-linen) 22px);
  pointer-events: none;
  display: none;
}
body[data-view="interview"] .gen-composer-wrap { display: block; }

.gen-composer-shell {
  max-width: var(--ds-layout-max);
  margin: 0 auto;
  padding: 0 var(--ds-outer-px);
  display: flex;
  gap: 64px;
  pointer-events: none;
}
.gen-composer-shell .spacer-rail {
  width: var(--ds-sidebar-w);
  min-width: var(--ds-sidebar-w);
  flex-shrink: 0;
}
.gen-composer {
  flex: 1;
  min-width: 0;
  max-width: var(--ds-content-max);
  position: relative;
  pointer-events: auto;
}

/* Composer input area (populated dynamically per question type) */
.iv-composer-input {
  padding: 2px 0 10px;
}
.iv-composer-input:empty {
  display: none;
}
.iv-composer-input .iv-text-wrap {
  margin: 0;
}
.iv-composer-input .cv-mc {
  padding: 2px 0;
}

/* Intervene chip strip */
.cv-iv-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0 4px;
  border-top: 1px dashed var(--ds-stone);
  margin-top: 4px;
}
.cv-iv-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--ds-radius-pill);
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ds-graphite);
  cursor: pointer;
  transition: background var(--ds-transition), border-color var(--ds-transition), color var(--ds-transition);
}
.cv-iv-chip:hover:not(:disabled) {
  background: var(--ds-parchment);
  border-color: var(--ds-stone-dark);
  color: var(--ds-ink);
}
.cv-iv-chip:disabled { opacity: 0.4; cursor: not-allowed; }
.cv-iv-chip--danger { color: var(--ds-red); }
.cv-iv-chip--danger:hover:not(:disabled) {
  color: var(--ds-red);
  border-color: rgba(239,68,68,0.4);
  background: rgba(239,68,68,0.05);
}
.cv-iv-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ds-ash);
}
.cv-iv-chip:hover:not(:disabled) .cv-iv-icon { color: var(--ds-ink); }

/* Banners */
.iv-stale-banner,
.iv-error-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--ds-radius-sm);
  font-size: 12.5px;
  margin-bottom: 8px;
}
.iv-stale-banner {
  background: rgba(245,158,11,0.10);
  border: 1px solid rgba(245,158,11,0.30);
  color: #92400e;
}
.iv-error-banner {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.28);
  color: var(--ds-red);
}

/* Topic hint chips in sidebar */
.iv-topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ds-ash);
  padding: 3px 8px;
  border-radius: var(--ds-radius-pill);
  background: var(--ds-parchment);
  border: 1px solid var(--ds-stone);
}
.iv-topic-chip--partial {
  color: var(--ds-graphite);
  border-color: var(--ds-stone-dark);
}
.iv-topic-chip--done {
  background: var(--ds-mint);
  color: #15803d;
  border-color: rgba(34,197,94,0.30);
}

/* Typing animation dots */
.iv-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ds-ash);
  animation: iv-dot-pulse 1.2s infinite;
}
@keyframes iv-dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Dark-mode tweaks */
[data-theme="dark"] .cv-bubble { background: var(--ds-parchment); }
[data-theme="dark"] .cv-bubble.is-user { background: var(--ds-ink); }
[data-theme="dark"] .iv-text-wrap { background: var(--ds-parchment); }
[data-theme="dark"] .cv-mc-opt { background: var(--ds-stone); }
[data-theme="dark"] .cv-mc-opt:hover { background: var(--ds-parchment); }
[data-theme="dark"] .cv-final { background: var(--ds-parchment); }

/* ── Canvas view (/companies/:slug) ─────────────────────────────── */

/* The canvas page intentionally inherits the site-wide `--ds-linen` body
   background so the footer (and any other body-rooted chrome) reads the
   same as every other route. The dot-grid overlay below carries its own
   `--ds-parchment` fill when focus mode is on. */

/* Animate layout shifts on focus mode toggle */
body[data-view="canvas"] #companies-layout {
  transition: gap 320ms ease;
}
body[data-view="canvas"] .comm-sidebar {
  transition: width 320ms ease, min-width 320ms ease, padding 320ms ease, opacity 240ms ease;
}
body[data-view="canvas"] .comm-content {
  transition: max-width 320ms ease, padding-top 320ms ease;
}

/* Focus mode: collapse sidebar, expand content, show dot-grid bg */
body[data-focus="on"][data-view="canvas"] .comm-sidebar {
  width: 0;
  min-width: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}
body[data-focus="on"][data-view="canvas"] #companies-layout { gap: 0 !important; }
body[data-focus="on"][data-view="canvas"] .comm-content { max-width: 9999px; }

/* Subtle dot-grid overlay that fades in when focus mode activates */
body[data-view="canvas"]::before {
  content: '';
  position: fixed;
  top: var(--ds-header-h);
  left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 1px 1px, rgba(26,26,26,0.07) 1px, transparent 1px) 0 0/22px 22px,
    var(--ds-parchment);
  z-index: 0;
  opacity: 0;
  transition: opacity 320ms ease;
}
body[data-focus="on"][data-view="canvas"]::before { opacity: 1; }
body[data-view="canvas"] .crumbs,
body[data-view="canvas"] .gen-head,
body[data-view="canvas"] .canvas-card { position: relative; z-index: 1; }
/* The detail header hosts the visibility dropdown — bump it above sibling
   canvas-cards so the menu doesn't render behind the roster/goals/tasks. */
body[data-view="canvas"] .cv-detail-header { position: relative; z-index: 5; }
/* The identity card hosts the tag-picker dropdown, which must render above
   sibling cards below it (roster/goals/tasks/etc.). Each canvas-card creates
   its own stacking context (z-index: 1), so the dropdown's own z-index can't
   escape unless this card sits above its peers. */
body[data-view="canvas"] #card-identity { z-index: 4; }
body[data-view="canvas"] #card-tag-catalog { z-index: 3; }
body[data-focus="on"][data-view="canvas"] .comm-content { padding-top: 72px; }

/* ── Focus-mode app menu bar ──────────────────────────────────────────────── */
.focus-bar {
  position: fixed;
  top: var(--ds-header-h);
  left: 0; right: 0;
  height: 44px;
  background: var(--ds-white);
  border-bottom: 1px solid var(--ds-stone);
  box-shadow: 0 1px 0 rgba(26,26,26,0.02);
  z-index: 40;
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 320ms ease, opacity 240ms ease;
}
body[data-focus="on"][data-view="canvas"] .focus-bar {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.focus-bar-inner {
  max-width: var(--ds-layout-max);
  margin: 0 auto;
  padding: 0 var(--ds-outer-px);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.focus-bar-spacer { flex: 1; }
.focus-bar-group { display: inline-flex; align-items: center; gap: 2px; }
.focus-bar-divider { width: 1px; height: 18px; background: var(--ds-stone); margin: 0 4px; }
.focus-bar-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px;
  font-size: 12px;
  color: var(--ds-graphite);
  background: none; border: none; cursor: pointer;
  border-radius: var(--ds-radius-pill);
  font-family: inherit;
  transition: color var(--ds-transition), background var(--ds-transition);
  white-space: nowrap;
}
.focus-bar-link:hover { color: var(--ds-ink); background: var(--ds-parchment); }
.focus-bar-link svg { opacity: 0.6; flex-shrink: 0; }
.focus-bar-icon {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  color: var(--ds-graphite);
  background: none; border: none; cursor: pointer;
  border-radius: var(--ds-radius-pill);
  font-family: inherit;
  transition: color var(--ds-transition), background var(--ds-transition);
}
.focus-bar-icon:hover { color: var(--ds-ink); background: var(--ds-parchment); }
.focus-bar-icon svg { opacity: 0.7; }
.focus-bar-icon-lg svg { width: 18px; height: 18px; }
.focus-bar-icon[data-tip]::after,
.focus-bar-icon[data-tip]::before {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease 60ms;
  z-index: 50;
}
.focus-bar-icon[data-tip]::after {
  content: attr(data-tip);
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ds-ink);
  color: var(--ds-white);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: var(--ds-radius-xs);
  box-shadow: var(--ds-shadow-md);
  font-family: var(--ds-font-body);
}
.focus-bar-icon[data-tip]::before {
  content: '';
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 6px; height: 6px;
  background: var(--ds-ink);
}
.focus-bar-icon[data-tip-align="end"]::after {
  left: auto;
  right: 0;
  transform: none;
}
.focus-bar-icon[data-tip]:hover::after,
.focus-bar-icon[data-tip]:hover::before,
.focus-bar-icon[data-tip]:focus-visible::after,
.focus-bar-icon[data-tip]:focus-visible::before { opacity: 1; }
.focus-bar-icon.is-active {
  color: var(--ds-white);
  background: var(--ds-green, #2f7d4f);
}
.focus-bar-icon.is-active svg { opacity: 1; }
.focus-bar-icon.is-active:not(:hover):not(:focus-visible)::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 50%;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--ds-green, #2f7d4f);
  transform: translateX(-50%);
}

/* Breadcrumb nav */
.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ds-text-xs);
  color: var(--ds-ash);
  margin-bottom: 10px;
}
.crumbs a,
.crumbs button,
.crumbs-back {
  color: var(--ds-ash);
  background: none;
  border: none;
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-xs);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: color var(--ds-transition);
}
.crumbs a:hover,
.crumbs button:hover,
.crumbs-back:hover { color: var(--ds-ink); }
.crumbs .sep { opacity: 0.6; }
.crumbs .current { color: var(--ds-graphite); }

/* Canvas page header */
.gen-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}
.gen-head .detail-mono {
  width: 44px;
  height: 44px;
  border-radius: var(--ds-radius-sm);
  border: 1px solid rgba(34,197,94,0.30);
  background: var(--ds-mint);
  color: #15803d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ds-font-serif);
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.gen-head .stack { flex: 1; min-width: 0; }
.gen-head h1 {
  font-family: var(--ds-font-serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--ds-ink);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.gen-head h1 em { font-style: italic; color: var(--ds-graphite); }
.gen-head p {
  font-family: var(--ds-font-serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ds-graphite);
  line-height: 1.5;
  margin-top: 6px;
}
.gen-head .chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 6px;
}

/* Canvas detail header — company-specific port of the resource-library
   lib-detail-header layout (title + meta on the left, chips on the right). */
.cv-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.cv-detail-header-body { flex: 1; min-width: 0; }
.cv-detail-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex-shrink: 0; padding-top: 4px; }
.cv-detail-title {
  font-family: var(--ds-font-serif);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ds-ink);
  margin-bottom: 12px;
}
.cv-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--ds-text-xs);
  color: var(--ds-ash);
}
.cv-detail-meta-sep {
  color: var(--ds-stone-dark, var(--ds-ash));
  user-select: none;
}
.cv-detail-meta-tip {
  cursor: help;
  outline: none;
}
/* Tooltip behaviour comes from `.tooltip` utility in layout.css. */
.cv-detail-meta-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ds-text-sm);
  color: var(--ds-graphite);
}
/* Canvas-only override: pin the verified pip to the avatar's top-right
   corner instead of the center-right placement used in row-card bylines. */
.cv-detail-meta-author .list-card-byline-avatar-badge {
  top: -2px;
  right: -2px;
}
.cv-detail-pitch {
  font-family: var(--ds-font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ds-graphite);
  margin: -4px 0 10px;
}
@media (max-width: 560px) {
  .cv-detail-header { flex-direction: column; gap: 8px; margin-bottom: 10px; }
  .cv-detail-chips  { padding-top: 0; }
  .cv-detail-title  { font-size: 22px; margin-bottom: 8px; }
  .cv-detail-pitch  { font-size: 14px; }
}

/* Canvas section cards */
.canvas-card {
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  padding: 24px;
  margin-bottom: 14px;
  scroll-margin-top: 80px;
}
.canvas-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.canvas-card-head .label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ds-ash);
}
.canvas-card-head .head-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.canvas-card-head .head-title {
  font-family: var(--ds-font-serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--ds-ink);
  letter-spacing: -0.01em;
  line-height: 1;
}
.canvas-card-head .count-badge {
  line-height: 1;
  text-transform: none;
  display: inline-flex;
  align-items: center;
}
.canvas-card-head .actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

/* Roster wrap + SVG connector overlay */
.roster-wrap {
  position: relative;
  min-height: 180px;
  padding: 8px 0 4px;
}
.roster-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Tier rows */
.tier-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 36px;
  position: relative;
  z-index: 2;
}
.tier-row:last-child { margin-bottom: 0; }

/* Agent node cards */
.agent-node {
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  padding: 9px 12px;
  width: 178px;
  box-shadow: var(--ds-shadow-sm);
  cursor: pointer;
  transition: all var(--ds-transition);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.agent-node:hover {
  box-shadow: var(--ds-shadow-md);
  border-color: var(--ds-stone-dark);
}
.agent-node.ceo {
  background: var(--ds-mint);
  border-color: rgba(34,197,94,0.30);
}
.agent-node .ava {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ds-stone);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
  color: var(--ds-graphite);
  flex-shrink: 0;
}
.agent-node.ceo .ava {
  background: var(--ds-white);
  color: #15803d;
}
.agent-node .meta { min-width: 0; flex: 1; }
.agent-node .nm {
  font-weight: 600;
  font-size: var(--ds-text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-node .tt {
  font-size: 10.5px;
  color: var(--ds-ash);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Edit-mode gating + smooth show/hide transitions ─────────────────
   Three groups appear only while editing:
     • `.canvas-card-head .actions` — per-card toolbars (e.g. + Task)
     • `.edit-only`                 — inline add buttons (e.g. + Project)
     • `.cv-edit-only`              — sidebar Focus + Danger zone items
   They always live in the DOM so the JS toggle is just a `data-canvas-edit`
   flip; visibility is driven entirely by CSS. We animate opacity + a small
   translateY, and use `transition-behavior: allow-discrete` + `@starting-style`
   to animate the discrete `display` property so they don't snap in/out. */
.canvas-card-head .actions,
.edit-only,
.cv-edit-only {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 200ms ease,
    transform 200ms ease,
    display 200ms allow-discrete;
}
body[data-canvas-edit="off"] .canvas-card-head .actions,
body[data-canvas-edit="off"] .edit-only,
body[data-canvas-edit="off"] .cv-edit-only {
  display: none;
  opacity: 0;
  transform: translateY(-4px);
}
@starting-style {
  body[data-canvas-edit="on"] .canvas-card-head .actions,
  body[data-canvas-edit="on"] .edit-only,
  body[data-canvas-edit="on"] .cv-edit-only {
    opacity: 0;
    transform: translateY(-4px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .canvas-card-head .actions,
  .edit-only,
  .cv-edit-only {
    transition: none;
  }
}

body[data-canvas-edit="off"] .agent-node { cursor: default; }
body[data-canvas-edit="off"] .agent-node:hover {
  box-shadow: var(--ds-shadow-sm);
  border-color: var(--ds-stone);
}

/* is-editing highlight for sidebar Edit button */
.comm-sidebar-link.is-editing {
  background: var(--ds-mint);
  color: #15803d;
}
.cv-sidebar-link--danger { color: var(--ds-red); }
.cv-sidebar-link--danger:hover { background: #fff1f2; color: #be123c; }

/* Save + Bell action row: the Save button fills the row; the bell sits
   right-aligned on top of it (like a count badge). Bell is hidden until
   the company is saved. */
.cv-action-row {
  position: relative;
}
.cv-action-row .cv-save-main { padding-right: 36px; }
.cv-bell-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--ds-ash);
  cursor: pointer;
  transition: background var(--ds-transition), color var(--ds-transition);
}
.cv-bell-btn svg { width: 14px; height: 14px; }
.cv-bell-btn:hover { background: var(--ds-stone); color: var(--ds-ink); }
.cv-bell-btn.is-on { color: var(--ds-green); }
.cv-bell-btn[hidden] { display: none; }

/* Danger zone — separates Delete from neutral actions with a divider and a
   muted-red section label. Owner-only. */
.cv-danger-divider {
  height: 1px;
  background: var(--ds-stone);
  margin: 12px 10px 8px;
}
.cv-danger-label { color: var(--ds-red); opacity: 0.7; }

.cv-publish-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px 8px;
}
.cv-publish-cta-label { font-size: 12px; color: var(--ds-graphite); }
.cv-publish-error { font-size: 11px; color: var(--ds-red); margin-top: 4px; display: block; }
/* US-021: hub sidebar credit chip — sits inline next to the "New company"
   button. Inherits .ds-chip base style (rounded pill, parchment bg, ash
   border, ds-text-xs); this rule only overrides typography to render the
   "Credits: N" label readably and adds a subtle weight bump for the count.
   `.ds-chip` sets `display: inline-flex` which overrides the UA `[hidden]`
   { display: none } default — the explicit selector below restores it so
   the chip truly disappears (not "shrink to a few px") when billing is off. */
.hub-credit-chip {
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.hub-credit-chip[hidden] {
  display: none !important;
}

/* US-020: inline error rendered directly under the visibility chip for
   publish-disabled and other visibility-change failures. */
.cv-vis-inline-error {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--ds-red);
  background: color-mix(in srgb, var(--ds-red) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--ds-red) 24%, transparent);
  border-radius: var(--ds-radius-xs);
  padding: 6px 8px;
  margin-top: 6px;
}
.comm-sidebar-link.is-editing::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--ds-green);
  border-radius: var(--ds-radius-pill);
}

/* Details card tab system — scoped to #card-details because the card has
   24px inner padding and the bar is full-bleed across it. Leaving this rule
   unscoped previously leaked the negative margin onto every .ds-tabs-bar
   on the site (e.g. the profile-page tabs, which then visibly stuck out
   past the surrounding content). */
#card-details { padding-top: 0; }
#card-details .ds-tabs-bar {
  display: flex;
  border-bottom: 1px solid var(--ds-stone);
  margin: 0 -24px 20px;
  padding: 0 24px;
}
.ds-tab-btn {
  padding: 12px 18px;
  font-family: var(--ds-font-body);
  font-size: 13px;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ds-ash);
  cursor: pointer;
  transition: color var(--ds-transition), border-color var(--ds-transition);
  margin-bottom: -1px;
}
.ds-tab-btn:hover { color: var(--ds-graphite); }
.ds-tab-btn.is-active {
  color: var(--ds-ink);
  border-bottom-color: var(--ds-green);
}
.ds-tab-panel { display: none; }
.ds-tab-panel.is-active { display: block; }

/* Identity grid */
.identity-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px 14px;
}
.identity-row-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ds-ash);
  padding-top: 6px;
}
.identity-row-value {
  font-size: var(--ds-text-sm);
  color: var(--ds-ink);
  padding: 5px 8px;
  border-radius: var(--ds-radius-xs);
  border: 1px solid transparent;
  min-height: 28px;
  white-space: pre-wrap;
  line-height: 1.5;
}
.identity-row-value.is-empty::before {
  content: attr(data-placeholder);
  color: var(--ds-ash);
  font-style: italic;
}

/* Manifest code block */
.code-block {
  font-family: var(--ds-font-mono);
  font-size: 11.5px;
  background: #0f0f0f;
  color: #d4d4d4;
  border-radius: var(--ds-radius-xs);
  padding: 14px 16px;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.6;
}

/* Metadata dl grid */
.meta-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 14px;
}
.meta-grid dt {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ds-ash);
}
.meta-grid dd {
  font-size: var(--ds-text-sm);
  color: var(--ds-ink);
  font-family: var(--ds-font-mono);
}

/* ── Identity grid: contenteditable styling ──────────────────────── */
body[data-canvas-edit="on"] .identity-row-value {
  border-color: var(--ds-stone);
  background: var(--ds-linen);
  cursor: text;
}
body[data-canvas-edit="on"] .identity-row-value:hover {
  border-color: var(--ds-stone-dark);
}
body[data-canvas-edit="on"] .identity-row-value:focus {
  outline: 2px solid var(--ds-ink);
  outline-offset: -1px;
  border-color: var(--ds-ink);
  background: var(--ds-white);
}

/* The tag picker mount uses transparent borders by default; edit-mode borders
   come from its inner controls, not the cell shell. `white-space: normal`
   overrides the `pre-wrap` from `.identity-row-value`, otherwise the literal
   newlines + indentation in the picker HTML template render as visible
   whitespace and stretch the cell. */
.identity-row-value.tag-picker-mount {
  white-space: normal;
  padding: 0;
}
body[data-canvas-edit="on"] .identity-row-value.tag-picker-mount {
  border-color: transparent;
  background: transparent;
  cursor: default;
}
body[data-canvas-edit="on"] .identity-row-value.tag-picker-mount:hover,
body[data-canvas-edit="on"] .identity-row-value.tag-picker-mount:focus {
  outline: none;
  border-color: transparent;
  background: transparent;
}

/* ── Tag pill picker ─────────────────────────────────────────────── */
/* white-space: normal overrides the `pre-wrap` inherited from
   `.identity-row-value`, which would otherwise preserve template-literal
   indentation and stretch each pill to multiple lines. */
.tag-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  white-space: normal;
}
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 8px;
  border-radius: 99px;
  background: var(--ds-linen);
  border: 1px solid var(--ds-stone);
  font-size: 12px;
  color: var(--ds-ink);
  line-height: 1.6;
  white-space: nowrap;
}
.tag-pill-remove {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0 0 0 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--ds-ash);
}
.tag-pill-remove:hover {
  background: var(--ds-stone);
  color: var(--ds-ink);
}
.tag-picker-empty {
  font-size: var(--ds-text-sm);
  color: var(--ds-ash);
  font-style: italic;
}
.tag-picker-input-wrap {
  position: relative;
}
.tag-picker-input {
  width: 100%;
  font-size: var(--ds-text-sm);
  padding: 5px 8px;
  border-radius: var(--ds-radius-xs);
  border: 1px solid var(--ds-stone);
  background: var(--ds-linen);
  color: var(--ds-ink);
  outline: none;
}
.tag-picker-input:focus {
  border-color: var(--ds-ink);
  background: var(--ds-white);
  outline: 2px solid var(--ds-ink);
  outline-offset: -1px;
}
.tag-picker-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone-dark);
  border-radius: var(--ds-radius-xs);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  z-index: 10;
  max-height: 240px;
  overflow-y: auto;
}
.tag-picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  border: 0;
  text-align: left;
  font-size: var(--ds-text-sm);
  color: var(--ds-ink);
  cursor: pointer;
}
.tag-picker-option:hover {
  background: var(--ds-linen);
}
.tag-picker-option-slug {
  font-family: var(--ds-font-mono);
  font-size: 11px;
  color: var(--ds-ash);
}
.tag-picker-option--create {
  border-top: 1px solid var(--ds-stone);
  color: var(--ds-blue);
}

/* ── Goals & Projects card ───────────────────────────────────────── */
.goals-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}
.goals-scroll::-webkit-scrollbar { height: 6px; }
.goals-scroll::-webkit-scrollbar-thumb { background: var(--ds-stone); border-radius: 99px; }

.goal-col {
  background: var(--ds-parchment);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  width: 220px;
  flex-shrink: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  outline: 2px dashed transparent;
  outline-offset: -4px;
  transition: outline-color 0.18s ease, background 0.18s ease;
}
.goal-col .hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--ds-stone);
}
.goal-col .hdr .pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ds-amber);
  flex-shrink: 0;
}
.goal-col .hdr .nm {
  font-weight: 600;
  font-size: var(--ds-text-sm);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.goal-col .hdr .ct {
  font-size: 10.5px;
  color: var(--ds-ash);
  font-family: var(--ds-font-mono);
}
.goal-col.drop-active {
  outline-color: var(--ds-amber);
  background: #fef3c7;
}

.proj-card {
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-xs);
  padding: 9px 10px;
  font-size: var(--ds-text-sm);
  transition: all var(--ds-transition);
}
.proj-card .nm { font-weight: 500; color: var(--ds-ink); }
.proj-card .ow { font-size: 10.5px; color: var(--ds-ash); margin-top: 2px; }

body[data-canvas-edit="on"] .proj-card { cursor: pointer; }
body[data-canvas-edit="on"] .proj-card:hover { border-color: var(--ds-stone-dark); }
.proj-card.dragging { opacity: 0.4; }

/* + Project add button inside goal columns */
.goal-col-add {
  background: transparent;
  border: 1px dashed var(--ds-stone-dark);
  color: var(--ds-ash);
  border-radius: var(--ds-radius-xs);
  padding: 7px 10px;
  font-size: var(--ds-text-xs);
  font-family: var(--ds-font-body);
  text-align: left;
  cursor: pointer;
  transition: color var(--ds-transition), border-color var(--ds-transition);
}
.goal-col-add:hover { color: var(--ds-ink); border-color: var(--ds-stone-dark); }

/* Flat goals list — current rendering. The `.goal-col` / `.proj-card`
   styles above are retained for when goals regain a project link and the
   kanban returns. See docs/notes/goals-spec-conformance-2026-05-11.md. */
.goals-flat {
  list-style: none;
  margin: 0;
  padding: 4px 2px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.goals-flat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--ds-parchment);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-xs);
  font-size: var(--ds-text-sm);
  transition: border-color var(--ds-transition), background var(--ds-transition);
}
.goals-flat-item .pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ds-amber);
  flex-shrink: 0;
}
.goals-flat-item .nm {
  flex: 1;
  min-width: 0;
  color: var(--ds-ink);
}
body[data-canvas-edit="on"] .goals-flat-item { cursor: pointer; }
body[data-canvas-edit="on"] .goals-flat-item:hover { border-color: var(--ds-stone-dark); background: var(--ds-white); }
.goals-flat-empty {
  list-style: none;
  padding: 24px 0;
  color: var(--ds-ash);
  font-size: 13px;
  font-style: italic;
  font-family: var(--ds-font-serif);
}

/* ── Tasks kanban card ───────────────────────────────────────────── */
.kanban {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}
.kanban::-webkit-scrollbar { height: 6px; }
.kanban::-webkit-scrollbar-thumb { background: var(--ds-stone); border-radius: 99px; }

.swimlane {
  background: var(--ds-parchment);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  padding: 10px;
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 110px;
  outline: 2px dashed transparent;
  outline-offset: -4px;
  transition: outline-color 0.18s ease, background 0.18s ease;
}
.swimlane.drop-active {
  outline-color: var(--ds-blue);
  background: #eef2ff;
}
.swimlane .hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--ds-stone);
}
.swimlane .hdr .ava {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ds-stone);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--ds-graphite);
  flex-shrink: 0;
}
.swimlane .hdr .name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.swimlane .hdr .ct {
  margin-left: auto;
  font-family: var(--ds-font-mono);
  font-size: 10.5px;
  color: var(--ds-ash);
  font-weight: 400;
}

.task-chip {
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-xs);
  padding: 8px 10px;
  font-size: var(--ds-text-sm);
  transition: all var(--ds-transition);
}
.task-chip .nm { font-weight: 500; color: var(--ds-ink); }
.task-chip .pj { font-size: 10.5px; color: var(--ds-ash); margin-top: 2px; }

body[data-canvas-edit="on"] .task-chip { cursor: pointer; }
body[data-canvas-edit="on"] .task-chip:hover { border-color: var(--ds-stone-dark); }
body[data-canvas-edit="on"] .swimlane[data-group="project"] .hdr { cursor: pointer; }
body[data-canvas-edit="on"] .swimlane[data-group="project"] .hdr:hover .name { color: var(--ds-graphite); text-decoration: underline; text-underline-offset: 3px; }
.task-chip.dragging { opacity: 0.4; }

/* ── Tasks toolbar toggle (By assignee / By project) ─────────────────
   `.tasks-toolbar` wraps two children:
     • `.toggle`   — view-mode control, always visible
     • `.actions`  — + Project / + Task buttons, edit-only (gated by the
                     generic `.canvas-card-head .actions` rule above)
   The toggle thumb cross-fades via background/color transitions; the
   kanban itself cross-fades via the View Transitions API (see
   `view-transition-name: kanban` below). */
.tasks-toolbar {
  display: flex;
  align-items: center;
  margin-left: auto;  /* hug the right edge of the card head */
  /* No `gap` here — the spacing between the toggle and the `.actions`
     buttons is owned by `.actions`'s own `margin-left`, which animates
     from 0 → 8px so the toggle slides leftward when edit mode opens. */
}

/* Tasks-card edit-mode reveal: instead of the generic `display:none` →
   `display:flex` discrete flip used by other card heads, the `.actions`
   container inside `.tasks-toolbar` stays in the flex flow and animates
   its `max-width` from 0 → expanded. This makes the By assignee /
   By project toggle slide leftward to make room for + Project / + Task
   when edit mode turns on, and slide back when it turns off. */
.tasks-toolbar .actions {
  margin-left: 0;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  white-space: nowrap;
  transition:
    max-width 260ms cubic-bezier(0.4, 0, 0.2, 1),
    margin-left 260ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 180ms ease,
    transform 180ms ease;
}
.tasks-toolbar .actions > * { flex-shrink: 0; }

body[data-canvas-edit="off"] .canvas-card-head .tasks-toolbar .actions {
  /* Override the generic `.canvas-card-head .actions { display: none }`
     so the actions container stays measurable for the slide animation. */
  display: flex;
}
body[data-canvas-edit="on"] .canvas-card-head .tasks-toolbar .actions {
  max-width: 320px;  /* generous upper bound; real width clips via overflow */
  margin-left: 8px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
  .tasks-toolbar .actions { transition: none; }
}
.toggle {
  display: inline-flex;
  background: var(--ds-parchment);
  border-radius: var(--ds-radius-pill);
  padding: 2px;
  border: 1px solid var(--ds-stone);
}
.toggle button {
  padding: 4px 10px;
  border-radius: var(--ds-radius-pill);
  font-size: 11px;
  color: var(--ds-graphite);
  background: none;
  border: none;
  font-family: var(--ds-font-body);
  font-weight: 500;
  cursor: pointer;
  transition:
    background 220ms cubic-bezier(0.4, 0, 0.2, 1),
    color 220ms cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle button:not(.on):hover { color: var(--ds-ink); }
.toggle button.on {
  background: var(--ds-ink);
  color: var(--ds-linen);
}

/* Kanban view-swap cross-fade is driven from JS via the Web Animations
   API — see `wireTasksCard` in screens/companies.js. We deliberately do
   NOT use the View Transitions API because it also snapshots the page
   `root` (visibly fading the topbar/nav during the swap). Scoping the
   animation to `#kanban` keeps the rest of the page perfectly static. */

/* edit-on: goal headers and cards are clickable */
body[data-canvas-edit="on"] .goal-col .hdr { cursor: pointer; }

/* edit-off: hide task/goal action buttons */
body[data-canvas-edit="off"] .goal-col .hdr { cursor: default; }
body[data-canvas-edit="off"] .proj-card:hover,
body[data-canvas-edit="off"] .task-chip:hover {
  box-shadow: var(--ds-shadow-sm);
  border-color: var(--ds-stone);
}

/* Editor form field */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ds-ash);
  font-weight: 600;
}
.field input,
.field select,
.field textarea {
  padding: 8px 11px;
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-xs);
  background: var(--ds-white);
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-sm);
  color: var(--ds-ink);
  outline: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--ds-ink);
  outline-offset: -1px;
  border-color: var(--ds-ink);
}
.field textarea {
  resize: vertical;
  min-height: 64px;
  font-family: var(--ds-font-body);
  line-height: 1.5;
}
.field input.is-error,
.field select.is-error,
.field textarea.is-error {
  border-color: var(--ds-danger, #e53e3e);
  outline: 2px solid var(--ds-danger, #e53e3e);
  outline-offset: -1px;
}

/* ── Clone / Remix chooser dialog ────────────────────────────────────────────── */
.branch-lede { margin: 0; font-size: 13px; color: var(--ds-graphite); line-height: 1.5; }
.branch-lede strong { color: var(--ds-ink); font-weight: 500; }
.branch-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 540px) { .branch-options { grid-template-columns: 1fr; } }
.branch-option {
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 14px 12px;
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-white);
  cursor: pointer;
  transition: border-color var(--ds-transition), background var(--ds-transition), box-shadow var(--ds-transition);
  /* Reset <button> defaults so a button-flavored option renders like the label
     variant used by the clone/remix chooser. */
  text-align: left;
  font: inherit;
  color: inherit;
}
.branch-option[aria-busy="true"] {
  opacity: 0.7;
}
.branch-option:hover { border-color: var(--ds-stone-dark); background: var(--ds-linen); }
.branch-option input[type="radio"] {
  position: absolute; opacity: 0; pointer-events: none;
}
.branch-option:has(input:checked) {
  border-color: var(--ds-ink);
  background: var(--ds-white);
  box-shadow: 0 0 0 1px var(--ds-ink) inset;
}
.branch-option-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  color: var(--ds-graphite);
  background: var(--ds-parchment);
  border-radius: var(--ds-radius-xs);
}
.branch-option:has(input:checked) .branch-option-icon {
  background: var(--ds-ink); color: var(--ds-white);
}
.branch-option-body { display: flex; flex-direction: column; gap: 4px; }
.branch-option-title {
  font-family: var(--ds-font-serif);
  font-size: 17px; font-weight: 500; color: var(--ds-ink);
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.branch-option-desc { font-size: 12.5px; color: var(--ds-graphite); line-height: 1.5; }
.branch-option-desc em { font-style: italic; color: var(--ds-ink); }
.branch-option-meta {
  margin-top: 4px;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ds-ash);
}
/* Locked Interview option (AI generator gated) — dim the card and block
   pointer events on its children so the click handler can intercept at the
   button level and surface an inline explanation instead of navigating. */
.branch-option[data-mode="interview"][data-locked="true"] {
  opacity: 0.78;
  cursor: not-allowed;
}
.branch-option[data-mode="interview"][data-locked="true"] .branch-option-meta {
  color: var(--ds-graphite);
}

/* ─── Beta / Invite-only badges (inline, reused in Interview card +
       Remix dialog header). Visually rhymes with .nav-beta-badge but in
       normal flow rather than absolutely-positioned. ─── */
.ds-card-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}
.ds-card-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--ds-font-body);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  border-radius: var(--ds-radius-pill);
  padding: 3px 6px;
  white-space: nowrap;
}
.ds-card-badge--beta {
  color: #92400e;
  background: #fef3c7;
  border: 1px solid rgba(245, 158, 11, 0.55);
}
.ds-card-badge--invite {
  color: var(--ds-graphite);
  background: var(--ds-parchment);
  border: 1px solid var(--ds-rule);
}

/* ─── Export dialog ─── */
#cv-export-dialog .ds-modal-body p {
  color: var(--ds-graphite);
  font-size: var(--ds-text-sm);
  margin-bottom: 16px;
}
#cv-export-dialog .ds-modal-title em {
  font-style: italic;
  color: var(--ds-graphite);
}
.export-dl-row {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.export-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ds-parchment);
  border-radius: var(--ds-radius-sm);
  padding: 10px 12px;
}
.export-copy-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--ds-graphite);
  white-space: nowrap;
}
.export-copy-input {
  flex: 1;
  min-width: 0;
  font-family: var(--ds-font-mono);
  font-size: 11.5px;
  color: var(--ds-graphite);
  background: transparent;
  border: none;
  outline: none;
  cursor: text;
}

/* ── Import dialog ──────────────────────────────────────────────────────────── */
.imp-dialog .ds-modal-body { gap: 12px; }
.imp-tabs-bar { margin: -18px -24px 14px; padding: 0 24px; }
.imp-json-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-xs);
  background: var(--ds-white);
  font-family: var(--ds-font-mono);
  font-size: 12px;
  color: var(--ds-ink);
  line-height: 1.55;
  resize: vertical;
  min-height: 140px;
  outline: none;
  transition: border-color var(--ds-transition), outline var(--ds-transition);
}
.imp-json-textarea:focus {
  outline: 2px solid var(--ds-ink);
  outline-offset: -1px;
  border-color: var(--ds-ink);
}
.imp-file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 20px;
  border: 1.5px dashed var(--ds-stone);
  border-radius: var(--ds-radius);
  background: var(--ds-linen);
  color: var(--ds-ash);
  cursor: pointer;
  transition: border-color var(--ds-transition), background var(--ds-transition);
  text-align: center;
  min-height: 120px;
}
.imp-file-drop:hover,
.imp-file-drop.is-dragover {
  border-color: var(--ds-ink);
  background: var(--ds-stone);
  color: var(--ds-ink);
}
.imp-file-drop-label { font-size: 13px; line-height: 1.4; }
.imp-errors[hidden] { display: none; }
.imp-errors:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
/* The hub new-company dialog uses .imp-errors at the top of the body to
   surface gate / billing errors. Give it bottom margin so the branch
   options below don't crowd the message. */
#hub-new-errors:not([hidden]) {
  margin-bottom: 14px;
}
.imp-error-item {
  font-size: 12.5px;
  color: var(--ds-red);
  background: color-mix(in srgb, var(--ds-red) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--ds-red) 20%, transparent);
  border-radius: var(--ds-radius-xs);
  padding: 7px 10px;
  line-height: 1.45;
}
/* ── Import validation card ─────────────────────────────────────────────── */
/* Use :not([hidden]) so the [hidden] attribute correctly hides the card —
   a plain `.imp-validation-card { display: flex }` rule would otherwise
   override the UA `[hidden] { display: none }` style. */
.imp-validation-card[hidden] { display: none; }
.imp-validation-card:not([hidden]) {
  margin-top: 14px;
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius);
  background: var(--ds-linen);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.imp-val-state {
  font-size: 12.5px; color: var(--ds-ash); font-style: italic;
}
.imp-val-head {
  display: flex; align-items: flex-start; gap: 10px;
}
.imp-val-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ds-green, #0a7c4a);
  color: var(--ds-white);
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.imp-val-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.imp-val-name {
  font-family: var(--ds-font-serif);
  font-size: 17px; font-weight: 400; color: var(--ds-ink); line-height: 1.2;
}
.imp-val-pitch {
  font-size: 12.5px; color: var(--ds-graphite); line-height: 1.4;
}
.imp-val-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
  border-top: 1px solid var(--ds-stone);
  padding-top: 10px;
}
.imp-val-pill {
  display: inline-flex; align-items: center;
  padding: 2px 10px;
  background: var(--ds-white);
  border: 1px solid var(--ds-stone);
  border-radius: 999px;
  font-size: 11.5px; line-height: 1.6;
  font-weight: 500;
  color: var(--ds-graphite);
  white-space: nowrap;
}

/* ── Visibility chip + dropdown menu (canvas header) ──────────────────────── */
/* Match .ds-chip metrics exactly so it sits flush next to status/tag chips. */
.cv-vis-chip {
  cursor: pointer;
  gap: 4px;
  /* Buttons default to font: -webkit-small-control and line-height: normal,
     neither of which inherit. Force inheritance so the chip matches the
     surrounding ds-chip spans. */
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-xs);
  line-height: inherit;
  color: var(--ds-graphite);
  background: var(--ds-white);
  border-color: var(--ds-stone-dark);
  transition: background 0.12s, border-color 0.12s;
}
/* Cap SVGs to text height so the icon + chevron don't inflate the chip box. */
.cv-vis-chip svg { width: 12px; height: 12px; flex-shrink: 0; }

.cv-vis-chip:hover,
.cv-vis-chip[aria-expanded="true"] {
  background: var(--ds-parchment);
}

.cv-vis-chip[disabled] {
  opacity: 0.5;
  cursor: wait;
}

.cv-vis-menu {
  display: flex;
}

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

.cv-vis-opt {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: none;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ds-ink);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.cv-vis-opt:hover {
  background: var(--ds-parchment);
}

.cv-vis-opt.is-active {
  background: var(--ds-parchment);
  font-weight: 600;
}

.cv-vis-opt.is-active svg:last-child {
  margin-left: auto;
  color: var(--ds-green, #16a34a);
}

[data-theme="dark"] .cv-vis-menu {
  background: var(--ds-ink);
  border-color: var(--ds-stone-dark);
}

[data-theme="dark"] .cv-vis-opt:hover,
[data-theme="dark"] .cv-vis-opt.is-active {
  background: var(--ds-parchment);
}

/* ── Lineage chip (shown in canvas header for clones / remixes) ──────────────── */
.lineage-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(59, 130, 246, 0.07);
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: var(--ds-radius-pill);
  font-size: var(--ds-text-xs);
  color: var(--ds-graphite);
  max-width: max-content;
}

.lineage-chip svg {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  color: rgba(59, 130, 246, 0.65);
}

.lineage-chip-label {
  font-style: italic;
  font-family: var(--ds-font-serif);
  color: var(--ds-graphite);
}

.lineage-chip-link {
  font-weight: 600;
  color: var(--ds-blue, #3b82f6);
  text-decoration: none;
}

.lineage-chip-link:hover {
  text-decoration: underline;
}

.lineage-chip--opaque {
  background: rgba(148, 163, 184, 0.10);
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--ds-ash);
}

.lineage-chip--opaque svg {
  color: var(--ds-ash);
}

/* ── Clones strip (canvas section below details card) ───────────────────────── */
.clones-strip .clones-strip-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
}

.clone-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--ds-parchment);
  border: 1px solid var(--ds-stone);
  border-radius: 8px;
  text-decoration: none;
  color: var(--ds-ink);
  transition: border-color 0.12s, background 0.12s;
}

.clone-card:hover {
  border-color: var(--ds-stone-dark);
  background: var(--ds-white);
}

.clone-card-mono {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid var(--ds-stone);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ds-font-serif);
  font-size: 14px;
  background: var(--ds-white);
  color: var(--ds-graphite);
}

.clone-card-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.clone-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ds-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clone-card-author {
  font-size: 11px;
  color: var(--ds-ash);
  font-family: var(--ds-font-serif);
  font-style: italic;
}

.clone-card-badge {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 500;
  color: rgba(59, 130, 246, 0.75);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 12px;
  padding: 2px 7px;
}

.clones-see-all {
  font-size: 12px;
  color: var(--ds-blue, #3b82f6);
  text-decoration: none;
  font-family: var(--ds-font-serif);
  font-style: italic;
}

.clones-see-all:hover {
  text-decoration: underline;
}

/* ── Hub card: bookmark (save) button ────────────────────────────── */
.hub-save-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ds-stone);
  border-radius: 6px;
  background: var(--ds-white);
  color: var(--ds-ash);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ds-transition), color var(--ds-transition), background var(--ds-transition);
  z-index: 3;
}

.list-card:hover .hub-save-btn {
  opacity: 1;
  pointer-events: auto;
}

.hub-save-btn.is-saved {
  opacity: 1;
  pointer-events: auto;
  color: var(--ds-blue, #3b82f6);
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.06);
}

.hub-save-btn:hover {
  color: var(--ds-ink);
  background: var(--ds-parchment);
}

.hub-save-btn.is-saved:hover {
  color: var(--ds-red, #ef4444);
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
}

/* ── File manager (Files tab) ──────────────────────────────────────────────── */
.file-manager {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-xs);
  overflow: hidden;
  height: 520px;
  background: var(--ds-white);
}
.fm-list-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--ds-stone);
  background: var(--ds-linen);
}
.fm-toolbar {
  display: flex;
  gap: 4px;
  padding: 0 8px;
  background: var(--ds-parchment);
  border-bottom: 1px solid var(--ds-stone);
  flex-shrink: 0;
  min-height: 32px;
  align-items: center;
}
.fm-tool-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--ds-radius-xs);
  padding: 3px 8px;
  font-family: var(--ds-font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ds-graphite);
  cursor: pointer;
  transition: background var(--ds-transition), color var(--ds-transition);
}
.fm-tool-btn:hover { background: var(--ds-linen); color: var(--ds-ink); border-color: var(--ds-stone); }
.fm-list {
  font-family: var(--ds-font-mono);
  font-size: 11.5px;
  color: var(--ds-graphite);
  padding: 8px 0;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}
.fm-list .ft-row {
  padding: 4px 12px;
  display: flex;
  gap: 6px;
  align-items: center;
  cursor: default;
  user-select: none;
}
.fm-list .ft-row .chev {
  width: 12px; height: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease;
  color: var(--ds-ash);
}
.fm-list .ft-row.is-collapsed .chev { transform: rotate(-90deg); }
.fm-list .ft-row .chev-spacer { width: 12px; flex-shrink: 0; }
.fm-list .ft-row .ficon { width: 12px; height: 12px; flex-shrink: 0; opacity: 0.7; }
.fm-list .ft-row .indent { display: inline-block; width: 10px; flex-shrink: 0; }
.fm-list .ft-row.is-folder { color: var(--ds-ink); font-weight: 500; cursor: pointer; transition: background var(--ds-transition); }
.fm-list .ft-row.is-folder:hover { background: var(--ds-parchment); }
.fm-list .ft-row.is-file { cursor: pointer; transition: background var(--ds-transition); }
.fm-list .ft-row.is-file:hover { background: var(--ds-parchment); }
.fm-list .ft-row.is-selected { background: var(--ds-mint); color: var(--ds-ink); }
.fm-list .ft-row.is-selected .ficon { opacity: 1; }
.fm-viewer {
  display: flex;
  flex-direction: column;
  background: var(--ds-white);
  overflow: hidden;
  min-height: 0;
}
.fm-viewer-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px;
  min-height: 32px;
  box-sizing: border-box;
  background: var(--ds-parchment);
  border-bottom: 1px solid var(--ds-stone);
  font-family: var(--ds-font-mono); font-size: 11px;
  color: var(--ds-graphite);
  flex-shrink: 0;
}
.fm-viewer-body {
  flex: 1;
  min-height: 0;
  color: var(--ds-ink);
  overflow: auto;
}
.fm-viewer-code {
  margin: 0;
  padding: 14px 16px;
  font-family: var(--ds-font-mono); font-size: 12px;
  line-height: 1.7;
  white-space: pre;
  overflow-x: auto;
}
.fm-viewer-md {
  padding: 18px 22px 28px;
  max-width: 760px;
  font-family: var(--ds-font-body);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ds-ink);
}
.fm-viewer-md h1 { font-size: 22px; margin: 0 0 12px; }
.fm-viewer-md h2 { font-size: 17px; margin: 22px 0 8px; }
.fm-viewer-md h3 { font-size: 14px; margin: 18px 0 6px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ds-graphite); }
.fm-viewer-md p  { margin: 0 0 10px; }
.fm-viewer-md ul, .fm-viewer-md ol { margin: 0 0 12px; padding-left: 20px; }
.fm-viewer-md li { margin: 2px 0; }
.fm-viewer-md code { font-family: var(--ds-font-mono); font-size: 12px; background: var(--ds-parchment); padding: 1px 5px; border-radius: 3px; }
.fm-viewer-md pre  { background: var(--ds-parchment); padding: 10px 12px; border-radius: 4px; overflow-x: auto; font-size: 12px; }
.fm-viewer-md pre code { background: transparent; padding: 0; }
.fm-viewer-md blockquote { border-left: 2px solid var(--ds-stone); margin: 10px 0; padding: 2px 0 2px 12px; color: var(--ds-graphite); }
.fm-viewer-md a { color: var(--ds-ink); text-decoration: underline; }
.fm-viewer-empty {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  color: var(--ds-ash);
  font-family: var(--ds-font-body); font-size: 13px;
  font-style: italic;
  background: var(--ds-linen);
}

/* Browse-files button (mobile only on page; always visible inside sheet header is irrelevant — sheet replaces the layout) */
.fm-browse-btn {
  display: none;
  appearance: none;
  border: 1px solid var(--ds-stone);
  background: var(--ds-white);
  border-radius: var(--ds-radius-xs);
  padding: 3px 9px;
  font-family: var(--ds-font-mono); font-size: 11px;
  color: var(--ds-ink);
  cursor: pointer;
}
.fm-browse-btn:hover { background: var(--ds-linen); }
.fm-viewer-bar-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mobile: single-column file manager, list hidden, browse opens it in a sheet */
@media (max-width: 720px) {
  .file-manager {
    grid-template-columns: 1fr;
    height: 60vh;
    min-height: 380px;
  }
  .fm-list-col { display: none; }
  .fm-browse-btn { display: inline-flex; align-items: center; gap: 4px; }
}

/* When the list column is hoisted into the modal sheet, override the
   "hidden on mobile" rule and let it fill the dialog body. */
.ds-modal.fm-sheet .fm-sheet-mount {
  display: flex;
  flex-direction: column;
  min-height: 50vh;
  max-height: 70vh;
}
.ds-modal.fm-sheet .fm-list-col.is-in-sheet {
  display: flex;
  flex: 1;
  min-height: 0;
  background: var(--ds-linen);
  border: 1px solid var(--ds-stone);
  border-radius: var(--ds-radius-xs);
  overflow: hidden;
}
.ds-modal.fm-sheet .fm-list-col.is-in-sheet .fm-list { flex: 1; }
