/* Probe hub UI.
   The palette is the one of the promotional site, so the application reads as
   the same product. No inline style is used anywhere: the service serves a
   strict Content-Security-Policy. */

:root {
  --bg: #f7f8fa;
  --bg-alt: #eef1f5;
  --surface: #ffffff;
  --surface-alt: #f2f5f9;
  --text: #16202c;
  --muted: #566273;
  --line: #d9dee6;
  --accent: #0f7b6c;
  --accent-strong: #0a5c51;
  --accent-soft: #d9f0ec;
  --setup: #2563eb;
  --setup-strong: #1d4ed8;
  --monitor: #7c3aed;
  --monitor-strong: #6d28d9;
  --code-bg: #0f1720;
  --code-text: #d7e0ea;
  --ok: #0f7b6c;
  --low: #7a8699;
  --medium: #b7791f;
  --high: #d9603b;
  --critical: #c0392b;
  --add: #e7f6ec;
  --add-line: #1a7f37;
  --del: #fdecea;
  --del-line: #b42318;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(15, 23, 32, 0.08);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-alt: #121821;
    --surface: #161d27;
    --surface-alt: #1b2330;
    --text: #e6ebf1;
    --muted: #9aa6b5;
    --line: #273140;
    --accent: #3cc2ab;
    --accent-strong: #62d6c2;
    --accent-soft: #123a35;
    --setup: #3b82f6;
    --setup-strong: #2563eb;
    --monitor: #8b5cf6;
    --monitor-strong: #7c3aed;
    --ok: #3cc2ab;
    --low: #8b97a6;
    --medium: #e0b252;
    --high: #ff8f70;
    --critical: #ff6b5b;
    --add: #10281a;
    --add-line: #4ac26b;
    --del: #2c1618;
    --del-line: #ff7b72;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
code, pre, .mono { font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace; }
h1, h2, h3 { line-height: 1.25; }

.hidden { display: none !important; }

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand small { font-weight: 500; color: var(--muted); }
.spacer { flex: 1; }
.severity-picker { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.severity-picker input { width: 120px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.severity-picker output { min-width: 7ch; color: var(--text); }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; }
.who img { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); }

/* Buttons */
.btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 7px 14px;
  border-radius: 8px;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.quiet { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.quiet:hover { background: var(--surface-alt); color: var(--text); }
/* Onboarding actions get their own colors so they stand out in the repository
   list: blue to create the policy, violet to start monitoring commits. */
.btn.setup { background: var(--setup); border-color: var(--setup); }
.btn.setup:hover { background: var(--setup-strong); border-color: var(--setup-strong); }
.btn.monitor { background: var(--monitor); border-color: var(--monitor); }
.btn.monitor:hover { background: var(--monitor-strong); border-color: var(--monitor-strong); }
.btn.small { padding: 4px 10px; font-size: 0.8rem; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 18px;
  padding: 18px 20px 40px;
  align-items: start;
}
/* Like the commit tree, the repository panel stays under the top bar and its
   list scrolls on its own, independently of the report and the page. */
.repo-panel {
  position: sticky;
  top: var(--panel-top, 76px);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--panel-top, 76px) - 18px);
}
.repo-panel > * { flex: none; }
.repo-panel > .repo-list { flex: 1 1 auto; min-height: 0; max-height: none; overscroll-behavior: contain; }
/* On mobile the panels stack; a button at the top right of the repository
   and commit tree panels jumps to the next one. */
.jump-next { display: none; }
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .jump-next { display: inline-block; flex: none; min-width: 34px; font-size: 0.95rem; line-height: 1.2; }
  .repo-panel { position: static; max-height: none; }
  .repo-panel > .repo-list { max-height: 420px; }
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 0.95rem; }
.panel-body { padding: 14px; }

/* Repository list */
.search { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-size: 0.9rem; }
.repo-list { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 220px); overflow: auto; }
.repo {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: grid;
  gap: 4px;
}
.repo:hover { background: var(--surface-alt); }
.repo.active { background: var(--accent-soft); }
.repo-head { display: flex; align-items: center; gap: 8px; }
.repo-name { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-weight: 600; font-size: 0.9rem; word-break: break-all; }
.repo-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 0.78rem; }
.repo-actions { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.repo-actions .btn.small { padding: 2px 8px; font-size: 0.76rem; }

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
}
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.chip.warn { color: var(--tone, var(--medium)); border-color: color-mix(in srgb, var(--tone, var(--medium)) 45%, var(--line)); }
.chip.bad { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, var(--line)); }
.chip.busy { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

.sev-low { color: var(--low); }
.sev-medium { color: var(--medium); }
.sev-high { color: var(--high); }
.sev-critical { color: var(--critical); }

/* A review verdict is tinted by the most severe alert of its report. */
.tone-low { --tone: var(--low); }
.tone-medium { --tone: var(--medium); }
.tone-high { --tone: var(--high); }
.tone-critical { --tone: var(--critical); }

/* Report */
.report-head { display: grid; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.report-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.report-title h2 { margin: 0; font-size: 1.05rem; }
.report-commit-line { display: flex; align-items: center; gap: 10px; }
.report-commit-line .btn { flex: none; }
.report-commit { flex: 1; min-width: 0; margin: 0; font-size: 1.15rem; font-weight: 600; overflow-wrap: anywhere; }
.report-sub { margin: 0; color: var(--muted); font-size: 0.85rem; word-break: break-word; }
/* Keep the author, age and trigger line tucked right under the commit label. */
.report-commit-line + .report-sub { margin-top: -8px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  min-width: 92px;
}
.stat b { display: block; font-size: 1.05rem; }
.stat span { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; }

.verdict { padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; border: 1px solid; }
.verdict.clear { color: var(--ok); border-color: var(--ok); background: var(--accent-soft); }
.verdict.review { color: var(--tone, var(--medium)); border-color: var(--tone, var(--medium)); }
.verdict.blocked { color: var(--critical); border-color: var(--critical); }
.verdict.failed { color: var(--muted); border-color: var(--line); }
.verdict.below-threshold { color: var(--muted); border-color: var(--line); border-style: dashed; }
.chip.below-threshold { color: var(--muted); border-style: dashed; }

/* Repository information: pending actions */
.notice {
  margin: 0 14px 10px;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--medium) 45%, var(--line));
  border-radius: 8px;
  color: var(--medium);
  font-size: 0.82rem;
}
.repo-info { display: grid; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.repo-info .notice { margin: 0; }

/* Severity filter */
.filters { display: grid; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-alt); }
.filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-row label { font-size: 0.82rem; color: var(--muted); }
.kinds { display: flex; gap: 6px; flex-wrap: wrap; }
.kinds button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 3px 11px; font: inherit; font-size: 0.78rem; cursor: pointer; }
.kinds button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* Alerts */
.alerts { list-style: none; margin: 0; padding: 0; }
.alert { border-bottom: 1px solid var(--line); }
.alert-head {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 11px 14px;
  background: transparent;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.alert-head:hover { background: var(--surface-alt); }
/* Centre the dot on the first title line, whatever the title wraps to. */
.alert-head > .dot { margin-top: calc((0.9rem * 1.4 - 8px) / 2); }
.alert-title { font-weight: 600; font-size: 0.9rem; line-height: 1.4; }
.alert-where { color: var(--muted); font-size: 0.78rem; word-break: break-all; }
.alert-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.alert-body { padding: 0 14px 14px 36px; display: grid; gap: 12px; }
.alert-detail { white-space: pre-wrap; background: var(--surface-alt); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 0.83rem; max-height: 320px; overflow: auto; }
.evidence { border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 0.83rem; display: grid; gap: 6px; }

/* The AI reviewer's reading and summary: model output, set apart from evidence. */
.ai-reading, .reviewer-summary { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px; font-size: 0.85rem; display: grid; gap: 4px; background: var(--accent-soft); }
.ai-reading p, .reviewer-summary p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.reviewer-summary { margin-top: 4px; }
.chip.lowered { color: var(--muted); border-style: dashed; text-decoration: line-through; }
.dismissed { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.dismissed > summary { cursor: pointer; font-weight: 600; font-size: 0.85rem; }
.dismissed > .note { margin: 6px 0; }

/* Diff */
.diff { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.diff-file { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--surface-alt); border-bottom: 1px solid var(--line); font-size: 0.82rem; }
.diff-file .path { font-weight: 600; word-break: break-all; }
.diff .diff-note { margin: 0; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.diff pre { margin: 0; overflow: auto; max-height: 460px; background: var(--surface); }
.diff table { border-collapse: collapse; width: 100%; font-size: 0.8rem; }
.diff td { padding: 0 8px; vertical-align: top; white-space: pre-wrap; word-break: break-word; }
.diff td.num { width: 1%; text-align: right; color: var(--muted); user-select: none; white-space: nowrap; border-right: 1px solid var(--line); }
.diff tr.add td { background: var(--add); }
.diff tr.add td.sign { color: var(--add-line); }
.diff tr.del td { background: var(--del); }
.diff tr.del td.sign { color: var(--del-line); }
.diff tr.focus td { outline: 2px solid var(--accent); outline-offset: -2px; }
.diff td.sign { width: 1%; user-select: none; }
.hunk-header td { background: var(--surface-alt); color: var(--muted); font-size: 0.76rem; }

/* Misc */
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  gap: 8px;
  max-width: 380px;
}
.toast div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  font-size: 0.86rem;
}
.toast div.error { border-left-color: var(--critical); }
.note { color: var(--muted); font-size: 0.8rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select, .select {
  padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 0.85rem;
}

/* Modal */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(8, 12, 18, 0.55); padding: 20px; }
.modal-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); width: min(720px, 100%); max-height: 86vh; overflow: auto; box-shadow: var(--shadow); }
.modal-card header { display: flex; align-items: center; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.modal-card header h3 { margin: 0; font-size: 1rem; }
.modal-card .body { padding: 14px; display: grid; gap: 12px; }
.modal-card footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px; border-top: 1px solid var(--line); }
.report-dialog { width: min(1100px, calc(100% - 40px)); padding: 0; color: var(--text); }
.report-dialog::backdrop { background: rgba(8, 12, 18, 0.55); }
.report-dialog > header { position: sticky; top: 0; z-index: 1; background: var(--surface); }
pre.policy { margin: 0; background: var(--code-bg); color: var(--code-text); padding: 12px; border-radius: 8px; overflow: auto; max-height: 40vh; font-size: 0.8rem; }

/* Sign-in page */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin-card { width: min(520px, 100%); text-align: center; padding: 32px; }
.signin-card h1 { margin: 6px 0 6px; font-size: 1.6rem; }
.signin-card p { color: var(--muted); }
.signin-actions { display: grid; gap: 10px; margin-top: 20px; }
.signin-actions a { display: block; text-decoration: none; text-align: center; padding: 12px; border-radius: 10px; border: 1px solid var(--line); color: var(--text); font-weight: 600; }
.signin-actions a:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.legal { margin-top: 22px; font-size: 0.78rem; color: var(--muted); }
.error-box { border: 1px solid var(--critical); color: var(--critical); border-radius: 8px; padding: 10px; margin-bottom: 14px; font-size: 0.86rem; }

/* Branch topology and the two independently cached analysis modes. */
.workspace { display: flex; align-items: flex-start; }
.commit-column {
  position: sticky;
  top: var(--panel-top, 58px);
  align-self: flex-start;
  flex: 0 0 var(--commit-column-width, 340px);
  min-width: 0;
  padding: 10px;
  border-right: 1px solid var(--line);
}
/* Draggable separator between the commit tree and the report. */
.splitter {
  position: sticky;
  top: var(--panel-top, 58px);
  align-self: stretch;
  flex: none;
  width: 8px;
  margin-left: -4px;
  margin-right: -4px;
  z-index: 1;
  cursor: col-resize;
  touch-action: none;
}
.splitter::after { content: ""; position: absolute; inset: 0 3px; border-radius: 2px; background: transparent; transition: background .15s; }
.splitter:hover::after, .splitter:focus-visible::after, .splitter.dragging::after { background: var(--accent); }
.splitter:focus-visible { outline: none; }
body.resizing { cursor: col-resize; user-select: none; }
.commit-column h3 { margin: 0; font-size: 0.92rem; }
.commit-column .note { margin: 6px 0; }
.report-pane { flex: 1; min-width: 0; }
.commit-tree { display: flex; overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); border-radius: 8px; }
.graph-lines { flex: none; }
.graph-edge { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: .65; }
.graph-edge.boundary { stroke-dasharray: 3 3; }
.graph-node { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.graph-node.selected { fill: var(--accent); }
.commit-rows { flex: 1; min-width: 0; }
.commit-row { height: 56px; padding: 6px 8px; line-height: 1.4; border-bottom: 1px solid var(--line); overflow: hidden; }
.commit-row:hover { background: var(--surface-alt); }
.commit-row.selected { background: var(--accent-soft); }
.commit-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.commit-open { flex: 1; min-width: 0; padding: 0; border: 0; color: var(--text); background: transparent; font: inherit; font-size: 0.86rem; font-weight: 600; text-align: left; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chip.branch { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; color: var(--accent); border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.commit-meta { flex-wrap: nowrap; gap: 4px; overflow: hidden; margin-top: 3px; }
.commit-meta .chip { font-size: 0.7rem; padding: 0 6px; }
.commit-meta .note { white-space: nowrap; font-size: 0.72rem; }
.branch-list { gap: 4px; margin-bottom: 8px; max-height: 84px; overflow: auto; }
@media (max-width: 1180px) {
  .workspace { flex-direction: column; align-items: stretch; }
  .commit-column { position: static; flex: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .splitter { display: none; }
  .commit-tree { max-height: 420px; }
}
.chip.unknown { color: var(--muted); background: var(--bg-alt); border: 1px solid var(--line); }
.comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.comparison-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow-wrap: anywhere; }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.card-head h3 { margin: 0; }
.card-head .note { margin: 0; }
.comparison-card > .note { margin: 6px 0 0; }
.comparison-card > .row { margin-top: 8px; }
#plan-intent { display: block; width: 100%; resize: vertical; }
.plan-intent-field { margin: 8px 0; }
#plan-result pre { max-height: 500px; overflow: auto; }
@media (max-width: 700px) {
  .comparison { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px; }
  .layout { padding: 12px 10px 30px; }
}

.activity-row { padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.activity-row .row { flex-wrap: wrap; }
.activity-row p { margin: 6px 0; }
.activity-error { white-space: pre-wrap; }
