/* ============================================================
   Plotloft — "Writing Room" design system
   Paper-first light theme (default) + warm night theme.
   Tokens are shared by the Plotloft app and the Dashboard.
   ============================================================ */

:root {
  /* -- Paper (default) -- */
  --bg: #f3efe6;
  --bg-raised: #faf7f0;
  --bg-card: #fffdf8;
  --bg-hover: #eae4d5;
  --line: #d9d2c0;
  --line-soft: #e6e0d1;
  --text: #29241a;
  --text-mute: #635c4a;
  --text-dim: #857c66;
  --accent: #a5522b; /* editor's pencil sienna */
  --accent-soft: color-mix(in oklch, var(--accent) 12%, transparent);
  --danger: #b0442f;
  --shadow:
    0 1px 2px rgba(92, 74, 36, 0.05),
    0 14px 30px -24px rgba(92, 74, 36, 0.35);
  --shadow-pop:
    0 2px 6px rgba(92, 74, 36, 0.08),
    0 32px 70px -30px rgba(92, 74, 36, 0.45);

  /* plotline accent hues — deeper chroma for paper */
  --hue-a: oklch(0.58 0.11 70);   /* ochre */
  --hue-b: oklch(0.58 0.10 165);  /* teal */
  --hue-c: oklch(0.56 0.12 35);   /* clay */
  --hue-d: oklch(0.56 0.10 285);  /* violet */
  --hue-e: oklch(0.58 0.10 130);  /* moss */
  --hue-f: oklch(0.58 0.11 350);  /* rose */
  /* text drawn on top of a hue swatch */
  --on-hue: #fdfbf5;

  --row-h: 112px;
  --col-base: 232px; /* density-controlled; the timeline derives --col-w from this × zoom */

  --font-ui: "Inter Tight", ui-sans-serif, system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --font-display: "Fraunces", Georgia, serif;
}

[data-theme="dark"] {
  --bg: #151310;
  --bg-raised: #1c1916;
  --bg-card: #221f1a;
  --bg-hover: #2b2721;
  --line: #353027;
  --line-soft: #292521;
  --text: #ece6d9;
  --text-mute: #aba28e;
  --text-dim: #837a66;
  --accent: #d3a266; /* candlelight amber */
  --accent-soft: color-mix(in oklch, var(--accent) 16%, transparent);
  --danger: #d4715c;
  --shadow:
    0 1px 0 rgba(255,255,255,0.03) inset,
    0 16px 36px -26px rgba(0,0,0,0.7);
  --shadow-pop:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 30px 70px -28px rgba(0,0,0,0.8);

  --hue-a: oklch(0.78 0.09 70);
  --hue-b: oklch(0.78 0.09 165);
  --hue-c: oklch(0.76 0.10 35);
  --hue-d: oklch(0.76 0.09 285);
  --hue-e: oklch(0.78 0.09 130);
  --hue-f: oklch(0.78 0.09 350);
  --on-hue: #171410;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.004em;
  height: 100vh;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; letter-spacing: inherit; }
input, textarea { font: inherit; color: inherit; background: none; border: 0; outline: 0; }
::selection { background: color-mix(in oklch, var(--accent) 24%, transparent); }

button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid color-mix(in oklch, var(--accent) 65%, transparent);
  outline-offset: 2px;
}

/* ===== Layout shell ===== */
.app {
  display: grid;
  grid-template-columns: 264px 1fr;
  grid-template-rows: 54px 1fr;
  height: 100vh;
  width: 100vw;
  background: var(--bg);
}
.app.inspector-open { grid-template-columns: 264px 1fr 380px; }
.app.side-off { grid-template-columns: 1fr; }
.app.side-off.inspector-open { grid-template-columns: 1fr 380px; }
.app.side-off .sidebar { display: none; }

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
  z-index: 5;
}
.sidebar {
  border-right: 1px solid var(--line);
  background: var(--bg-raised);
  padding: 18px 12px 14px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 24px;
}
.canvas {
  overflow: auto;
  position: relative;
  background: var(--bg);
}
[data-grid="on"] .canvas {
  background:
    radial-gradient(circle at 1px 1px, var(--line-soft) 1px, transparent 1px) 0 0 / 26px 26px,
    var(--bg);
}
.inspector {
  border-left: 1px solid var(--line);
  background: var(--bg-raised);
  overflow-y: auto;
}

/* ===== Topbar ===== */
.brand {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: -0.02em;
  padding: 4px 6px 4px 4px;
  border-radius: 8px;
}
button.brand:hover { background: var(--bg-hover); }
.brand-mark {
  width: 24px; height: 24px;
  border-radius: 7px;
  background: var(--accent);
  display: grid; place-items: center;
  color: var(--on-hue, #fff);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  font-style: italic;
}
[data-theme="dark"] .brand-mark { color: #171410; }
.project-switch {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  min-width: 0;
}
.project-switch:hover { background: var(--bg-hover); }
.project-switch .chev { color: var(--text-dim); font-size: 10px; }
.project-switch .t {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 220px;
}
.divider-v { width: 1px; height: 20px; background: var(--line); margin: 0 4px; flex: 0 0 auto; }

/* Quiet editorial tabs — active gets an ink underline */
.tabs {
  display: flex; align-items: stretch; gap: 2px;
  align-self: stretch;
}
.tab {
  position: relative;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mute);
  display: inline-flex; align-items: center;
  border-radius: 0;
}
.tab:hover { color: var(--text); }
.tab::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  transition: background 0.14s ease;
}
.tab.active { color: var(--text); }
.tab.active::after { background: var(--accent); }
.tab .kbd { margin-left: 7px; opacity: 0; transition: opacity 0.12s; }
.tab:hover .kbd { opacity: 1; }

.topbar-left { display: flex; align-items: center; gap: 4px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 6px; }

.pill-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-mute);
  font-size: 12.5px; font-weight: 500;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.pill-btn:hover { color: var(--text); border-color: var(--text-dim); }
.pill-btn.danger { color: var(--danger); }
.pill-btn.danger:hover { border-color: var(--danger); }
.pill-btn.pin-on { color: var(--accent); border-color: var(--accent); }

.icon-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-mute);
  transition: color 0.12s, background 0.12s;
}
.icon-btn:hover { color: var(--text); background: var(--bg-hover); }
.icon-btn.active { color: var(--accent); }

.kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-dim);
  border: 1px solid var(--line);
}

/* ===== Sidebar ===== */
.side-section { display: flex; flex-direction: column; gap: 2px; }
.side-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 0 8px 7px 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.side-label .add {
  color: var(--text-dim);
  font-size: 14px; line-height: 1;
  padding: 2px 4px; border-radius: 4px;
}
.side-label .add:hover { background: var(--bg-hover); color: var(--text); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px;
  border-radius: 7px;
  color: var(--text-mute);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-hover); color: var(--text); }
.nav-item .icon { width: 14px; height: 14px; opacity: 0.7; flex-shrink: 0; }
.nav-item .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.plotline-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px;
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  width: 100%;
  text-align: left;
  position: relative;
}
.plotline-item:hover { background: var(--bg-hover); }
.plotline-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--plot-color, var(--accent));
  flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--plot-color, var(--accent)) 18%, transparent);
}
.plotline-item .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.plotline-item.hidden { opacity: 0.45; }
.plotline-item.hidden .name-t { text-decoration: line-through; text-decoration-color: var(--text-dim); }
.plotline-item.hidden .plotline-dot { box-shadow: none; background: transparent; border: 1px dashed var(--text-dim); }

.character-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
}
.character-item:hover { background: var(--bg-hover); }
.character-item.filtering {
  background: var(--accent-soft);
  border-color: color-mix(in oklch, var(--accent) 40%, transparent);
}
.character-item .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.char-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 600;
  color: var(--on-hue);
  flex-shrink: 0;
}

.side-foot {
  margin-top: auto;
  padding: 12px 8px 0;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
}
.side-foot .meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.6;
}

/* ===== Canvas chrome ===== */
.canvas-header {
  position: sticky;
  top: 0; left: 0;
  z-index: 4;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}
.canvas-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}
.canvas-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
  display: flex; gap: 14px;
}
.canvas-meta b { color: var(--text-mute); font-weight: 500; }
.canvas-controls { display: flex; gap: 6px; align-items: center; }

.seg {
  display: inline-flex; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden;
  background: var(--bg-card);
}
.seg button {
  padding: 5px 10px; font-size: 12px; color: var(--text-mute);
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--bg-hover); color: var(--text); }

/* ===== Timeline grid ===== */
.timeline {
  position: relative;
  padding: 0 24px 120px 24px;
  min-width: min-content;
  /* column width = density base × zoom; --col-cw is a collapsed act's stub column */
  --col-w: calc(var(--col-base, 232px) * var(--tl-zoom, 1));
  --col-cw: 22px;
}
.timeline-inner { position: relative; padding-top: 20px; }

/* Column headers — sticky */
.col-headers {
  display: grid;
  grid-template-columns: 140px repeat(var(--cols), var(--col-w));
  gap: 0;
  position: sticky;
  top: 71px;
  z-index: 3;
  background: var(--bg);
  padding: 18px 0 12px;
  border-bottom: 1px solid var(--line);
}
.corner { }
.scene-col {
  padding: 0 16px;
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  border-radius: 8px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.scene-col.collapsed { padding: 0; }
/* act banding / zebra carried onto the (opaque) sticky header */
.scene-col.band-act { background: color-mix(in oklch, var(--accent) 4%, transparent); }
.scene-col.band-zebra { background: color-mix(in oklch, var(--text) 3%, transparent); }
.scene-col.band-act.band-zebra { background: color-mix(in oklch, var(--accent) 7%, transparent); }
.scene-col.selected { box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--accent) 45%, transparent); background: color-mix(in oklch, var(--accent) 9%, transparent); }
.scene-num {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.scene-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.15;
}
.scene-title:hover { color: var(--accent); }
.scene-pop {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Act banding */
.act-band {
  position: absolute;
  top: 0; bottom: 0;
  pointer-events: none;
  border-left: 1px dashed color-mix(in oklch, var(--text-dim) 55%, transparent);
  display: flex;
  align-items: flex-start;
  padding-top: 4px;
  padding-left: 10px;
}
.act-band .label { pointer-events: auto; cursor: pointer; white-space: nowrap; }
.act-band .label:hover { border-color: var(--accent); background: color-mix(in oklch, var(--accent) 16%, var(--bg)); }
.act-band .label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in oklch, var(--accent) 9%, var(--bg));
  padding: 3px 8px;
  border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent);
  border-radius: 999px;
}

/* Rows */
.plot-row {
  display: grid;
  grid-template-columns: 140px repeat(var(--cols), var(--col-w));
  align-items: center;
  position: relative;
  min-height: var(--row-h);
}
.plot-row + .plot-row::before {
  content: "";
  position: absolute;
  left: 140px; right: 0; top: 0;
  border-top: 1px dashed var(--line-soft);
}
.plot-label {
  padding-right: 16px;
  display: flex; flex-direction: column; gap: 4px;
  justify-content: center;
  align-self: stretch;
  position: sticky;
  left: 24px;
  background: linear-gradient(to right, var(--bg) 75%, transparent);
  padding-left: 2px;
  z-index: 2;
}
.plot-label .name {
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
.plot-label .swatch {
  width: 10px; height: 10px; border-radius: 3px;
  background: var(--plot-color);
}
.plot-label .sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-left: 18px;
}

/* Continuity line for each plotline row */
.plot-row .line {
  position: absolute;
  left: 140px; right: 16px;
  top: 50%;
  height: 1px;
  background: linear-gradient(to right,
    transparent 0%,
    var(--plot-color) 8%,
    var(--plot-color) 92%,
    transparent 100%);
  opacity: 0.3;
  pointer-events: none;
}

/* Cell */
.cell {
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: stretch;
  position: relative;
  z-index: 1;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.cell.collapsed { padding: 4px 2px; justify-content: center; align-self: stretch; }
.beat-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--plot-color, var(--accent));
  opacity: 0.85;
}

/* Index-card look */
.card {
  width: 100%;
  min-height: 72px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px 10px 14px;
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  text-align: left;
  box-shadow: var(--shadow);
}
.card:hover {
  border-color: color-mix(in oklch, var(--plot-color) 55%, var(--line));
  transform: translateY(-1px);
  box-shadow: var(--shadow-pop);
}
.card.active {
  border-color: var(--plot-color);
  box-shadow: 0 0 0 1px var(--plot-color), var(--shadow);
}
.card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--plot-color);
  border-radius: 8px 0 0 8px;
  opacity: 0.9;
}
.card .title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.005em;
}
.card .body {
  font-size: 11.5px;
  color: var(--text-mute);
  line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .meta {
  display: flex; align-items: center; gap: 6px; margin-top: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.card .chars { display: flex; margin-left: auto; }
.card .chars .dot {
  width: 15px; height: 15px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 8px; font-weight: 600;
  color: var(--on-hue);
  border: 1.5px solid var(--bg-card);
  margin-left: -3px;
}

/* Card style variants (Tweaks) */
[data-card-style="minimal"] .card {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
[data-card-style="minimal"] .card:hover { background: var(--bg-hover); }
[data-card-style="chip"] .card { min-height: 0; padding: 8px 10px 8px 13px; }
[data-card-style="chip"] .card .body { display: none; }

.cell-empty {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 72px;
  border-radius: 8px;
  border: 1px dashed transparent;
  color: var(--text-dim);
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.12s, border-color 0.12s;
}
.cell:hover .cell-empty {
  opacity: 1;
  border-color: var(--line);
}
.cell-empty:hover { color: var(--accent); border-color: color-mix(in oklch, var(--accent) 45%, transparent); }

/* Add scene button at end */
.add-scene-col {
  padding: 0 16px;
  display: flex; align-items: flex-start; padding-top: 4px;
}
.add-scene-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  color: var(--text-dim);
  display: grid; place-items: center;
  font-size: 16px;
}
.add-scene-btn:hover { color: var(--accent); border-color: color-mix(in oklch, var(--accent) 45%, transparent); background: var(--bg-hover); }

.add-plot-row {
  display: grid;
  grid-template-columns: 140px repeat(var(--cols), var(--col-w));
  padding-top: 14px;
}
.add-plot-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 10px;
  border-radius: 6px;
  justify-self: start;
  margin-left: 2px;
}
.add-plot-btn:hover { color: var(--accent); background: var(--bg-hover); }

/* ===== Inspector ===== */
.insp { display: flex; flex-direction: column; height: 100%; }
.insp-head {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(180deg, color-mix(in oklch, var(--plot-color, var(--accent)) 7%, transparent), transparent);
}
.insp-tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.insp-tag .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--plot-color); }

.insp-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--text);
}
.insp-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 26px; height: 26px;
  border-radius: 6px;
  display: grid; place-items: center;
  color: var(--text-dim);
}
.insp-close:hover { background: var(--bg-hover); color: var(--text); }

.insp-meta-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  align-items: center;
  padding: 10px 22px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line-soft);
}
.insp-meta-row .k {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.insp-meta-row .v { color: var(--text); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  background: var(--bg-card);
  color: var(--text);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--chip-color, var(--accent)); }
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }

.insp-section {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
}
.insp-section h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 10px;
  font-weight: 500;
}
.insp-body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
}
.insp-body em { color: var(--text-mute); font-style: italic; }
.insp-hint { font-size: 12px; color: var(--text-dim); font-style: italic; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 12px;
}
.stat .k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.stat .v {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.1;
  color: var(--text);
  margin-top: 4px;
}
.stat .v small {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-left: 4px;
}

/* Beat chain */
.beats { display: flex; flex-direction: column; gap: 8px; }
.beat {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 10px;
  border-radius: 6px;
}
.beat:hover { background: var(--bg-hover); }
.beat .num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  min-width: 18px;
}
.beat .t { font-size: 12.5px; color: var(--text); line-height: 1.35; }
.beat.done .t { color: var(--text-mute); text-decoration: line-through; text-decoration-color: var(--text-dim); }

/* ===== Tweaks panel ===== */
.tweaks {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 320px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  z-index: 50;
  overflow: hidden;
}
.tweaks-head {
  padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line);
}
.tweaks-head .t {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: -0.01em;
}
.tweaks-body {
  padding: 14px 16px 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.tweak-row { display: flex; flex-direction: column; gap: 6px; }
.tweak-row .label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.seg.full { width: 100%; }
.seg.full button { flex: 1; }
.swatch-row { display: flex; gap: 6px; }
.swatch-row button {
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--s);
}
.swatch-row button.active { outline: 2px solid var(--text); outline-offset: 2px; }

/* ===== Scrollbars ===== */
.canvas::-webkit-scrollbar, .sidebar::-webkit-scrollbar, .inspector::-webkit-scrollbar { width: 10px; height: 10px; }
.canvas::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb, .inspector::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 5px; border: 2px solid var(--bg);
}
.canvas::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== Editable fields ===== */
.editable {
  cursor: text;
  border-radius: 4px;
  transition: background 0.12s, box-shadow 0.12s;
}
button.editable, .card .editable { cursor: pointer; }
.editable:hover:not(.editing) {
  background: color-mix(in srgb, var(--text) 7%, transparent);
}
input.editable.editing, textarea.editable.editing {
  outline: 0;
  border: 0;
  background: var(--bg-card) !important;
  box-shadow: 0 0 0 1.5px var(--plot-color, var(--accent));
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: 5px;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
}
textarea.editable.editing { min-height: 2.4em; }

/* Delete affordances */
.card { position: relative; }
.card-del, .plot-del, .scene-del {
  position: absolute;
  top: 6px; right: 6px;
  width: 18px; height: 18px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-dim);
  background: var(--bg-card);
  opacity: 0;
  transition: opacity 0.12s, color 0.12s, background 0.12s;
  display: grid; place-items: center;
}
.card:hover .card-del { opacity: 1; }
.card-del:hover { color: var(--danger); background: var(--bg-hover); }

.plot-row { position: relative; }
.plot-del {
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
}
.plot-row:hover .plot-del { opacity: 0.6; }
.plot-del:hover { opacity: 1; color: var(--danger); }

.scene-del {
  position: static;
  opacity: 0;
  background: transparent;
}
.scene-col:hover .scene-del { opacity: 0.5; }
.scene-del:hover { opacity: 1; color: var(--danger); }

/* ===== Drag & drop ===== */
.grip {
  display: inline-block;
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: -2px;
  cursor: grab;
  user-select: none;
  margin-right: 2px;
  opacity: 0;
  transition: opacity 0.12s;
}
.scene-col:hover .grip, .plot-label:hover .grip { opacity: 0.6; }
.plot-label { cursor: grab; }
.plot-label:active { cursor: grabbing; }

.scene-grip-row {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  cursor: grab;
  user-select: none;
}
.scene-grip-row:active { cursor: grabbing; }

.card[draggable="true"] { cursor: grab; }
.card.dragging { cursor: grabbing; }
.plot-row.dragging, .scene-col.dragging { opacity: 0.4; }

.drop-line {
  position: absolute;
  background: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--accent) 30%, transparent);
  z-index: 10;
  pointer-events: none;
  border-radius: 2px;
}
.drop-line.row { left: 140px; right: 0; top: -1px; height: 2px; }
.drop-line.row.bottom { top: auto; bottom: -1px; }

.cell.drop-target {
  background: color-mix(in oklch, var(--plot-color, var(--accent)) 12%, transparent);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--plot-color, var(--accent));
}

/* ===== Timeline v2: banding, scene drag, multi-select, collapse, zoom ===== */

/* Full-height act/scene stripes behind the grid */
.tl-stripes { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.tl-stripe { position: absolute; top: 0; bottom: 0; }
.tl-stripe.alt-act { background: color-mix(in oklch, var(--accent) 4%, transparent); }
.tl-stripe.alt-scene { background: color-mix(in oklch, var(--text) 3%, transparent); }
.tl-stripe.alt-act.alt-scene { background: color-mix(in oklch, var(--accent) 7%, transparent); }
.tl-stripe.selected { background: color-mix(in oklch, var(--accent) 10%, transparent); }

/* Full-height insertion line while dragging scenes */
.tl-insert-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px; margin-left: -1px;
  background: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--accent) 35%, transparent);
  border-radius: 2px;
  z-index: 6;
  pointer-events: none;
}
.tl-insert-line::before, .tl-insert-line::after {
  content: "";
  position: absolute; left: -4px;
  border: 5px solid transparent;
}
.tl-insert-line::before { top: 0; border-top-color: var(--accent); }
.tl-insert-line::after { bottom: 0; border-bottom-color: var(--accent); }

/* Columns part around the insertion point */
.push-l { transform: translateX(-4px); }
.push-r { transform: translateX(4px); }
/* Dragged columns fade as one block */
.scene-col.dim, .cell.dim { opacity: 0.3; }

/* Insert-between button on column boundaries */
.gap-add {
  position: absolute;
  left: -11px; top: 1px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px dashed var(--line);
  background: var(--bg);
  color: var(--text-dim);
  font-size: 12px; line-height: 1;
  display: grid; place-items: center;
  opacity: 0;
  z-index: 4;
  transition: opacity 0.12s;
}
.scene-col:hover .gap-add { opacity: 0.75; }
.gap-add:hover { opacity: 1; color: var(--accent); border-style: solid; border-color: color-mix(in oklch, var(--accent) 55%, transparent); }

/* Multi-select drag ghost + floating selection chip */
.drag-ghost-badge {
  position: absolute; top: -1000px; left: 0;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--on-hue);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 12px; font-weight: 600;
}
.tl-sel-chip {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-pop);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
}
.tl-sel-chip b { color: var(--accent); font-weight: 600; }
.tl-sel-chip .hint { color: var(--text-dim); }
.tl-sel-chip button { color: var(--text-dim); }
.tl-sel-chip button:hover { color: var(--danger); }

/* Compress mode — title-only cards for a scannable overview */
.timeline.compress .card .body { display: none; }
.timeline.compress .card { min-height: 0; }
.timeline.compress .plot-row { min-height: 58px; }
.timeline.compress .cell-empty { min-height: 36px; }

/* Utility */
.icon-line {
  width: 14px; height: 14px;
  display: inline-block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  flex-shrink: 0;
}

/* ===== Characters view ===== */
.chars-view { display: flex; flex-direction: column; min-height: 100%; }
.chars-search {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px;
  color: var(--text-mute);
}
.chars-search:focus-within { border-color: var(--text-dim); }
.chars-search input {
  background: none; border: 0; outline: 0;
  font-size: 12.5px; color: var(--text); width: 160px;
}
.chars-search input::placeholder { color: var(--text-dim); }

.chars-body {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  flex: 1;
  align-items: stretch;
}
.chars-grid {
  padding: 24px 28px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  align-content: start;
}

.char-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 18px 14px;
  text-align: left;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.char-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--c-color, var(--accent));
  opacity: 0.75;
}
.char-card:hover { border-color: var(--text-dim); transform: translateY(-1px); box-shadow: var(--shadow-pop); }
.char-card.active {
  border-color: var(--c-color, var(--accent));
  box-shadow: 0 0 0 1px var(--c-color, var(--accent)), var(--shadow);
}
.char-card-cover { display: flex; align-items: center; gap: 14px; }
.char-card-head .role {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-dim);
}
.char-card-head .name {
  font-family: var(--font-display);
  font-size: 20px; letter-spacing: -0.015em;
  line-height: 1.1; color: var(--text); margin-top: 2px;
}
.char-card-head .occ {
  font-family: var(--font-display); font-style: italic;
  font-size: 12.5px; color: var(--text-mute); margin-top: 3px;
}
.char-card .tag {
  font-family: var(--font-display); font-style: italic;
  font-size: 13.5px; color: var(--text-mute); line-height: 1.45; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.char-card-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: 8px; overflow: hidden; margin-top: auto;
}
.char-card-stats > div {
  background: var(--bg-card); padding: 8px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.char-card-stats .v {
  font-family: var(--font-display); font-size: 16px;
  color: var(--text); line-height: 1;
}
.char-card-stats .k {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim);
}

.char-card.ghost {
  border-style: dashed; background: transparent; box-shadow: none;
  align-items: center; justify-content: center; text-align: center;
  color: var(--text-dim); min-height: 210px;
}
.char-card.ghost::before { display: none; }
.char-card.ghost:hover { color: var(--text); border-color: var(--text-dim); }
.char-card.ghost .plus {
  width: 42px; height: 42px; border-radius: 10px;
  border: 1.5px dashed currentColor;
  display: grid; place-items: center; font-size: 18px; font-weight: 300;
}
.char-card.ghost .lab { font-family: var(--font-display); font-size: 17px; color: inherit; }
.char-card.ghost .sub {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim);
}

.char-detail {
  border-left: 1px solid var(--line);
  padding: 24px 24px 40px;
  background: var(--bg-raised);
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
  position: relative;
}
.char-detail::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0;
  height: 4px; background: var(--c-color, var(--accent)); opacity: 0.75;
}
.char-detail-head { display: flex; align-items: flex-start; gap: 14px; }
.char-detail-head .role {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim);
}
.char-detail-head .name {
  font-family: var(--font-display); font-size: 24px;
  letter-spacing: -0.02em; line-height: 1.1; margin-top: 2px;
}
.char-detail-head .occ {
  font-family: var(--font-display); font-style: italic;
  font-size: 13px; color: var(--text-mute); margin-top: 3px;
}
.char-detail-tag {
  font-family: var(--font-display); font-style: italic;
  font-size: 14.5px; color: var(--text-mute); line-height: 1.5; margin: 0;
  padding-bottom: 14px; border-bottom: 1px solid var(--line-soft);
}
.char-detail-row { display: grid; grid-template-columns: 70px 1fr; gap: 12px; align-items: baseline; font-size: 13.5px; }
.char-detail-row .k {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim);
  padding-top: 3px;
}
.char-detail-row .v { color: var(--text); line-height: 1.55; }

.char-detail-section { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.char-detail-section h4 {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim); margin: 0; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.char-detail-section h4 .count { font-family: var(--font-mono); color: var(--text-dim); }

.rel-list { display: flex; flex-direction: column; gap: 6px; }
.rel-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--line-soft);
  text-align: left; cursor: pointer;
  position: relative;
}
.rel-row:hover { border-color: var(--text-dim); }
.rel-row .rel-name { font-size: 13px; color: var(--text); }
.rel-row .rel-label {
  font-family: var(--font-display); font-style: italic;
  font-size: 12.5px; color: var(--text-mute); margin-left: auto; text-align: right;
}

.appearance-list { display: flex; flex-direction: column; gap: 4px; }
.appearance-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; background: var(--bg-card);
  border: 1px solid var(--line-soft); text-align: left; cursor: pointer;
}
.appearance-row:hover { border-color: var(--text-dim); background: var(--bg-hover); }
.appearance-row .scene-num {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-dim); letter-spacing: 0.06em;
  width: 22px;
}
.appearance-row .plot-swatch { width: 4px; height: 26px; border-radius: 2px; flex-shrink: 0; }
.appearance-row .app-body { flex: 1; min-width: 0; }
.appearance-row .app-title {
  font-size: 13px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appearance-row .app-meta {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-dim); letter-spacing: 0.04em; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appearance-row .app-go { color: var(--text-dim); font-size: 14px; }
.appearance-row:hover .app-go { color: var(--text); }

.char-detail-empty { justify-content: center; align-items: center; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 40px 20px; }
.empty-state-icon { font-size: 28px; color: var(--text-dim); opacity: 0.4; }
.empty-state-title { font-family: var(--font-display); font-size: 15px; color: var(--text-mute); }
.empty-state-sub { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }

/* ---- Character detail editing ---- */
.char-detail-delete {
  background: none; border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 8px; font-size: 10.5px; font-family: var(--font-mono);
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim); cursor: pointer; flex-shrink: 0;
  transition: border-color 0.12s, color 0.12s;
}
.char-detail-delete:hover { border-color: var(--danger); color: var(--danger); }

/* Colour swatches */
.color-swatches { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
.color-swatch {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer; padding: 0;
  outline: none; transition: transform 0.1s;
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.active { border-color: var(--text); }

/* Trait chips with remove */
.chip .chip-remove {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none;
  padding: 4px 5px; margin: -4px -6px -4px -3px;
  color: var(--text-dim); cursor: pointer; font-size: 13px; line-height: 1;
}
.chip .chip-remove:hover { color: var(--text); }
.chip-add-input {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 20px; padding: 3px 10px; font-size: 12.5px;
  color: var(--text); outline: none; width: 100px;
}
.chip-add-input:focus { border-color: var(--text-dim); }
.chip-add-btn {
  background: none; border: 1px dashed var(--line); border-radius: 20px;
  padding: 3px 10px; font-size: 12px; color: var(--text-dim); cursor: pointer;
  font-family: var(--font-mono);
}
.chip-add-btn:hover { color: var(--text); border-color: var(--text-dim); }

/* Chip picker — selected chips + searchable add popover */
.picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.picker-anchor { position: relative; }
.picker-pop {
  position: absolute;
  top: calc(100% + 6px); left: 0;
  z-index: 40;
  min-width: 190px;
  max-height: 216px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  padding: 4px;
}
.picker-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 6px 9px;
  border: none; background: none;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.picker-item.hi { background: var(--bg-hover); }
.picker-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--chip-color, var(--accent)); flex-shrink: 0; }
.picker-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}

/* Relationship row with remove */
.rel-row .rel-label { margin-left: auto; }
.rel-remove {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; padding: 0 4px; font-size: 14px; line-height: 1;
  border-radius: 4px; flex-shrink: 0;
}
.rel-remove:hover { color: var(--text); }

/* Relationship add form */
.rel-add-row {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px; border-radius: 8px; border: 1px dashed var(--line);
}
.rel-add-row select, .rel-add-row input {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 8px; font-size: 12.5px;
  color: var(--text); outline: none; width: 100%;
}
.rel-add-row select:focus, .rel-add-row input:focus { border-color: var(--text-dim); }
.rel-add-actions { display: flex; gap: 6px; }
.rel-add-btn {
  flex: 1; padding: 5px; border-radius: 6px; font-size: 12px;
  border: 1px solid var(--line); background: var(--bg-card);
  color: var(--text); cursor: pointer;
}
.rel-add-btn.primary { background: var(--accent); color: var(--on-hue); border-color: var(--accent); }
.rel-add-btn:disabled { opacity: 0.4; cursor: default; }

/* Add character inline form */
.char-add-form {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-card); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 16px;
}
.char-form-title {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-dim);
}
.char-form-label {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim); margin-top: 2px;
}
.char-form-input {
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 10px; font-size: 14px;
  color: var(--text); outline: none; width: 100%; box-sizing: border-box;
}
.char-form-input:focus { border-color: var(--text-dim); }
.char-form-select {
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 10px; font-size: 13px;
  color: var(--text); outline: none; width: 100%; box-sizing: border-box;
}
.char-form-actions { display: flex; gap: 6px; margin-top: 4px; }
.char-form-btn {
  flex: 1; padding: 7px; border-radius: 7px; font-size: 12.5px;
  border: 1px solid var(--line); background: var(--bg-raised);
  color: var(--text); cursor: pointer;
}
.char-form-btn.primary { background: var(--accent); color: var(--on-hue); border-color: var(--accent); }
.char-form-btn:disabled { opacity: 0.4; cursor: default; }
.char-form-btn:not(:disabled):hover { border-color: var(--text-dim); }

.empty-mini {
  font-family: var(--font-display); font-style: italic;
  font-size: 13px; color: var(--text-dim);
  padding: 10px; text-align: center;
}

/* ===== Outline view ===== */
.outline-view { display: flex; flex-direction: column; min-height: 100%; }
.outline-body { flex: 1; }
.outline-scroll { padding: 32px 40px 64px; display: grid; place-items: start center; }
.outline-doc {
  width: min(860px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 56px 64px;
  box-shadow: var(--shadow-pop);
}
.outline-doc-head { text-align: center; margin-bottom: 44px; }
.outline-doc-head .ed-label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 10px;
}
.outline-doc-head h1 {
  font-family: var(--font-display);
  font-size: 44px; font-weight: 400; letter-spacing: -0.02em;
  color: var(--text); margin: 0; line-height: 1.05;
}
.outline-doc-head .ed-sub {
  font-family: var(--font-display); font-style: italic;
  font-size: 15px; color: var(--text-mute); margin-top: 8px;
}

.out-act { display: flex; flex-direction: column; gap: 22px; margin-bottom: 44px; }
.out-act-label {
  display: flex; align-items: center; gap: 14px; margin: 0 auto 8px;
  color: var(--text-dim);
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase;
}
.out-act-label .rule { flex: 0 0 60px; height: 1px; background: var(--line); }
.out-act-label .lbl { color: var(--accent); }

.out-scene { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.out-scene-head {
  display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.out-scene-head .num {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-dim); letter-spacing: 0.08em;
  padding-top: 2px;
}
.out-scene-head .title {
  font-family: var(--font-display); font-size: 22px;
  font-weight: 400; letter-spacing: -0.015em; margin: 0;
  color: var(--text); line-height: 1.2;
}
.out-scene-head .pop {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-mute); letter-spacing: 0.08em;
  text-transform: uppercase;
}
.out-scene-head .count {
  margin-left: auto; font-family: var(--font-mono);
  font-size: 10px; color: var(--text-dim); letter-spacing: 0.08em; text-transform: uppercase;
}

.out-empty {
  font-family: var(--font-display); font-style: italic;
  font-size: 13.5px; color: var(--text-dim);
  padding: 10px 16px;
}

.out-card {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 14px 16px 14px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}
.out-card:hover { background: color-mix(in oklch, var(--plot-color) 5%, transparent); }
.out-card-rail {
  width: 3px; border-radius: 2px; flex-shrink: 0;
  background: var(--plot-color, var(--accent));
  margin-left: 4px;
}
.out-card-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.out-card-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim);
}
.out-card-meta .plot { color: var(--plot-color, var(--text-mute)); }
.out-card-meta .sep { color: var(--text-dim); opacity: 0.5; }
.out-card-meta .status.idea { color: var(--hue-c); }
.out-card-meta .status.outlined { color: var(--hue-a); }
.out-card-meta .status.drafted { color: var(--hue-b); }
.out-card-meta .status.revised { color: var(--hue-e); }

.out-card-title {
  font-family: var(--font-display); font-size: 18px;
  font-weight: 400; letter-spacing: -0.01em; margin: 0;
  color: var(--text); line-height: 1.25;
}
.out-card-body-text {
  font-family: var(--font-display);
  font-size: 14.5px; line-height: 1.55;
  color: var(--text-mute); margin: 0;
}
.out-card-people { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.out-card-people .person {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-mute);
  padding: 2px 8px 2px 3px; border-radius: 999px;
  border: 1px solid var(--line-soft); background: var(--bg-raised);
}

.outline-doc-foot {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin-top: 44px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-dim);
}
.outline-doc-foot .rule { flex: 0 0 80px; height: 1px; background: var(--line); }

/* ===== Plotline focus (Beat sheet sub-view) ===== */
.plotline-focus {
  max-width: 760px; margin: 0 auto; padding: 32px 40px 64px;
  display: flex; flex-direction: column; gap: 24px;
}
.plotline-focus.empty { color: var(--text-dim); padding: 80px 40px; text-align: center; }

.pf-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: transparent; border: 1px solid var(--line);
  color: var(--text-mute); cursor: pointer;
  font-size: 12px; font-family: inherit;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.pf-pill:hover { background: var(--bg-hover); color: var(--text); }
.pf-pill .swatch {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--plot-color, var(--text-mute));
}
.pf-pill.active {
  color: var(--text);
  border-color: var(--plot-color, var(--text));
  background: color-mix(in oklch, var(--plot-color) 10%, transparent);
}
.pf-pill .n { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); }

.pf-header {
  border-left: 3px solid var(--plot-color, var(--line));
  padding: 4px 0 4px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.pf-title { font-family: var(--font-display); font-size: 28px; font-weight: 400; letter-spacing: -0.01em; line-height: 1.2; color: var(--text); margin: 0; }
.pf-sub { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--plot-color, var(--text-mute)); }
.pf-count { font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-dim); margin-top: 4px; }

.pf-list { display: flex; flex-direction: column; gap: 10px; position: relative; }
.pf-empty { color: var(--text-dim); padding: 24px 0; text-align: center; }

.pf-row {
  position: relative;
  display: grid; grid-template-columns: 24px 1fr 28px;
  gap: 10px; align-items: stretch;
}
.pf-row.dragging .pf-card { opacity: 0.35; }

.pf-grip {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); cursor: grab; user-select: none;
  font-size: 14px; line-height: 1; border-radius: 6px;
}
.pf-grip:hover { background: var(--bg-hover); color: var(--text-mute); }
.pf-grip:active { cursor: grabbing; }

.pf-card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-left: 3px solid var(--plot-color, var(--line));
  border-radius: 10px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer; min-width: 0;
  box-shadow: var(--shadow);
  transition: background 0.1s, border-color 0.1s;
}
.pf-card:hover { background: var(--bg-hover); }
.pf-row.active .pf-card { border-color: var(--plot-color, var(--text)); background: var(--bg-hover); }

.pf-card-meta {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim);
}
.pf-card-meta .status.idea { color: var(--hue-c); }
.pf-card-meta .status.outlined { color: var(--hue-a); }
.pf-card-meta .status.drafted { color: var(--hue-b); }
.pf-card-meta .status.revised { color: var(--hue-e); }
.pf-card-meta .scene {
  color: var(--text-mute);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}

.pf-chars { display: flex; gap: 4px; margin-left: auto; }
.pf-chars .dot {
  width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600; color: var(--on-hue);
}

.pf-card-title { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.3; }
.pf-card-body { font-size: 13px; color: var(--text-mute); line-height: 1.5; white-space: pre-wrap; }

.pf-del {
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--text-dim);
  cursor: pointer; border-radius: 6px;
  opacity: 0; transition: opacity 0.1s, color 0.1s, background 0.1s;
}
.pf-row:hover .pf-del { opacity: 1; }
.pf-del:hover { color: var(--danger); background: var(--bg-hover); }

.pf-add {
  align-self: flex-start; margin-top: 6px; margin-left: 34px;
  background: transparent; border: 1px dashed var(--line);
  color: var(--text-mute); padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-family: inherit; font-size: 13px;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.pf-add:hover { background: var(--bg-hover); color: var(--text); border-color: var(--text-dim); }

/* ===== Index cards (Index sub-view) ===== */
.index-view {
  max-width: 1080px; margin: 0 auto; padding: 32px 40px 64px;
  display: flex; flex-direction: column; gap: 22px;
}
.ic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.ic-card {
  position: relative;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px 12px;
  display: flex; flex-direction: column; gap: 7px;
  cursor: pointer;
  min-width: 0;
  box-shadow: var(--shadow);
  transition: background 0.1s, border-color 0.1s, transform 0.1s;
}
.ic-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-pop); }
.ic-card.active { border-color: var(--plot-color, var(--text)); }
.ic-rule {
  position: absolute; top: 0; left: 12px; right: 12px; height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--plot-color, var(--line));
}
.ic-meta {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim);
  min-width: 0;
}
.ic-meta .sc { color: var(--text-mute); flex: 0 0 auto; }
.ic-meta .plot {
  color: var(--plot-color, var(--text-dim));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ic-meta .status { margin-left: auto; flex: 0 0 auto; }
.ic-meta .status.idea { color: var(--hue-c); }
.ic-meta .status.outlined { color: var(--hue-a); }
.ic-meta .status.drafted { color: var(--hue-b); }
.ic-meta .status.revised { color: var(--hue-e); }
.ic-title {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 400; letter-spacing: -0.01em;
  color: var(--text); line-height: 1.3;
}
.ic-body {
  font-size: 12.5px; color: var(--text-mute); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
  flex: 1;
}
.ic-foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px; padding-top: 8px;
  border-top: 1px dashed var(--line-soft);
  min-width: 0;
}
.ic-foot .scene-title {
  font-size: 11px; font-style: italic; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ic-chars { display: flex; gap: 3px; margin-left: auto; flex: 0 0 auto; }
.ic-chars .dot {
  width: 16px; height: 16px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 600; color: var(--on-hue);
}

/* ===== Tab placeholders ===== */
.tab-ph { display: flex; flex-direction: column; min-height: 100%; }
.tab-ph-body { flex: 1; display: grid; place-items: center; padding: 40px; }
.tab-ph-card {
  max-width: 460px; text-align: center;
  background: var(--bg-raised); border: 1px dashed var(--line);
  border-radius: 14px; padding: 40px 36px;
  display: flex; flex-direction: column; gap: 14px; align-items: center;
}
.tab-ph-card .ed-label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-dim);
}
.tab-ph-card h2 {
  font-family: var(--font-display); font-size: 26px;
  font-weight: 400; letter-spacing: -0.02em; margin: 0;
}
.tab-ph-card p {
  font-family: var(--font-display); font-style: italic;
  color: var(--text-mute); line-height: 1.5; margin: 0;
}

/* ===== Duo layout — Notes / Places / Tags (list + detail) ===== */
.duo-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.duo-body {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 300px 1fr;
  border-top: 1px solid var(--line-soft);
}
.duo-list {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 10px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg);
}
.duo-item {
  display: flex; flex-direction: column; gap: 3px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  width: 100%;
}
.duo-item:hover { background: var(--bg-hover); }
.duo-item.active {
  background: var(--bg-card);
  border-color: var(--line);
  box-shadow: var(--shadow);
}
.duo-item-head { display: flex; align-items: center; gap: 7px; min-width: 0; }
.duo-pin { color: var(--accent); font-size: 8px; }
.duo-item-title {
  font-weight: 600; font-size: 13.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.duo-item-sub {
  font-size: 12px; color: var(--text-mute); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.duo-item-meta {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-dim); letter-spacing: 0.05em; text-transform: uppercase;
  margin-top: 2px;
}
.place-item .place-swatch {
  width: 9px; height: 9px; border-radius: 3px;
  background: var(--item-color, var(--text-dim));
  flex: 0 0 auto;
}

.duo-detail {
  overflow-y: auto;
  padding: 26px 34px 60px;
  background: var(--bg-raised);
  min-width: 0;
}
.duo-detail-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.duo-detail-when {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-dim); letter-spacing: 0.05em; text-transform: uppercase;
}

.note-title {
  font-family: var(--font-display);
  font-weight: 400; font-size: 26px; letter-spacing: -0.01em;
  margin: 0 0 12px; line-height: 1.2;
  max-width: 720px;
}
h1.note-title.editable.editing, input.note-title { font-size: 26px; }
.note-body {
  font-size: 14.5px; line-height: 1.75; color: var(--text-mute);
  white-space: pre-wrap;
  max-width: 720px;
  min-height: 120px;
}
textarea.note-body { color: var(--text); }
.place-summary {
  font-size: 14px; font-style: italic; color: var(--text-mute);
  margin: 0; max-width: 720px;
  border-left: 2px solid var(--item-color, var(--line));
  padding-left: 12px;
}

/* ===== Topbar data menu ===== */
.data-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 190px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  padding: 5px;
  display: flex; flex-direction: column;
  z-index: 60;
}
.data-menu button {
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-mute);
}
.data-menu button:hover { background: var(--bg-hover); color: var(--text); }

/* ===== Search palette ===== */
.sp-backdrop {
  position: fixed; inset: 0;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(3px);
  z-index: 90;
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: 14vh;
}
.sp-panel {
  width: min(620px, calc(100vw - 48px));
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 60vh;
}
.sp-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
}
.sp-input { flex: 1; font-size: 15px; color: var(--text); }
.sp-input::placeholder { color: var(--text-dim); }
.sp-results { overflow-y: auto; padding: 6px; }
.sp-empty {
  padding: 24px 16px; text-align: center;
  font-size: 13px; color: var(--text-dim); font-style: italic;
}
.sp-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
}
.sp-row.active { background: var(--bg-hover); }
.sp-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.sp-title {
  font-size: 13.5px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-sub {
  font-size: 12px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.sp-type {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  margin-left: auto; flex: 0 0 auto;
}

/* ===== Drafts drawer ===== */
.drafts-count {
  font-family: var(--font-mono);
  font-size: 10px;
  min-width: 16px; height: 16px;
  display: inline-grid; place-items: center;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.dr-backdrop {
  position: fixed; inset: 0;
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  backdrop-filter: blur(2px);
  z-index: 90;
  display: flex; justify-content: flex-end;
}
.dr-panel {
  width: min(430px, calc(100vw - 32px));
  height: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
  animation: dr-slide 0.16s ease;
}
/* Transform-only: render-throttled tabs may never start animations, and an
   animation stuck at `from` must not leave the drawer invisible. */
@keyframes dr-slide {
  from { transform: translateX(26px); }
  to   { transform: none; }
}
.dr-head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 16px 16px 13px;
  border-bottom: 1px solid var(--line);
}
.dr-head .icon-btn { margin-left: auto; flex: 0 0 auto; }
.dr-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; color: var(--text);
}
.dr-sub { margin-top: 5px; font-size: 12px; line-height: 1.55; color: var(--text-dim); max-width: 330px; }
.dr-saverow {
  display: flex; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.dr-input {
  flex: 1; min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 7px 10px;
  font-size: 12.5px;
}
.dr-input::placeholder { color: var(--text-dim); }
.dr-input:focus { border-color: color-mix(in oklch, var(--accent) 55%, transparent); }
.dr-save-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12.5px; font-weight: 600;
  flex: 0 0 auto;
  transition: background 0.12s, color 0.12s;
}
.dr-save-btn:hover { background: var(--accent); color: var(--on-hue); }
.dr-notice {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12px; line-height: 1.5;
  color: var(--danger);
}
.dr-list {
  flex: 1; overflow-y: auto;
  padding: 12px 14px 18px;
  display: flex; flex-direction: column; gap: 9px;
}
.dr-listlabel {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 2px 1px;
}
.dr-empty {
  padding: 30px 16px;
  text-align: center;
  font-size: 12.5px; font-style: italic; line-height: 1.7;
  color: var(--text-dim);
}
.dr-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px 9px;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 6px;
}
.dr-item.is-current {
  border-color: color-mix(in oklch, var(--accent) 55%, transparent);
  background: color-mix(in oklch, var(--accent) 4%, var(--bg));
}
.dr-item-top { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.dr-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  overflow-wrap: anywhere;
}
.dr-rename { font-weight: 600; padding: 3px 8px; }
.dr-auto {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  flex: 0 0 auto;
}
.dr-meta { font-size: 11.5px; color: var(--text-dim); }
.dr-chips { display: flex; flex-wrap: wrap; gap: 5px; min-height: 18px; }
.dr-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-mute);
  background: var(--bg-card);
}
.dr-chip.add  { color: var(--hue-e); border-color: color-mix(in oklch, var(--hue-e) 45%, transparent); }
.dr-chip.del  { color: var(--danger); border-color: color-mix(in oklch, var(--danger) 45%, transparent); }
.dr-chip.edit { color: var(--hue-a); border-color: color-mix(in oklch, var(--hue-a) 50%, transparent); }
.dr-chip.same {
  color: var(--accent);
  border-color: color-mix(in oklch, var(--accent) 50%, transparent);
  background: var(--accent-soft);
}
.dr-actions {
  display: flex; align-items: center; gap: 2px;
  margin-top: 2px;
}
.dr-actions button {
  font-size: 11.5px; font-weight: 500;
  color: var(--text-dim);
  padding: 3px 7px;
  border-radius: 6px;
}
.dr-actions button:hover { color: var(--text); background: var(--bg-hover); }
.dr-actions .dr-open {
  color: var(--accent);
  font-weight: 600;
  border: 1px solid color-mix(in oklch, var(--accent) 45%, transparent);
  padding: 3px 11px;
  margin-right: 4px;
}
.dr-actions .dr-open:hover { background: var(--accent); color: var(--on-hue); }
.dr-actions .dr-del { margin-left: auto; }
.dr-actions .dr-del:hover,
.dr-actions .dr-del.armed { color: var(--danger); }

/* ===== Responsive ===== */
@media (max-width: 1180px) {
  .app { grid-template-columns: 232px 1fr; }
  .app.inspector-open { grid-template-columns: 232px 1fr 340px; }
  .project-switch .t { max-width: 130px; }
}
@media (max-width: 900px) {
  .tab .kbd { display: none; }
  .pill-btn .kbd { display: none; }
}
