/* GRAPHOS — content-engine cockpit. Dark base; brand navy + red as a neon paintbrush. */
:root {
  --ink: #0a0b16;
  --panel: #10122400;      /* set below with alpha layers */
  --panel-1: #10131f;
  --panel-2: #161a2e;
  --card: #191d34;
  --line: rgba(139, 150, 255, 0.12);
  --line-soft: rgba(139, 150, 255, 0.07);

  --navy: #202759;
  --blue: #6e7bff;         /* brand navy, brightened to neon */
  --blue-dim: rgba(110, 123, 255, 0.16);
  --red: #d62229;
  --red-neon: #ff3b45;
  --red-dim: rgba(255, 59, 69, 0.15);

  --text: #eaecf7;
  --muted: #8a8fb5;
  --faint: #5a5f83;

  --wait: #ffc24b;
  --run: #6e7bff;
  --done: #34e5b0;
  --fail: #ff3b45;

  --r: 14px;
  --r-sm: 9px;
  --pill: 999px;
  --f-display: "Space Grotesk", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--f-body);
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 82% -8%, rgba(110, 123, 255, 0.10), transparent 60%),
    radial-gradient(900px 520px at -6% 108%, rgba(214, 34, 41, 0.09), transparent 55%),
    var(--ink);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
/* faint cockpit grid */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.5;
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px),
                    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 46px 46px; mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 78%);
}
#app { position: relative; z-index: 1; }
button { font: inherit; cursor: pointer; }
a { color: var(--blue); }

/* ---- top bar ------------------------------------------------------------ */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 16px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.brand .mark {
  font-family: var(--f-display); font-weight: 700; font-size: 22px; letter-spacing: 4px;
  color: #fff; text-shadow: 0 0 18px rgba(110, 123, 255, 0.55), 0 0 4px rgba(110, 123, 255, 0.6);
}
.brand .mark b { color: var(--red-neon); text-shadow: 0 0 18px rgba(255, 59, 69, 0.55); }
.brand .sub { font-family: var(--f-mono); font-size: 11px; color: var(--faint); letter-spacing: 1px; }
.topbar .ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: var(--pill); padding: 7px 15px; font-size: 13px; transition: 0.15s;
}
.topbar .ghost:hover { color: var(--text); border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim); }

/* ---- layout ------------------------------------------------------------- */
.cockpit {
  display: grid; grid-template-columns: 340px 1fr; gap: 0; align-items: start;
  min-height: calc(100vh - 66px);
  /* full-height divider drawn on the container, so the rail can hug its content */
  background: linear-gradient(var(--line), var(--line)) 340px 0 / 1px 100% no-repeat;
}
@media (max-width: 820px) { .cockpit { grid-template-columns: 1fr; background: none; } }

.rail { padding: 20px; align-self: start; height: fit-content; }
.rail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.rail-head h2 { font-family: var(--f-display); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin: 0; }
.new-btn {
  border: 0; border-radius: var(--pill); padding: 9px 16px; font-weight: 600; font-size: 13px; color: #fff;
  background: linear-gradient(120deg, var(--navy), var(--blue)); box-shadow: 0 0 18px rgba(110, 123, 255, 0.4);
  transition: 0.15s;
}
.new-btn:hover { box-shadow: 0 0 26px rgba(110, 123, 255, 0.65); transform: translateY(-1px); }
.new-btn:disabled { opacity: 0.5; box-shadow: none; }

.runs { display: flex; flex-direction: column; gap: 10px; }
.run-card {
  display: flex; flex-direction: column; gap: 8px; flex: none;
  text-align: left; width: 100%; padding: 12px 14px;
  background: var(--panel-1); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--text); transition: 0.16s;
}
.run-card:hover { border-color: rgba(110, 123, 255, 0.4); transform: translateY(-1px); }
.run-card.active { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue), 0 8px 30px -12px rgba(110, 123, 255, 0.6); }
.run-card .title { font-weight: 600; font-size: 14px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.run-card .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.run-card .rc-stage { font-family: var(--f-mono); font-size: 11px; color: var(--faint); }

/* ---- pills -------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-display);
  font-size: 11px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--pill); border: 1px solid currentColor;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.pill.awaiting { color: var(--wait); background: rgba(255, 194, 75, 0.08); }
.pill.running  { color: var(--run);  background: var(--blue-dim); animation: throb 1.1s ease-in-out infinite; }
.pill.done     { color: var(--done); background: rgba(52, 229, 176, 0.08); }
.pill.failed   { color: var(--fail); background: var(--red-dim); }
.pill.cancelled { color: var(--faint); border-color: var(--line); }
@keyframes throb { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---- main stage --------------------------------------------------------- */
.stage { padding: clamp(18px, 3vw, 36px); min-height: calc(100vh - 65px); }
.empty { color: var(--muted); font-size: 15px; max-width: 420px; margin-top: 12vh; }
.empty b { color: var(--text); font-family: var(--f-display); }
/* the stage's idle state: centered, with a quiet "standby" cue so it reads as
   intentional rather than an empty void (the rail's .empty keeps the base style) */
.stage > .empty {
  margin: 20vh auto 0; max-width: 440px; text-align: center; line-height: 1.6;
}
.stage > .empty::before {
  content: ""; display: block; width: 12px; height: 12px; margin: 0 auto 20px;
  border-radius: 50%; background: var(--blue);
  box-shadow: 0 0 0 6px var(--blue-dim), 0 0 22px 2px var(--blue);
  animation: throb 1.8s ease-in-out infinite;
}

/* workspace: the gate console beside the right-hand info panel */
.workspace {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start;
}
.workspace .console { margin-inline: 0; }          /* fill the left cell, not centered */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 1fr; }        /* panel drops below the console */
  .info { position: static !important; }
}

/* info panel */
.info { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 20px; }
.ipanel { background: var(--panel-1); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 15px; }
.ipanel-h {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font-family: var(--f-display); font-size: 11px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted);
}
.ipanel-h .jscore { margin-left: auto; font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 0; color: var(--done); }
.ipanel-h .jscore.ok { color: var(--wait); }
.ipanel-h .jscore.low { color: var(--fail); }
.ipanel-h .icount { margin-left: auto; font-family: var(--f-mono); font-size: 11px; color: var(--faint);
  background: var(--panel-2); border-radius: var(--pill); padding: 1px 9px; }

.jrules { display: flex; flex-direction: column; gap: 5px; }
.jrule { font-size: 12px; color: var(--muted); }
.jrule.ok { color: #cbd0ea; }
.jrule.no { color: #ffb9bd; }
.jrat { margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line-soft);
  font-size: 12.5px; line-height: 1.5; color: var(--muted); font-style: italic; }
.jnote { margin-top: 8px; font-size: 11px; color: var(--faint); }

.srcs { display: flex; flex-direction: column; gap: 12px; max-height: 46vh; overflow: auto; padding-right: 4px; }
.srcs::-webkit-scrollbar { width: 7px; }
.srcs::-webkit-scrollbar-thumb { background: var(--line); border-radius: 7px; }
.src + .src { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.src-claim { font-size: 12.5px; line-height: 1.5; color: #cfd2ea; }
.src-link { display: inline-block; margin-top: 5px; font-family: var(--f-mono); font-size: 11px;
  color: var(--blue); text-decoration: none; word-break: break-word; }
.src-link:hover { text-decoration: underline; }

.idl { display: flex; flex-direction: column; gap: 9px; }
.idl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.idl .ik { font-family: var(--f-mono); font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; }
.idl .iv { font-size: 13px; color: var(--text); }
.idl .iv.mono { font-family: var(--f-mono); }
.idl .iv.spend-sm { font-family: var(--f-mono); color: var(--done); }

/* the signature: a console card whose glow reacts to run state */
.console {
  position: relative; background: linear-gradient(180deg, var(--card), var(--panel-1));
  border: 1px solid var(--line); border-radius: 20px; padding: clamp(18px, 2.4vw, 28px);
  max-width: 920px; margin-inline: auto;         /* centered so the whitespace is balanced */
  --glow: var(--blue);
  box-shadow: 0 0 0 1px rgba(110, 123, 255, 0.08), 0 26px 70px -30px rgba(0, 0, 0, 0.9),
              0 0 42px -14px var(--glow);
  transition: box-shadow 0.4s;
}
.console.s-awaiting { --glow: var(--wait); }
.console.s-running  { --glow: var(--run); animation: consolePulse 1.6s ease-in-out infinite; }
.console.s-done     { --glow: var(--done); }
.console.s-failed   { --glow: var(--fail); }
@keyframes consolePulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(110,123,255,.08), 0 26px 70px -30px #000, 0 0 40px -16px var(--glow); }
  50%      { box-shadow: 0 0 0 1px rgba(110,123,255,.18), 0 26px 70px -30px #000, 0 0 66px -8px var(--glow); }
}
/* the decision trail — pinned context so the topic + accepted steps stay visible */
.trail {
  margin: -4px 0 18px; padding: 12px 14px; border-radius: var(--r-sm);
  background: rgba(110, 123, 255, 0.06); border: 1px solid var(--line);
}
.trail-topic { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.trail-k { font-family: var(--f-mono); font-size: 10px; letter-spacing: 1px; color: var(--faint); }
.trail-topic .trail-t { font-family: var(--f-display); font-weight: 600; font-size: 14.5px;
  color: var(--text); line-height: 1.3; flex: 1; min-width: 0; }
.trail-topic .ct { font-family: var(--f-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--blue); border: 1px solid rgba(110,123,255,.35);
  border-radius: var(--pill); padding: 2px 8px; }
.trail-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.tstep {
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .3px;
  padding: 2px 9px; border-radius: var(--pill); border: 1px solid transparent; white-space: nowrap;
}
.tstep.done    { color: var(--done); background: rgba(52,229,176,.09); }
.tstep.done::before  { content: "✓ "; }
.tstep.current { color: var(--blue); background: var(--blue-dim); border-color: rgba(110,123,255,.5);
  box-shadow: 0 0 0 2px var(--blue-dim); }
.tstep.current::before { content: "▶ "; }
.tstep.pending { color: var(--faint); border-color: var(--line-soft); }
.trail-note { margin-top: 10px; font-size: 12.5px; color: var(--wait);
  border-top: 1px dashed var(--line); padding-top: 9px; }

.console-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.console-head .eyebrow { font-family: var(--f-mono); font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.console-head .score { margin-left: auto; font-family: var(--f-mono); font-size: 12px; color: var(--done); }
.console-head .score.ok  { color: var(--wait); }   /* 70–84 */
.console-head .score.low { color: var(--fail); }   /* under 70 */

.doc-title { font-family: var(--f-display); font-size: clamp(20px, 2.4vw, 27px); font-weight: 600; line-height: 1.2; margin: 0 0 14px; }
.doc-body { white-space: pre-wrap; color: #cfd2ea; font-size: 15.5px; line-height: 1.72; max-height: 52vh; overflow: auto; padding-right: 6px; }
.doc-body::-webkit-scrollbar { width: 8px; }
.doc-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
/* Cap height (square/portrait images otherwise push the approve buttons off-screen);
   letterbox with object-fit so the whole image stays visible and centered. */
.hero-img { display: block; max-width: 100%; max-height: 52vh; object-fit: contain;
  margin: 0 auto; border-radius: 14px; border: 1px solid var(--line); background: #0d1020; }
/* inline chip standing in for the {{BLOG_URL}} placeholder in a social post preview */
.urlchip { display: inline-flex; align-items: center; gap: 5px; vertical-align: baseline;
  font-family: var(--f-mono); font-size: 12.5px; color: var(--blue);
  background: var(--blue-dim); border: 1px solid rgba(110, 123, 255, 0.35);
  border-radius: var(--pill); padding: 1px 9px; }

/* choice rows (topics, categories) */
.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.choice {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--r); padding: 13px 17px; font-size: 14.5px; line-height: 1.45; transition: 0.15s;
}
.choice .idx {
  flex: none; width: 27px; height: 27px; display: grid; place-items: center;
  font-family: var(--f-mono); color: var(--blue); font-size: 13px;
  border: 1px solid rgba(110, 123, 255, 0.45); border-radius: 50%;
}
.choice .topic { flex: 1; }
.choice .ct { flex: none; font-family: var(--f-mono); font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; }
.choice:hover { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim); transform: translateX(3px); }

/* action row */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.act {
  border-radius: var(--pill); padding: 11px 20px; font-weight: 600; font-size: 14px; border: 1px solid transparent; transition: 0.15s;
}
.act.accept { background: linear-gradient(120deg, #128a63, var(--done)); color: #04120d; box-shadow: 0 0 20px -4px var(--done); }
.act.accept:hover { box-shadow: 0 0 30px -2px var(--done); transform: translateY(-1px); }
.act.edit { background: transparent; color: var(--blue); border-color: rgba(110, 123, 255, 0.5); }
.act.edit:hover { box-shadow: 0 0 0 3px var(--blue-dim); }
.act.regen { background: transparent; color: var(--wait); border-color: rgba(255, 194, 75, 0.5); }
.act.regen:hover { box-shadow: 0 0 0 3px rgba(255, 194, 75, 0.14); }
.act.danger { background: transparent; color: var(--fail); border-color: rgba(255, 59, 69, 0.5); }
.act.danger:hover { box-shadow: 0 0 0 3px var(--red-dim); }
.act:disabled { opacity: 0.45; }

.notebox { margin-top: 16px; display: grid; gap: 10px; }
.notebox textarea {
  width: 100%; min-height: 84px; resize: vertical; background: #0d1020; color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; font: inherit;
}
.notebox textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim); }
.notebox .row { display: flex; gap: 10px; }

/* working / done / failed states */
.working { display: flex; align-items: center; gap: 12px; color: var(--blue); font-family: var(--f-display); font-size: 15px; }
.working .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 14px var(--blue); animation: throb 1s infinite; }
.kv { display: grid; gap: 10px; margin-top: 6px; font-size: 14px; }
.kv a { word-break: break-all; }
.kv .k { font-family: var(--f-mono); font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; }
.spend { font-family: var(--f-mono); color: var(--done); font-size: 20px; }
.err { color: #ffb9bd; background: var(--red-dim); border: 1px solid rgba(255, 59, 69, 0.35); border-radius: var(--r-sm); padding: 12px 14px; font-size: 14px; }

/* ---- login -------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login {
  width: min(380px, 100%); background: linear-gradient(180deg, var(--card), var(--panel-1));
  border: 1px solid var(--line); border-radius: 20px; padding: 34px 30px; text-align: center;
  box-shadow: 0 30px 80px -30px #000, 0 0 50px -20px var(--blue);
}
.login .mark { font-family: var(--f-display); font-weight: 700; font-size: 30px; letter-spacing: 6px; color: #fff; text-shadow: 0 0 22px rgba(110, 123, 255, 0.6); }
.login .mark b { color: var(--red-neon); }
.login p { color: var(--muted); font-size: 13px; margin: 6px 0 22px; }
.login input {
  width: 100%; background: #0d1020; color: var(--text); border: 1px solid var(--line);
  border-radius: var(--pill); padding: 13px 18px; font: inherit; text-align: center; letter-spacing: 2px;
}
.login input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim); }
.login button { width: 100%; margin-top: 12px; border: 0; border-radius: var(--pill); padding: 13px; font-weight: 600; color: #fff; background: linear-gradient(120deg, var(--navy), var(--blue)); box-shadow: 0 0 22px rgba(110, 123, 255, 0.45); }
.login .bad { color: var(--fail); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* keyboard focus — visible neon ring, only for keyboard nav (not mouse clicks) */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.run-card:focus-visible, .choice:focus-visible, .act:focus-visible, .new-btn:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
