:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --surface-1: #11141b;
  --surface-2: #171b24;
  --surface-3: #1e2330;
  --border: #232836;
  --border-strong: #323948;
  --text: #e8eaf0;
  --muted: #8b92a5;
  --accent: #ff8f5a;
  --accent-ink: #1a0e07;
  --ok: #4cc38a;
  --warn: #f0c05a;
  --error: #ef6b6b;
  --info: #8fb8ff;
  --violet: #b9a4ff;
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 20px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@media (max-width: 640px) { body { padding: 12px; } }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); font-size: 12px; }

.page { max-width: 1400px; margin: 0 auto; }

/* Page head */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
}
.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.subtitle { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 8px; }

/* Buttons and inputs */
button {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  min-height: 34px;
  padding: 7px 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
button:hover:not(:disabled) { background: var(--surface-3); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, white); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover:not(:disabled) { background: transparent; color: var(--text); }
button.sm { min-height: 28px; padding: 4px 10px; font-size: 12px; }
button.danger { color: var(--error); }

input, select {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  min-height: 34px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.field { display: grid; gap: 6px; }
.field label { font-size: 12px; font-weight: 500; color: var(--muted); }
.field select { width: 100%; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

/* Sign-in card */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.gate { max-width: 28rem; margin: 40px auto 0; }
.gate h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.gate-form { display: grid; gap: 12px; margin: 14px 0 10px; }
.gate-form button { justify-self: start; }

/* Azure DevOps banner; --tone is set by the warn or error class */
.banner {
  margin: 0 0 14px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  background: color-mix(in srgb, var(--tone) 10%, var(--surface-1));
  border: 1px solid color-mix(in srgb, var(--tone) 40%, transparent);
  border-radius: var(--radius);
}
.banner.warn { --tone: var(--warn); }
.banner.error { --tone: var(--error); }

/* Stat tiles */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stat {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-value.warn { color: var(--warn); }
.stat-value.error { color: var(--error); }
.stat-detail { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.toolbar input[type="search"] { min-width: 240px; flex: 1 1 240px; max-width: 360px; }

.segmented {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.segmented button {
  min-height: 32px;
  padding: 7px 11px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0;
}
.segmented button:hover:not(:disabled) { color: var(--text); background: transparent; }
.segmented button + button { border-left: 1px solid var(--border-strong); }
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }

.end { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.auto {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
}
.auto:hover { color: var(--text); }
.auto:focus-within { box-shadow: var(--focus-ring); }
.auto input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.auto .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.auto input:checked + .dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent);
}

.status { min-height: 1.2em; margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.status.error { color: var(--error); }

/* Table */
.table-wrap {
  overflow: auto;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
th {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--muted);
  background: var(--surface-2);
}
tbody tr:not(.history):not(.group):hover > td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
/* A fixed width, not just a cap: in an auto-layout table the column otherwise
   sizes to the widest visible row, so filtering to short-titled rows made every
   title wrap sooner. Fixed here, the width is the same under every filter. */
th.title, td.title { width: 26rem; min-width: 26rem; max-width: 26rem; }
th.expander, td.expander { width: 2rem; padding-right: 0; }
th.cost, td.cost { text-align: right; }
td.empty { padding: 24px 12px; text-align: center; color: var(--muted); }

/* Repository group header; the hover rule comes before .locked so locked wins */
tr.group > td {
  padding: 9px 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--border-strong);
  cursor: pointer;
}
tr.group:hover > td { background: var(--surface-3); }
tr.group.locked > td { cursor: default; background: var(--surface-2); }
.group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.group-name { font-size: 13px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.group-count { font-size: 12px; }
.group-cost {
  margin-left: auto;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.pr-id { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.pr-state { margin-top: 4px; }
.title-text { font-weight: 500; }
.sub { margin-top: 2px; font-size: 12px; color: var(--muted); }
.model { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.detail {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.detail.error { color: var(--error); }

td.cost {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
td.cost .tokens {
  max-width: 10rem;
  margin-left: auto;
  white-space: normal;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--muted);
}

td.checks { min-width: 9rem; max-width: 14rem; }
.checks-pills { display: flex; flex-wrap: wrap; gap: 4px; }

td.actions { text-align: right; white-space: nowrap; }

button.disclosure {
  min-height: 0;
  padding: 2px 4px;
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 0;
}
button.disclosure:hover:not(:disabled) { color: var(--text); background: transparent; }

/* Status pills; --tone is set by the tone-* class */
.tone-ok { --tone: var(--ok); }
.tone-warn { --tone: var(--warn); }
.tone-info { --tone: var(--info); }
.tone-error { --tone: var(--error); }
.tone-violet { --tone: var(--violet); }
.tone-neutral { --tone: var(--muted); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 12%, var(--surface-1));
  border: 1px solid transparent;
  border-radius: 999px;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill.tone-violet { background: color-mix(in srgb, var(--violet) 14%, var(--surface-1)); }
.pill-sm { height: 20px; padding: 0 7px; font-size: 11.5px; }

/* "More actions" menu */
.menu { position: relative; display: inline-block; margin-left: 4px; vertical-align: middle; }
.menu-trigger { min-width: 28px; padding: 4px 6px; font-size: 15px; line-height: 1; }
.menu-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 10;
  min-width: 200px;
  padding: 6px;
  text-align: left;
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.menu.open .menu-panel { display: block; }
.menu-label {
  padding: 6px 8px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  font-size: 13px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
}
.menu-item:hover:not(:disabled) { background: var(--surface-3); }
.menu-item.danger { color: var(--error); }
.menu-item[aria-current="true"] { opacity: 1; font-weight: 600; }
.menu-item[aria-current="true"]::after { content: "current"; font-size: 11px; font-weight: 400; color: var(--muted); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }

/* Revision history */
tr.history > td { padding: 4px 12px 14px; background: var(--bg); }
tr.history > td.history-lead { padding: 0; }
.timeline { margin: 0; padding: 0; list-style: none; border-left: 2px solid var(--border); }
.timeline li {
  position: relative;
  padding: 0 0 10px 14px;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  top: 5px;
  left: -5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tone, var(--border-strong));
}
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tl-meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* Retrigger dialog */
dialog {
  width: calc(100% - 32px);
  max-width: 34rem;
  padding: 20px;
  color: var(--text);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}
dialog[open] { display: grid; gap: 12px; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h2 { margin: 0; font-size: 15px; font-weight: 600; }
dialog p { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* Phones: Head and Updated stay hidden, Checks shows one pill and a count of
   the rest, and the age moves under the review state (see checksCell). */
.narrow-only { display: none; }

@media (max-width: 760px) {
  .hide-narrow { display: none; }
  .narrow-only { display: inline-flex; }
  .narrow-only.narrow-checks { display: block; margin-top: 6px; }
  .extra, .wide-only { display: none; }
  th.title, td.title { width: auto; min-width: 11rem; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
