/* EP Agent — visual system. Refined dark UI for a creative production company.
   Class names are kept stable across the app; this file restyles them wholesale. */
:root {
  --bg: #0b0d11;
  --bg-2: #0f1216;
  --panel: #14181f;
  --panel-2: #1a1f28;
  --panel-3: #212836;
  --line: #262d38;
  --line-2: #313a47;
  --text: #e7ecf3;
  --dim: #97a3b2;
  --faint: #6b7684;
  --accent: #4fd39b;         /* emerald — primary */
  --accent-ink: #04140c;
  --accent-2: #7bb0ff;       /* blue — secondary/links */
  --accent2: #7bb0ff;        /* legacy alias — some inline styles use the un-hyphenated name */
  --warn: #e7b455;
  --bad: #ef6f60;
  --ok: var(--accent);
  --radius: 13px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 30px rgba(0,0,0,.22);
  --ring: 0 0 0 3px rgba(79,211,155,.22);
  --ring-2: 0 0 0 3px rgba(123,176,255,.22);
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(1100px 520px at 50% -12%, #161d27 0%, rgba(22,29,39,0) 70%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

h1, h2, h3 { line-height: 1.25; letter-spacing: -.012em; margin: 0 0 .5em; font-weight: 680; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; color: var(--text); margin-top: 1.3em; }
p { margin: 0 0 .8em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code, kbd { font-family: var(--mono); font-size: .9em; background: var(--panel-3);
  padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); }

/* ---------------- top bar + nav ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 11px 22px;
  background: rgba(15,18,22,.82);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 750; font-size: 16.5px; letter-spacing: -.02em; margin-right: 6px;
  color: var(--text); text-decoration: none; }
a.brand:hover { text-decoration: none; opacity: .9; }
.brand span { color: var(--accent); }
.brand em { font-style: normal; color: var(--faint); font-size: 11.5px; font-weight: 500;
  margin-left: 9px; letter-spacing: 0; }
.topbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; flex: 1; }
.topbar nav a { color: var(--dim); font-size: 13.5px; font-weight: 500;
  padding: 6px 10px; border-radius: 7px; white-space: nowrap; }
.topbar nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.navsep { color: var(--line-2); margin: 0 4px; }
.navcta { background: var(--accent) !important; color: var(--accent-ink) !important;
  font-weight: 650 !important; padding: 6px 12px !important; }
.navcta:hover { filter: brightness(1.06); }
.topbar .inline { margin: 0; }
.topbar form button.ghost { font-size: 12.5px; padding: 6px 11px; }

/* ---------------- layout ---------------- */
main { max-width: 1160px; margin: 0 auto; padding: 28px 26px 64px; }
footer { max-width: 1160px; margin: 0 auto; padding: 24px 26px 40px;
  color: var(--faint); font-size: 12.5px; border-top: 1px solid var(--line); margin-top: 24px; }

.banner { padding: 11px 22px; font-size: 13.5px; text-align: center; }
.banner.warn { background: #2c2612; color: var(--warn); border-bottom: 1px solid #4a3d1a; }
.banner.bad { background: #2f1a17; color: var(--bad); border-bottom: 1px solid #522a24; }
.banner.info { background: #16223a; color: var(--accent-2); border-bottom: 1px solid #24365c; }

/* ---------------- cards ---------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}
.card > h2:first-child, .card > h1:first-child { margin-top: 0; }
.card.hero {
  border-color: transparent;
  background:
    linear-gradient(180deg, rgba(79,211,155,.10), rgba(79,211,155,0) 60%),
    var(--panel);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(79,211,155,.25);
}
.card.hero h2 { font-size: 22px; margin-top: 0; }
details.card > summary { cursor: pointer; font-weight: 600; color: var(--text); list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸ "; color: var(--accent); }
details.card[open] > summary::before { content: "▾ "; }

/* ---------------- stats ---------------- */
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat span { color: var(--dim); font-size: 12.5px; }

/* ---------------- tables ---------------- */
table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line);
  vertical-align: top; }
th { color: var(--faint); font-weight: 600; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; border-bottom-color: var(--line-2); }
tbody tr:hover, table tr:hover { background: rgba(255,255,255,.018); }
tr:last-child td { border-bottom: 0; }

/* ---------------- forms ---------------- */
label { display: block; margin: 12px 0 5px; color: var(--dim); font-size: 12.5px;
  font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], textarea, select {
  width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 14px; font-family: inherit; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--dim); }
textarea { resize: vertical; min-height: 78px; line-height: 1.5; }
textarea.tall { min-height: 220px; }
label.check { display: flex; gap: 9px; align-items: center; color: var(--text);
  font-size: 14px; font-weight: 400; margin: 6px 0; cursor: pointer; }
label.check input { width: auto; }
form.inline { display: inline; margin: 0; }

/* ---------------- buttons ---------------- */
button, .btnlink {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: var(--radius-sm); padding: 9px 16px;
  font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: filter .12s, transform .06s, box-shadow .12s; text-decoration: none;
}
button:hover, .btnlink:hover { filter: brightness(1.07); text-decoration: none; }
button:active, .btnlink:active { transform: translateY(1px); }
button:focus-visible, .btnlink:focus-visible { box-shadow: var(--ring); outline: none; }
button.ghost, .btnlink.ghost { background: transparent; color: var(--dim);
  border: 1px solid var(--line-2); font-weight: 500; }
button.ghost:hover, .btnlink.ghost:hover { color: var(--text); border-color: var(--dim);
  filter: none; }
button.danger { background: var(--bad); color: #fff; }
button.big, .btnlink.big { font-size: 15.5px; padding: 13px 22px; border-radius: 11px; }

/* ---------------- tags / chips ---------------- */
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2.5px 9px;
  border-radius: 999px; border: 1px solid var(--line-2); color: var(--dim);
  margin: 0 5px 3px 0; letter-spacing: .01em; }
.tag.ok { color: var(--accent); border-color: rgba(79,211,155,.4); background: rgba(79,211,155,.10); }
.tag.warn { color: var(--warn); border-color: rgba(231,180,85,.4); background: rgba(231,180,85,.10); }
.tag.bad { color: var(--bad); border-color: rgba(239,111,96,.4); background: rgba(239,111,96,.10); }
.tag.info { color: var(--accent-2); border-color: rgba(123,176,255,.4); background: rgba(123,176,255,.10); }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }

/* ---------------- text helpers ---------------- */
.dim { color: var(--dim); }
.small { font-size: 13px; }
.faint { color: var(--faint); }
pre { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px;
  line-height: 1.5; color: var(--dim); }

/* ---------------- claims / evidence ---------------- */
.claim { border-left: 3px solid var(--accent); background: rgba(79,211,155,.05);
  padding: 10px 14px; margin: 9px 0; border-radius: 0 8px 8px 0; }
.claim.missing { border-left-color: var(--warn); background: rgba(231,180,85,.05); }
.ev { color: var(--dim); font-size: 12.5px; margin-top: 5px; line-height: 1.5; }
.ev a { color: var(--accent-2); word-break: break-all; }

/* ---------------- hint callout ---------------- */
.hint { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0;
  padding: 13px 16px; background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2); border-radius: 0 10px 10px 0; }
.hint .ico { font-size: 19px; line-height: 1.1; }
.hint .htxt { flex: 1; }
.hint .htxt b { color: var(--text); }
.hint .htxt .sub, .hint .sub { color: var(--dim); font-size: 13px; margin-top: 3px; }
.hint .htxt form, .hint .htxt .row { margin-top: 10px; }
.hint.blue { border-left-color: var(--accent-2); }
.hint.warn { border-left-color: var(--warn); background: rgba(231,180,85,.06); }
.hint.done { border-left-color: var(--accent); background: rgba(79,211,155,.06); }

/* ---------------- step tracker (interview screen) ---------------- */
.steps { display: flex; gap: 0; margin: 18px 0 22px; }
.steps .step { flex: 1 1 0; min-width: 90px; position: relative; text-align: center; padding: 0 4px; }
.steps .step::before { content: ""; position: absolute; top: 15px; left: -50%; width: 100%;
  height: 2px; background: var(--line); }
.steps .step:first-child::before { display: none; }
.steps .step .dot { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: 2px solid var(--line); color: var(--faint); font-weight: 700; }
.steps .step .lbl { font-size: 12.5px; color: var(--dim); line-height: 1.35; margin-top: 6px; display: block; }
.steps .step .lbl small { display: block; font-size: 11px; opacity: .8; }
.steps .step.done .dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps .step.done::before { background: var(--accent); }
.steps .step.done .lbl { color: var(--text); }
.steps .step.current .dot { border-color: var(--accent-2); color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(123,176,255,.14); }
.steps .step.current .lbl { color: var(--accent-2); font-weight: 600; }

/* ---------------- misc component bits used around the app ---------------- */
.scorebar { height: 7px; border-radius: 999px; background: var(--panel-3); overflow: hidden; margin: 4px 0; }
.scorebar > span { display: block; height: 100%; background: var(--accent); }
.crit { color: var(--bad); }
.curstep { color: var(--accent-2); font-weight: 600; }

/* ---------------- spinner ---------------- */
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--line-2);
  border-top-color: var(--accent-2); border-radius: 50%; animation: spin .8s linear infinite;
  vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= New-pitch wizard ================= */
body.wizard { background: var(--bg); }
.wiz-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center;
  justify-content: space-between; padding: 13px 24px; background: rgba(15,18,22,.85);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.wiz-exit { color: var(--dim); font-size: 13px; padding: 5px 10px; border-radius: 7px; }
.wiz-exit:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.wiz-steps { display: flex; gap: 0; max-width: 780px; margin: 26px auto 8px; padding: 0 24px; }
.wiz-step { flex: 1 1 0; min-width: 60px; text-align: center; position: relative; }
.wiz-step::before { content: ""; position: absolute; top: 16px; left: -50%; width: 100%; height: 2px;
  background: var(--line); z-index: 0; }
.wiz-step:first-child::before { display: none; }
.wiz-dot { position: relative; z-index: 1; display: inline-flex; align-items: center;
  justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2);
  border: 2px solid var(--line); color: var(--faint); font-weight: 700; }
.wiz-lbl { display: block; font-size: 12px; color: var(--dim); margin-top: 7px; line-height: 1.3; }
.wiz-step.done .wiz-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.wiz-step.done::before { background: var(--accent); }
.wiz-step.current .wiz-dot { border-color: var(--accent-2); color: var(--accent-2);
  box-shadow: 0 0 0 5px rgba(123,176,255,.14); }
.wiz-step.current .wiz-lbl { color: var(--accent-2); font-weight: 600; }
.wiz-main { max-width: 780px; margin: 0 auto; padding: 12px 24px 72px; }
.wiz-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 30px 32px; box-shadow: var(--shadow); }
.wiz-card h1 { margin: 0 0 8px; font-size: 25px; }
.wiz-drop { display: block; border: 1.5px dashed var(--line-2); border-radius: 12px;
  background: var(--panel-2); padding: 26px; text-align: center; cursor: pointer; margin: 10px 0 6px;
  transition: border-color .12s, background .12s; }
.wiz-drop:hover { border-color: var(--accent-2); background: var(--panel-3); }
.wiz-drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.wiz-drop-files { display: block; margin-top: 9px; color: var(--accent-2); font-size: 13px; min-height: 1em; }
.wiz-or { margin: 14px 0; } .wiz-or summary { color: var(--accent-2); cursor: pointer; font-size: 14px; }
.wiz-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 22px; margin: 8px 0 4px; }
.wiz-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.wiz-actions-r { display: flex; gap: 10px; align-items: center; }
.wiz-actions form { display: inline; margin: 0; }

.wiz-progress { height: 8px; background: var(--panel-3); border-radius: 999px; overflow: hidden; margin: 12px 0 0; }
#wiz-upbar { height: 100%; width: 0; background: var(--accent); transition: width .15s ease; }

/* per-file upload / reading status list */
.filelist { border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); margin: 12px 0; overflow: hidden; }
.filelist-head { padding: 11px 14px; font-size: 13.5px; border-bottom: 1px solid var(--line); background: var(--panel-3); }
.filelist-head b { color: var(--accent); }
.fdot { display: inline-block; margin-right: 6px; font-weight: 700; }
.fdot.ok { color: var(--accent); } .fdot.bad { color: var(--bad); }
.filerow { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; font-size: 13.5px; }
.filerow:last-child { border-bottom: 0; }
.ficon { width: 18px; text-align: center; flex: 0 0 auto; font-weight: 700; }
.fname { flex: 1 1 auto; color: var(--text); word-break: break-all; }
.fstat { color: var(--dim); font-size: 12.5px; flex: 0 0 auto; }
.ferr { flex-basis: 100%; color: var(--bad); font-size: 12px; padding-left: 28px; }
.status-ready .ficon { color: var(--accent); }
.status-error .ficon, .status-error .fstat { color: var(--bad); }
.status-extracting { animation: filepulse 1.6s ease-in-out infinite; }
.status-extracting .fstat { color: var(--accent-2); }
.status-skipped { opacity: .6; }
.status-skipped .ficon, .status-skipped .fstat { color: var(--faint); }
@keyframes filepulse { 0%, 100% { background: transparent; } 50% { background: rgba(123,176,255,.07); } }

/* plain warn text (not a hint/banner) + confirmation-step blocks */
p.warn, .small.warn { color: var(--warn); }
.found { border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
  padding: 10px 12px; margin: 10px 0; }
.found p { margin: 3px 0; }
.abstain-card { border-color: rgba(231,180,85,.5); background: rgba(231,180,85,.06); margin: 14px 0; }
select[name="run_type"] { width: 100%; }

/* run log timeline */
.timeline { margin: 18px 0; border-left: 2px solid var(--line); padding-left: 0; }
.tl-row { display: flex; gap: 12px; padding: 4px 0 14px; position: relative; }
.tl-mark { flex: 0 0 auto; width: 22px; margin-left: -12px; text-align: center; color: var(--faint); }
.tl-human .tl-mark { color: var(--accent-2); }
.tl-body { flex: 1 1 auto; min-width: 0; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-when { margin-left: auto; }
.tl-sources { margin: 6px 0; padding-left: 8px; border-left: 2px solid var(--line); }
.tl-sources a { margin-left: 4px; }
.tl-detail { margin-top: 6px; }
.jsonblock { max-height: 340px; overflow: auto; font-size: 12px; margin-top: 6px; }

/* interview review controls: clickable evidence, edit/narrow, Q&A states */
.ev-chip { display: inline-block; font-size: 12px; padding: 1px 7px; border: 1px solid var(--line);
  border-radius: 6px; text-decoration: none; color: var(--accent-2); margin: 1px 2px; }
.ev-chip:hover { background: rgba(123,176,255,.12); }
.rev-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-top: 8px; }
.rev-controls form { margin: 0; }
.narrow-box { margin: 0; }
.narrow-box > summary.linklike { cursor: pointer; color: var(--accent-2); font-size: 13px; list-style: none; }
.narrow-box > summary.linklike::-webkit-details-marker { display: none; }
.narrow-box[open] > summary.linklike { margin-bottom: 6px; }
.narrow-box textarea, .narrow-box input { margin: 4px 0; }
button.tiny { font-size: 12px; padding: 3px 8px; }
.turn { border-left: 3px solid var(--line); }
.turn-ep { border-left-color: var(--accent-2); }
.turn-director { border-left-color: var(--accent); }
.turn-challenge { border-left-color: var(--warn); }
.turn-human { border-left-color: var(--faint); background: var(--panel-2); }
.turn-person { border-left-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 8%, transparent); }
.turn-person strong { color: var(--accent-2); }
.room-controls { margin-top: 18px; }
.room-say { display: flex; flex-direction: column; gap: 10px; }
.room-say textarea { width: 100%; }
.room-say-row { display: flex; gap: 10px; align-items: center; }
.room-say-row select { flex: 0 0 auto; }
.room-say-row button { margin-left: auto; }

/* Wiredrive reel detail grid */
.reel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.reel-card { display: flex; flex-direction: column; }
.reel-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--panel-2); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.reel-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
video.reel-thumb { width: 100%; object-fit: cover; background: #000; }
.reel-noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 26px; }
.reel-dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.72); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.reel-meta { display: flex; flex-direction: column; gap: 2px; margin-top: 7px; }
.reel-meta strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cov-row { align-items: center; gap: 8px; padding: 3px 0; flex-wrap: wrap; }
.cov-actions { margin-left: auto; display: flex; gap: 6px; }
.cov-row form { margin: 0; }
.qa-excluded { opacity: .55; }
.ts { color: var(--accent-2); }
:target.card, .card:target { outline: 2px solid var(--accent-2); outline-offset: 2px; }

@media (max-width: 720px) {
  .grid.c2, .grid.c4, .wiz-pick { grid-template-columns: 1fr; }
  main { padding: 20px 16px 48px; }
  .wiz-step:not(.current) .wiz-lbl { display: none; }  /* keep the current step named */
  .topbar { padding: 10px 14px; }
}

/* HND-04 agency-board diff + board text */
.board-diff { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; border: 1px solid var(--line, #e2e5ea); border-radius: 8px; overflow: auto; }
.diff-line { padding: 1px 10px; white-space: pre-wrap; }
.diff-add { background: #e5f6ea; color: #14713a; }
.diff-del { background: #fdeaea; color: #a4232a; }
.diff-equal { color: #6b7280; }
.board-text { white-space: pre-wrap; font-size: 14px; line-height: 1.5; padding: 10px 12px; background: var(--chrome-2, #f5f6f8); border-radius: 8px; max-height: 340px; overflow: auto; }
