/* TeknaByte IR Console
   Dark, dense, low-chrome. This gets used at 1am on someone else's network. */

:root {
  --bg: #0b0e14;
  --bg-1: #111620;
  --bg-2: #161d29;
  --bg-3: #1d2635;
  --line: #232d3f;
  --line-2: #2e3a4f;
  --fg: #dce3ee;
  --fg-dim: #8a97ad;
  --fg-faint: #5d6b83;
  --accent: #4da3ff;
  --accent-dim: #2b5f99;
  --ok: #3ecf8e;
  --warn: #e3b341;
  --danger: #f2626b;
  --crit: #ff4d5e;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Inter, sans-serif;
  --r: 6px;
}

* { box-sizing: border-box; }

/* .btn sets display:inline-flex, which otherwise beats the hidden attribute's
   UA display:none and leaves hidden buttons on screen. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--bg-2); padding: 1px 5px; border-radius: 3px; color: #b9c8e0; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; letter-spacing: -0.2px; }
h2 { font-size: 16px; margin: 0 0 8px; font-weight: 600; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 600; text-transform: uppercase;
     letter-spacing: 0.6px; color: var(--fg-dim); }
.muted { color: var(--fg-dim); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.mt { margin-top: 16px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.opt { color: var(--fg-faint); font-weight: 400; font-size: 11px; }

/* ------------------------------------------------------------------ chrome */

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px; height: 52px;
  background: var(--bg-1); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: var(--r);
  background: linear-gradient(140deg, var(--accent), var(--accent-dim));
  color: #06101d; font-weight: 800; font-size: 12px; letter-spacing: -0.5px;
}
.brand-mark.big { width: 46px; height: 46px; font-size: 18px; margin: 0 auto 14px; }
.brand-text { font-size: 14px; color: var(--fg-dim); }
.brand-text b { color: var(--fg); font-weight: 600; }
.topnav { display: flex; gap: 4px; margin-left: auto; }
.topnav a {
  padding: 6px 12px; border-radius: var(--r);
  color: var(--fg-dim); font-size: 13px;
}
.topnav a:hover { background: var(--bg-2); color: var(--fg); text-decoration: none; }
.topnav a.on { background: var(--bg-3); color: var(--fg); }
.who { display: flex; align-items: center; gap: 12px; }
.who-name { font-size: 12.5px; color: var(--fg-dim); }
.linkish {
  background: none; border: 0; color: var(--fg-faint);
  font: inherit; font-size: 12.5px; cursor: pointer; padding: 0;
}
.linkish:hover { color: var(--fg); }

main { display: block; }
.page { max-width: 1100px; margin: 0 auto; padding: 28px 20px 80px; }
.page.wide { max-width: 1400px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }

/* ------------------------------------------------------------------ login */

.login-wrap { display: grid; place-items: center; min-height: calc(100vh - 52px); padding: 20px; }
.login-card {
  width: 100%; max-width: 380px; text-align: center;
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: 10px; padding: 32px 28px;
}
.login-card h1 { font-size: 18px; }
.block { display: block; width: 100%; margin-top: 18px; }

/* --------------------------------------------------------------- controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--r);
  background: var(--bg-2); border: 1px solid var(--line-2); color: var(--fg);
  font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg-3); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06101d; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--danger); border-color: #4a2b30; }
.btn.danger:hover { background: #2a1519; }
.btn.tiny { padding: 3px 9px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.inline { display: inline-flex; gap: 6px; }

label { display: block; margin-bottom: 14px; font-size: 12.5px; color: var(--fg-dim); font-weight: 500; }
input[type=text], input:not([type]), textarea, select {
  display: block; width: 100%; margin-top: 5px;
  padding: 8px 10px; border-radius: var(--r);
  background: var(--bg); border: 1px solid var(--line-2); color: var(--fg);
  font: inherit; font-size: 13px;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent-dim); box-shadow: 0 0 0 3px rgba(77,163,255,0.1);
}
.hint { display: block; margin-top: 4px; color: var(--fg-faint); font-size: 11.5px; font-weight: 400; }
.chk { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; }
.chk input { width: auto; margin: 0; }
.row { display: flex; gap: 12px; align-items: flex-start; }
.row .grow { flex: 1; }

.flash { padding: 10px 14px; border-radius: var(--r); margin-bottom: 16px; font-size: 13px; }
.flash.error { background: #2a1519; border: 1px solid #4a2b30; color: #ffb3b9; }
.flash.ok { background: #10291f; border: 1px solid #1f4a37; color: #8ae5bd; }
.warn {
  background: #2a2313; border: 1px solid #4a4020; color: #e8cf94;
  padding: 8px 12px; border-radius: var(--r); font-size: 12.5px;
}

.modal {
  border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--bg-1); color: var(--fg); padding: 24px;
  width: min(520px, 92vw);
}
.modal::backdrop { background: rgba(5, 8, 13, 0.72); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* ----------------------------------------------------------------- tables */

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th {
  text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px; color: var(--fg-faint);
  border-bottom: 1px solid var(--line);
}
table.grid th.num { text-align: right; }
table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tbody tr:hover { background: var(--bg-1); }
table.grid tr.dead td { opacity: 0.45; }
table.grid tr.closed td:not(:first-child) { color: var(--fg-dim); }
.ref { font-family: var(--mono); font-size: 12.5px; }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
  background: var(--bg-3); color: var(--fg-dim);
}
.pill.active, .pill.confirmed { background: #10291f; color: var(--ok); }
.pill.closed { background: var(--bg-3); color: var(--fg-faint); }
.pill.revoked, .pill.rejected { background: #2a1519; color: var(--danger); }
.pill.unconfirmed { background: #2a2313; color: var(--warn); }
.pill.local { background: #12283d; color: var(--accent); }

.empty {
  text-align: center; padding: 56px 20px;
  border: 1px dashed var(--line-2); border-radius: 10px; color: var(--fg-dim);
}
.empty.small { padding: 28px; }
.empty h2 { color: var(--fg); }
.empty p { max-width: 460px; margin: 0 auto; }

/* ------------------------------------------------------- engagement head */

.eng-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 32px; padding-bottom: 18px; margin-bottom: 4px;
}
.crumb { font-size: 12px; color: var(--fg-faint); margin-bottom: 6px; }
.crumb span { margin: 0 6px; }
.eng-head h1 { display: flex; align-items: center; gap: 10px; }
.sub { margin: 2px 0 0; color: var(--fg-dim); }
.eng-meta { font-size: 12px; color: var(--fg-dim); text-align: right; line-height: 1.9; }
.eng-meta .k {
  display: inline-block; min-width: 68px; text-align: right;
  margin-right: 8px; color: var(--fg-faint); text-transform: uppercase;
  font-size: 10px; letter-spacing: 0.6px;
}

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab {
  padding: 8px 14px; color: var(--fg-dim); font-size: 13px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--fg); text-decoration: none; }
.tab.on { color: var(--fg); border-bottom-color: var(--accent); }
.count {
  display: inline-block; margin-left: 5px; padding: 0 6px;
  background: var(--bg-3); border-radius: 10px;
  font-size: 11px; color: var(--fg-dim); font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- console */

.console-wrap { display: flex; flex-direction: column; height: calc(100vh - 260px); min-height: 420px; }
.transcript {
  flex: 1; overflow-y: auto; padding: 4px 4px 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.sys-note {
  background: var(--bg-1); border: 1px solid var(--line);
  border-left: 2px solid var(--accent-dim);
  border-radius: var(--r); padding: 12px 14px; font-size: 12.5px; color: var(--fg-dim);
}
.sys-note b { color: var(--fg); }
.msg { display: flex; flex-direction: column; gap: 4px; }
.msg-role {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--fg-faint); font-weight: 600;
}
.msg-body {
  white-space: pre-wrap; word-break: break-word;
  padding: 10px 14px; border-radius: var(--r);
  background: var(--bg-1); border: 1px solid var(--line);
}
.msg.user .msg-body { background: var(--bg-2); border-color: var(--line-2); }
.msg.assistant .msg-body { font-family: var(--mono); font-size: 12.5px; line-height: 1.65; }

.composer { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
.composer textarea { margin: 0; }
.composer-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.composer-actions .btn { margin-left: auto; }
.composer-actions .btn + .btn { margin-left: 0; }

/* --------------------------------------------------------------- timeline */

.note-form { display: flex; gap: 8px; margin-bottom: 4px; }
.note-form input { margin: 0; }
.timeline { list-style: none; margin: 18px 0 0; padding: 0; }
.entry { border-left: 2px solid var(--line-2); padding: 0 0 18px 16px; position: relative; }
.entry:last-child { padding-bottom: 0; }
.entry-head { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.dot {
  position: absolute; left: -5px; top: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--fg-faint); border: 2px solid var(--bg);
}
.dot.analyst { background: var(--accent); }
.dot.model { background: #a97bff; }
.dot.endpoint { background: var(--warn); }
.dot.system { background: var(--fg-faint); }
.entry-kind {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px;
  font-weight: 700; color: var(--fg-dim);
}
.entry-actor { color: var(--fg-faint); font-family: var(--mono); font-size: 11.5px; }
.entry time { margin-left: auto; color: var(--fg-faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.entry-summary { margin-top: 3px; }
.entry-body {
  margin: 8px 0 0; padding: 10px 12px; max-height: 320px; overflow: auto;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r);
  white-space: pre-wrap; word-break: break-word; color: #b9c8e0;
}
.entry-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; font-size: 11.5px; color: var(--fg-faint); }
.entry-meta b { color: var(--fg-dim); font-weight: 600; }

/* --------------------------------------------------------------- findings */

.adder { margin-bottom: 18px; }
.adder summary { display: inline-flex; list-style: none; }
.adder summary::-webkit-details-marker { display: none; }
.finding-form {
  margin-top: 14px; padding: 16px;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r);
}
.findings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.finding {
  padding: 14px 16px; border-radius: var(--r);
  background: var(--bg-1); border: 1px solid var(--line); border-left: 3px solid var(--line-2);
}
.finding.critical { border-left-color: var(--crit); }
.finding.high { border-left-color: var(--danger); }
.finding.medium { border-left-color: var(--warn); }
.finding.low { border-left-color: var(--accent-dim); }
.finding.rejected { opacity: 0.5; }
.finding-head { display: flex; align-items: center; gap: 10px; }
.finding p { margin: 8px 0; color: var(--fg-dim); }
.sev {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.7px;
  padding: 2px 7px; border-radius: 3px; background: var(--bg-3); color: var(--fg-dim);
}
.sev.critical { background: var(--crit); color: #1a0508; }
.sev.high { background: var(--danger); color: #1a0508; }
.sev.medium { background: var(--warn); color: #1c1503; }
.sev.low { background: var(--accent-dim); color: #04121f; }
.artifact { display: block; margin-top: 8px; padding: 7px 10px; word-break: break-all; }
.finding-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 10px; font-size: 12px;
}

/* --------------------------------------------------------------- endpoint */

.explain { max-width: 720px; margin-bottom: 22px; }
.explain p { color: var(--fg-dim); }
.token-form, .token-reveal {
  padding: 18px; border-radius: var(--r);
  background: var(--bg-1); border: 1px solid var(--line); margin-bottom: 24px;
}
.token-reveal { border-color: var(--accent-dim); background: #0d1926; }
.copy-row { display: flex; gap: 8px; align-items: stretch; margin: 10px 0; }
.copy-row pre {
  flex: 1; margin: 0; padding: 12px 14px; overflow-x: auto;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r);
  color: #9fe7c4; white-space: pre-wrap; word-break: break-all;
}
.ticks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ticks li { padding-left: 22px; position: relative; color: var(--fg-dim); }
.ticks li::before {
  content: ""; position: absolute; left: 4px; top: 7px;
  width: 5px; height: 9px; border: solid var(--ok); border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.ticks b { color: var(--fg); }

/* ------------------------------------------------------------ containment */

.tab-spacer { flex: 1; }
.tab.report { color: var(--fg-faint); font-size: 12.5px; }
.tab.report::after { content: " \2197"; font-size: 10px; }
.count.alert { background: var(--warn); color: #1c1503; font-weight: 700; }

.actions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.action {
  padding: 16px; border-radius: var(--r);
  background: var(--bg-1); border: 1px solid var(--line);
}
.action.proposed { border-left: 3px solid var(--warn); }
.action-head { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.action-meta { margin-top: 4px; font-size: 12px; color: var(--fg-faint); }
.action blockquote {
  margin: 10px 0; padding: 8px 12px;
  border-left: 2px solid var(--line-2); color: var(--fg-dim); font-size: 13px;
}
.decide { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.decide input { margin: 0; flex: 1; }

/* --------------------------------------------------------------- evidence */

.ev-source {
  padding: 14px 16px; margin-bottom: 12px; border-radius: var(--r);
  background: var(--bg-1); border: 1px solid var(--line);
}
.ev-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ev-stats { display: flex; gap: 20px; margin-top: 8px; font-size: 13px; color: var(--fg-dim); }
.ev-stats b { color: var(--fg); font-variant-numeric: tabular-nums; }
.gaps { margin-top: 10px; }
.gaps summary { cursor: pointer; color: var(--warn); font-size: 12.5px; }
.gaps pre {
  margin: 8px 0 0; padding: 10px 12px; max-height: 260px; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  color: #b9c8e0; white-space: pre-wrap;
}

@media (max-width: 720px) {
  .eng-head { flex-direction: column; gap: 12px; }
  .eng-meta { text-align: left; }
  .topnav { margin-left: 0; }
}

/* Engagement mode picker */
.mode-row { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--border, #2a2f3a); border-radius: 7px; overflow: hidden; }
.seg-btn { border: 0; background: transparent; color: inherit; padding: 4px 12px; font-size: 12px; cursor: pointer; border-left: 1px solid var(--border, #2a2f3a); }
.seg-btn:first-child { border-left: 0; }
.seg-btn:hover { background: rgba(127,127,127,0.12); }
.seg-btn.on { background: #3a4152; color: #fff; }
.seg-btn.m-offensive.on { background: #8a2f2f; }
.seg-btn.m-defensive.on { background: #2f5a8a; }
.mode-warn { margin: 10px 0 0; padding: 8px 12px; border-radius: 7px; background: #3a1f1f; color: #f0c9c0; border: 1px solid #6b2f2f; font-size: 13px; }
