/* Fleet Desk console. Hand-written, no build step: the Worker serves these
   three files as static assets, so there is nothing to compile on demo day. */
:root {
  --bg: #0d1117;
  --bg-elev: #151b23;
  --bg-elev-2: #1c242e;
  --line: #263039;
  --line-soft: #1e262e;
  --fg: #e6edf3;
  --fg-dim: #9aa7b4;
  --fg-faint: #8b98a6;   /* was #6b7784: 3.79:1 on cards, under AA */
  --accent: #4a9eff;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --violet: #a371f7;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--sans);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }

/* ---- replay banner: must be impossible to mistake for live ---- */
#banner-root .banner {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; font-weight: 650; letter-spacing: .04em;
  font-size: 13.5px; text-transform: uppercase;
}
#banner-root .banner.replay { background: repeating-linear-gradient(45deg,#4a3200,#4a3200 12px,#5a3d00 12px,#5a3d00 24px); color: #ffd479; border-bottom: 1px solid #7a5400; }
#banner-root .banner.dry { background: #2b1d3d; color: #c9a6ff; border-bottom: 1px solid #4b3268; }
#banner-root .banner b { font-weight: 800; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 28px;
  padding: 12px 20px; background: var(--bg-elev); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 210px; }
.mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.brand-name { font-weight: 680; font-size: 15px; letter-spacing: -.01em; }
.brand-sub { color: var(--fg-faint); font-size: 12.5px; font-family: var(--mono); }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  background: transparent; border: 1px solid transparent; color: var(--fg-dim);
  padding: 6px 13px; border-radius: 7px; font-weight: 550;
}
.tab:hover { color: var(--fg); background: var(--bg-elev-2); }
.tab.is-active { color: var(--fg); background: var(--bg-elev-2); border-color: var(--line); }
.tab .count { color: var(--warn); font-family: var(--mono); font-size: 12.5px; }
.live { display: flex; align-items: center; gap: 7px; color: var(--fg-faint); font-size: 12.5px; font-family: var(--mono); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(63,185,80,.15); }
.dot.stale { background: var(--warn); box-shadow: 0 0 0 3px rgba(210,153,34,.15); }
.dot.dead { background: var(--bad); box-shadow: 0 0 0 3px rgba(248,81,73,.15); }

/* ---- metrics strip ---- */
.metrics {
  display: grid; grid-template-columns: repeat(6, 1fr);
  border-bottom: 1px solid var(--line);
}
.metric { background: var(--bg); padding: 15px 18px; }
/* A drawn divider on each tile after the first, instead of the usual 1px-gap
   trick: a fractional grid width rounds those gaps unevenly, which shows up as
   one seam brighter than the others on a projector. */
.metric + .metric { border-left: 1px solid var(--line-soft); }
.metric-label { color: var(--fg-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.metric-value { font-size: 23px; font-weight: 660; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.metric-value.small { font-size: 15px; font-weight: 600; padding-top: 6px; }
.metric-sub { color: var(--fg-faint); font-size: 12px; margin-top: 1px; }
.metric-value.ok { color: var(--ok); } .metric-value.warn { color: var(--warn); } .metric-value.bad { color: var(--bad); }

/* ---- layout ---- */
main { padding: 0; }
.split { display: grid; grid-template-columns: 372px 1fr; min-height: calc(100vh - 122px); }
.pane { background: var(--bg); }
.list-pane { border-right: 1px solid var(--line); }
.pane-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 15px 20px 11px; border-bottom: 1px solid var(--line-soft);
}
.pane-head h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--fg-dim); font-weight: 640; }
.hint { color: var(--fg-faint); font-size: 12.5px; }

/* ---- ticket list ---- */
.ticket-list { overflow-y: auto; max-height: calc(100vh - 170px); }
.ticket-item {
  display: block; width: 100%; text-align: left; background: transparent;
  border: 0; border-bottom: 1px solid var(--line-soft); border-left: 2px solid transparent;
  padding: 12px 18px; color: var(--fg);
}
.ticket-item:hover { background: var(--bg-elev); }
.ticket-item.is-active { background: var(--bg-elev); border-left-color: var(--accent); }
.ticket-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.ticket-num { font-family: var(--mono); font-size: 12px; color: var(--fg-faint); }
.ticket-req { font-weight: 570; font-size: 13.5px; margin: 3px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-meta { color: var(--fg-faint); font-size: 12.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 7px; border-radius: 20px; white-space: nowrap;
}
.pill.agent_working { background: rgba(74,158,255,.14); color: #79b8ff; }
.pill.awaiting_info { background: rgba(210,153,34,.15); color: #e3b341; }
.pill.needs_approval { background: rgba(163,113,247,.16); color: #c9a6ff; }
.pill.resolved { background: rgba(63,185,80,.14); color: #56d364; }
.pill.escalated { background: rgba(248,81,73,.14); color: #ff7b72; }
.pill.replay { background: rgba(210,153,34,.2); color: #ffd479; border: 1px dashed #7a5400; }

/* ---- detail ---- */
.detail-pane { padding: 0; overflow-y: auto; max-height: calc(100vh - 122px); }
#detail { padding: 20px 26px 60px; }
.detail-head { border-bottom: 1px solid var(--line-soft); padding-bottom: 14px; margin-bottom: 16px; }
.detail-title { font-size: 17px; font-weight: 640; letter-spacing: -.01em; margin: 6px 0 4px; }
.detail-sub { color: var(--fg-faint); font-size: 13px; font-family: var(--mono); display: flex; gap: 12px; flex-wrap: wrap; }
.why {
  margin: 14px 0 4px; padding: 11px 14px; background: var(--bg-elev);
  border-left: 2px solid var(--accent); border-radius: 0 6px 6px 0; font-size: 13px;
}
.why-label { color: var(--fg-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 650; margin-bottom: 3px; }

.timeline { position: relative; margin-top: 20px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px;
  width: 1px; background: var(--line);
}
.ev { position: relative; padding: 0 0 15px 30px; }
.ev-dot {
  position: absolute; left: 3px; top: 5px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--fg-faint);
}
.ev.kind-tool_call .ev-dot, .ev.kind-investigation .ev-dot { border-color: var(--accent); }
.ev.kind-decision .ev-dot, .ev.kind-policy .ev-dot { border-color: var(--violet); }
.ev.kind-action .ev-dot, .ev.kind-write .ev-dot { border-color: var(--warn); }
.ev.kind-verification .ev-dot { border-color: var(--ok); }
.ev.kind-escalation .ev-dot, .ev.kind-error .ev-dot { border-color: var(--bad); }
.ev-time { color: var(--fg-faint); font-family: var(--mono); font-size: 11.5px; }
.ev-title { font-weight: 570; font-size: 13px; margin: 1px 0 2px; }
.ev-body { color: var(--fg-dim); font-size: 13.5px; white-space: pre-wrap; }
.ev.kind-verification .ev-body { color: #7ee787; }
.ev.kind-escalation .ev-body { color: #ffa198; }

.runs { margin-top: 26px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--fg-dim); font-weight: 650; margin: 0 0 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--fg-faint); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding: 5px 9px; border-bottom: 1px solid var(--line); }
td { padding: 6px 9px; border-bottom: 1px solid var(--line-soft); color: var(--fg-dim); font-family: var(--mono); font-size: 12.5px; }
td.wrap { font-family: var(--sans); font-size: 13px; }
td.ok { color: #56d364; } td.bad { color: #ff7b72; } td.warn { color: #e3b341; }

/* ---- empty states ---- */
.empty {
  padding: 62px 40px; text-align: center; max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column; justify-content: center;
  min-height: calc(100vh - 200px);
}
.empty-title { font-weight: 620; font-size: 15px; margin: 0 0 7px; }
.empty-body { color: var(--fg-faint); font-size: 14px; margin: 0; }
.empty-glyph {
  width: 44px; height: 44px; margin: 0 auto 16px; border-radius: 11px;
  border: 1px dashed var(--line); display: grid; place-items: center;
  color: var(--fg-faint); font-size: 19px;
}
.empty-glyph.is-done { border-style: solid; border-color: var(--line); color: var(--ok); }
.empty-glyph svg { display: block; }
.pane > #approvals-body, .pane > #audit-body, .pane > #settings-body { padding: 0 20px 60px; }

/* ---- approvals / cards ---- */
.card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 9px;
  padding: 14px 16px; margin: 12px 0;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-title { font-weight: 600; font-size: 13.5px; }
.card-body { color: var(--fg-dim); font-size: 13.5px; margin-top: 5px; }
.card-meta { color: var(--fg-faint); font-size: 12px; font-family: var(--mono); margin-top: 8px; display: flex; gap: 14px; flex-wrap: wrap; }
.reason-list { margin: 7px 0 0; padding-left: 17px; color: var(--fg-dim); font-size: 13px; }
.chip { display: inline-block; background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 7px; font-family: var(--mono); font-size: 12px; color: var(--fg-dim); margin: 2px 4px 2px 0; }
.chip.priv { border-color: #6b3d3d; color: #ff9b95; background: rgba(248,81,73,.08); }
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 4px 16px; font-size: 13.5px; margin-top: 10px; }
.kv dt { color: var(--fg-faint); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--fg-dim); }
.code-block { background: #0a0e13; border: 1px solid var(--line); border-radius: 7px; padding: 12px 14px; font-family: var(--mono); font-size: 12.5px; color: var(--fg-dim); overflow-x: auto; white-space: pre; margin-top: 10px; }
.flash { animation: flash 1.1s ease-out; }
@keyframes flash { from { background: rgba(74,158,255,.18); } to { background: transparent; } }
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .split { grid-template-columns: 300px 1fr; }
}

/* ---- audit: history retained from an earlier run ---- */
/* The audit log is append-only, so a demo reset clears tickets but not their
   audit entries. These rows are labelled rather than hidden, because silently
   dropping them would be the same lie in the other direction. */
.audit-note {
  color: var(--fg-dim); font-size: 13.5px; line-height: 1.55;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 6px; padding: 10px 14px; margin: 0 0 14px;
}
tr.is-prior-run td { color: var(--fg-faint); }
tr.is-prior-run .prior-run {
  color: var(--warn); font-family: var(--mono); font-size: 13px;
  letter-spacing: .04em; text-transform: uppercase;
}
