/*
 * home-builders.css — the three homepage builder panels, redesigned.
 *
 * Each panel is its own instrument rather than a shared card:
 *   · Automations (#dp-au-inline) — an amber operations console: job-ticket
 *     input, platform keys with LEDs, a physical RUN key, and a live pipeline
 *     board that mirrors the /automation canvas (dotted grid, flowing wires).
 *   · AI Agents (#dp-ag-inline) — mission control: a HUD-braced brief, shape
 *     cards with node-graph glyphs, and a dark sandbox viewport where the
 *     team orbits its lead (deliberately dark in both themes, like a monitor).
 *   · Skill.md (#dp-sk-inline) — the document itself: an editor window with a
 *     SKILL.md tab, line-number gutter, live frontmatter, and the textarea
 *     embedded as the body of the file.
 *
 * Built entirely on tokens.css (--surface/--fg/--border/--shadow/--s-*) so
 * light + dark both come for free. Per-builder hues stay the deliberate
 * identities: amber / indigo→cyan / violet.
 *
 * JS contract preserved: panel ids, .au-pf pickers (aria-pressed), #ag-build /
 * #sk-build, .hb-result hosts, .hb-cost pills. Loaded by index.html only.
 *
 * NOTE: animations here play regardless of prefers-reduced-motion — site-wide
 * product decision (2026-07-11); do not add reduce guards.
 */

/* ── Shared shell ───────────────────────────────────────────────────────── */

.hbx {
  --ax: var(--dp-blue);
  --ax-2: var(--dp-blue);
  --ax-deep: var(--dp-blue-active, #0073cc);
  --ax-soft: var(--dp-blue-soft);
  /* --ax-ink: accent used AS TEXT on light surfaces — dark enough for WCAG AA
     at label sizes; .dark-mode swaps it back to the bright accent. */
  --ax-ink: var(--ax-deep);
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px; /* match .tool card so the build-mode swap keeps one radius */
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.hbx-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ax-ink);
}
.dark-mode .hbx-kicker { color: var(--ax); }
.hbx-kicker svg { flex: 0 0 auto; }
.hbx-new {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  background: var(--ax-deep);
}

.hbx-title {
  font-family: var(--font-display);
  font-size: clamp(21px, 2.6vw, 27px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--fg);
  margin: 10px 0 0;
}
.hbx-sub {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--fg-muted);
  margin: 9px 0 0;
  max-width: 52ch;
}

/* Section micro-label shared by pickers ("Export to", "Shape") */
.hbx-mini-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 8px;
}

/* Ghost "full page" link shared by all three */
.hbx-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: var(--r-button);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.hbx-more:hover { color: var(--fg); background: var(--surface-2); }
.hbx-more svg { transition: transform var(--dur-fast) var(--ease); }
.hbx-more:hover svg { transform: translateX(2px); }

/* The consoles / brief / editor draw their own focus ring on the CONTAINER
   (amber console glow, HUD brackets, violet editor frame). The global blue
   :focus-visible outline from tokens.css doubled up on the textarea itself —
   suppress it here; the container ring stays as the visible focus indicator.
   (Beats the :where()-zero-specificity global rule despite its !important.) */
.au-console-input:focus-visible,
.ag-brief-input:focus-visible,
.sk-input:focus-visible { outline: none !important; }

/* Result hosts (rendered by home-builders.js) get breathing room inside the
   new shells; inner .hb-* markup keeps its injected styles. */
#dp-ag-inline .hb-result { margin: 0; padding: 16px 22px 20px; border-top: 1px solid var(--border); }

/* ═══════════════════════════════════════════════════════════════════════
   A · AUTOMATIONS — amber operations console + live pipeline board
   ═══════════════════════════════════════════════════════════════════════ */

#dp-au-inline .hbx {
  --ax: #f59e0b;
  --ax-2: #fbbf24;
  --ax-deep: #d97706;
  --ax-ink: #b45309; /* amber needs an extra step down to read on white */
  --ax-soft: rgba(245, 158, 11, 0.12);
}

.au-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
}

.au-main { padding: var(--s-6); min-width: 0; }

/* Job-ticket console */
.au-console {
  margin-top: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--bg);
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.au-console:focus-within {
  border-color: var(--ax);
  box-shadow: 0 0 0 3px var(--ax-soft);
}
.au-console-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.au-console-led {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ax);
  box-shadow: 0 0 6px var(--ax);
  animation: au-led 2.4s ease-in-out infinite;
}
@keyframes au-led { 50% { opacity: 0.35; box-shadow: none; } }
.au-console-status { margin-left: auto; color: var(--ax-ink); letter-spacing: 0.06em; }
.dark-mode .au-console-status { color: var(--ax); }

.au-console-input {
  display: block;
  width: 100%;
  min-height: 78px;
  resize: vertical;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  padding: 12px 14px;
}
.au-console-input::placeholder { color: var(--fg-subtle); }

/* Platform keys — console switches with LEDs */
.au-dest { margin-top: 16px; }
.au-keys { display: flex; flex-wrap: wrap; gap: 8px; }
.au-key {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--r-button);
  padding: 7px 13px;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.au-key-led {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.au-key:hover { color: var(--fg); border-color: var(--ax); }
.au-key:active { transform: translateY(1px); }
.au-key[aria-pressed="true"] {
  color: var(--fg);
  font-weight: 600;
  background: var(--ax-soft);
  border-color: var(--ax);
}
.au-key[aria-pressed="true"] .au-key-led {
  background: var(--ax);
  box-shadow: 0 0 6px var(--ax);
}

/* RUN key — the one physical control on the console */
.au-go-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.au-run {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 11px;
  background: linear-gradient(180deg, color-mix(in srgb, #fff 16%, var(--ax)), var(--ax-deep) 62%, color-mix(in srgb, #000 8%, var(--ax-deep)));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.22),
              0 3px 0 #9a5a06, 0 6px 14px rgba(245, 158, 11, 0.34);
  transition: filter var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.au-run:hover { filter: brightness(1.04); }
.au-run:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 0 #9a5a06, 0 3px 8px rgba(245, 158, 11, 0.34);
}
.au-run svg { flex: 0 0 auto; }
.au-note { font-size: 12px; line-height: 1.45; color: var(--fg-subtle); max-width: 24ch; }

/* Pipeline board — mirrors the /automation canvas */
.au-board {
  position: relative;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--fg) 10%, transparent) 1px, transparent 0) 0 0 / 20px 20px,
    linear-gradient(180deg, var(--ax-soft), transparent 55%),
    var(--surface-2);
  padding: 18px 20px 16px;
  min-width: 0;
}
.au-board-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 14px;
}
.au-board-head::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ax);
  box-shadow: 0 0 6px var(--ax);
  animation: au-led 2.4s ease-in-out infinite;
}

.au-flow { display: flex; flex-direction: column; align-items: stretch; flex: 1; }
.au-node {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--ax);
  border-radius: 11px;
  padding: 9px 12px;
  box-shadow: var(--shadow-sm);
}
.au-node-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ax-ink);
}
.dark-mode .au-node-kicker { color: var(--ax); }
.au-node-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
  margin-top: 2px;
}
.au-node-name svg { flex: 0 0 auto; color: var(--fg-muted); }

/* Wires between nodes — dashes flow downward, a pulse travels the line */
.au-wire {
  position: relative;
  width: 2px;
  margin: 0 auto;
  height: 22px;
  background-image: linear-gradient(180deg, var(--ax) 55%, transparent 55%);
  background-size: 2px 7px;
  animation: au-dash 1.1s linear infinite;
  opacity: 0.75;
}
@keyframes au-dash { to { background-position: 0 7px; } }
.au-wire i {
  position: absolute;
  left: 50%;
  top: -3px;
  width: 7px; height: 7px;
  margin-left: -3.5px;
  border-radius: 50%;
  background: var(--ax);
  box-shadow: 0 0 8px var(--ax);
  animation: au-travel 2.2s var(--ease) infinite;
}
.au-wire[data-wire="2"] i { animation-delay: 1.1s; }
@keyframes au-travel {
  0%   { transform: translateY(0);     opacity: 0; }
  18%  { opacity: 1; }
  82%  { opacity: 1; }
  100% { transform: translateY(19px);  opacity: 0; }
}

.au-ticker {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-subtle);
  white-space: nowrap;
  overflow: hidden;
}
.au-ticker b { color: var(--ax-ink); font-weight: 600; }
.dark-mode .au-ticker b { color: var(--ax); }
.au-tick-ok { color: #16a34a; }

/* ═══════════════════════════════════════════════════════════════════════
   B · AI AGENTS — mission control + sandbox orbit viewport
   ═══════════════════════════════════════════════════════════════════════ */

#dp-ag-inline .hbx {
  --ax: #6366f1;
  --ax-2: #06b6d4;
  --ax-deep: #4f46e5;
  --ax-soft: rgba(99, 102, 241, 0.12);
}

.ag-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
}
.ag-main { padding: var(--s-6); min-width: 0; }

/* Mission brief — HUD corner brackets */
.ag-brief { position: relative; margin-top: 18px; padding: 5px; }
.ag-brief::before, .ag-brief::after,
.ag-brief-inner::before, .ag-brief-inner::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid var(--ax);
  opacity: 0.65;
  transition: opacity var(--dur-fast) var(--ease);
  pointer-events: none;
}
.ag-brief::before { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.ag-brief::after  { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; }
.ag-brief-inner::before { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.ag-brief-inner::after  { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }
.ag-brief:focus-within::before, .ag-brief:focus-within::after,
.ag-brief:focus-within .ag-brief-inner::before, .ag-brief:focus-within .ag-brief-inner::after { opacity: 1; }
.ag-brief-input {
  display: block;
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  outline: none;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  padding: 12px 14px;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.ag-brief-input:focus { border-color: var(--ax); box-shadow: 0 0 0 3px var(--ax-soft); }
.ag-brief-input::placeholder { color: var(--fg-subtle); }

/* Shape cards — mini node-graph diagrams */
.ag-shapes-wrap { margin-top: 16px; }
.ag-shapes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ag-shape {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 11px 12px 10px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}
.ag-shape:hover { border-color: var(--ax); transform: translateY(-1px); }
.ag-shape svg { color: var(--fg-subtle); transition: color var(--dur-fast) var(--ease); }
.ag-shape b { font-size: 12.5px; font-weight: 700; color: var(--fg); line-height: 1.2; }
.ag-shape small { font-size: 11px; color: var(--fg-muted); line-height: 1.35; }
.ag-shape[aria-pressed="true"] {
  border-color: var(--ax);
  background: linear-gradient(135deg, var(--ax-soft), rgba(6, 182, 212, 0.08));
  box-shadow: 0 0 0 1px var(--ax);
}
.ag-shape[aria-pressed="true"] svg { color: var(--ax); }

/* Actions — glowing capsule build + ghost link */
.ag-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.ag-build {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--ax), var(--ax-2));
  box-shadow: 0 6px 18px -2px rgba(99, 102, 241, 0.5), 0 0 0 1px rgba(99, 102, 241, 0.25);
  transition: box-shadow var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
}
.ag-build:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 8px 26px -2px rgba(6, 182, 212, 0.55), 0 0 0 1px rgba(6, 182, 212, 0.3);
}
.ag-build:disabled { opacity: 0.6; cursor: default; }

/* Sandbox viewport — deliberately dark in both themes, like a monitor */
.ag-viewport {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-left: 1px solid var(--border);
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(99, 102, 241, 0.28), transparent 55%),
    radial-gradient(110% 90% at 90% 100%, rgba(6, 182, 212, 0.2), transparent 55%),
    #0b0f1e;
  padding: 16px 18px 14px;
}
.ag-vp-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(226, 230, 240, 0.7);
}
.ag-vp-head::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 7px #22d3ee;
  animation: au-led 2.2s ease-in-out infinite;
}

.ag-orbit { position: relative; flex: 1; min-height: 218px; }
/* concentric rings */
.ag-orbit::before, .ag-orbit::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 255, 0.14);
}
.ag-orbit::before { width: 150px; height: 150px; }
.ag-orbit::after  { width: 220px; height: 220px; border-color: rgba(148, 163, 255, 0.08); }
.ag-ring {
  position: absolute;
  left: 50%; top: 50%;
  width: 186px; height: 186px;
  margin: -93px 0 0 -93px;
  border-radius: 50%;
  border: 1.5px dashed rgba(103, 232, 249, 0.28);
  animation: ag-spin 26s linear infinite;
}
@keyframes ag-spin { to { transform: rotate(360deg); } }

/* beams lead ↔ workers */
.ag-beam {
  position: absolute;
  left: 50%; top: 50%;
  width: 78px; height: 1.5px;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.8), rgba(6, 182, 212, 0.15));
  animation: ag-beam 2.6s ease-in-out infinite;
}
.ag-beam[data-beam="1"] { transform: rotate(-142deg); }
.ag-beam[data-beam="2"] { transform: rotate(24deg); animation-delay: 1.3s; }
@keyframes ag-beam { 50% { opacity: 0.35; } }

/* the team */
.ag-lead {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.ag-lead-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18), 0 8px 24px -4px rgba(6, 182, 212, 0.55);
  animation: ag-breathe 3.4s ease-in-out infinite;
}
@keyframes ag-breathe { 50% { box-shadow: 0 0 0 7px rgba(99, 102, 241, 0.1), 0 8px 28px -2px rgba(6, 182, 212, 0.65); } }
.ag-worker {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.ag-worker[data-pos="1"] { left: 14%; top: 12%; }
.ag-worker[data-pos="2"] { right: 12%; bottom: 14%; }
.ag-worker-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 12px;
  color: #a5b4fc;
  background: rgba(30, 37, 66, 0.9);
  border: 1px solid rgba(129, 140, 248, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.ag-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(226, 230, 240, 0.72);
  background: rgba(11, 15, 30, 0.72);
  border: 1px solid rgba(148, 163, 255, 0.18);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.ag-lead .ag-tag { color: #c7d2fe; border-color: rgba(148, 163, 255, 0.35); }

.ag-exports {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.6;
  color: rgba(226, 230, 240, 0.68);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ag-exports b { color: rgba(165, 243, 252, 0.95); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════
   C · SKILL.MD — the living document (violet editorial)
   ═══════════════════════════════════════════════════════════════════════ */

#dp-sk-inline .hbx {
  --ax: #8b5cf6;
  --ax-2: #a78bfa;
  --ax-deep: #6d28d9;
  --ax-soft: rgba(139, 92, 246, 0.12);
  max-width: 780px;
}

.sk-head { padding: 24px 26px 0; text-align: left; }

/* Editor window */
.sk-editor {
  margin: 18px 22px 22px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--bg);
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.sk-editor:focus-within { border-color: var(--ax); box-shadow: 0 0 0 3px var(--ax-soft); }

.sk-chrome {
  display: flex;
  align-items: center;
  flex-wrap: wrap; /* very narrow viewports: let "Deploy to" drop below the tab */
  row-gap: 6px;
  gap: 12px;
  padding: 8px 12px 0 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.sk-dots { display: inline-flex; gap: 5px; padding-bottom: 8px; }
.sk-dots i {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--fg) 14%, transparent);
}
.sk-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--r-button) var(--r-button) 0 0;
  padding: 7px 14px 8px;
  position: relative;
  top: 1px;
}
.sk-tab::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: var(--r-button) var(--r-button) 0 0;
  background: linear-gradient(90deg, var(--ax), var(--ax-2));
}
.sk-tab svg { color: var(--ax); }

.sk-target {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding-bottom: 8px;
  font-size: 12px;
  color: var(--fg-muted);
  white-space: nowrap;
}
.sk-target select {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: 8px;
  padding: 5px 8px;
  max-width: 180px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}
.sk-target select:hover, .sk-target select:focus-visible { border-color: var(--ax); }

/* Document body: line-number gutter + page */
.sk-doc { display: grid; grid-template-columns: 44px minmax(0, 1fr); }
.sk-gutter {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 14px 10px 14px 0;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 21px;
  color: var(--fg-subtle);
  user-select: none;
}
.sk-page { padding: 14px 16px 6px; min-width: 0; }

.sk-fm {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 21px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--fg-muted);
}
.sk-fm .sk-delim { color: var(--fg-subtle); }
.sk-fm .sk-key { color: var(--ax-deep); font-weight: 600; }
.dark-mode .sk-fm .sk-key { color: var(--ax-2); }
.sk-fm .sk-val { color: var(--fg-muted); font-style: italic; }

.sk-h {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 21px;
  color: var(--fg);
  margin-top: 21px;
}
.sk-h .sk-hash { color: var(--ax-ink); }
.dark-mode .sk-h .sk-hash { color: var(--ax); }

.sk-input {
  display: block;
  width: 100%;
  min-height: 84px;
  margin-top: 4px;
  resize: vertical;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5; /* 21px — keeps rows in step with the gutter + frontmatter */
  padding: 0 0 10px;
}
.sk-input::placeholder { color: var(--fg-subtle); }

/* Status bar */
.sk-statusbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px 10px 16px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.sk-status-note {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.sk-status-note b { color: var(--ax-deep); font-weight: 600; }
.dark-mode .sk-status-note b { color: var(--ax-2); }
.sk-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.sk-build {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--ax), var(--ax-deep));
  box-shadow: 0 4px 14px -4px rgba(109, 40, 217, 0.55);
  transition: filter var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.sk-build:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 6px 18px -4px rgba(109, 40, 217, 0.65); }
.sk-build:disabled { opacity: 0.6; cursor: default; }

/* cost pill inside build buttons (markup class .hb-cost, restyled).
   Darkening scrim (not a lightening one) keeps white text AA-readable
   on the cyan end of the gradient. */
.ag-build .hb-cost, .sk-build .hb-cost {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
}

/* Skill result renders inside the panel below the editor */
#dp-sk-inline .hb-result { margin: 0 22px 22px; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }

/* ═══════════════════════════════════════════════════════════════════════
   D · AI WORKFLOWS — blueprint planner (blue→violet)
   Scoped to #dp-wf-inline: the /workflows page shares .wf-* classes and
   keeps its own look from workflow.css.
   ═══════════════════════════════════════════════════════════════════════ */

#dp-wf-inline .hbx {
  --ax: #7c3aed;
  --ax-2: var(--dp-blue);
  --ax-deep: #5b21b6;
  --ax-ink: #6d28d9;
  --ax-soft: rgba(124, 58, 237, 0.11);
}

.wfb-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.75fr);
}
.wfb-main { padding: var(--s-6); min-width: 0; }

.wfb-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.wfb-head-text { min-width: 0; }
.wfb-expand { flex: 0 0 auto; margin-top: -2px; border: 0; background: transparent; font-family: inherit; cursor: pointer; }

.wfb-section { margin-top: 16px; }
.wfb-opt { text-transform: none; letter-spacing: 0.02em; font-weight: 500; color: var(--fg-subtle); }

/* Build-type chips (class .wf-tt kept for app.js) */
.wfb-tt { display: flex; flex-wrap: wrap; gap: 8px; }
#dp-wf-inline .wf-tt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 13px;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
#dp-wf-inline .wf-tt svg { flex: 0 0 auto; color: var(--fg-subtle); transition: color var(--dur-fast) var(--ease); }
#dp-wf-inline .wf-tt:hover { color: var(--fg); border-color: var(--ax); transform: translateY(-1px); }
#dp-wf-inline .wf-tt[aria-pressed="true"] {
  color: var(--fg);
  border-color: var(--ax);
  background: linear-gradient(135deg, var(--ax-soft), rgba(0, 143, 254, 0.08));
  box-shadow: 0 0 0 1px var(--ax);
}
#dp-wf-inline .wf-tt[aria-pressed="true"] svg { color: var(--ax); }

/* Idea sheet — gradient drafting frame; the frame IS the focus ring */
.wfb-sheet {
  margin-top: 16px;
  padding: 1.5px;
  border-radius: 14px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--dp-blue) 45%, var(--border-strong)),
    color-mix(in srgb, #7c3aed 45%, var(--border-strong)));
  transition: box-shadow var(--dur-fast) var(--ease);
}
.wfb-sheet:focus-within {
  background: linear-gradient(135deg, var(--dp-blue), #7c3aed);
  box-shadow: 0 0 0 3px var(--ax-soft);
}
.wfb-idea {
  display: block;
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 0;
  outline: none;
  border-radius: 12.5px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  padding: 13px 14px;
}
.wfb-idea::placeholder { color: var(--fg-subtle); }
/* the gradient frame is the focus indicator — drop the doubled global outline */
#dp-wf-inline #wf-idea:focus-visible { outline: none !important; }

/* Subscription chips (class .wf-sub rendered by app.js) */
#dp-wf-inline .wf-subs { display: flex; flex-wrap: wrap; gap: 7px; }
#dp-wf-inline .wf-sub {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--fg-muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 11px;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
#dp-wf-inline .wf-sub:hover { color: var(--fg); border-color: var(--ax); }
#dp-wf-inline .wf-sub[aria-pressed="true"] {
  color: var(--fg);
  font-weight: 600;
  background: var(--ax-soft);
  border-color: var(--ax);
}

/* Controls: language + gradient route CTA */
.wfb-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.wfb-lang { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--fg-muted); white-space: nowrap; }
#dp-wf-inline .wf-lang {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}
#dp-wf-inline .wf-lang:hover, #dp-wf-inline .wf-lang:focus-visible { border-color: var(--ax); }
#dp-wf-inline .wf-generate {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 12px 22px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--dp-blue), #7c3aed);
  box-shadow: 0 6px 18px -4px rgba(124, 58, 237, 0.5);
  transition: filter var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
#dp-wf-inline .wf-generate:hover:not(:disabled) { filter: brightness(1.05); box-shadow: 0 8px 24px -4px rgba(124, 58, 237, 0.6); }
#dp-wf-inline .wf-generate:disabled, #dp-wf-inline .wf-generate.is-busy { opacity: 0.65; cursor: default; }
#dp-wf-inline .wf-cost-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28); /* darkening scrim keeps white AA-readable */
}
.wfb-hint { margin-top: 10px; font-size: 11.5px; color: var(--fg-subtle); }

/* Blueprint board — graph paper + the plan being traced */
.wfb-board {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-left: 1px solid var(--border);
  background:
    repeating-linear-gradient(0deg, transparent 0 19px, color-mix(in srgb, var(--ax) 9%, transparent) 19px 20px),
    repeating-linear-gradient(90deg, transparent 0 19px, color-mix(in srgb, var(--ax) 9%, transparent) 19px 20px),
    linear-gradient(180deg, var(--ax-soft), transparent 60%),
    var(--surface-2);
  padding: 18px 20px 16px;
}
.wfb-board-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 14px;
}
.wfb-board-head::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ax);
  box-shadow: 0 0 6px var(--ax);
  animation: au-led 2.4s ease-in-out infinite;
}
.wfb-plan { list-style: none; margin: 0; padding: 0; flex: 1; }
.wfb-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px dashed color-mix(in srgb, var(--ax) 45%, var(--border-strong));
  border-radius: 11px;
  padding: 8px 11px;
  animation: wfb-trace 8s var(--ease) infinite;
}
.wfb-step + .wfb-step { margin-top: 18px; }
.wfb-step + .wfb-step::before {
  content: "";
  position: absolute;
  left: 22px;
  top: -19px;
  height: 17px;
  border-left: 2px dashed color-mix(in srgb, var(--ax) 40%, transparent);
}
.wfb-step:nth-child(1) { animation-delay: 0s; }
.wfb-step:nth-child(2) { animation-delay: 2s; }
.wfb-step:nth-child(3) { animation-delay: 4s; }
.wfb-step:nth-child(4) { animation-delay: 6s; }
/* each step "inks in" for a moment, in order — the plan being drawn */
@keyframes wfb-trace {
  0%, 18% { border-style: solid; border-color: var(--ax); box-shadow: 0 0 0 3px var(--ax-soft); }
  25%, 100% { border-style: dashed; border-color: color-mix(in srgb, var(--ax) 45%, var(--border-strong)); box-shadow: none; }
}
.wfb-num {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px; height: 25px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--ax-ink);
  background: var(--ax-soft);
  border: 1px solid color-mix(in srgb, var(--ax) 35%, transparent);
}
.dark-mode .wfb-num { color: #c4b5fd; }
.wfb-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wfb-body b { font-size: 12.5px; font-weight: 600; color: var(--fg); line-height: 1.25; }
.wfb-body small { font-family: var(--font-mono); font-size: 10px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wfb-board-foot {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
}

/* Below-panel shared sections (examples / loading / copy row) — light retouch */
#dp-wf-inline .wf-loading { margin-top: 16px; }
#dp-wf-inline .wf-empty { margin-top: 20px; }
#dp-wf-inline .wf-ex { transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
#dp-wf-inline .wf-ex:hover { border-color: var(--ax); transform: translateY(-1px); }

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 880px) {
  .au-grid, .ag-grid, .wfb-grid { grid-template-columns: minmax(0, 1fr); }
  .au-board, .ag-viewport, .wfb-board { display: none; }
  .au-main, .ag-main, .wfb-main { padding: 22px 18px 20px; }
  .wfb-head { flex-wrap: wrap; }
  .sk-head { padding: 20px 18px 0; }
  .sk-editor { margin: 16px 14px 18px; }
  #dp-sk-inline .hb-result { margin: 0 14px 18px; }
  .ag-shapes { grid-template-columns: minmax(0, 1fr); }
  .ag-shape { flex-direction: row; align-items: center; }
  .ag-shape svg, .ag-shape b { flex: 0 0 auto; }
  .au-note { max-width: none; }
}

@media (pointer: coarse), (max-width: 720px) {
  .au-key, .au-run, .ag-shape, .ag-build, .sk-build, .hbx-more, #dp-wf-inline .wf-generate { min-height: 42px; touch-action: manipulation; }
  .sk-target select, #dp-wf-inline .wf-lang { min-height: 40px; }
  .sk-doc { grid-template-columns: 34px minmax(0, 1fr); }
}
