/* Overmind, in QED's brand: navy ink, cyan highlights, yellow for the one
   action that matters on a page. Colour tokens mirror qed-website's @theme.

   Every size below comes from the tokens in :root. Reach for a token before
   typing a number; /styleguide/ renders each token and component.

   Two schemes, chosen by the system setting. Each colour token is named for
   its light value and keeps its strength against the page in dark: --navy
   stays the strongest ink, --cyan-50 the faintest tint, --surface the card
   on the page. --on-fill and --brand-navy exist because a few colours must
   not flip.

   Breakpoints (media queries can't read custom properties):
     860px  layout: the top bar wraps, gutters shrink
     640px  phone: grids tighten
   Tables follow the room they get, not the viewport: .table-wrap is a
   container; table.stack becomes cards under 52rem, table.report under 72rem.
   Input type: (hover: hover) gates hover styles, (pointer: coarse) grows
   tap targets. */

:root {
  /* Colour: light-dark(light, dark) */
  --navy: light-dark(#011e30, #eef5fa);
  --navy-900: light-dark(#0a4563, #a3d2f0);
  --navy-700: light-dark(#155b7d, #72b3de);
  --cyan: light-dark(#c6e1f3, #1d4a66);
  --cyan-100: light-dark(#8cc5e9, #3b7aa3);
  --cyan-50: light-dark(#ebf5fb, #102f45);
  --blue: light-dark(#2b71d0, #6aa6f5);
  --yellow: #ffd166;
  --yellow-900: #ffc336;
  --amber-50: light-dark(#fff4d6, #3a2c0a);
  --amber-900: light-dark(#7a5200, #ffd166);
  --salmon: light-dark(#efa99c, #c96a5c);
  --salmon-50: light-dark(#fcebe7, #3b1a17);
  --red: light-dark(#b4231b, #ff8f82);
  --off-white: light-dark(#f7f7f7, #07141e);
  --ink: light-dark(#0d1b2a, #dde7ee);
  --ink-2: light-dark(#3d5566, #a8bac8);
  --ink-3: light-dark(#6b7d8b, #7d93a4);
  --ink-4: light-dark(#b8c2ca, #465c6d);
  --border: light-dark(#e5e7eb, #1e3445);
  --hairline: light-dark(#eef1f4, #162a39);
  --surface: light-dark(#ffffff, #0c1c28);
  --surface-2: light-dark(#fafbfc, #0f2130);
  --surface-hover: light-dark(#f7fbfe, #122738);
  /* Ink on a solid --navy-900, --navy or --red fill. */
  --on-fill: light-dark(#ffffff, #011e30);
  /* QED navy in both schemes: ink on yellow, the entrance backdrop. */
  --brand-navy: #011e30;

  /* Type */
  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --text-xs: 0.75rem; /* 12px: labels, badges, table heads */
  --text-sm: 0.8125rem; /* 13px: secondary copy, notes */
  --text-md: 0.875rem; /* 14px: tables, buttons, controls */
  --text-base: 0.9375rem; /* 15px: body, h3 */
  --text-lg: 1.125rem; /* 18px: h2 */
  --text-xl: 1.375rem; /* 22px: stat figures */
  --text-2xl: clamp(1.625rem, 1.2rem + 1.4vw, 2.125rem); /* h1 */
  --text-3xl: clamp(2.25rem, 1.8rem + 1.6vw, 3rem); /* the SLA uptime figure */

  /* Space: a 4px grid */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-11: 44px;
  --space-18: 72px;

  /* Layout */
  --gutter: var(--space-8);
  --section-gap: var(--space-11);

  /* Controls: coarse pointers get bigger targets (see the end of the file) */
  --control-h: 38px;
  --control-h-sm: 32px;

  /* Shape */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px light-dark(rgb(1 30 48 / 0.05), rgb(0 0 0 / 0.4));
  --shadow: 0 10px 30px light-dark(rgb(1 30 48 / 0.08), rgb(0 0 0 / 0.45));

  /* Motion */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --fast: 150ms;

  color-scheme: light dark;
  interpolate-size: allow-keywords;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* In-page links land clear of the sticky top bar (two rows tall on phones). */
html {
  scroll-padding-top: calc(2 * var(--space-18));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--off-white);
  color: var(--ink);
  font: 400 var(--text-base) / 1.55 var(--font-body);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--navy);
}

h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

h2 {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.012em;
}

h3 {
  font-size: var(--text-base);
  font-weight: 650;
  letter-spacing: -0.005em;
}

p {
  margin: 0;
}

a {
  color: var(--navy-900);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--navy-700);
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.muted {
  color: var(--ink-3);
}

.text-fail {
  color: var(--red);
}

.num {
  font-variant-numeric: tabular-nums;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

/* The bar lifts off the page once content scrolls under it, like qed.tech's
   navbar. Browsers without scroll timelines keep the static border. */
@supports (animation-timeline: scroll()) {
  .topbar {
    animation: topbar-lift linear both;
    animation-timeline: scroll(root);
    animation-range: 0 32px;
  }

  @keyframes topbar-lift {
    to {
      border-bottom-color: transparent;
      box-shadow: var(--shadow);
    }
  }
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: var(--space-3) max(var(--gutter), env(safe-area-inset-right)) var(--space-3)
    max(var(--gutter), env(safe-area-inset-left));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--navy);
  text-decoration: none;
}

.brand:hover {
  color: var(--navy);
}

.brand-mark {
  width: 26px;
  height: 26px;
  color: var(--navy-900);
}

.brand-name {
  font: 700 1.0625rem/1 var(--font-display);
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav a {
  flex-shrink: 0;
  padding: 7px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font: 550 var(--text-md) / 1.2 var(--font-display);
  text-decoration: none;
  transition:
    background-color var(--fast) ease,
    color var(--fast) ease;
}

.nav a[aria-current="page"] {
  background: var(--cyan-50);
  color: var(--navy-900);
  font-weight: 700;
}

.nav-sep {
  flex-shrink: 0;
  width: 1px;
  height: 18px;
  margin: 0 var(--space-2);
  background: var(--border);
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.avatar {
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--navy-900);
  color: var(--on-fill);
  font: 700 var(--text-sm) / 1 var(--font-display);
  text-transform: uppercase;
}

.account-email {
  max-width: 220px;
  overflow: hidden;
  color: var(--ink-2);
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account form {
  margin: 0;
}

/* ---------- Page scaffolding ---------- */

.page {
  padding: 36px max(var(--gutter), env(safe-area-inset-right))
    calc(var(--space-18) + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.eyebrow {
  margin-bottom: var(--space-2);
  color: var(--navy-700);
  font: 650 var(--text-xs) / 1 var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lede {
  margin-top: var(--space-2);
  color: var(--ink-2);
  font-size: var(--text-base);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.page-actions .muted {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 2px;
  font-size: var(--text-sm);
}

.section + .section {
  margin-top: var(--section-gap);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
}

.section-head p {
  color: var(--ink-3);
  font-size: var(--text-sm);
}

/* The dashboard's environments come in groups, production first. */
.console-group + .console-group {
  margin-top: var(--space-8);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: var(--space-4);
  padding: var(--space-3) 14px;
  border-radius: var(--radius);
  background: var(--cyan-50);
  color: var(--navy-900);
  font-size: var(--text-sm);
}

.note code {
  overflow-wrap: anywhere;
}

.note svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

/* ---------- Buttons ---------- */

.btn,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-h);
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--navy-900);
  font: 650 var(--text-md) / 1 var(--font-display);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--fast) ease,
    border-color var(--fast) ease,
    transform 120ms var(--ease-out);
}

.btn:active,
button:active {
  transform: scale(0.97);
}

.btn svg,
button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  border-color: var(--yellow-900);
  background: var(--yellow);
  color: var(--brand-navy);
  --spinner: var(--brand-navy);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}

.btn-sm {
  min-height: var(--control-h-sm);
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

button:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Busy state for forms that post and redirect: the button keeps its width,
   the label dims and a spinner takes over, so a double click can't fire twice. */
button[aria-busy="true"] {
  position: relative;
  color: transparent;
  pointer-events: none;
}

button[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 14px;
  height: 14px;
  margin: auto;
  border: 2px solid var(--spinner, var(--navy));
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Segmented control: a set of links where one is the current view, or of
   labelled radios where one is checked. */
.segmented {
  display: inline-flex;
  max-width: 100%;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.segmented a,
.segmented label {
  flex: 1 0 auto;
  min-width: 52px;
  padding: 7px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font: 650 var(--text-sm) / 1 var(--font-display);
  text-align: center;
  text-decoration: none;
  transition:
    background-color var(--fast) ease,
    color var(--fast) ease,
    transform 120ms var(--ease-out);
}

.segmented label {
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label:has(:focus-visible) {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.segmented a:active,
.segmented label:active {
  transform: scale(0.97);
}

.segmented a[aria-current="true"],
.segmented label:has(:checked) {
  background: var(--navy-900);
  color: var(--on-fill);
}

/* ---------- Hover (only where a pointer can hover) ----------
   On touch screens a tap would leave these stuck on until the next tap. */

@media (hover: hover) {
  .nav a:hover {
    background: var(--hairline);
    color: var(--navy);
  }

  a.chip:hover {
    background: var(--cyan-50);
    color: var(--navy);
  }

  .btn:hover,
  button:hover {
    border-color: var(--cyan-100);
    background: var(--cyan-50);
    color: var(--navy-900);
  }

  .btn-primary:hover {
    border-color: var(--yellow-900);
    background: var(--yellow-900);
    color: var(--brand-navy);
  }

  .btn-ghost:hover {
    border-color: transparent;
    background: var(--hairline);
    color: var(--navy);
  }

  button:disabled:hover {
    border-color: var(--border);
    background: var(--surface);
  }

  .btn-primary:disabled:hover {
    border-color: var(--yellow-900);
    background: var(--yellow);
  }

  .segmented a:not([aria-current="true"]):hover,
  .segmented label:not(:has(:checked)):hover {
    color: var(--navy);
  }

  input:hover,
  select:hover {
    border-color: var(--cyan-100);
  }

  table.data tbody tr:hover > td {
    background: var(--surface-hover);
  }

  .fold > summary:hover {
    background: var(--surface-2);
  }

  .filters a:not([aria-current="true"]):hover {
    border-color: var(--cyan-100);
    background: var(--cyan-50);
    color: var(--navy-900);
  }

  .filters a.is-attention:not([aria-current="true"]):hover {
    border-color: var(--red);
    background: var(--salmon-50);
    color: var(--red);
  }

  table.data th .sort:hover {
    border-color: transparent;
    background: none;
    color: var(--navy);
  }

  .problem-name:hover b {
    text-decoration: underline;
  }
}

/* ---------- Forms ---------- */

input[type="text"],
input[type="date"],
input[type="search"],
select {
  min-height: var(--control-h);
  max-width: 100%;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 500 var(--text-md) / 1 var(--font-body);
  transition:
    border-color var(--fast) ease,
    box-shadow var(--fast) ease;
}

select {
  padding-right: var(--space-8);
  appearance: none;
  /* A data URI can't read tokens: this grey reads on both schemes' surfaces. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%237d8e9b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 14px;
  cursor: pointer;
}

input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent);
}

.field {
  display: grid;
  gap: 6px;
  color: var(--ink-2);
  font: 600 var(--text-xs) / 1 var(--font-display);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin: 0 0 var(--space-5);
}

.week-picker {
  margin-bottom: var(--space-8);
}

/* ---------- Tables ---------- */

/* A container, so a wide grid (table.report) can turn into cards when the
   space it gets is narrow, whatever the viewport. */
.table-wrap {
  container-type: inline-size;
  overflow: auto;
  max-height: 72vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.table-wrap.is-short {
  max-height: none;
}

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-md);
  font-variant-numeric: tabular-nums;
}

table.data th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  font: 650 var(--text-xs) / 1.2 var(--font-display);
  letter-spacing: 0.01em;
  text-align: left;
  white-space: nowrap;
}

table.data td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  vertical-align: middle;
  transition: background-color 120ms ease;
}

table.data tbody tr:last-child td {
  border-bottom: 0;
}

table.data .num,
table.data th.num {
  text-align: right;
  white-space: nowrap;
}

table.data .nowrap {
  white-space: nowrap;
}

table.data .actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

table.data .empty-row td {
  padding: 40px var(--space-4);
  color: var(--ink-3);
  text-align: center;
}

/* Wide report grid (the weekly report and the console): it never scrolls
   sideways. Headings wrap, qualifiers sit under their figure, and in less
   than 72rem of room each row becomes a card. */
table.report th {
  padding-inline: var(--space-3);
  vertical-align: bottom;
  white-space: normal;
}

table.report td {
  padding: 10px var(--space-3);
  white-space: nowrap;
}

table.report td[data-col="project"] {
  max-width: 16rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

table.report td[data-col="project"] a {
  font-weight: 700;
  text-decoration: none;
}

table.report td[data-col="project"] a:hover {
  text-decoration: underline;
}

table.report .env-name {
  margin-left: 6px;
  color: var(--ink-3);
  font-size: var(--text-sm);
}

table.report td > small {
  margin-left: 2px;
  color: var(--ink-3);
  font-size: var(--text-xs);
}

table.report td > .console-sub {
  display: block;
  white-space: normal;
}

.blank {
  color: var(--ink-4);
}

/* ---------- Badges, chips, status ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--hairline);
  color: var(--ink-2);
  font: 650 var(--text-xs) / 1.3 var(--font-display);
  white-space: nowrap;
}

.badge-ok,
.badge-role {
  background: var(--cyan-50);
  color: var(--navy-900);
}

.badge-fail {
  background: var(--salmon-50);
  color: var(--red);
}

.badge-running {
  background: var(--amber-50);
  color: var(--amber-900);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge-running .dot {
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

code.chip,
a.chip {
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: var(--hairline);
  color: var(--navy-900);
  font-size: var(--text-xs);
  white-space: nowrap;
}

/* A chip that opens the thing it names. */
a.chip {
  font-family: var(--font-mono);
  text-decoration: none;
  transition: background-color var(--fast) ease;
}

/* The arrow says the link leaves Overmind, in a new tab. */
a[target="_blank"]::after {
  content: "\2197";
  margin-left: 3px;
  color: var(--ink-3);
  font-family: var(--font-body);
}

a.chip:active {
  background: var(--cyan);
}

/* Direction arrow on a change. */
.trend[data-dir]::before {
  content: "";
  margin-right: 5px;
  border-inline: 4px solid transparent;
}

.trend[data-dir="up"]::before {
  border-bottom: 5px solid currentColor;
}

.trend[data-dir="down"]::before {
  border-top: 5px solid currentColor;
}

.cap {
  display: inline-block;
}

.cap::first-letter {
  text-transform: uppercase;
}

/* ---------- Tooltips ---------- */

.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}

.tip-body {
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  z-index: 30;
  width: max-content;
  max-width: min(260px, calc(100vw - 2 * var(--gutter)));
  padding: var(--space-2) 11px;
  border-radius: var(--radius-sm);
  background: var(--navy);
  box-shadow: var(--shadow);
  color: var(--on-fill);
  font: 500 var(--text-xs) / 1.45 var(--font-body);
  letter-spacing: 0.005em;
  text-align: left;
  text-transform: none;
  white-space: normal;
  /* Closed tips are display: none so they can't widen the page on a phone;
     allow-discrete keeps the fade in and out. overmind.js sets --tip-nudge to
     keep an open tip inside the viewport. */
  --tip-x: calc(-50% + var(--tip-nudge, 0px));
  display: none;
  opacity: 0;
  pointer-events: none;
  transform: translate(var(--tip-x), 4px) scale(0.97);
  transform-origin: bottom center;
  transition:
    opacity 130ms var(--ease-out),
    transform 130ms var(--ease-out),
    display 130ms allow-discrete;
}

.tip-below .tip-body {
  --tip-x: var(--tip-nudge, 0px);
  top: calc(100% + var(--space-2));
  bottom: auto;
  left: 0;
  transform: translate(var(--tip-x), -4px) scale(0.97);
  transform-origin: top left;
}

/* :focus, not :focus-visible, so a tap on a touch screen opens it too. */
.tip:hover .tip-body,
.tip:focus .tip-body {
  display: block;
  opacity: 1;
  transform: translate(var(--tip-x), 0) scale(1);
}

@starting-style {
  .tip:hover .tip-body,
  .tip:focus .tip-body {
    opacity: 0;
    transform: translate(var(--tip-x), 4px) scale(0.97);
  }

  .tip-below:hover .tip-body,
  .tip-below:focus .tip-body {
    transform: translate(var(--tip-x), -4px) scale(0.97);
  }
}

/* A resting mouse waits a beat so passing over doesn't flash tooltips; focus
   and taps show them at once. */
@media (hover: hover) {
  .tip:hover:not(:focus) .tip-body {
    transition-delay: 300ms;
  }
}

.tip-icon {
  width: 14px;
  height: 14px;
  color: var(--ink-3);
}

/* ---------- Toasts ---------- */

.toasts {
  --toast-from: -8px;
  position: fixed;
  top: 76px;
  right: var(--space-6);
  z-index: 60;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 2 * var(--space-4)));
  margin: 0;
  padding: 0;
  list-style: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-left: 3px solid var(--navy-900);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: var(--text-md);
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 300ms var(--ease-out),
    transform 300ms var(--ease-out);
}

@starting-style {
  .toast {
    opacity: 0;
    transform: translateY(var(--toast-from));
  }
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(var(--toast-from));
  transition-duration: 180ms;
}

.toast-success {
  border-left-color: var(--cyan-100);
}

.toast-warning {
  border-left-color: var(--yellow-900);
}

.toast-error {
  border-left-color: var(--salmon);
}

.toast-text {
  flex: 1;
  padding-top: 5px;
}

.toast-close {
  min-height: 28px;
  width: 28px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--ink-3);
}

/* ---------- Empty states ---------- */

.empty {
  display: grid;
  justify-items: start;
  gap: 6px;
  padding: 28px;
  color: var(--ink-2);
}

.empty strong {
  color: var(--navy);
  font: 700 1rem/1.3 var(--font-display);
}

/* ---------- Dashboard ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: var(--space-3);
  margin: 0 0 var(--section-gap);
}

.stat {
  display: grid;
  gap: var(--space-1);
  align-content: start;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat dt {
  color: var(--ink-3);
  font: 650 var(--text-xs) / 1.2 var(--font-display);
  letter-spacing: 0.01em;
}

.stat dd {
  margin: 0;
}

.stat-value {
  color: var(--navy);
  font: 700 var(--text-xl) / 1.15 var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-value small,
.console-value small {
  margin-left: 3px;
  color: var(--ink-3);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0;
}

.stat-note {
  color: var(--ink-3);
  font-size: var(--text-sm);
}

/* A change as coloured text; data-big adds a tinted pill. */
.trend {
  display: inline-flex;
  align-items: center;
  color: var(--ink-3);
  font: 650 var(--text-xs) / 1.3 var(--font-display);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.trend.is-worse {
  color: var(--red);
}

.trend.is-better {
  color: var(--navy-700);
}

.trend.is-neutral {
  color: var(--ink-2);
}

.trend[data-big] {
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}

.trend.is-worse[data-big] {
  background: var(--salmon-50);
}

.trend.is-better[data-big] {
  background: var(--cyan-50);
}

/* Fleet totals carry no rule of their own, so their changes stay ink: colour
   is for what needs a look. */
.stat .trend {
  color: var(--ink-2);
}

/* A stat's daily line: the whole tile wide, under its figure. */
.stat-spark {
  margin-top: var(--space-1);
}

.stat-spark .spark {
  display: block;
  width: 100%;
  height: var(--space-6);
  color: var(--ink-3);
}

.stat-note .signal {
  margin: 0 var(--space-1) 0 0;
}

/* The dashboard's first answer: one card per production environment with a
   problem, worst first. Built like a .stat tile, so the two rows read as
   one surface: the environment as the label, the reason as the figure, and
   where to look next as the note. A dot carries the level. */
.problems {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
  padding: 0;
  list-style: none;
}

.problem {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.problem-name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  justify-self: start;
  color: var(--ink-3);
  font: 650 var(--text-xs) / 1.2 var(--font-display);
  letter-spacing: 0.01em;
  text-decoration: none;
}

.problem-name b {
  color: var(--ink-2);
}

.problem-name::before {
  content: "";
  width: var(--space-2);
  height: var(--space-2);
  border-radius: 50%;
  background: var(--yellow-900);
  box-shadow: 0 0 0 3px var(--amber-50);
}

.problem.is-critical .problem-name::before {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--salmon-50);
}

.problem-reasons {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.problem-reasons > li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.problem-why {
  color: var(--navy);
  font: 700 var(--text-lg) / 1.3 var(--font-display);
  letter-spacing: -0.012em;
}

.problem .spark {
  flex: none;
  width: 80px;
  height: var(--space-5);
}

.problem.is-critical .spark {
  color: var(--red);
}

.problem-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  font-size: var(--text-sm);
}

/* The lede's follow-ups: each opens the filter it names. */
.lede-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin-top: var(--space-2);
  font-size: var(--text-sm);
}

.console-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.filters a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--control-h-sm);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-2);
  font: 650 var(--text-sm) / 1 var(--font-display);
  text-decoration: none;
  transition:
    background-color var(--fast) ease,
    border-color var(--fast) ease,
    color var(--fast) ease,
    transform 120ms var(--ease-out);
}

.filters a:active {
  transform: scale(0.97);
}

.filters a span {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.filters a[aria-current="true"] {
  border-color: var(--navy-900);
  background: var(--navy-900);
  color: var(--on-fill);
}

.filters a.is-attention {
  border-color: var(--salmon);
  color: var(--red);
}

.filters a.is-attention[aria-current="true"] {
  border-color: var(--red);
  background: var(--red);
  color: var(--on-fill);
}

.filters a[aria-current="true"] span {
  color: color-mix(in srgb, var(--on-fill) 75%, transparent);
}

input.console-search {
  width: min(100%, 260px);
  min-height: var(--control-h-sm);
}

/* One row per environment: value, change and a daily line in every cell. */
table.console td {
  vertical-align: top;
}

.console-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.console-value {
  color: var(--navy);
  font: 700 var(--text-md) / 1.25 var(--font-display);
}

.console-sub {
  color: var(--ink-3);
  font-size: var(--text-xs);
}

/* kubectl restarts are run to run, not a total: a dotted figure whose tip
   says so, instead of a badge on every row. */
.console-value.is-run-to-run {
  text-decoration: underline dotted var(--ink-3);
  text-underline-offset: 3px;
}

.spark {
  width: 64px;
  height: var(--space-4);
  color: var(--navy-700);
}

table.console tr[data-problem] .console-cell:has(.trend.is-worse) .spark {
  color: var(--red);
}

/* A row without a problem (fine, or only missing data) keeps its figures,
   moves and sparklines in ink, without sub-lines, so problem rows still
   stand out. */
table.console tr:not([data-problem]) .console-sub {
  display: none;
}

table.console tr:not([data-problem]) .trend {
  padding: 0;
  background: none;
  color: var(--ink-3);
}

.spark polyline {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* Days the provider may still revise (cost only). */
.spark polyline.is-settling {
  stroke-dasharray: 2 3;
  opacity: 0.6;
}

/* The period before, behind the current one. */
.spark polyline.is-previous {
  stroke: var(--ink-4);
  stroke-width: 1;
}

/* Uptime's SLO. */
.spark line.is-target {
  stroke: var(--ink-3);
  stroke-width: 1;
  stroke-dasharray: 1 2;
  vector-effect: non-scaling-stroke;
}

/* The provider; the cluster it runs on is in the tip. */
.console-where {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: var(--text-xs);
}

table.console td[data-col="signal"] {
  white-space: normal;
}

/* The environment and its signals take the room they need; the figures get
   the rest. Table layout only: cards ignore column widths. */
table.console th:is([data-col="project"], [data-col="signal"]) {
  width: 1%;
}

table.console th[data-col="project"] {
  min-width: 14rem;
}

.signal {
  display: inline-flex;
  margin: 0 var(--space-1) var(--space-1) 0;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  font: 650 var(--text-xs) / 1.3 var(--font-display);
  white-space: nowrap;
}

.signal.is-critical {
  background: var(--red);
  color: var(--on-fill);
}

.signal.is-warning {
  background: var(--amber-50);
  color: var(--amber-900);
}

.signal.is-gap {
  background: var(--hairline);
  color: var(--ink-2);
}

/* Worth knowing, never urgent: outlined so it reads apart from a data gap. */
.signal.is-info {
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--border);
}

.signal.is-ok {
  background: var(--cyan-50);
  color: var(--navy-900);
}

/* Missing data still needs a look on production, but it is a chore, not an
   incident: outlined, and no coloured edge on its row. */
.signal.is-warning.is-missing {
  background: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber-900) 40%, transparent);
}

/* The rows with a problem carry a coloured edge. */
table.console tr[data-level="critical"] td[data-col="project"] {
  box-shadow: inset 3px 0 0 var(--red);
}

table.console tr[data-problem][data-level="warning"] td[data-col="project"] {
  box-shadow: inset 3px 0 0 var(--yellow-900);
}

/* The row a problem link opened: lit, then fading once the eye has found it. */
table.console tr:target td {
  animation: target-fade 2s var(--ease-out) both;
}

@keyframes target-fade {
  0%,
  45% {
    background-color: var(--cyan-50);
  }

  100% {
    background-color: transparent;
  }
}

/* Report grids (weekly and console) with less than 72rem of room: one card
   per row. The environment and its signals span the card; the figures share
   rows beneath. */
@container (max-width: 72rem) {
  table.report thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  table.report,
  table.report tbody {
    display: block;
  }

  table.report tr {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
    gap: var(--space-3) var(--space-4);
    padding: var(--space-4);
    border-bottom: 1px solid var(--hairline);
  }

  table.report tbody tr:last-child {
    border-bottom: 0;
  }

  table.data.report td {
    display: block;
    min-width: 0;
    max-width: none;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    text-align: left;
    white-space: normal;
  }

  table.report td:not([data-label]) {
    grid-column: 1 / -1;
  }

  table.report td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--ink-3);
    font: 600 var(--text-xs) / 1.5 var(--font-display);
  }

  /* A figure nobody collects is noise on a card; the signals name the gap. */
  table.report td[data-label]:has(> .blank) {
    display: none;
  }

  table.report .console-cell {
    align-items: flex-start;
    justify-content: flex-start;
  }

  /* The urgent edge moves from the environment cell to the whole card. */
  table.console tr[data-level] td[data-col="project"] {
    box-shadow: none;
  }

  table.report tr[data-level="critical"] {
    box-shadow: inset 3px 0 0 var(--red);
  }

  table.report tr[data-problem][data-level="warning"] {
    box-shadow: inset 3px 0 0 var(--yellow-900);
  }

  table.report .empty-row td {
    padding: var(--space-6) 0;
    text-align: center;
  }
}

/* overmind.js turns the headings of table[data-sortable] into buttons. */
table.data th .sort {
  gap: var(--space-1);
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  white-space: inherit;
}

table.data th[aria-sort="descending"] .sort::after {
  content: "\25BC";
  font-size: 0.7em;
}

table.data th[aria-sort="ascending"] .sort::after {
  content: "\25B2";
  font-size: 0.7em;
}

.fold-body {
  padding: 0 18px 18px;
}
/* ---------- Disclosure panels ---------- */

.fold + .fold {
  margin-top: var(--space-3);
}

.fold > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  list-style: none;
  transition: background-color var(--fast) ease;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold-count {
  color: var(--ink-3);
  font-size: var(--text-sm);
}

.chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-left: auto;
  color: var(--ink-3);
  transition: transform 200ms var(--ease-out);
}

.fold[open] .chevron {
  transform: rotate(180deg);
}

.fold::details-content {
  block-size: 0;
  overflow: clip;
  transition:
    block-size 260ms var(--ease-out),
    content-visibility 260ms allow-discrete;
}

.fold[open]::details-content {
  block-size: auto;
}

/* ---------- Project charts ---------- */

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr));
  gap: var(--space-4);
}

.chart-card {
  min-width: 0;
  padding: 18px 18px var(--space-2);
}

.chart-card h2 {
  font-size: var(--text-base);
}

.chart {
  height: 280px;
}

/* ---------- Runs ---------- */

.errors {
  font-size: var(--text-sm);
}

.errors summary {
  color: var(--red);
  font-weight: 650;
  cursor: pointer;
}

.errors ul {
  display: grid;
  gap: 6px;
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.errors li {
  max-width: 460px;
  padding: var(--space-2) 10px;
  border-radius: var(--radius-sm);
  background: var(--salmon-50);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.errors li b {
  display: block;
  color: var(--red);
  font-family: var(--font-display);
}

/* ---------- Projects ---------- */

.row-link {
  color: var(--navy);
  font: 700 var(--text-base) / 1.3 var(--font-display);
  text-decoration: none;
}

.row-link:hover {
  color: var(--navy-900);
  text-decoration: underline;
}

.env-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.env {
  padding: 3px 9px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  font-size: var(--text-sm);
  white-space: nowrap;
}

tr.is-retired .row-link {
  color: var(--ink-3);
}

.crumb {
  color: inherit;
  text-decoration: none;
}

.crumb:hover {
  color: var(--navy-900);
  text-decoration: underline;
}

/* ---------- Project ---------- */

h1 .badge {
  vertical-align: middle;
}

.section-sub {
  margin-top: var(--space-1);
}

.sla-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: var(--space-4);
  align-items: start;
}

.sla-list {
  display: grid;
  gap: var(--space-4);
}

.sla-card {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-6);
}

.sla-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* The month's verdict. Its colour matches the budget fill below it. */
.sla-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--cyan-50);
  color: var(--navy-900);
  font: 700 var(--text-xs) / 1.3 var(--font-display);
  white-space: nowrap;
}

.sla-state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.sla-state.is-over-pace {
  background: var(--amber-50);
  color: var(--amber-900);
}

.sla-state.is-breached {
  background: var(--red);
  color: var(--on-fill);
}

.sla-state.is-none {
  background: var(--hairline);
  color: var(--ink-3);
}

.sla-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-8);
  align-items: end;
}

.sla-uptime {
  color: var(--navy);
  font: 700 var(--text-3xl) / 1 var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
}

.sla-uptime small {
  margin-left: 2px;
  color: var(--ink-3);
  font-size: 0.5em;
  letter-spacing: 0;
}

.sla-caption {
  display: block;
  margin-top: var(--space-2);
  color: var(--ink-3);
  font: 500 var(--text-xs) / 1.2 var(--font-body);
  letter-spacing: 0.01em;
}

/* Downtime budget: the fill is the share used, the line is how much of the
   month has gone. Fill past the line means burning faster than the month. */
.budget-track {
  position: relative;
  height: var(--space-3);
  margin-top: var(--space-6);
  border-radius: var(--radius-pill);
  background: var(--cyan-50);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--navy) 4%, transparent);
}

.budget-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--used);
  border-radius: inherit;
  background: var(--navy-900);
  clip-path: inset(0);
  transition: clip-path 600ms var(--ease-out) 120ms;
}

@starting-style {
  .budget-fill {
    clip-path: inset(0 100% 0 0);
  }
}

.budget.is-over-pace .budget-fill {
  background: var(--yellow-900);
}

.budget.is-breached .budget-fill {
  background: var(--red);
}

.budget.is-none .budget-track {
  background: var(--hairline);
}

.budget-today {
  position: absolute;
  top: calc(-1 * var(--space-1));
  bottom: calc(-1 * var(--space-1));
  left: var(--pace);
  width: 2px;
  border-radius: 1px;
  background: var(--navy);
  transform: translateX(-50%);
}

.budget-today span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  padding-bottom: var(--space-1);
  color: var(--navy-700);
  font: 650 var(--text-xs) / 1 var(--font-display);
  white-space: nowrap;
  transform: translateX(-50%);
}

.budget-figures {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: var(--space-4) 0 0;
}

.budget-figures dt {
  color: var(--ink-3);
  font: 650 var(--text-xs) / 1.3 var(--font-display);
}

.budget-figures dd {
  margin: 0;
  color: var(--navy);
  font: 700 var(--text-base) / 1.3 var(--font-display);
  font-variant-numeric: tabular-nums;
}

.sla-coverage {
  color: var(--ink-3);
  font-size: var(--text-sm);
}

.sla-months {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-5) 0 0;
  border-top: 1px solid var(--hairline);
  list-style: none;
}

.sla-months li {
  display: grid;
  gap: 2px;
  align-content: start;
}

.sla-month-name {
  color: var(--ink-3);
  font: 650 var(--text-xs) / 1.3 var(--font-display);
}

.sla-month-figure {
  color: var(--navy);
  font: 700 var(--text-base) / 1.3 var(--font-display);
  font-variant-numeric: tabular-nums;
}

.sla-month-state {
  color: var(--navy-700);
  font-size: var(--text-xs);
}

.sla-months .is-missed .sla-month-state {
  color: var(--red);
  font-weight: 700;
}

.sla-months .is-none :is(.sla-month-figure, .sla-month-state) {
  color: var(--ink-4);
}

/* ---------- Weekly Flow: one row per team ---------- */

/* Each team row opens a detail row with its lists (_flow_table.html). The
   detail row's own tables are table.stack too, so they read the same here as
   on the project page. */
table.flow tr[hidden] {
  display: none;
}

table.flow tr.is-toggle {
  cursor: pointer;
}

table.flow td[data-col="project"] a {
  font-weight: 700;
  text-decoration: none;
}

table.flow td[data-col="project"] a:hover {
  text-decoration: underline;
}

.flow-toggle {
  display: inline-flex;
  margin: 0 6px 0 0;
  padding: 2px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-3);
  vertical-align: middle;
  cursor: pointer;
}

.flow-toggle .chevron {
  margin: 0;
  transition: transform 200ms var(--ease-out);
}

.flow-toggle[aria-expanded="true"] .chevron {
  transform: rotate(90deg);
}

table.flow tr.flow-detail > td:not([data-label]) {
  padding: var(--space-4) var(--space-5) var(--space-5);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-weight: inherit;
}

table.data.flow tbody tr.flow-detail:hover > td {
  background: var(--surface-2);
}

.flow-sub {
  display: block;
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.flow-meta {
  margin: 0 0 var(--space-3);
  color: var(--ink-2);
  font-size: var(--text-sm);
}

table.flow tr.flow-detail h3 {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--text-sm);
}

/* ---------- Monthly report ---------- */

/* A closed month is met or missed; the meter keeps the SLA card's colours. */
.sla-state.is-met {
  background: var(--cyan-50);
  color: var(--navy-900);
}

.sla-state.is-missed {
  background: var(--red);
  color: var(--on-fill);
}

.budget.is-missed .budget-fill {
  background: var(--red);
}

/* The shared page has no top bar, so the eyebrow carries the mark. */
.report-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.report-brand .brand-mark {
  width: 18px;
  height: 18px;
}

.report-head .page-actions form {
  display: contents;
}

.report-stats {
  margin: var(--space-4) 0 0;
}

/* The monthly report's cost by service beside cost by namespace; they stack
   when there is no room for two tables. */
.cost-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.cost-breakdown > div {
  flex: 1 1 24rem;
  min-width: 0;
}

.cost-breakdown h3 {
  margin: 0 0 var(--space-2);
}

.cost-breakdown > .stat-note {
  flex-basis: 100%;
  margin: 0;
}

.share-card {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-6);
  border-color: var(--yellow-900);
}

.share-card p {
  color: var(--ink-2);
}

.share-url {
  width: 100%;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.report-foot {
  margin-top: var(--section-gap);
  padding-top: var(--space-4);
  border-top: 1px solid var(--hairline);
  color: var(--ink-3);
  font-size: var(--text-sm);
}

.terms {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-6);
}

.terms-body {
  color: var(--ink-2);
  font-size: var(--text-md);
  overflow-wrap: anywhere;
}

.console-env {
  color: var(--navy);
  font-weight: 700;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: var(--space-4);
  align-items: start;
}

.setup-card {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6) var(--space-6);
}

.setup-card h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* Label / value lines: a fixed label column, values wrap beside it. */
.facts {
  display: grid;
  gap: var(--space-2);
  margin: 0;
}

.facts > div {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: var(--space-3);
  align-items: baseline;
}

.facts dt {
  color: var(--ink-3);
  font: 650 var(--text-xs) / 1.5 var(--font-display);
}

.facts dd {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: 0;
  font-size: var(--text-sm);
}

/* Registry names (clusters, namespaces, SBOMs) can outgrow the card. */
.setup-cluster,
.facts .chip {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.setup-sub {
  margin: 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--hairline);
  color: var(--navy-700);
  font: 650 var(--text-xs) / 1 var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.freshness {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.freshness li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.freshness-name {
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.freshness time {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* ---------- Members ---------- */

.member {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  overflow-wrap: anywhere;
}

.member .avatar {
  background: var(--cyan);
  color: var(--navy-900);
}

.role-form {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin: 0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: 0 0 var(--space-5);
  padding: 0;
  color: var(--ink-2);
  font-size: var(--text-sm);
  list-style: none;
}

.legend b {
  color: var(--navy);
  font-family: var(--font-display);
}

/* ---------- Pager ---------- */

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
  color: var(--ink-3);
  font-size: var(--text-sm);
}

.pager-links {
  display: flex;
  gap: var(--space-2);
}

/* ---------- Style guide page ---------- */

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  gap: var(--space-3);
}

/* Each swatch shows its token twice: light on the left, dark on the right,
   whatever scheme the page is in. Markup sets --swatch to the token. */
.swatch {
  position: relative;
  display: grid;
  gap: 2px;
  padding: var(--space-3);
  font-size: var(--text-xs);
}

.swatch::before,
.swatch::after {
  content: "";
  height: 44px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--swatch);
}

.swatch::before {
  margin-bottom: var(--space-2);
  color-scheme: light;
}

.swatch::after {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: calc(50% - var(--space-3));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color-scheme: dark;
}

.swatch b {
  color: var(--navy);
  font-family: var(--font-display);
}

/* The preview switch on /styleguide/ overrides the system setting. */
:root:has(#scheme-light:checked) {
  color-scheme: light;
}

:root:has(#scheme-dark:checked) {
  color-scheme: dark;
}

.specimen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
}

.specimen + .specimen {
  border-top: 1px solid var(--hairline);
}

.specimen > .muted {
  flex-basis: 100%;
  font-size: var(--text-xs);
}

.specimen .legend {
  margin: 0;
}

.space-bar {
  height: 12px;
  border-radius: 3px;
  background: var(--cyan-100);
}

.space-bar-1 { width: var(--space-1); }
.space-bar-2 { width: var(--space-2); }
.space-bar-3 { width: var(--space-3); }
.space-bar-4 { width: var(--space-4); }
.space-bar-5 { width: var(--space-5); }
.space-bar-6 { width: var(--space-6); }
.space-bar-8 { width: var(--space-8); }
.space-bar-11 { width: var(--space-11); }
.space-bar-18 { width: var(--space-18); }

/* ---------- Entrance (sign-in, no access) ---------- */

body.entrance {
  display: grid;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgb(21 91 125 / 0.55), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgb(10 69 99 / 0.6), transparent 60%),
    var(--brand-navy);
}

body.entrance .page {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 48px var(--space-5) calc(48px + env(safe-area-inset-bottom));
}

.entrance-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  width: min(420px, 100%);
  padding: 36px var(--space-8) var(--space-8);
  border-radius: var(--space-6);
  /* A dark card on the navy backdrop needs an edge; on white it vanishes. */
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.35);
}

.entrance-card h1 + p {
  margin-top: var(--space-2);
}

.entrance-card .brand-mark {
  width: 36px;
  height: 36px;
}

.entrance-card h1 {
  font-size: 1.625rem;
}

.entrance-card p {
  color: var(--ink-2);
}

.entrance-card form {
  display: grid;
  gap: var(--space-3);
}

.entrance-card .btn,
.entrance-card button {
  width: 100%;
  min-height: 46px;
  font-size: var(--text-base);
  white-space: normal;
}

.entrance-foot {
  padding-top: var(--space-4);
  border-top: 1px solid var(--hairline);
  color: var(--ink-3);
  font-size: var(--text-sm);
}

.entrance-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- Tablet and below: 860px ---------- */

@media (max-width: 860px) {
  :root {
    --gutter: var(--space-4);
    --section-gap: var(--space-8);
  }

  .sla-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar-inner {
    flex-wrap: wrap;
    gap: 6px var(--space-4);
    padding-top: 10px;
    padding-bottom: 6px;
  }

  /* The nav becomes its own row that scrolls sideways; the fade on the right
     says there is more, and the end padding lets the last link clear it. */
  .nav {
    order: 3;
    flex-basis: 100%;
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 var(--space-8) 2px calc(var(--gutter) - var(--space-3));
    mask-image: linear-gradient(to right, #000 calc(100% - var(--space-8)), transparent);
  }

  .account {
    margin-left: auto;
  }

  .account-email {
    display: none;
  }

  .page {
    padding-top: var(--space-6);
  }

  .page-head {
    gap: var(--space-4);
    margin-bottom: var(--space-6);
  }

  .toasts {
    --toast-from: 8px;
    top: auto;
    right: var(--space-4);
    bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  }

  .table-wrap:has(> table.stack) {
    max-height: none;
  }
}

/* ---------- Phone: 640px ---------- */

@media (max-width: 640px) {
  .page-actions,
  .page-head > .segmented {
    width: 100%;
  }

  .sla-card,
  .terms {
    padding: var(--space-5);
  }

  .sla-body {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
  }

  .page-actions .segmented {
    flex: 1 1 100%;
  }

  /* Toolbars stack: fields take the full width, buttons share a row. */
  .toolbar .field {
    flex: 1 1 100%;
  }

  .toolbar .field input,
  .toolbar .field select {
    width: 100%;
  }

  .toolbar > .btn,
  .toolbar > button {
    flex: 1 1 auto;
  }

  /* Week picker: the date first, then previous / show / next underneath. */
  .week-picker .field {
    order: -1;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat {
    padding: var(--space-3) var(--space-4);
  }

  input.console-search {
    width: 100%;
  }

  .fold > summary {
    padding-inline: var(--space-4);
  }

  .fold-body {
    padding-inline: var(--space-3);
  }

  .chart {
    height: 240px;
  }

  .chart-card {
    padding-inline: var(--space-3);
  }

  .legend {
    flex-direction: column;
  }

  .empty {
    padding: var(--space-5);
  }

  .entrance-card {
    padding: 28px var(--space-6) var(--space-6);
  }
}

/* ---------- Stacked tables: under 52rem of room ---------- */

/* Each row becomes a card of label / value lines. Cells carry their label in
   data-label; a cell without one spans the card (the row's title, or its
   actions). A container query, so a table turns into cards once its columns
   stop fitting, not at a fixed viewport width. */
@container (max-width: 52rem) {
  table.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  table.stack,
  table.stack tbody,
  table.stack tr,
  table.stack td {
    display: block;
    width: auto;
  }

  table.stack tr {
    padding: 14px var(--space-4);
    border-bottom: 1px solid var(--hairline);
  }

  table.stack tbody tr:last-child {
    border-bottom: 0;
  }

  table.stack td,
  table.data.stack .num,
  table.data.stack .actions {
    width: auto;
    padding: 3px 0;
    border: 0;
    background: none;
    text-align: left;
    white-space: normal;
  }

  table.stack td[data-label] {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: var(--space-3);
    align-items: baseline;
    justify-items: start;
  }

  table.stack td[data-label]::before {
    content: attr(data-label);
    color: var(--ink-3);
    font: 600 var(--text-xs) / 1.5 var(--font-display);
  }

  table.stack td:not([data-label]):first-child {
    padding-bottom: 6px;
    color: var(--navy);
    font-family: var(--font-display);
    font-weight: 700;
  }

  table.stack td[data-label]:empty {
    display: none;
  }

  table.stack td.actions {
    padding-top: 10px;
  }

  table.stack td.actions:not(:has(*)) {
    display: none;
  }

  table.stack td.actions > form {
    display: flex;
  }

  table.stack td.actions button {
    flex: 1;
  }

  table.stack .role-form select {
    flex: 1;
  }

  table.stack .empty-row td {
    padding: var(--space-6) 0;
    text-align: center;
  }
}

/* ---------- Touch: bigger targets, no zoom on focus ---------- */

@media (pointer: coarse) {
  :root {
    --control-h: 44px;
    --control-h-sm: 40px;
  }

  /* iOS zooms the page into any control with text under 16px. */
  input[type="text"],
  input[type="date"],
  input[type="search"],
  select {
    font-size: 1rem;
  }

  .nav a {
    padding-block: 11px;
  }

  .segmented a,
  .segmented label {
    padding-block: var(--space-3);
  }

  .toast-close {
    min-height: 40px;
    width: 40px;
    margin: -6px -6px -6px 0;
  }

  .crumb {
    display: inline-block;
    margin-block: -10px;
    padding-block: 10px;
  }
}

/* ---------- Motion and transparency preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .topbar {
    animation: none;
    box-shadow: none;
  }

  button[aria-busy="true"]::after {
    animation: none;
    border-right-color: var(--spinner, var(--navy));
    opacity: 0.6;
  }

  /* A colour fade, no movement: it still shows where a link landed. */
  table.console tr:target td {
    animation-duration: 2s !important;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  /* Switching period or filter reloads the page: a short crossfade keeps
     the figures from blinking. Same-origin navigations only. */
  @view-transition {
    navigation: auto;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 150ms;
    animation-timing-function: var(--ease-out);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border: light-dark(#9aa7b1, #587084);
    --hairline: light-dark(#c7d0d6, #34495a);
    --ink-3: light-dark(#4a5a66, #a8bac8);
  }
}

/* ---------- Print: the monthly report as a PDF ---------- */

@media print {
  /* Paper is white: a report printed from a dark screen still prints light. */
  :root {
    --gutter: 0px;
    --section-gap: var(--space-6);
    color-scheme: light;
  }

  body {
    background: #fff;
  }

  .topbar,
  .page-actions,
  .share,
  .toasts {
    display: none;
  }

  .page {
    padding: 0;
  }

  .panel,
  .stat,
  .section {
    break-inside: avoid;
    box-shadow: none;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
