/* ═══════════════════════════════════════════════════════════════════════════
   Vantage design system
   Colours are defined once with light-dark(): the active scheme comes from
   color-scheme, which follows the OS unless the user picked a theme
   (html[data-theme], set by /static/theme.js before first paint).
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/static/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url("/static/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
}

:root {
  color-scheme: light dark;

  --bg: light-dark(#f7f7f9, #0b0b0f);
  --surface: light-dark(#ffffff, #131318);
  --surface-2: light-dark(#f4f4f7, #1a1a21);
  --surface-3: light-dark(#ececf1, #23232c);
  --sidebar: light-dark(#fbfbfc, #0f0f14);
  --border: light-dark(#e6e6ec, #25252e);
  --border-strong: light-dark(#d5d5de, #343440);
  --text: light-dark(#17171c, #ececf1);
  --text-muted: light-dark(#5f5f6c, #a0a0ad);
  --text-subtle: light-dark(#8e8e9a, #6f6f7c);

  --accent: light-dark(#7c3aed, #a78bfa);
  --accent-hover: light-dark(#6d28d9, #c4b5fd);
  --accent-soft: light-dark(#f4eeff, #211a36);
  --accent-border: light-dark(#ddd0fb, #3d3166);
  --on-accent: light-dark(#ffffff, #130d22);

  --ok: light-dark(#15803d, #4ade80);
  --ok-strong: light-dark(#16a34a, #22c55e);
  --ok-soft: light-dark(#ecfdf3, #0d2619);
  --ok-border: light-dark(#bbf0cf, #1b4a30);
  --warn: light-dark(#b45309, #fbbf24);
  --warn-strong: light-dark(#d97706, #f59e0b);
  --warn-soft: light-dark(#fff7e6, #2a1f08);
  --warn-border: light-dark(#fbdca0, #594112);
  --bad: light-dark(#c81e1e, #f87171);
  --bad-strong: light-dark(#dc2626, #ef4444);
  --bad-soft: light-dark(#fef1f1, #2c1213);
  --bad-border: light-dark(#f8c6c6, #5e2224);
  --info: light-dark(#1d4ed8, #7cb0ff);
  --info-soft: light-dark(#eef4ff, #111d36);
  --info-border: light-dark(#c9dbff, #23386a);
  --idle: light-dark(#6b6b76, #a1a1ab);
  --idle-soft: light-dark(#f1f1f4, #1d1d24);

  --code-bg: light-dark(#f6f6f9, #0f0f14);
  --focus: light-dark(rgb(124 58 237 / 28%), rgb(167 139 250 / 35%));
  --shadow-color: light-dark(rgb(17 17 26 / 7%), rgb(0 0 0 / 45%));
  --shadow-sm: 0 1px 2px var(--shadow-color);
  --shadow-md: 0 1px 2px var(--shadow-color), 0 6px 16px -4px var(--shadow-color);
  --shadow-lg: 0 10px 38px -10px var(--shadow-color), 0 10px 20px -15px var(--shadow-color);

  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 7px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sidebar-w: 256px;
  --logo-a: light-dark(#3b0764, #7c3aed);
  --logo-b: light-dark(#7c3aed, #a78bfa);
  --logo-c: light-dark(#c4b5fd, #ede9fe);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -0.011em; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13.5px; font-weight: 600; }
p { margin: 0 0 8px; }
p:last-child { margin-bottom: 0; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 12px;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  line-height: 1.5;
}
::selection { background: var(--accent-soft); color: var(--text); }
.icon { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; }
.icon.sm { width: 14px; height: 14px; vertical-align: -2px; }
.icon.lg { width: 20px; height: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── App shell ─────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  background: linear-gradient(to right, var(--sidebar) var(--sidebar-w), transparent var(--sidebar-w));
}
.nav-toggle { display: none; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 14px 12px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: var(--text); }
.sb-brand:hover { color: var(--text); }
.logo { width: 28px; height: 28px; display: grid; place-items: center; flex: none; }
.logo svg { width: 26px; height: 26px; overflow: visible; }
.logo .facet-a { fill: var(--logo-a); }
.logo .facet-b { fill: var(--logo-b); }
.logo .facet-c { fill: var(--logo-c); }
.sb-brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.sb-brand-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  padding: 0 6px;
  line-height: 18px;
}
.sb-section + .sb-section { margin-top: 18px; }
.sb-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-subtle);
  padding: 0 10px 6px;
  letter-spacing: 0.02em;
}
.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.3;
  min-width: 0;
}
.sb-link:hover { background: var(--surface-2); color: var(--text); }
.sb-link.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.sb-link.active .icon { color: var(--accent); }
.sb-link .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-count {
  font-size: 11.5px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  border-radius: 999px;
  padding: 0 6px;
  line-height: 18px;
  background: var(--surface-3);
  color: var(--text-muted);
}
.sb-count.bad { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad-border); }
/* Disclosure chevron: a <span class="chev"> inside a <summary> turns when its <details> opens. */
summary .chev { display: inline-flex; color: var(--text-subtle); transition: transform 0.15s ease; }
details[open] > summary .chev { transform: rotate(90deg); }
.sb-spacer { flex: 1; min-height: 16px; }
.sb-footer { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }

.theme-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.theme-switch button {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

.user-card { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); min-width: 0; }
.user-card:hover { background: var(--surface-2); }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 650;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  flex: none;
}
.user-card .who { min-width: 0; flex: 1; line-height: 1.25; }
.user-card .who strong { display: block; color: var(--text); font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .who span { display: block; color: var(--text-subtle); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card form { margin: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 36px 72px; }

/* ── Project switcher ──────────────────────────────────────────────────── */
.switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  margin: 0 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.switcher:hover { border-color: var(--accent-border); color: var(--text); }
.switcher > .icon { color: var(--text-subtle); transform: rotate(90deg); }
.switcher-label { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.switcher-label strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-org-label { font-size: 11.5px; color: var(--text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: none;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}
.switcher-dialog {
  width: min(560px, calc(100vw - 32px));
  margin: 12vh auto auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.switcher-dialog::backdrop { background: rgb(10 8 20 / 40%); backdrop-filter: blur(2px); }
.switcher-dialog[open] { animation: toast-in 0.15s ease-out; }
.switcher-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border); }
.switcher-head > .icon { color: var(--text-subtle); }
.switcher-head input[type="search"] { border: 0; box-shadow: none; padding: 6px 0; font-size: 15px; background: transparent; min-height: 0; }
.switcher-head input[type="search"]:focus { box-shadow: none; }
.switcher-body { max-height: min(60vh, 520px); overflow-y: auto; padding: 8px; }
.switcher-org + .switcher-org, .switcher-all + .switcher-org { margin-top: 8px; }
.switcher-org-name { display: flex; align-items: center; gap: 6px; padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-subtle); }
.switcher-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); }
.switcher-item:hover, .switcher-item:focus-visible { background: var(--surface-2); color: var(--text); }
.switcher-item.current { background: var(--accent-soft); }
.switcher-item > .icon { color: var(--accent); }
.switcher-name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-envs { display: flex; gap: 4px; }
.switcher-empty { padding: 16px; text-align: center; color: var(--text-subtle); }
.project-title .btn { margin-left: auto; }

/* ── Page header ───────────────────────────────────────────────────────── */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--text-subtle); font-size: 13px; margin-bottom: 10px; }
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--text-subtle); opacity: 0.7; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-muted); margin-top: 6px; max-width: 70ch; }
.page-head .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.head-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--accent);
  flex: none;
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card + .card, .stack > * + * { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-head > div:first-child { min-width: 0; max-width: 100%; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head .desc { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-body.flush > .table-wrap:first-child table thead th:first-child { border-top-left-radius: 0; }
.card.inset { background: var(--surface-2); box-shadow: none; }

.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-tiles { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack-sm > * + * { margin-top: 8px; }

/* ── Stats ─────────────────────────────────────────────────────────────── */
.stat { padding: 16px 18px; }
.stat-label { display: flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.stat-label .icon { color: var(--text-subtle); }
.stat-value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-hint { color: var(--text-subtle); font-size: 12.5px; margin-top: 4px; }

/* ── Status banner ─────────────────────────────────────────────────────── */
.banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.banner .banner-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.banner strong { display: block; font-size: 15px; }
.banner span.muted { font-size: 13px; }
.banner.ok { background: var(--ok-soft); border-color: var(--ok-border); }
.banner.ok .banner-icon { background: var(--ok-strong); color: #fff; }
.banner.bad { background: var(--bad-soft); border-color: var(--bad-border); }
.banner.bad .banner-icon { background: var(--bad-strong); color: #fff; }
.banner.warn { background: var(--warn-soft); border-color: var(--warn-border); }
.banner.warn .banner-icon { background: var(--warn-strong); color: #fff; }
.banner.info { background: var(--info-soft); border-color: var(--info-border); }
.banner.info .banner-icon { background: var(--info); color: #fff; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
td { font-size: 13.5px; }
th {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  white-space: nowrap;
  padding-top: 8px;
  padding-bottom: 8px;
}
.card-body.flush > .table-wrap:first-child thead th:first-child { border-top-left-radius: var(--radius-lg); }
.card-body.flush > .table-wrap:first-child thead th:last-child { border-top-right-radius: var(--radius-lg); }
.card-head + .card-body.flush > .table-wrap:first-child thead th { border-radius: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td a { font-weight: 500; }
.cell-title { font-weight: 550; color: var(--text); }
.link-quiet { color: var(--text); }
.link-quiet:hover { color: var(--accent); }
.row-inline { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.row-inline .icon { color: var(--text-subtle); }
.filter-bar { margin-bottom: 14px; }
/* One search input with its button, side by side (admin audit filter). */
.search-row { display: flex; align-items: center; gap: 8px; }
.search-row input[type="search"] { width: 320px; flex: 0 1 auto; min-width: 0; }
.audit-detail { min-width: 280px; max-width: 520px; overflow-wrap: anywhere; }
.seg-count { color: var(--text-subtle); font-weight: 500; margin-left: 2px; }
.btn.active .seg-count { color: inherit; }
.cell-sub { display: block; color: var(--text-subtle); font-size: 12.5px; margin-top: 2px; }
.user-cell { display: flex; align-items: center; gap: 12px; color: var(--text); }
.user-cell:hover .cell-title { color: var(--accent); }
.avatar.sm { width: 32px; height: 32px; font-size: 11.5px; }

/* ── Badges, dots ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  line-height: 19px;
  white-space: nowrap;
  background: var(--idle-soft);
  color: var(--idle);
  border: 1px solid var(--border);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-border); }
.badge.info { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; position: relative; }
.dot.ok { color: var(--ok-strong); }
.dot.bad { color: var(--bad-strong); }
.dot.warn { color: var(--warn-strong); }
.dot.idle { color: var(--text-subtle); }
.badge.bad .dot::after, .dot.bad.pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
  animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping {
  0% { transform: scale(0.6); opacity: 0.55; }
  80%, 100% { transform: scale(1.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .badge.bad .dot::after, .dot.bad.pulse::after { animation: none; }
}

/* ── Empty states ──────────────────────────────────────────────────────── */
.empty { padding: 40px 20px; text-align: center; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-subtle);
  margin-bottom: 6px;
}
.empty h3 { color: var(--text); font-size: 14.5px; }
.empty > div:last-child { max-width: 48ch; }
.empty .btn { margin-top: 8px; }

/* ── Toasts (flash messages) ───────────────────────────────────────────── */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  animation: toast-in 0.25s ease-out;
  word-break: break-word;
}
.toast .icon { margin-top: 1px; }
.toast.ok .icon { color: var(--ok-strong); }
.toast.bad { border-color: var(--bad-border); }
.toast.bad .icon { color: var(--bad-strong); }
.toast.info .icon { color: var(--info); }
.toast .toast-text { flex: 1; }
.toast-close { border: 0; background: none; color: var(--text-subtle); cursor: pointer; padding: 0; line-height: 0; }
.toast-close:hover { color: var(--text); }
/* Success and info messages leave on their own; errors stay until dismissed. */
.toast.ok, .toast.info { animation: toast-in 0.25s ease-out, toast-out 0.3s ease-in 7s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .toast, .toast.ok, .toast.info { animation: none; } }

.flash { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.flash.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-border); }
.flash.info { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }

.secret {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--accent-soft);
  border: 1px dashed var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  word-break: break-all;
  user-select: all;
  color: var(--text);
}

.secret-row { display: flex; gap: 8px; align-items: stretch; }
.secret-row .secret { flex: 1; min-width: 0; }
.secret-row .btn { height: auto; }

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 6px 6px 0 0;
}
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs a.active .icon { color: var(--accent); }
.tabs a .icon { color: var(--text-subtle); }

/* ── Forms ─────────────────────────────────────────────────────────────── */
form.stack > * + * { margin-top: 14px; }
/* A hidden first field (the username hint for password managers) must not push the visible fields down. */
form.stack > [hidden]:first-child + * { margin-top: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-weight: 550; font-size: 13px; color: var(--text); }
.field .hint { color: var(--text-subtle); font-size: 12.5px; }
.fields { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); align-items: start; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"],
input[type="search"], input[type="datetime-local"], input[type="date"], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  min-height: 36px;
  width: 100%;
  min-width: 0;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-subtle); cursor: not-allowed; }
select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}
textarea { min-height: 96px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
button:focus-visible, a:focus-visible, summary:focus-visible, .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); border-radius: var(--radius-sm); }
.check { display: flex; width: fit-content; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.row > .check { display: inline-flex; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
input.code-input { font-family: var(--mono); font-size: 22px; letter-spacing: 0.35em; text-align: center; min-height: 48px; }

.btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn .icon { color: var(--text-muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgb(76 29 149 / 25%), inset 0 1px 0 rgb(255 255 255 / 12%); }
.btn.primary .icon { color: currentColor; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.danger .icon { color: currentColor; }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad-border); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; gap: 5px; }
.btn.icon-only { width: 34px; padding: 0; }
.btn.small.icon-only { width: 28px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; height: auto; font-weight: 500; box-shadow: none; }
.btn.link:hover { text-decoration: underline; background: none; }
.btn.block { width: 100%; height: 40px; }
.inline-form { display: inline; margin: 0; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: nowrap; align-items: center; }
details.disclosure > summary { cursor: pointer; color: var(--accent); font-weight: 550; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure[open] > summary { margin-bottom: 12px; }
details.disclosure > summary.btn { color: var(--text); }
details.disclosure > summary.btn.danger { color: var(--bad); }
.confirm-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--bad-border); background: var(--bad-soft); border-radius: var(--radius-sm); }

/* ── Status colours & charts ───────────────────────────────────────────── */
.status-ok { color: var(--ok); }
.status-warn { color: var(--warn); }
.status-bad { color: var(--bad); }
.status-idle { color: var(--idle); }
.bars { display: block; width: 100%; height: 26px; }
.bars rect.ok { fill: var(--ok-strong); }
.bars rect.bad { fill: var(--bad-strong); }
.bars rect.warn { fill: var(--warn-strong); }
.bars rect.none { fill: var(--surface-3); }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--text-subtle); font-size: 12px; font-family: var(--font); }
.chart .series-1 { stroke: var(--accent); fill: none; stroke-width: 2; }
.chart .series-1-area { fill: var(--accent-soft); stroke: none; }
.chart .series-bad { stroke: var(--bad-strong); fill: none; stroke-width: 2; }
.chart .bar { fill: var(--accent); }
.chart .bar-bad { fill: var(--bad-strong); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--surface-2); fill-opacity: 0.5; }
.chart .point.accent { fill: var(--accent); }
.chart .point.bad { fill: var(--bad-strong); }
.chart-figure { margin: 0; }
.chart-data { margin-top: 10px; }
.chart-data > summary { cursor: pointer; color: var(--text-subtle); font-size: 12.5px; }
.chart-data .table-wrap { margin-top: 8px; max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.chart-data th, .chart-data td { padding: 5px 12px; }
.spark { display: block; width: 96px; height: 22px; }
.spark rect { fill: var(--text-subtle); opacity: 0.55; }
.spark rect.now { fill: var(--accent); opacity: 1; }
.spark .spark-base { stroke: var(--border); stroke-width: 1; }
td.strip-cell { min-width: 200px; width: 30%; vertical-align: middle; }
.legend { display: flex; gap: 14px; margin-top: 10px; color: var(--text-muted); font-size: 12.5px; flex-wrap: wrap; }

/* Key–value facts (run details, error details, ops host/run facts) */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.facts dt { color: var(--text-muted); font-size: 13px; padding-top: 1px; }
.facts dd { margin: 0; min-width: 0; word-break: break-word; }

/* ── Environment tiles ─────────────────────────────────────────────────── */
.env-tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.env-tile:hover { border-color: var(--accent-border); box-shadow: var(--shadow-md); color: var(--text); }
.env-tile .name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.env-tile .facts-row { display: flex; gap: 8px; flex-wrap: wrap; color: var(--text-muted); font-size: 12.5px; align-items: center; }
.env-tile .meta { color: var(--text-subtle); font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
.project-block + .project-block { margin-top: 22px; }
.org-section { padding-top: 8px; }
.org-section + .org-section { margin-top: 28px; }
.org-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 14px; }
.org-title .icon { color: var(--text-subtle); }
.env-tile.is-down { border-color: var(--bad-border); }
.env-tile.is-down:hover { border-color: var(--bad-strong); }
.env-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.env-status.ok { color: var(--ok); }
.env-status.bad { color: var(--bad); }
.env-status.idle { color: var(--text-subtle); }
.uptime-figure { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.env-tile .facts-row { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; }
.fact { display: inline-flex; align-items: center; gap: 6px; }
.fact .icon { color: var(--text-subtle); }
.project-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.project-title h3 { font-size: 14px; }

/* ── Logs ──────────────────────────────────────────────────────────────── */
.log-table td { padding: 6px 12px; font-family: var(--mono); font-size: 12px; }
.log-table td.msg { white-space: pre-wrap; word-break: break-word; }
.lvl { font-weight: 700; }
.lvl-ERROR, .lvl-FATAL { color: var(--bad); }
.lvl-WARN, .lvl-WARNING { color: var(--warn); }
.lvl-INFO { color: var(--info); }
.lvl-DEBUG, .lvl-TRACE { color: var(--idle); }
.log-stack summary { cursor: pointer; color: var(--text-muted); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.toolbar .field { min-width: 140px; }
.toolbar .grow { flex: 1; min-width: 220px; }

.htmx-indicator { opacity: 0; transition: opacity 0.2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.qr { width: 184px; height: 184px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: #fff; }
.qr svg { display: block; width: 100%; height: 100%; }

/* ── Auth pages ────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-aside {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 44px 52px;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 110% -10%, rgb(196 181 253 / 35%), transparent 60%),
    radial-gradient(800px 500px at -20% 110%, rgb(91 33 182 / 70%), transparent 60%),
    linear-gradient(150deg, #2e1065 0%, #5b21b6 48%, #7c3aed 100%);
}
.auth-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgb(255 255 255 / 6%) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 6%) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
  pointer-events: none;
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.auth-tag { font-weight: 500; opacity: 0.8; margin-left: 2px; }
.plain-brand { margin-bottom: 24px; padding-left: 0; }
/* On the violet brand panel the gem sits on a white tile, otherwise its dark facet would vanish. */
.auth-brand .logo { width: 38px; height: 38px; border-radius: 11px; background: #fff; box-shadow: 0 6px 20px -6px rgb(17 0 51 / 55%); }
.auth-brand .logo svg { width: 24px; height: 24px; }
.auth-brand .logo .facet-a { fill: #3b0764; }
.auth-brand .logo .facet-b { fill: #7c3aed; }
.auth-brand .logo .facet-c { fill: #c4b5fd; }
.auth-pitch { margin-top: auto; max-width: 30rem; }
.auth-pitch h2 { font-size: 30px; line-height: 1.2; font-weight: 650; letter-spacing: -0.02em; margin-bottom: 14px; }
.auth-pitch p { color: rgb(255 255 255 / 78%); font-size: 15px; }
.auth-features { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 14px; }
.auth-features li { display: flex; gap: 12px; align-items: flex-start; color: rgb(255 255 255 / 88%); }
.auth-features .icon { width: 18px; height: 18px; margin-top: 1px; color: #ddd6fe; }
.auth-foot { margin-top: 40px; color: rgb(255 255 255 / 60%); font-size: 12.5px; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card .lead { color: var(--text-muted); margin-bottom: 24px; }
.auth-card .help { margin-top: 20px; color: var(--text-subtle); font-size: 12.5px; text-align: center; }
.auth-card .mobile-brand { display: none; }
.auth-tools { position: absolute; top: 16px; right: 16px; }
.auth-main { position: relative; }

.auth-step-icon { margin-bottom: 16px; }
.step { display: flex; align-items: center; gap: 10px; padding-top: 6px; }
.step-no { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 650; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border); }
.qr-block { display: grid; grid-template-columns: 148px 1fr; gap: 14px; align-items: center; }
.qr-block .qr { width: 148px; height: 148px; }
@media (max-width: 420px) { .qr-block { grid-template-columns: 1fr; } }

/* Narrow single-card pages (errors, invite) without the shell */
.page-narrow { max-width: 460px; margin: 0 auto; padding: 72px 16px; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .page { padding: 24px 24px 64px; }
}
@media (max-width: 960px) {
  /* No sidebar stripe: the sidebar is a drawer here, the stripe would be a band behind the content. */
  .app { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    z-index: 60;
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .nav-toggle:checked ~ .app .sidebar { transform: none; }
  .scrim { display: none; position: fixed; inset: 0; background: rgb(0 0 0 / 35%); z-index: 55; }
  .nav-toggle:checked ~ .app .scrim { display: block; }
  .mobilebar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  .mobilebar .sb-brand { padding: 0; }
  .mobilebar label { cursor: pointer; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-card .mobile-brand { display: flex; margin-bottom: 28px; color: var(--text); }
}
@media (min-width: 961px) { .scrim { display: none; } }
@media (max-width: 640px) {
  .page { padding: 18px 16px 56px; }
  th, td { padding: 9px 12px; }
  h1 { font-size: 21px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 14px; }
  .stat-value { font-size: 22px; }
  .chart .axis-label { font-size: 22px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
  .auth-tools { position: static; margin-bottom: 16px; align-self: flex-end; }
}

/* ══ module: uptime ═══════════════════════════════════════════════════════ */
.monitor-edit { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.monitor-edit > summary { color: var(--text); }

/* ══ module: alerts ═══════════════════════════════════════════════════════ */

/* ══ module: tests ════════════════════════════════════════════════════════ */
/* Every file in a run gets its own table; fixed columns keep them aligned with each other. */
.case-table { table-layout: fixed; min-width: 640px; }
.case-table col.c-project { width: 140px; }
.case-table col.c-status { width: 160px; }
.case-table col.c-num { width: 110px; }
.case-table td:first-child { word-break: break-word; }
.bars rect.idle { fill: var(--idle); }
.bars a:hover rect, .bars a:focus-visible rect { opacity: 0.65; }

.run-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 24px; margin: 0; }
.run-facts dt { color: var(--text-muted); font-size: 12.5px; }
.run-facts dd { margin: 2px 0 0; }
.run-stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.test-failure + .test-failure { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.test-meta { color: var(--text-muted); font-size: 12.5px; margin: 4px 0 8px; }
.test-file + .test-file { border-top: 1px solid var(--border); }
.test-file > summary { list-style: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; cursor: pointer; }
.test-file > summary::-webkit-details-marker { display: none; }
.test-file > summary:hover { background: var(--surface-2); }
.test-file-name { font-family: var(--mono); font-size: 12.5px; font-weight: 600; word-break: break-all; }
.test-file .table-wrap { border-top: 1px solid var(--border); }
.case-error { margin-top: 6px; }
.case-error > summary { cursor: pointer; color: var(--text-muted); font-size: 12.5px; }
.case-error pre { margin-top: 6px; }

.tests-admin .suite-admin { padding: 12px 0; border-top: 1px solid var(--border); }
.tests-admin .suite-admin .table-wrap { margin: 8px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tests-admin input[type="date"] {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  width: 100%;
  min-width: 0;
}
.ci-snippet { user-select: all; font-size: 12px; }

/* ══ module: logs / apm / errors ══════════════════════════════════════════ */
/* Segmented controls (time range, error status) and toggles */
.seg { display: inline-flex; flex-wrap: wrap; }
.seg .btn { border-radius: 0; margin-left: -1px; }
.seg .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.seg .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.seg .btn.active, .range-custom > summary.btn.active, .live-toggle.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  position: relative;
}
.range-picker { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.range-custom > summary.btn { color: var(--text); font-weight: 600; }
details.range-custom[open] { flex-basis: 100%; }
details.range-custom[open] > summary { margin-bottom: 8px; }

/* Logs */
.log-search fieldset.levels { border: 0; padding: 0; margin: 0; min-width: 0; }
.log-search fieldset.levels legend { padding: 0; margin-bottom: 4px; }
.log-search .levels .row { min-height: 34px; gap: 14px; }
.log-table td.logger { white-space: nowrap; color: var(--text-muted); }
.log-table tr.tail-row td, .log-table tr.more-row td {
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--text-muted);
}
.log-table tr.tail-row td { background: var(--surface-2); }
.log-table tr.more-row td { text-align: center; padding: 10px 12px; }
.log-table tr.more-row td.status-bad { color: var(--bad); }
.log-table tr.empty-row td { padding: 0; font-family: var(--font); }
.log-table tr.empty-row:hover td { background: none; }
.log-stack pre { margin-top: 6px; max-height: 420px; overflow: auto; }
.log-table td.msg { width: 100%; min-width: 320px; }
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  margin-right: 8px;
  vertical-align: middle;
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

.card-note { padding: 12px 16px 0; margin: 0; }

/* Errors */
.error-cell { min-width: 280px; max-width: 640px; }
.error-cell a { font-weight: 600; word-break: break-word; color: var(--text); }
.error-cell a:hover { color: var(--accent); }
.error-head { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.error-head h2 { font-size: 15px; word-break: break-word; }
.exception-chain p { margin: 0 0 4px; }
ol.frames { list-style: none; margin: 0; padding: 0; font-family: var(--mono); font-size: 12px; }
ol.frames > li { padding: 4px 0; border-bottom: 1px solid var(--border); word-break: break-word; }
ol.frames > li:last-child { border-bottom: 0; }
ol.frames .frame.lib code { color: var(--text-muted); }
ol.frames .frame-group summary { cursor: pointer; color: var(--text-muted); font-family: var(--font); font-size: 12.5px; }
ol.frames .frame-group ol.frames { margin: 4px 0 0 16px; }

/* Sources settings */
.source-block + .source-block { border-top: 1px solid var(--border); padding-top: 16px; }
.source-block > * + * { margin-top: 10px; }

/* ══ ops ══════════════════════════════════════════════════════════════════ */
:root {
  /* The run log is a terminal: dark in both themes, set off from the page in dark mode too. */
  --term-bg: light-dark(#18181f, #08080b);
  --term-fg: light-dark(#e4e4ec, #d4d4dd);
  --term-selection: light-dark(rgb(167 139 250 / 40%), rgb(167 139 250 / 35%));
}

/* Dashboard */
.ops-banners > .banner:last-child { margin-bottom: 0; }
.ops-stat-of { color: var(--text-subtle); font-size: 0.62em; font-weight: 550; letter-spacing: 0; }

/* Run detail: prominent status, two fact columns, terminal log */
.ops-run-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ops-run-status .badge { font-size: 13.5px; line-height: 22px; padding: 2px 12px; gap: 8px; }
.ops-run-status .badge .dot { width: 8px; height: 8px; }
.ops-facts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px 48px; }
.ops-facts-grid > .facts { align-content: start; }
.ops-log {
  max-height: 70vh;
  min-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12px;
  line-height: 1.6;
}
.ops-term {
  color-scheme: dark;
  background: var(--term-bg);
  color: var(--term-fg);
  border: 0;
  border-radius: 0 0 calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px);
  padding: 16px 20px 20px;
  scrollbar-width: thin;
  /* Ansible prints "=>"; a ligature would show a different character than the file holds. */
  font-variant-ligatures: none;
}
.ops-term::selection { background: var(--term-selection); }
.ops-live {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--ok-border);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 12px;
  font-weight: 550;
  line-height: 19px;
}
.ops-live .live-dot { width: 6px; height: 6px; margin-right: 6px; }

/* Forms: field groups in cards, actions bottom-left */
.ops-form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ops-section-head { padding-top: 12px; }
.ops-section-head h2 { font-size: 16px; }
.ops-section-head p { margin-top: 2px; }
.ops-threshold-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 640px; }
.ops-fields-narrow { max-width: 480px; }
input.mono { font-family: var(--mono); font-size: 13px; }
.ops-role-help { margin-bottom: 0; padding-left: 18px; color: var(--text-muted); font-size: 12.5px; display: grid; gap: 4px; }
.ops-role-help strong { color: var(--text); font-weight: 550; }
.ops-divided { border-top: 1px solid var(--border); padding-top: 14px; }
.card.ops-highlight { border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm); }
.card.ops-highlight .card-head h2 .icon { color: var(--accent); }
.card.ops-danger { border-color: var(--bad-border); }
.card.ops-danger .card-head h2 .icon { color: var(--bad); }
.ops-align-start { align-items: start; }
.ops-profile { padding: 2px 0; }
.ops-profile .badge { margin-left: auto; }

/* Tables and lists */
.ops-card-tabs .tabs { margin: 0; padding: 6px 12px 0; }
.ops-pager { display: flex; justify-content: center; margin-top: 16px; }
.ops-detail { max-width: 420px; word-break: break-word; color: var(--text-muted); }
.ops-clip { display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops-check-key { max-width: 300px; overflow-wrap: anywhere; }
.ops-wrap { overflow-wrap: anywhere; }
.ops-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ops-search { position: relative; display: flex; align-items: center; width: 360px; max-width: 100%; }
.ops-search .icon { position: absolute; left: 11px; color: var(--text-subtle); pointer-events: none; }
.ops-search input { padding-left: 32px; }

@media (max-width: 640px) {
  .ops-clip { max-width: 180px; }
  /* Relative time is enough on phones; the exact date stays in the title tooltip. */
  td.ops-time { white-space: normal; min-width: 76px; }
  td.ops-time .cell-sub { display: none; }
  .ops-hide-sm { display: none; }
  .ops-check-key { min-width: 120px; }
  .ops-log { max-height: 60vh; font-size: 11.5px; }
  .ops-term { padding: 12px 14px 16px; }
  .ops-facts-grid { gap: 0; }
}
