/*!*****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ../../node_modules/.pnpm/next@15.5.21_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[2]!../../node_modules/.pnpm/next@15.5.21_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[3]!./app/globals.css ***!
  \*****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/* Nucleus Studio — design tokens + base. Legible and clean over polished-
   everywhere; one accent, calm dark surface, a single type scale. The approval
   surface (View 3) earns the extra weight. */

:root {
  --bg: #0b0d10;
  --surface: #12151a;
  --surface-2: #171b21;
  --surface-3: #1d222a;
  --line: #262c36;
  --line-soft: #1e232b;
  --text: #e7ebf0;
  --text-dim: #9aa4b2;
  --text-faint: #6b7482;

  --accent: #5b8cff;
  --accent-soft: #1a2340;
  --accent-line: #2c3d6e;

  --good: #46c58a;
  --good-soft: #12281f;
  --warn: #e0a44a;
  --warn-soft: #2a2011;
  --danger: #e06a6a;
  --danger-soft: #2a1414;

  --core: #b98bff;
  --core-soft: #211a33;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.02), 0 8px 24px rgba(0, 0, 0, 0.35);

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--accent);
  text-decoration: none;
}
button {
  font-family: inherit;
  cursor: pointer;
}
::selection {
  background: var(--accent-soft);
}

/* --- workspace frame ---------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: 64px 1fr;
  height: 100vh;
  overflow: hidden;
}
.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 6px;
}
.rail-brand {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--accent), var(--core));
  display: grid;
  place-items: center;
  color: #0b0d10;
  font-weight: 800;
  font-size: 17px;
  margin-bottom: 12px;
}
.lens {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--text-faint);
  background: transparent;
  border: 1px solid transparent;
  position: relative;
}
.lens svg {
  width: 20px;
  height: 20px;
}
.lens.active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.lens.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.lens .lens-tip {
  position: absolute;
  left: 52px;
  white-space: nowrap;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-4px);
  transition: opacity 0.12s, transform 0.12s;
  z-index: 20;
}
.lens:hover .lens-tip {
  opacity: 1;
  transform: translateX(0);
}
.rail-spacer {
  flex: 1 1;
}
.agent-dock {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px dashed var(--line);
  display: grid;
  place-items: center;
  color: var(--text-faint);
}

.canvas {
  overflow: auto;
  position: relative;
}

/* --- generic bits ------------------------------------------------------- */

.wrap {
  max-width: 940px;
  margin: 0 auto;
  padding: 40px 28px 96px;
}
.wrap-wide {
  max-width: 1100px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}
h1.title {
  font-size: 26px;
  font-weight: 680;
  letter-spacing: -0.01em;
  margin: 8px 0 6px;
}
.lede {
  color: var(--text-dim);
  max-width: 60ch;
}

.btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 560;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
}
.btn:hover {
  background: var(--surface-3);
  border-color: #33404f;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #08101f;
  font-weight: 640;
}
.btn-primary:hover {
  background: #6f9bff;
  border-color: #6f9bff;
}
.btn-approve {
  background: var(--good);
  border-color: var(--good);
  color: #062015;
  font-weight: 680;
  padding: 12px 22px;
  font-size: 14px;
}
.btn-approve:hover {
  background: #57d69a;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  background: var(--surface-2);
}
.pill-core {
  color: var(--core);
  background: var(--core-soft);
  border-color: #38295c;
}
.pill-good {
  color: var(--good);
  background: var(--good-soft);
  border-color: #1c4432;
}
.pill-warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: #4a3915;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
}
.spin {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- utilities ---------------------------------------------------------- */
.text-dim { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }

.banner {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 16px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.banner-danger { border-color: #4a2020; background: var(--danger-soft); color: #f0b4b4; }
.banner-warn { border-color: #4a3915; background: var(--warn-soft); color: #f0cf9e; }

/* --- step header -------------------------------------------------------- */
.stepbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line-soft);
}
.stepbar-lens { display: flex; align-items: baseline; gap: 12px; }
.stepbar-url { color: var(--text-dim); }
.steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.step {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-faint);
  padding: 5px 12px; border-radius: 20px; border: 1px solid transparent;
}
.step-dot {
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
  background: var(--surface-3); color: var(--text-faint);
}
.step.on { color: var(--text); background: var(--accent-soft); border-color: var(--accent-line); }
.step.on .step-dot { background: var(--accent); color: #08101f; }
.step.done { color: var(--text-dim); }
.step.done .step-dot { background: var(--good-soft); color: var(--good); }

/* --- start view --------------------------------------------------------- */
.start-form { display: flex; gap: 10px; margin-top: 28px; max-width: 560px; }
.start-input {
  flex: 1 1; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 15px; outline: none;
}
.start-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.start-suggest { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.chip {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-dim);
  padding: 4px 10px; border-radius: 20px; font-size: 12px;
}
.chip:hover { border-color: var(--accent-line); color: var(--text); }

/* --- stream view (View 1) ---------------------------------------------- */
.stream-grid { display: grid; grid-template-columns: 260px 1fr; grid-gap: 24px; gap: 24px; align-items: start; }
.stream-feed { position: -webkit-sticky; position: sticky; top: 0; }
.stream-status {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); margin-bottom: 14px;
}
.stream-status-label { font-weight: 580; font-size: 13px; }
.dot-good { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.feed {
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--surface); padding: 6px; max-height: 62vh; overflow: auto;
}
.feed-empty { color: var(--text-faint); font-size: 12px; padding: 12px; }
.feed-row {
  display: flex; align-items: baseline; gap: 8px; padding: 4px 8px;
  font-size: 12px; color: var(--text-dim); border-radius: 6px;
  animation: rise 0.2s ease both;
}
.feed-icon { color: var(--text-faint); width: 12px; text-align: center; flex: none; }
.feed-text { font-family: var(--mono); font-size: 11.5px; }
.feed-genome .feed-icon { color: var(--good); }
.feed-extraction .feed-icon { color: var(--accent); }

.stream-main-head { margin-bottom: 18px; }
.draft-placeholder {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 40px; text-align: center; color: var(--text-faint);
}
.family { margin-bottom: 22px; }
.family-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.family-head h3 { margin: 0; font-size: 13px; font-weight: 640; letter-spacing: 0.02em; }
.family-loading { color: var(--text-faint); font-size: 12px; display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.node-list { display: grid; grid-gap: 10px; gap: 10px; }
.node {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 13px 15px;
}
.node-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.node-kind {
  font-size: 11px; font-weight: 640; letter-spacing: 0.03em;
  color: var(--accent); background: var(--accent-soft);
  padding: 2px 7px; border-radius: 5px; border: 1px solid var(--accent-line);
}
.node-conf { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.conf-bar { width: 42px; height: 4px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.conf-fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.node-content { font-size: 14px; line-height: 1.5; }
.cite {
  margin-top: 9px; display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: none; color: var(--text-faint);
  font-size: 12px; padding: 0;
}
.cite:hover { color: var(--accent); }
.cite-quote {
  margin: 8px 0 0; padding: 8px 11px; border-left: 2px solid var(--accent-line);
  background: var(--surface-2); border-radius: 0 6px 6px 0;
  font-size: 12.5px; color: var(--text-dim); font-style: italic;
}
.cite-url { display: block; font-style: normal; color: var(--text-faint); margin-bottom: 3px; font-size: 11px; }

.stream-cta {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 8px; padding: 16px 18px;
  border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--radius);
  position: -webkit-sticky;
  position: sticky; bottom: 16px; box-shadow: var(--shadow);
}

/* --- interview (View 2) ------------------------------------------------- */
.q-list { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-gap: 14px; gap: 14px; }
.q-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 18px 20px; }
.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.q-num {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-dim); font-size: 12px; font-weight: 640;
}
.q-prompt { font-size: 16px; font-weight: 560; margin-bottom: 14px; letter-spacing: -0.005em; }
.q-options { display: grid; grid-gap: 8px; gap: 8px; }
.q-option {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; background: var(--surface-2); transition: border-color 0.12s, background 0.12s;
}
.q-option:hover { border-color: #33404f; }
.q-option.sel { border-color: var(--accent); background: var(--accent-soft); }
.q-option input { margin-top: 3px; accent-color: var(--accent); }
.q-textarea {
  width: 100%; margin-top: 10px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px;
  font-family: inherit; font-size: 14px; line-height: 1.5; resize: vertical; outline: none;
}
.q-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.q-confirm { display: grid; grid-gap: 0; gap: 0; }
.interview-foot { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 22px; }

/* --- approval (View 3) -------------------------------------------------- */
.consequence {
  display: grid; grid-template-columns: 1fr 1fr; grid-gap: 16px; gap: 16px; margin-top: 26px;
}
.consequence-col {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 15px 17px;
}
.consequence-head { margin-bottom: 8px; }
.consequence-sub { font-size: 12px; margin-bottom: 8px; }
.consequence-list { margin: 0; padding-left: 18px; display: grid; grid-gap: 5px; gap: 5px; font-size: 13.5px; }
.consequence-list li { line-height: 1.45; }

.conflict-band { margin-top: 18px; }
.conflict-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-gap: 8px; gap: 8px; }
.conflict-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.conflict-a, .conflict-b { background: rgba(0,0,0,0.25); padding: 3px 9px; border-radius: 6px; }
.conflict-vs { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--warn); }

.ops-head { margin: 30px 0 12px; }
.ops-list { display: grid; grid-gap: 10px; gap: 10px; }
.op {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 15px 17px;
}
.op-human { border-color: #1c4432; background: linear-gradient(to right, var(--good-soft), var(--surface) 40%); }
.op-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.op-verb {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  color: var(--text-faint); background: var(--surface-3); padding: 2px 6px; border-radius: 4px;
}
.op-conf { margin-left: auto; font-size: 11px; color: var(--text-faint); }
.op-content { font-size: 14.5px; line-height: 1.5; }
.op-reason {
  margin-top: 9px; font-size: 13px; color: var(--text-dim); line-height: 1.5;
  padding-top: 9px; border-top: 1px dashed var(--line-soft);
}
.op-reason-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700;
  color: var(--text-faint); margin-right: 6px;
}
.op-evidence { display: grid; grid-gap: 6px; gap: 6px; margin-top: 9px; }
.op-quote {
  margin: 0; padding: 8px 11px; border-left: 2px solid var(--accent-line);
  background: var(--surface-2); border-radius: 0 6px 6px 0;
  font-size: 12.5px; color: var(--text-dim); font-style: italic; line-height: 1.45;
}
.op-quote-kind {
  font-style: normal; color: var(--text-faint); margin-right: 8px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
}
.op-quote-ref { font-style: normal; color: var(--text-faint); }
.op-edge { border-style: dashed; }

.approve-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-top: 26px; padding: 18px 20px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2); position: -webkit-sticky; position: sticky; bottom: 16px; box-shadow: var(--shadow);
}
.approve-note {
  display: flex; align-items: flex-start; gap: 10px; max-width: 52ch;
  font-size: 12.5px; color: var(--text-dim); line-height: 1.45;
}
.approve-note svg { flex: none; margin-top: 1px; color: var(--text-faint); }

/* sealed */
.sealed { text-align: center; padding: 40px 20px; max-width: 620px; margin: 20px auto 0; }
.sealed-badge {
  width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%;
  display: grid; place-items: center; color: var(--good);
  background: var(--good-soft); border: 1px solid #1c4432;
}
.sealed-title { font-size: 22px; font-weight: 680; margin: 0 0 8px; }
.sealed-facts {
  margin: 26px 0 0; text-align: left; display: grid; grid-template-columns: 1fr 1fr; grid-gap: 1px; gap: 1px;
  background: var(--line-soft); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.fact { background: var(--surface); padding: 12px 15px; }
.fact dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 3px; }
.fact dd { margin: 0; font-size: 13px; word-break: break-all; }

@media (max-width: 860px) {
  .stream-grid { grid-template-columns: 1fr; }
  .stream-feed { position: static; }
  .consequence, .sealed-facts { grid-template-columns: 1fr; }
}

/* --- rail button reset (lens entries are buttons now) ------------------- */
.lens { padding: 0; font: inherit; background: transparent; }
.lens:not(.disabled):not(.active):hover { color: var(--text-dim); background: var(--surface-2); }
.lens.disabled { pointer-events: none; }

/* === PLAN LENS ========================================================== */

/* --- goal entry --------------------------------------------------------- */
.goal-genome { display: flex; align-items: center; gap: 12px; margin: 26px 0 10px; }
.goal-genome label { margin-right: -4px; }
.select {
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; outline: none;
}
.select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.goal-textarea {
  width: 100%; max-width: 680px; margin-top: 6px; background: var(--surface);
  border: 1px solid var(--line); color: var(--text); border-radius: var(--radius);
  padding: 14px 16px; font-family: inherit; font-size: 16px; line-height: 1.5;
  resize: vertical; outline: none;
}
.goal-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.goal-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.goal-examples { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 22px; }

/* --- interpretation ----------------------------------------------------- */
.goal-quote {
  margin: 10px 0 22px; padding: 10px 16px; border-left: 3px solid var(--accent-line);
  background: var(--surface); border-radius: 0 8px 8px 0; color: var(--text-dim);
  font-size: 15px; font-style: italic; max-width: 70ch;
}
.interp-archetype {
  border: 1px solid var(--accent-line); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 120%);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 22px;
}
.interp-archetype-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; font-size: 15px; }
.archetype-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 10px; gap: 10px; }
.archetype-card {
  text-align: left; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius-sm); padding: 12px 13px; color: var(--text);
  display: flex; flex-direction: column; gap: 6px; transition: border-color 0.12s, background 0.12s, transform 0.05s;
}
.archetype-card:hover { border-color: #33404f; }
.archetype-card.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent-line); }
.archetype-card:active { transform: translateY(1px); }
.archetype-card-head { display: flex; align-items: center; gap: 8px; }
.archetype-card-name { font-weight: 640; font-size: 14px; }
.archetype-card-tag {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
  color: var(--accent); background: var(--bg); border: 1px solid var(--accent-line); padding: 1px 5px; border-radius: 4px;
}
.archetype-card-blurb { font-size: 12px; color: var(--text-dim); line-height: 1.4; }

.interp-fields { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-inputs { display: flex; gap: 8px; }
.input {
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  padding: 9px 12px; border-radius: var(--radius-sm); font-size: 14px; outline: none; width: 150px;
  font-family: inherit;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-metric { width: 170px; }
.interp-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 26px; }

/* --- plan head + estimate ---------------------------------------------- */
.plan-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.plan-head-actions { display: flex; gap: 10px; flex: none; }
.estimate {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 18px;
}
.estimate-figs { display: flex; align-items: center; gap: 26px; }
.estimate-fig { display: flex; flex-direction: column; }
.estimate-n { font-size: 22px; font-weight: 680; letter-spacing: -0.01em; }
.estimate-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.estimate-model { color: var(--text-dim); font-size: 13px; }
.estimate-cta { display: flex; align-items: center; gap: 14px; }

/* --- legend ------------------------------------------------------------- */
.legend { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; font-size: 12px; color: var(--text-dim); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid; }
.legend-asset { background: var(--accent-soft); border-color: var(--accent-line); }
.legend-seq { background: var(--good-soft); border-color: #1c4432; }
.legend-gate { background: var(--warn-soft); border-color: #4a3915; }
.legend svg .edge { stroke: var(--text-faint); stroke-width: 1.6; }
.legend svg .edge-gate { stroke: var(--warn); stroke-dasharray: 4 3; }

/* --- timeline ----------------------------------------------------------- */
.timeline-scroll { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface); padding-bottom: 8px; }
.timeline { position: relative; min-height: 200px; }
.timeline-axis { position: absolute; top: 0; left: 0; height: 44px; border-bottom: 1px solid var(--line-soft); }
.tick { position: absolute; top: 0; height: 44px; }
.tick-label { position: absolute; top: 14px; left: 8px; font-size: 11px; color: var(--text-faint); font-family: var(--mono); white-space: nowrap; }
.gridline { position: absolute; top: 44px; width: 1px; background: var(--line-soft); opacity: 0.5; }
.edges { position: absolute; top: 0; left: 0; pointer-events: none; }
.edge { stroke: #3a4657; stroke-width: 1.8; }
.edge-gate { stroke: var(--warn); stroke-width: 1.8; stroke-dasharray: 5 4; opacity: 0.8; }

.node-card {
  position: absolute; box-sizing: border-box; border: 1px solid var(--line);
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 5px; overflow: hidden; box-shadow: var(--shadow);
}
.node-card.asset { border-left: 3px solid var(--accent); }
.node-card.sequence { border-left: 3px solid var(--good); }
.node-card.gate {
  border: 1px dashed var(--warn); background: var(--warn-soft);
}
.node-card-top { display: flex; align-items: center; gap: 8px; }
.node-badge { font-size: 11px; font-weight: 640; color: var(--text); letter-spacing: 0.01em; }
.node-card.gate .node-badge { color: var(--warn); }
.node-channel {
  margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-dim); background: var(--surface-3); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 4px;
}
.node-card-label { font-size: 13px; font-weight: 560; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.node-window { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.node-prov { margin-top: auto; border-top: 1px dashed var(--line-soft); padding-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.prov-persona { font-size: 11px; color: var(--core); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-card.gate .prov-persona { color: var(--warn); }
.prov-grounds { font-size: 10.5px; color: var(--text-faint); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; overflow: hidden; max-height: 18px; }
.prov-chip { color: var(--text-dim); background: var(--surface); border: 1px solid var(--line-soft); border-radius: 4px; padding: 0 5px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prov-more { color: var(--text-faint); }

@media (max-width: 860px) {
  .archetype-grid { grid-template-columns: 1fr; }
}

/* --- campaign (generated) state ----------------------------------------- */

.status-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700;
  padding: 1px 7px; border-radius: 4px; border: 1px solid var(--line);
  color: var(--text-dim); background: var(--surface-3); white-space: nowrap;
}
.status-chip.st-done { color: var(--good); border-color: #1c4432; background: var(--good-soft); }
.status-chip.st-generating { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.status-chip.st-failed { color: var(--danger); border-color: #52201f; background: var(--danger-soft); }
.status-chip.st-blocked { color: var(--warn); border-color: #4a3915; background: var(--warn-soft); }
.status-chip.st-pending { color: var(--text-faint); }
.status-chip.st-skipped { color: var(--warn); border-color: #4a3915; background: var(--warn-soft); }
.status-chip.st-provisional { color: var(--warn); border-color: #4a3915; background: var(--warn-soft); border-style: dashed; }

.flag-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; color: var(--warn);
}

.gen-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block;
  animation: genpulse 1.1s ease-in-out infinite;
}
@keyframes genpulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}
.gen-live { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 13px; font-weight: 560; }

/* per-node footer in the generated state (replaces the grounding chips —
   provenance moves to the drawer, where there is room to read it) */
.node-gen { margin-top: auto; border-top: 1px dashed var(--line-soft); padding-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.node-open-hint { margin-left: auto; font-size: 11px; color: var(--text-faint); }

.node-card.clickable { cursor: pointer; font: inherit; color: inherit; transition: border-color 0.12s; }
.node-card.clickable:hover { border-color: var(--accent); }
.node-card.clickable:hover .node-open-hint { color: var(--accent); }
.node-card.st-generating { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line), var(--shadow); }
.node-card.st-failed { border-color: #52201f; background: linear-gradient(180deg, var(--danger-soft), var(--surface-2) 60%); }
.node-card.st-blocked { opacity: 0.75; }
.node-card.st-pending { opacity: 0.65; }

.campaign-progress.is-running { border-color: var(--accent-line); }
.progress-problems { display: flex; align-items: center; gap: 8px; }

/* --- node drawer (read-only asset view) ---------------------------------- */

.drawer-backdrop { position: fixed; inset: 0; background: rgba(4, 6, 9, 0.55); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 92vw); z-index: 41;
  background: var(--surface); border-left: 1px solid var(--line);
  padding: 22px 24px 40px; overflow-y: auto; box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
  animation: drawerin 0.16s ease-out;
}
@keyframes drawerin {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.drawer-title { font-size: 19px; font-weight: 660; margin: 2px 0 0; letter-spacing: -0.01em; }
.drawer-rationale { font-size: 13px; margin: 10px 0 0; }
.drawer-status { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

.asset-panel {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
  padding: 14px 16px; margin-top: 16px; display: flex; flex-direction: column; gap: 10px;
}
.asset-panel.provisional { border-style: dashed; border-color: #4a3915; }
.asset-panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.asset-model { margin-left: auto; font-size: 11px; color: var(--text-faint); }
.asset-content {
  margin: 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg);
  border: 1px solid var(--line-soft); font-family: var(--sans); font-size: 13px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; color: var(--text);
}
.asset-flags { display: flex; flex-direction: column; gap: 8px; }
.asset-flag {
  display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px;
  border: 1px solid #4a3915; background: var(--warn-soft); border-radius: var(--radius-sm); padding: 8px 11px;
}
.asset-flag-reason { color: var(--warn); font-weight: 600; }
.asset-flag-excerpt { color: var(--text-dim); margin-top: 2px; }

/* --- saved campaigns (goal entry) ---------------------------------------- */

.saved-campaigns { margin-top: 34px; display: flex; flex-direction: column; gap: 10px; }
.saved-list { display: flex; flex-direction: column; gap: 8px; }
.saved-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  text-align: left; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius-sm); padding: 11px 14px; color: var(--text);
  transition: border-color 0.12s;
}
.saved-row:hover { border-color: var(--accent); }
.saved-label { font-size: 13.5px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-meta { display: flex; align-items: center; gap: 12px; flex: none; font-size: 12px; color: var(--text-dim); }
.saved-arch {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
  color: var(--accent); background: var(--bg); border: 1px solid var(--accent-line); padding: 1px 5px; border-radius: 4px;
}
.saved-flags { color: var(--warn); font-weight: 600; }
.saved-failed { color: var(--danger); font-weight: 600; }
.saved-running { color: var(--accent); font-weight: 600; }

/* --- the review surface (Slice B): edits, flags, gates, cascade, digest --- */

.writeback-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border-color: var(--accent-line); background: var(--accent-soft);
}

.stale-banner { display: flex; flex-direction: column; gap: 10px; }
.stale-head { font-size: 13px; }
.stale-list { display: flex; flex-direction: column; gap: 8px; }
.stale-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.stale-row.stale-edited { border-color: var(--warn); }
.stale-info { min-width: 0; font-size: 13px; }
.stale-label { font-weight: 600; }
.stale-warning { margin-top: 4px; font-size: 12px; color: var(--warn); }
.stale-choice { display: flex; align-items: center; gap: 8px; flex: none; }
.stale-cost { font-size: 11.5px; }
.stale-apply { display: flex; align-items: center; justify-content: space-between; gap: 14px; }

.rev-badge {
  font-size: 10.5px; color: var(--text-dim); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 6px;
}
.rev-badge.rev-edited { color: var(--warn); border-color: #4a3915; background: var(--warn-soft); }
.btn-edit { margin-left: auto; }

.asset-edit { display: flex; flex-direction: column; gap: 8px; }
.asset-editor {
  width: 100%; resize: vertical; font: 12.5px/1.55 var(--font-mono, ui-monospace, monospace);
  color: var(--text); background: var(--bg); border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.asset-editor:focus { outline: none; border-color: var(--accent); }
.asset-edit-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.flag-body { min-width: 0; flex: 1 1; }
.flag-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.flag-input {
  flex: 1 1; min-width: 180px; font-size: 12.5px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.flag-input:focus { outline: none; border-color: var(--accent); }
.flag-resolved { opacity: 0.62; }
.flag-resolution { margin-top: 3px; font-size: 12px; color: var(--good); }

.btn-gate { font-size: 11.5px; padding: 3px 10px; }
.node-card.gate-approved { border-color: #1c4432; }

.drawer-digest { width: min(680px, 94vw); }
.digest-proposal { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 6px; }
.digest-proposal .approval { margin-top: 8px; }

.reject-controls { display: flex; align-items: center; gap: 8px; }
.reject-reason {
  font-size: 12px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px;
}

/* --- the Deploy lens: the confirmation queue and publish states ------------- */

.deploy-panel { margin-top: 26px; }
.deploy-title { font-size: 17px; font-weight: 650; margin: 0 0 4px; }
.deploy-subhead { font-size: 13.5px; font-weight: 640; margin: 26px 0 8px; }
.deploy-note { font-size: 12.5px; margin: 0 0 10px; }

.deploy-week { margin-top: 14px; }
.deploy-week-head {
  display: flex; align-items: baseline; gap: 10px; padding: 6px 2px;
  border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.deploy-week-label { font-weight: 640; }

.deploy-row, .deploy-asset {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 2px; border-bottom: 1px solid var(--line);
}
.deploy-row-main { flex: 1 1; min-width: 0; }
.deploy-row-label { font-size: 13px; font-weight: 560; }
.deploy-row-preview { font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deploy-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.deploy-when { font-size: 11.5px; color: var(--text-dim); }
.deploy-offset { font-size: 11.5px; color: var(--text-dim); min-width: 52px; padding-top: 2px; }
.deploy-flag { margin-left: 8px; }
.deploy-asset-blocked { opacity: 0.62; }

/* The ladder state, worn on the row. Degraded/failed are deliberately loud. */
.state-pill {
  font-size: 11px; font-weight: 640; letter-spacing: 0.02em; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px;
  color: var(--text-dim); margin-top: 1px;
}
.state-awaiting { color: var(--accent); border-color: var(--accent-line); }
.state-published { color: var(--good); border-color: #1c4432; background: rgba(46, 160, 67, 0.08); }
.state-degraded { color: var(--warn); border-color: #4a3915; background: var(--warn-soft); }
.state-failed { color: var(--danger, #e5534b); border-color: #4a1f1c; background: rgba(229, 83, 75, 0.08); }
.state-exported { color: var(--text-dim); border-style: dashed; }

.deploy-outcome { font-size: 12px; margin-top: 4px; color: var(--good); }
.deploy-outcome-warn { color: var(--warn); }
.deploy-outcome-bad { color: var(--danger, #e5534b); }

.deploy-setup { margin-top: 6px; }
.deploy-controls { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin: 12px 0; }
.deploy-controls .field { display: flex; flex-direction: column; gap: 5px; min-width: 260px; }
.deploy-assets { margin-top: 4px; }
.deploy-add-connector { margin: 4px 0 8px; }
.deploy-connector-form {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; margin: 8px 0; display: flex; flex-direction: column; gap: 10px; max-width: 560px;
}
.deploy-connector-actions { display: flex; gap: 8px; }

/* --- the Results lens: attribution that speaks strategy --------------------- */
/* Reuses .deploy-panel/.deploy-row/.chip/.state-pill; new classes are the
   sentence-and-chips vocabulary only. No charts — the sentence is the product. */

.results-genome-head { font-size: 16px; font-weight: 650; margin: 34px 0 0; }

.results-chip { white-space: normal; display: inline-block; line-height: 1.45; }
.results-sentence { font-size: 13px; margin-top: 7px; }
.results-counts { font-size: 12px; margin-top: 3px; }
.results-grounding { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* "Too little data to compare" — an explicit state: dimmed, fully readable. */
.results-thin { opacity: 0.62; }
.results-thin-head { font-size: 12.5px; font-weight: 640; color: var(--text-dim); margin: 20px 0 0; }

.results-cut-row {
  display: flex; align-items: baseline; gap: 12px; font-size: 12.5px;
  padding: 5px 2px; border-bottom: 1px solid var(--line-soft);
}
.results-cut-key { font-weight: 560; min-width: 130px; }

.results-archetype { margin-left: 10px; }

