@import "tokens.css";

/* ═══════════════════════════════════════════════════════════
   ΩVERMIND CONTROL — AthenaOS reskin (P31 phosphor CRT)
   ═══════════════════════════════════════════════════════════ */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(0, 255, 106, 0.05), transparent 60%),
    radial-gradient(ellipse 120% 100% at 50% 50%, var(--p-bg-2) 0%, var(--p-bg) 55%, #000 100%);
  color: var(--p-glow);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

/* Scanlines + flicker live on body::before; vignette on body::after */
body::before {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  content: "";
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.16) 2px,
    rgba(0, 0, 0, 0.16) 4px
  );
  animation: scanroll 12s linear infinite, phosphor-flicker 9s ease-in-out infinite;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(ellipse 100% 100% at 50% 0%, rgba(0, 255, 106, 0.04) 0%, transparent 55%),
    radial-gradient(ellipse 95% 92% at 50% 50%, transparent 58%, rgba(0, 0, 10, 0.6) 100%);
}

@keyframes scanroll {
  0% { background-position: 0 0; }
  100% { background-position: 0 800px; }
}

@keyframes phosphor-flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.94; }
  94% { opacity: 1; }
  97% { opacity: 0.96; }
  98% { opacity: 1; }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

@keyframes sweep-line {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.85; }
}

button,
select,
textarea,
input {
  font: inherit;
}

button,
a,
select,
textarea,
input {
  outline: none;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--p-cyan);
  outline-offset: 2px;
  box-shadow: var(--glow-cyan);
}

.app-frame {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100svh;
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100svh;
  padding: 18px;
  border-right: 1px solid var(--p-edge);
  background: var(--p-mid);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--p-glow-dim);
  border-radius: var(--radius);
  background: rgba(0, 255, 106, 0.06);
  color: var(--p-glow);
  font-family: var(--font-display);
  font-weight: 900;
  text-shadow: var(--glow-md);
}

.rail-nav {
  display: grid;
  gap: 6px;
}

.rail-nav a {
  min-height: 42px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--p-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rail-nav a:hover,
.rail-nav a[aria-current="page"] {
  border-color: var(--p-glow-faint);
  background: rgba(0, 255, 106, 0.05);
  color: var(--p-glow);
  text-shadow: var(--glow-sm);
}

.rail-refresh {
  margin-top: auto;
}

.workspace {
  min-width: 0;
  padding: 24px clamp(18px, 3vw, 42px) 42px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.title-stack {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--p-white-dim, var(--p-faint));
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--p-glow);
  text-shadow: var(--glow-md);
}

h1 {
  max-width: 900px;
  font-size: clamp(32px, 4.4vw, 64px);
  line-height: 1;
  text-shadow: var(--glow-lg);
}

h2 {
  font-size: 20px;
  line-height: 1.15;
}

h3 {
  font-size: 16px;
}

.lede {
  max-width: 640px;
  margin: 14px 0 0;
  color: var(--p-muted);
  font-family: var(--font-vt);
  font-size: 22px;
  line-height: 1.3;
  text-shadow: none;
}

.agent-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 520px;
}

.agent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--p-edge);
  border-radius: var(--radius);
  background: var(--p-surface);
  color: var(--p-muted);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--p-faint);
}

.agent.ok .dot {
  background: var(--p-glow);
  box-shadow: var(--glow-sm);
  animation: pulse-glow 1.6s ease-in-out infinite;
}

.agent.missing .dot,
.agent.error .dot {
  background: var(--p-red);
  box-shadow: var(--glow-red);
}

.command-deck,
.board,
.control-grid {
  margin-top: 16px;
}

.command-deck {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(360px, 1.3fr);
  gap: 18px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid var(--p-edge);
  border-radius: var(--radius);
  background: var(--p-mid);
  box-shadow: var(--shadow);
}

.deck-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 116px;
  padding: 8px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--p-edge);
  border-radius: var(--radius);
  background: var(--p-surface);
}

.stat b {
  display: block;
  color: var(--p-glow);
  font-family: var(--font-vt);
  font-size: clamp(28px, 3.4vw, 48px);
  line-height: 1;
  font-weight: 400;
  text-shadow: var(--glow-sm);
  overflow-wrap: anywhere;
}

.stat span {
  display: block;
  margin-top: 12px;
  color: var(--p-faint);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) minmax(360px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.status-stack {
  display: grid;
  gap: 16px;
}

.panel,
.board-column {
  border: 1px solid var(--p-edge);
  border-radius: var(--radius);
  background: var(--p-bg);
  box-shadow: var(--shadow);
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-head,
.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--p-edge);
  background: var(--p-mid);
  position: relative;
}

.panel-head::after,
.board-head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--p-glow), var(--p-glow-dim), transparent);
  opacity: 0.5;
  animation: sweep-line 4s ease-in-out infinite;
}

.field {
  display: grid;
  gap: 8px;
  padding: 16px 18px 0;
}

.field span,
.capability-box legend {
  color: var(--p-faint);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

select,
textarea,
input {
  width: 100%;
  border: 1px solid var(--p-edge);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
  color: var(--p-white);
  caret-color: var(--p-glow);
}

select {
  min-height: 46px;
  padding: 0 12px;
}

textarea,
input {
  resize: vertical;
  min-height: 210px;
  padding: 14px;
  line-height: 1.5;
}

input {
  resize: none;
  min-height: 46px;
  padding: 0 12px;
}

select:hover,
textarea:hover,
input:hover {
  border-color: var(--p-glow-dim);
}

select:focus,
textarea:focus,
input:focus {
  text-shadow: 0 0 8px rgba(200, 255, 212, 0.3);
}

.task-field textarea {
  min-height: 280px;
  font-size: 15px;
}

.project-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.project-field {
  min-width: 0;
}

.project-new {
  margin: 0 18px 0 0;
  min-width: 76px;
}

.project-form {
  display: grid;
  gap: 12px;
  margin: 16px 18px 0;
  padding: 14px;
  border: 1px solid var(--p-edge);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.32);
}

.project-form[hidden] {
  display: none;
}

.project-form-head,
.project-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field.compact {
  padding: 0;
}

.field.compact textarea {
  min-height: 92px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.capability-box {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--p-edge);
  border-radius: var(--radius);
}

.capability-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.capability-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--p-muted);
  font-size: 13px;
}

.capability-grid input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--p-glow);
}

.project-rules,
.drop-note,
.empty {
  color: var(--p-faint);
  font-size: 13px;
  line-height: 1.5;
}

.dropzone {
  display: grid;
  gap: 6px;
  margin: 16px 18px 0;
  padding: 16px;
  border: 1px dashed var(--p-glow-faint);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.32);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.dropzone:hover,
.dropzone.drag {
  border-color: var(--p-glow);
  background: rgba(0, 255, 106, 0.07);
  transform: translateY(-1px);
}

.dropzone input {
  display: none;
}

.drop-title {
  color: var(--p-glow);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-shadow: var(--glow-sm);
}

.file-list {
  display: grid;
  gap: 8px;
  padding: 14px 18px 0;
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--p-edge);
  border-radius: var(--radius);
  background: var(--p-surface);
  color: var(--p-muted);
  font-size: 13px;
}

.actions {
  display: flex;
  gap: 10px;
  padding: 18px;
}

/* ── Buttons: phosphor terminal (transparent + glow sweep) ── */
button {
  min-height: 44px;
  border: 1px solid var(--p-glow-dim);
  border-radius: var(--radius);
  padding: 0 16px;
  background: transparent;
  color: var(--p-glow);
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: var(--glow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease, opacity 160ms ease;
}

button:hover:not(:disabled) {
  background: rgba(0, 255, 106, 0.1);
  box-shadow: var(--glow-sm);
  color: var(--p-white);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

button.ghost {
  border-color: var(--p-edge);
  background: transparent;
  color: var(--p-muted);
  text-shadow: none;
}

button.ghost:hover:not(:disabled) {
  border-color: var(--p-glow-dim);
  color: var(--p-glow);
}

/* New action buttons inherit theme; reroute=amber, deliver=green accent */
#rerouteBtn {
  border-color: var(--p-amber-dim);
  color: var(--p-amber);
  text-shadow: var(--glow-amber);
}

#rerouteBtn:hover:not(:disabled) {
  background: rgba(255, 176, 0, 0.1);
  box-shadow: var(--glow-amber);
  color: var(--p-amber);
}

#deliverBtn {
  border-color: var(--p-glow-dim);
  color: var(--p-glow);
}

#deliverBtn:hover:not(:disabled) {
  background: rgba(0, 255, 106, 0.12);
  box-shadow: var(--glow-md);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--p-edge);
  border-radius: var(--radius);
  background: var(--p-surface);
  color: var(--p-muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pill.low,
.pill.ReviewReady,
.pill.Delivered {
  border-color: var(--p-glow-dim);
  color: var(--p-glow);
  text-shadow: var(--glow-sm);
}

.pill.medium,
.pill.Running,
.pill.Queued {
  border-color: var(--p-amber-dim);
  color: var(--p-amber);
  text-shadow: var(--glow-amber);
}

.pill.high,
.pill.Failed {
  border-color: var(--p-red-dim);
  color: var(--p-red);
  text-shadow: var(--glow-red);
}

#routeCard {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kv {
  border: 1px solid var(--p-edge);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
}

.kv b {
  display: block;
  margin-bottom: 6px;
  color: var(--p-faint);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.kv span {
  color: var(--p-white);
  overflow-wrap: anywhere;
}

.route-list {
  margin: 0;
  padding-left: 20px;
  color: var(--p-muted);
  line-height: 1.55;
}

.finding {
  border: 1px solid var(--p-red-dim);
  border-left: 2px solid var(--p-red);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--p-red);
  background: rgba(255, 59, 48, 0.08);
}

.timeline {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 18px;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--p-edge);
  border-left: 2px solid var(--p-glow-faint);
  border-radius: var(--radius);
  background: var(--p-surface);
  color: var(--p-muted);
}

.timeline time {
  color: var(--p-glow-faint);
  font-size: 12px;
  font-weight: 400;
}

.artifact {
  padding: 0 18px 18px;
}

.artifact a {
  color: var(--p-cyan);
  text-decoration: none;
  font-weight: 400;
  text-shadow: var(--glow-cyan);
}

.artifact a:hover {
  text-decoration: underline;
}

.error {
  color: var(--p-red);
  text-shadow: var(--glow-red);
}

.board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.project-board,
.job-board {
  display: grid;
  gap: 10px;
  padding: 14px;
  max-height: 420px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--p-edge) transparent;
}

.project-board::-webkit-scrollbar,
.job-board::-webkit-scrollbar {
  width: 4px;
}

.project-board::-webkit-scrollbar-thumb,
.job-board::-webkit-scrollbar-thumb {
  background: var(--p-edge);
}

.project-card,
.job-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--p-edge);
  border-left: 2px solid var(--p-faint);
  border-radius: var(--radius);
  background: var(--p-surface);
}

.project-card.Running,
.project-card.Queued,
.job-card.Running,
.job-card.Queued {
  border-left-color: var(--p-amber);
}

.project-card.ReviewReady,
.project-card.Delivered,
.job-card.ReviewReady,
.job-card.Delivered {
  border-left-color: var(--p-glow);
}

.project-card.Failed,
.job-card.Failed {
  border-left-color: var(--p-red);
}

.card-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-line b {
  min-width: 0;
  color: var(--p-white);
  overflow-wrap: anywhere;
}

.project-card p,
.job-card p {
  margin: 0;
  color: var(--p-muted);
  line-height: 1.45;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mini-grid span,
.job-meta,
.job-event {
  min-width: 0;
  color: var(--p-faint);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.task-snippet {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ═══════════════════════════════════════════════════════════
   NEW ELEMENTS — history, login, command palette
   ═══════════════════════════════════════════════════════════ */

/* History list — reuses board/card rhythm */
#historyList {
  display: grid;
  gap: 10px;
  padding: 14px 18px 18px;
  max-height: 420px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--p-edge) transparent;
}

#historyList::-webkit-scrollbar {
  width: 4px;
}

#historyList::-webkit-scrollbar-thumb {
  background: var(--p-edge);
}

.history-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--p-edge);
  border-left: 2px solid var(--p-glow-faint);
  border-radius: var(--radius);
  background: var(--p-surface);
  color: var(--p-muted);
  font-size: 13px;
  transition: border-color 120ms ease, background 120ms ease;
}

.history-item:hover {
  border-color: var(--p-glow-dim);
  background: rgba(0, 255, 106, 0.04);
}

/* Login — centered card overlay, reuses panel + field styles */
#loginForm {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 24px;
}

#loginCard {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--p-glow-dim);
  border-radius: var(--radius);
  background: var(--p-mid);
  box-shadow: var(--glow-lg), 0 40px 80px rgba(0, 0, 0, 0.8);
}

#loginCard h1,
#loginCard h2 {
  font-size: clamp(22px, 3vw, 32px);
}

/* Command palette overlay */
#cmdPalette {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

#cmdPalette.open,
#cmdPalette[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

#cmdPalette[hidden] {
  display: none;
}

#cmdPalette > * {
  width: min(520px, 90vw);
  border: 1px solid var(--p-glow-dim);
  border-radius: var(--radius);
  background: var(--p-mid);
  box-shadow: var(--glow-lg), 0 40px 80px rgba(0, 0, 0, 0.8);
  max-height: 60vh;
  overflow: auto;
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  padding: var(--gap-sm) var(--gap-md);
  border-left: 2px solid transparent;
  color: var(--p-white);
  font-size: 13px;
  cursor: pointer;
  transition: background 100ms ease, border-color 100ms ease;
}

.cmd-item:hover,
.cmd-item.highlighted,
.cmd-item[aria-selected="true"] {
  background: rgba(0, 255, 106, 0.07);
  border-left-color: var(--p-glow);
  color: var(--p-glow);
  text-shadow: var(--glow-sm);
}

/* Busy state — any element marked aria-busy */
[aria-busy="true"] {
  position: relative;
  cursor: progress;
  opacity: 0.7;
}

[aria-busy="true"]::after {
  content: "";
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--p-glow), transparent);
  box-shadow: var(--glow-sm);
  animation: busy-sweep 1.1s linear infinite;
}

@keyframes busy-sweep {
  0% { transform: translateX(0); }
  100% { transform: translateX(350%); }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1180px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    flex-direction: row;
    align-items: center;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--p-edge);
  }

  .rail-nav {
    display: flex;
    flex-wrap: wrap;
  }

  .rail-refresh {
    margin: 0 0 0 auto;
  }

  .command-deck,
  .control-grid,
  .board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 18px 14px 28px;
  }

  .topbar,
  .panel-head,
  .actions,
  .project-form-head,
  .project-form-actions,
  .rail {
    align-items: stretch;
    flex-direction: column;
  }

  .agent-strip {
    justify-content: flex-start;
  }

  .stat-grid,
  .route-grid,
  .timeline li,
  .project-row,
  .form-grid,
  .capability-grid,
  .mini-grid {
    grid-template-columns: 1fr;
  }

  .project-new {
    margin: 0 18px;
  }

  .rail-refresh {
    margin: 0;
  }

  h1 {
    font-size: 38px;
  }
}

/* ═══════════════════════════════════════════════════════════
   REDUCED MOTION — disable ALL flicker / scanline / sweep
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  body::before {
    animation: none;
  }
}

/* --- layout for elements added during frontend wiring (logic owner) --- */
.login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  z-index: 100;
  padding: 1.5rem;
}
.login-overlay[hidden] { display: none; }
#loginCard { width: min(360px, 100%); }
.login-error {
  color: var(--p-red, #ff3b30);
  font-size: 0.85rem;
  margin: 0.25rem 0;
}
.login-error[hidden] { display: none; }

.job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}
.job-actions[hidden] { display: none; }
.job-actions select {
  min-width: 8rem;
}

.md-preview {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--p-line, #11331f);
  background: var(--p-surface, rgba(0, 255, 106, 0.03));
  max-height: 320px;
  overflow: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}
.md-preview h2, .md-preview h3, .md-preview h4 { margin: 0.6rem 0 0.3rem; }
.md-preview code { font-family: var(--font-mono, monospace); }

/* --- P2 tail: artifact list, route override, disagreement chip --- */
.artifact-list { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.5rem; }
.artifact-row {
  display: flex; justify-content: space-between; gap: 0.5rem;
  padding: 0.4rem 0.6rem; text-align: left; cursor: pointer;
  border: 1px solid var(--p-line, #11331f);
  background: var(--p-surface, rgba(0, 255, 106, 0.03));
  color: inherit; font: inherit;
}
.artifact-row:hover { border-color: var(--p-green, #00ff6a); }
.ar-size { opacity: 0.6; font-size: 0.8rem; }
.route-override { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.6rem; }
.route-override span { font-size: 0.8rem; opacity: 0.7; }
.disagree-chip { margin-left: 0.4rem; }

/* --- Follow-up popup --- */
.followup-overlay {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 900;
  width: 420px;
  max-width: calc(100vw - 2rem);
  animation: followup-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes followup-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.followup-overlay[hidden] { display: none; }
.followup-card {
  background: var(--p-bg, #000d04);
  border: 1px solid var(--p-green, #00ff6a);
  box-shadow: 0 0 24px rgba(0, 255, 106, 0.18), 0 8px 32px rgba(0,0,0,0.6);
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.followup-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.followup-icon { font-size: 1.1rem; }
.followup-head h3 {
  flex: 1;
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--p-green, #00ff6a);
}
.followup-close {
  background: none;
  border: none;
  color: var(--p-green, #00ff6a);
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.6;
  padding: 0.1rem 0.3rem;
  line-height: 1;
}
.followup-close:hover { opacity: 1; }
.followup-question {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-left: 2px solid var(--p-green, #00ff6a);
  font-family: var(--font-mono, monospace);
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  opacity: 0.88;
  background: rgba(0, 255, 106, 0.04);
  max-height: 160px;
  overflow-y: auto;
}
.followup-input {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 72px;
  font-family: var(--font-mono, monospace);
  font-size: 0.9rem;
  background: var(--p-surface, rgba(0,255,106,0.03));
  border: 1px solid var(--p-line, #11331f);
  color: inherit;
  padding: 0.5rem 0.6rem;
  outline: none;
}
.followup-input:focus { border-color: var(--p-green, #00ff6a); }
.followup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}
