/*
 * Claude design system for the gateway admin console.
 *
 * Colours and type faces come from DESIGN-claude.md: warm cream, coral primary,
 * dark warm ink, serif display. Layout, structure and sizing follow the Selekta
 * system (../../dgg-selekta-cv-screener/DESIGN.md): the page header sits on the
 * canvas ABOVE one cream panel, sections inside the panel are flat and divider
 * separated, and the type scale is compact -- 14px primary, 12px secondary,
 * 11px uppercase labels.
 *
 * Copernicus / StyreneB are licensed Anthropic faces; Newsreader (display) and
 * Inter (body) stand in from Google Fonts.
 */

:root {
  --primary: #cc785c;
  --primary-active: #a9583e;
  /* Coral as text. #cc785c on cream is 3.1:1, under the 4.5:1 small text needs;
     the brand coral stays for fills, borders and icons. */
  --primary-text: #a9583e;
  /* Coral under white text. White on #cc785c is 3.3:1; these pass 4.5:1. */
  --primary-fill: #a9583e;
  --primary-fill-hover: #8f4526;
  --primary-disabled: #e6dfd8;
  --ink: #141413;
  --body: #3d3d3a;
  --body-strong: #252523;
  --muted: #6c6a64;
  --muted-soft: #75726a;
  --hairline: #e6dfd8;
  /* Tooltip ground. Lighter than the canvas so a tip reads as floating above a
     card rather than as part of it. Read back by console-charts.js so the
     canvas tooltips and the HTML ones cannot drift apart. */
  --tooltip-bg: #ffffff;
  --hairline-soft: #ebe6df;
  /* Panels stay warm cream -- pure white was tried and read cold against the
     coral -- and float on a slightly deeper page. --surface-soft is a hover and
     selected tint only; it is never a section fill, because in-panel sections
     are flat and divider separated. */
  --canvas: #faf9f5;
  --page-bg: #f8f5ef;
  --surface-soft: #f4f0e8;
  --surface-card: #ede7dc;
  --surface-cream-strong: #e8e0d2;
  --surface-dark: #181715;
  --surface-dark-elevated: #252320;
  --surface-dark-soft: #1f1e1b;
  --on-primary: #ffffff;
  --on-dark: #faf9f5;
  --on-dark-soft: #a09d96;
  --accent-teal: #5db8a6;
  --accent-amber: #e8a55a;
  --success: #5db872;
  --warning: #d4a017;
  --error: #c64545;

  --font-display: "Copernicus", "Tiempos Headline", Newsreader, "Source Serif 4", Georgia, serif;
  --font-body: "StyreneB", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  --nav-height: 64px;
  --rail-width: 240px;
  --rail-width-collapsed: 68px;
  --container-width: 1280px;
  --rail-current: var(--rail-width);
}

* { box-sizing: border-box; }

html { scrollbar-gutter: stable; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  color: var(--body);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Display tracking is an em ladder that tightens as the size grows, the way
   DESIGN-claude.md's own scale does: -0.01em at 17px, -0.015em at 20px,
   -0.02em here at 24px. Never px -- the same px value across two sizes tracks
   the larger heading looser, which is what this replaced. */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.02em;
}

a { color: var(--primary-text); }

/* Everything Google's icon stylesheet used to set, now that fonts.css ships the
   face from this box instead. The file is the wght 300 / opsz 24 / FILL 0
   instance, so there are no axes left to set here -- a filled or heavier icon
   needs another instance downloaded, not a font-variation-settings line.
   The 1em box with overflow:hidden is load-shift protection: the face is
   font-display: block, and until it arrives the ligature takes the *fallback*
   font's width -- "event_available" wide, which shoved every heading beside one
   sideways for a frame on a cold load. */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1em;
  height: 1em;
  line-height: 1;
  overflow: hidden;
}

/* Selekta's 11px uppercase label -- eyebrows, form labels, table headers. */
.label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 500;
  color: var(--ink);
}

.mono, .numeric { font-variant-numeric: tabular-nums; }

/* ---- Brand mark ---- */
.brand-mark { width: 20px; height: 20px; flex-shrink: 0; display: block; }
.signin-card__mark .brand-mark { width: 22px; height: 22px; }

/* ---- Shell: max-w-screen-xl centred inside the area the rail leaves ---- */
.shell {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  width: 100%;
}
@media (min-width: 1024px) {
  .shell { padding: 0 40px; }
}
/* The audit pages opt out of the cap (`shell_wide` on the route). Their content
   is a wide table and a bar of eight controls, not prose: at 1280px the bar ran
   about 40px short of holding its row and dropped Export and Refresh onto a
   second one. The cap stays the default everywhere else, where it is what keeps
   a line of text a readable length. */
.shell--wide { max-width: none; }

/* ---- Side rail: fixed, full height, collapses to a 68px icon rail ---- */
.side-nav {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20;
  width: var(--rail-current);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  border-right: 1px solid var(--hairline);
  transition: width 0.2s ease;
}
.side-nav__brand {
  height: var(--nav-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  padding: 0 var(--space-md);
  border-bottom: 1px solid var(--hairline);
}
.side-nav__brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.01em;
  /* The serif's descender pushes the text box's optical centre below the
     mark's when the box is line-height 1.55; 1 puts both on the same axis. */
  line-height: 1;
}
/* Flex centres the mark on the line box, which sits below the serif's cap height. */
.side-nav__brand-link .brand-mark { transform: translateY(-1.5px); }
.side-nav__brand-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
}
.rail-toggle {
  height: 32px;
  width: 32px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--muted);
  cursor: pointer;
}
.rail-toggle:hover { background: var(--surface-soft); color: var(--ink); }
.rail-toggle .material-symbols-outlined { font-size: 20px; }
.rail-toggle--expand {
  display: none;
  margin: var(--space-sm) auto 0;
  height: 40px;
  width: 40px;
}

.side-nav__groups {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) 10px;
}
.side-nav__group + .side-nav__group { margin-top: var(--space-sm); }
.side-nav__section-title { padding: 4px var(--space-sm) 2px; display: block; }
.side-nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-sm);
  margin-bottom: 2px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: background-color 0.12s ease, color 0.12s ease;
}
.side-nav__link span:not(.material-symbols-outlined) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-nav__link .material-symbols-outlined { font-size: 20px; flex-shrink: 0; }
.side-nav__link:hover { background: var(--surface-soft); color: var(--ink); }
.side-nav__link--active {
  background: var(--surface-cream-strong);
  color: var(--ink);
  font-weight: 600;
}
.side-nav__link--active .material-symbols-outlined {
  color: var(--primary);
}
.side-nav__footer {
  flex-shrink: 0;
  border-top: 1px solid var(--hairline);
  padding: var(--space-sm) 10px;
}
.side-nav__identity {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-sm);
  min-width: 0;
}
.side-nav__identity .material-symbols-outlined { font-size: 20px; color: var(--muted); flex-shrink: 0; }
.side-nav__email {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-nav__signout { width: 100%; color: var(--error); background: none; border: none; font-family: inherit; cursor: pointer; }
.side-nav__signout:hover { background: #f9eeee; color: var(--error); }
.side-nav__signout .material-symbols-outlined { color: var(--error); }

/* Collapsed rail. Keyed off html[data-sidebar], which base.html sets pre-paint
   from localStorage -- held in JS after load, the wide rail would paint first
   and snap narrow a frame later. */
html[data-sidebar="collapsed"] { --rail-current: var(--rail-width-collapsed); }
/* The label leaves the eye but stays the link's name, or a screen reader names
   every collapsed link after its icon. */
html[data-sidebar="collapsed"] .rail-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
html[data-sidebar="collapsed"] .rail-only-open { display: none; }
html[data-sidebar="collapsed"] .rail-toggle--expand { display: inline-flex; }
html[data-sidebar="collapsed"] .side-nav__brand { justify-content: center; padding: 0; }
html[data-sidebar="collapsed"] .side-nav__link,
html[data-sidebar="collapsed"] .side-nav__identity {
  justify-content: center;
  height: 40px;
  width: 40px;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
}

/* ---- Main column, offset by the rail ---- */
.app-main {
  margin-left: var(--rail-current);
  padding: 40px 0;
  min-height: 100vh;
  transition: margin-left 0.2s ease;
}
.app-main--bare { margin-left: 0; }
.content { min-width: 0; }

/* ---- Headline figures: one look for every big number on every page ---- */
.figure, .kpi strong, .rate-card strong, .budget-figure,
.global-row__amount, .alloc-summary__figure {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---- Page header: on the canvas, above the panel ---- */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: 20px;
}
/* Grows, or the block shrink-wraps to the title and the subtitle wraps at
   half the width its max-width allows. */
.page-header__text { min-width: 0; flex: 1; }
.page-header h1 {
  font-size: 24px;
  line-height: 1.2;
  margin: var(--space-xxs) 0 0;
}
.page-header p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin: 6px 0 0;
  max-width: 672px;
}
.page-header__action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* ---- Panel: one per page, flat divider-separated sections within ---- */
.panel {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel + .panel { margin-top: var(--space-md); }
.panel__section {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--hairline-soft);
}
.panel__section:last-child { border-bottom: none; }
/* Always scrollable, not only on a narrow screen: a browser zoom shrinks the
   layout viewport while staying well above the mobile breakpoint, and a table
   wider than its panel was being clipped instead of scrolled. */
.panel__section--flush { padding: 0; overflow-x: auto; }

/* Filters sit on the canvas above the panel, never inside it -- Selekta keeps
   its search and Selects as a bare flex row between the page header and the
   table card. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
/* A card above the bar owns no bottom margin of its own (.panel + .panel is
   what usually spaces them), so the two sat edge to edge and the controls read
   as part of the card. Scoped to that pairing: after an alert the bar already
   has the alert's own margin under it, and adding to it would double the gap. */
.panel + .filter-bar { margin-top: var(--space-md); }
.filter-bar input, .filter-bar select { width: auto; max-width: none; }
.filter-bar .search-input input[type="text"] { width: 100%; }
/* The one item on the bar that gives ground. `.search-input` is flex-shrink: 0
   everywhere else, which is right where it stands alone, but on a bar of eight
   controls it made a viewport 40px short of fitting wrap a whole control onto a
   second row. It has the most slack to give: a placeholder reads fine at 150px,
   where a select's label truncates. */
.filter-bar .search-input { flex-shrink: 1; min-width: 150px; }
/* The way back to an unfiltered page. It sits after the controls, never above
   the table, or it reads as a caption on the table rather than as part of the
   bar.

   Plain text, not a bordered control. Bordered on the coral it was the loudest
   thing on the bar, which put the page's emphasis on undoing a filter rather
   than on the filters themselves -- and it was a whole control's width of
   padding and border on a bar that has none to spare. Height is kept so it
   still shares the row's centre line. */
.filter-bar__clear {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  height: 38px;
  padding: 0 var(--space-xxs);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--primary-text);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.filter-bar__clear:hover { text-decoration: underline; }
.filter-bar__clear .material-symbols-outlined { font-size: 16px; }
/* The two controls that act on the whole list rather than on any one filter,
   held together and pushed to the far edge as a pair. As a pair rather than
   each on its own `margin-left: auto`: at a width where the bar wraps, the
   trailing one dropped to the second row alone and hard against its left edge,
   which read as a control that had fallen off the bar. Grouped, they take the
   slack together and wrap together. */
.filter-bar__actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* Bordered on the hairline rather than the coral: taking a copy is not the
   page's action, the filters are. */
.filter-bar__export {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  height: 38px;
  padding: 0 var(--space-sm);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--muted);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  text-decoration: none;
  white-space: nowrap;
}
.filter-bar__export:hover { color: var(--ink); background: var(--surface-soft); }
/* Off, not gone: a control that disappears whenever a filter finds nothing
   reads as the page having lost it, and the bar's spacing moves with it. */
.filter-bar__export.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.filter-bar__export.is-disabled:hover { color: var(--muted); background: var(--canvas); }
.filter-bar__export .material-symbols-outlined { font-size: 16px; }

/* Last in the group. Worded and bordered like the Clear control on the bar --
   a bare glyph among bordered controls read as decoration rather than as
   something to press -- but on the hairline rather than the coral, because
   clearing filters is the page's action and refreshing is the least of them. */
.filter-bar__refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--muted);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.filter-bar__refresh:hover { color: var(--ink); background: var(--surface-soft); }
.filter-bar__refresh .material-symbols-outlined { font-size: 16px; }
.filter-bar__refresh:disabled { opacity: 0.5; cursor: default; }
/* The read is out. Same spin as every other wait on the console, and it stays
   on the glyph rather than replacing the label: a control that swaps its own
   text mid-press reads as a different button. */
.filter-bar__refresh.is-refreshing .material-symbols-outlined {
  animation: metric-spin 0.7s linear infinite;
}
/* Where a search term matched, marked in the rows by search-highlight.js.
   Coral tint rather than the browser's yellow, which is the one colour on these
   pages belonging to nothing in the system. No padding: a mark mid-word would
   push the letters around it apart. */
.text-hit {
  background: rgba(204, 120, 92, 0.28);
  color: inherit;
  border-radius: 2px;
}

/* ---- Date range: a relative length, or two dates off a hand-drawn calendar ----
   Its trigger borrows .select__button so the bar has one control height and one
   focus ring, but the panel is its own: a Select picks one of a list, this one
   holds a draft nothing acts on until Apply. Native <input type="date"> is not
   an option here -- its picker is drawn by the browser, which is the one thing
   this console does not allow anywhere. */
.daterange { position: relative; }
.daterange__panel {
  position: fixed;
  z-index: 40;
  width: 320px;
  padding: var(--space-md);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 28px rgba(20, 20, 19, 0.14);
}
.daterange__panel[hidden] { display: none; }
.daterange__tabs {
  display: flex;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-sm);
}
.daterange__tab {
  flex: 1;
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--canvas);
  border: none;
  cursor: pointer;
}
.daterange__tab + .daterange__tab { border-left: 1px solid var(--hairline); }
.daterange__tab.is-active { background: var(--primary-fill); color: var(--on-primary); }
.daterange__pane[hidden] { display: none; }
.daterange__label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 var(--space-xxs);
}
/* The preset list is the Select's own option row, so choosing a length here and
   choosing a model in the bar behave alike. */
.daterange__option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
}
.daterange__option:hover { background: var(--surface-soft); }
.daterange__option .material-symbols-outlined {
  font-size: 16px;
  color: var(--primary);
  visibility: hidden;
}
.daterange__option.is-selected { font-weight: 500; background: var(--surface-soft); }
.daterange__option.is-selected .material-symbols-outlined { visibility: visible; }
.daterange__custom {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: var(--space-xs);
  align-items: end;
  margin-top: var(--space-xs);
}
.daterange__custom input[type="text"] { width: 100%; max-width: none; height: 32px; font-size: 13px; }
/* Four short toggles rather than a Select: a Select inside this panel writes a
   hidden input, and the bar's form submits on any such write -- picking "hours"
   would submit the draft before Apply ever ran. */
.daterange__units { display: flex; gap: 4px; }
.daterange__unit {
  flex: 1;
  height: 32px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--body);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.daterange__unit.is-selected {
  border-color: var(--primary-text);
  color: var(--primary-text);
  background: rgba(204, 120, 92, 0.08);
}
.daterange__fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-xs); }
.daterange__field {
  display: block;
  padding: 6px 10px;
  text-align: left;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.daterange__field.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(204, 120, 92, 0.30);
}
.daterange__field span {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
}
.daterange__field.is-empty span { color: var(--muted-soft); }
.daterange__month {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--space-sm) 0 var(--space-xxs);
}
.daterange__month strong { font-size: 13px; font-weight: 500; color: var(--ink); }
.daterange__month div { display: flex; gap: 2px; }
.daterange__grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.daterange__dow {
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted-soft);
  padding: 4px 0;
}
.daterange__day {
  height: 30px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.daterange__day:hover { background: var(--surface-soft); }
.daterange__day.is-between { background: rgba(204, 120, 92, 0.14); border-radius: 0; }
.daterange__day.is-end {
  background: var(--primary-fill);
  color: var(--on-primary);
  font-weight: 500;
}
.daterange__day:disabled { color: var(--primary-disabled); cursor: not-allowed; background: none; }
.daterange__day.is-empty { visibility: hidden; }
.daterange__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--hairline);
}
.daterange__footer div { display: flex; gap: var(--space-xs); }
.daterange__reset {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--primary-text);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.daterange__reset:hover { text-decoration: underline; }
.panel__footer {
  padding: var(--space-sm) var(--space-lg);
  border-top: 1px solid var(--hairline-soft);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-body);
  /* 13px against Selekta's compact scale: 14px read as a second UI weight next
     to 12px table text and 11px labels. The height is 38 and not 36, because a
     button sits in a line of 38px inputs, selects and readonly fields, and two
     pixels short reads as a misalignment rather than as a smaller control. Type
     and height are set independently for that reason -- one control height on
     the console, one type scale inside it. */
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-md);
  padding: 0 16px;
  height: 38px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.btn .material-symbols-outlined { font-size: 17px; }
.btn--primary { background: var(--primary-fill); color: var(--on-primary); border-color: var(--primary-fill); }
.btn--primary:hover, .btn--primary:active { background: var(--primary-fill-hover); border-color: var(--primary-fill-hover); }
.btn--normal { background: var(--canvas); color: var(--ink); border-color: var(--hairline); }
.btn--normal:hover { background: var(--surface-soft); }
.btn--danger { background: var(--canvas); color: var(--error); border-color: var(--error); }
.btn--danger:hover { background: #f9eeee; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:active:not(:disabled) { scale: 0.97; }
/* Disabled reads as switched off, not as a faded copy of the live button. */
.btn--primary:disabled, .btn--danger:disabled {
  opacity: 1; background: var(--primary-disabled); border-color: var(--primary-disabled); color: var(--muted);
}
/* Row-level actions only: a 38px button inside a 12px table row reads as a
   second row of chrome. A toolbar button keeps the full height -- it sits in a
   line of 38px inputs and selects, where 28px reads as misaligned. */
.btn--sm { height: 28px; font-size: 12px; padding: 0 12px; border-radius: var(--radius-md); }
.btn--sm .material-symbols-outlined { font-size: 15px; }

/* ---- Forms ---- */
.form-field { margin-bottom: var(--space-md); }
.form-field label, .field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 500;
  color: var(--ink);
}
/* Cancel then primary, bottom right -- the shape every Selekta form ends on. */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-xs);
  margin-top: var(--space-lg);
}
/* Submit rail on the canvas below the panel: the action belongs to the page,
   not to the last section of the form. */
.form-actions--page { margin-top: var(--space-md); }
.form-field__hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}
/* A value the form shows but does not let you change. Sized to the input beside
   it so a fixed field and an editable one sit on the same baseline. */
.form-static {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 38px;
  margin: 0;
  font-size: 14px;
  color: var(--body-strong);
}
.form-static__name { min-width: 0; overflow-wrap: anywhere; }
/* Every text-entry type is listed. A type missing from here falls back to the
   browser's own control, which is how the invite form's email box shipped
   unstyled beside correctly styled fields. */
input[type="text"], input[type="number"], input[type="email"],
input[type="password"], input[type="search"], input[type="url"], select {
  width: 100%;
  max-width: 360px;
  height: 38px;
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.2;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
}
select { padding-right: var(--space-xs); }
input::placeholder { color: var(--muted-soft); }
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(204, 120, 92, 0.30);
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* ---- Search field: leading icon, trailing clear (Selekta's SearchInput) ---- */
.search-input { position: relative; display: block; width: var(--search-width, 260px); flex-shrink: 0; }
.search-input input[type="text"] { width: 100%; max-width: none; padding-left: 36px; padding-right: 32px; }
.search-input__icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--muted);
  pointer-events: none;
}
.search-input__clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  width: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
}
.search-input__clear .material-symbols-outlined { font-size: 15px; }
.search-input__clear:hover { background: var(--surface-soft); color: var(--ink); }
.search-input.is-filled .search-input__clear { display: inline-flex; }

/* ---- Select: Selekta's hand-rolled dropdown, not the native control.
   The panel is position:fixed and placed by JS on open -- .panel sets
   overflow:hidden for its rounded corners, which would clip an absolutely
   positioned menu opening out of a short table. ---- */
.select { position: relative; display: inline-block; }
.select__button {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0 10px 0 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.12s ease;
}
.select__button:hover { border-color: rgba(204, 120, 92, 0.6); }
.select[data-open="true"] .select__button {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(204, 120, 92, 0.30);
}
.select__icon { font-size: 16px; color: var(--muted); flex-shrink: 0; }
.select__label { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select__chevron { font-size: 18px; color: var(--muted); flex-shrink: 0; transition: transform 0.12s ease; }
.select[data-open="true"] .select__chevron { transform: rotate(180deg); }
/* The date window borrows .select__button but is not a .select, so the rule
   above never reached its chevron and only that one control did not turn. */
.select__button[aria-expanded="true"] .select__chevron { transform: rotate(180deg); }
.select__panel {
  position: fixed;
  z-index: 40;
  max-height: 288px;
  overflow-y: auto;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 28px rgba(20, 20, 19, 0.14);
  padding: 4px 0;
}
.select__panel[hidden] { display: none; }
.select__filter { padding: 4px 8px 6px; position: sticky; top: 0; background: var(--canvas); }
.select__filter input[type="text"] { width: 100%; max-width: none; height: 32px; font-size: 13px; }
.select__option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  text-align: left;
  color: var(--ink);
  background: none;
  border: none;
  cursor: pointer;
}
.select__option[hidden] { display: none; }
.select__option:hover { background: var(--surface-soft); }
.select__option.is-selected { font-weight: 500; background: var(--surface-soft); }
.select__option-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select__check { font-size: 16px; color: var(--primary); flex-shrink: 0; visibility: hidden; }
.select__option.is-selected .select__check { visibility: visible; }
/* Two kinds of thing in one list. Sticky would fight the sticky filter above
   it, so it scrolls with its options. */
.select__group {
  padding: 8px 12px 4px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--ink);
}
.select__group[hidden] { display: none; }
.select__empty { padding: 10px 12px; font-size: 12px; color: var(--muted); }

/* ---- Tables ---- */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
/* The fill sits on the row, not on each cell. Per-cell backgrounds are rounded
   independently at fractional browser zoom, and the sub-pixel each one loses
   shows as a hairline seam between every pair of headers. One painted row has
   no edges to round. */
table.data-table thead tr { background: var(--primary-fill); }
table.data-table th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  color: var(--on-primary);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  white-space: nowrap;
}
table.data-table td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--hairline-soft);
  color: var(--body);
  /* Middle, not top: a badge is shorter than a line of body text, so top
     alignment sat every status chip visibly above its own row. */
  vertical-align: middle;
}
table.data-table tbody tr:last-child td { border-bottom: none; }
/* Dates and the action button never wrap: a wrapped "2026-11-15" reads as two
   values, and a wrapped button clipped its own label at the table edge. */
table.data-table td.nowrap, table.data-table th.nowrap { white-space: nowrap; }
table.data-table td.actions { white-space: nowrap; width: 1%; text-align: right; }
/* ---- Spend limits: one group per enforcement system, aligned rows ---- */
.limit-state { margin: 0; font-size: 12px; color: var(--muted); }
.limit-group + .limit-group { margin-top: var(--space-md); }
.limit-rows { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }

/* A grid, so period, bar and figures line up down the whole card. Left to itself
   each row sized to its own content and nothing aligned. No row rule: the reset
   line already sits under the period, and a divider read as a second track. */
/* The track takes the room the card has: the figures are one short line, so
   nothing is gained by holding width back for them. */
.limit-row {
  display: grid;
  /* The figures column is fixed, not auto: sized to its own text it changed
     width per row, and every track then ended at a different x. */
  /* 190px, not 150: "Resets at 07:00 (in 13 hr)" is 26 mono characters and the
     line must not wrap under the period it belongs to. */
  grid-template-columns: 190px minmax(120px, 1fr) 92px;
  align-items: center;
  gap: var(--space-md);
  padding: 4px 0;
}
.limit-row__label { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.limit-row__period { font-size: 13px; color: var(--body-strong); }
.limit-row__figures {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
/* Colour alone said "near": the word is what a screen reader and a colour-blind
   reader get. */
.limit-row__flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #7a5c05;
}
.limit-row__flag .material-symbols-outlined { font-size: 14px; }
.limit-row.is-over .limit-row__flag { color: var(--error); }
.limit-row__track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-cream-strong);
  overflow: hidden;
}
/* Nothing to fill, so the track reads as an absence rather than as an empty
   allowance somebody is at 0% of. */
.limit-row__track.is-uncapped { background: transparent; border-bottom: 1px dashed var(--hairline); }
.limit-row__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--primary);
  /* A limit barely touched still shows something: a 0.2% fill rounds to nothing
     and reads as a broken bar rather than as low spend. */
  min-width: 2px;
}
.limit-row__pct,
.limit-row__reset {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.limit-row__pct { font-size: 12px; color: var(--body); text-align: right; }
.limit-row__reset { font-size: 11px; color: var(--muted-soft); }
.limit-row.is-near .limit-row__fill { background: var(--warning); }
.limit-row.is-over .limit-row__fill { background: var(--error); }
.limit-row.is-over .limit-row__pct { color: var(--error); }

@media (max-width: 720px) {
  /* Label and bar on one line, the figures under them: three columns in a phone
     width put two characters per cell. */
  .limit-row {
    grid-template-columns: 110px minmax(0, 1fr);
    justify-content: stretch;
    gap: var(--space-sm);
  }
  /* No room for 26 characters on one line at this width, so the reset wraps
     rather than running under the track. */
  .limit-row__reset { white-space: normal; }
  .limit-row__figures { grid-column: 1 / -1; align-items: flex-start; }
}

/* ---- Spend limits: the same bar inside a table row ---- */
/* The column it sits in is sized by that table's colgroup, not here: the table
   is table-layout: fixed so revealing a row cannot re-measure and shift every
   track to a different x. */
.limit-meter {
  display: grid;
  /* The *track* is the fixed column and the figure takes the remainder, not the
     other way round. With the track on 1fr its width came out of dividing the
     leftover space, and at fractional browser zoom that division rounds
     differently row by row -- so the bars ended up visibly different lengths in
     the same column. A fixed track cannot vary; the figure is right-aligned, so
     the slack falls between the two and nothing moves. */
  grid-template-columns: 130px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-sm);
}
.limit-meter__track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-cream-strong);
  overflow: hidden;
}
/* Nothing to fill, so the track reads as an absence rather than as an allowance
   somebody is at 0% of. */
.limit-meter__track.is-uncapped { background: transparent; border-bottom: 1px dashed var(--hairline); }
.limit-meter__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--primary);
  /* A limit barely touched still shows something: a 0.2% fill rounds to nothing
     and reads as a broken bar rather than as low spend. */
  min-width: 2px;
}
.limit-meter__figure {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--body);
  white-space: nowrap;
  text-align: right;
}
.limit-meter.is-near .limit-meter__fill { background: var(--warning); }
.limit-meter.is-over .limit-meter__fill { background: var(--error); }
.limit-meter.is-over .limit-meter__figure { color: var(--error); }
/* Pending and unreadable share this: both are the absence of a reading, and
   neither may look like a bar sitting at zero. */
.limit-meter__pending { font-size: 11px; color: var(--muted-soft); }

/* ---- How much of the global limit a group's budget may take ---- */
/* Sits inside the form, under the field it bounds, so it is spaced as a field
   is rather than as a panel. The fill is what other groups already hold; the
   empty remainder is what may be typed above it.

   Drawn in two places from the same figures: server-rendered on /groups/new,
   and built by confirmDialog's buildRoom for the Change budget dialog. */
.alloc-room {
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}
.alloc-room__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: 6px;
}
.alloc-room__caption { font-size: 12px; color: var(--muted); }
.alloc-room__figure {
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.alloc-room__track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-cream-strong);
  overflow: hidden;
}
.alloc-room__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--primary);
}
/* Taken and this group's share sit end to end, so the track is a row. */
.alloc-room__track { display: flex; }
.alloc-room__fill--this { width: 0; opacity: .45; transition: width .15s ease; }
.alloc-room__dot--this { background: var(--primary); opacity: .45; }
.alloc-room.is-over { border-color: var(--error); }
.alloc-room.is-over .alloc-room__caption,
.alloc-room.is-over .alloc-room__figure { color: var(--error); }
.alloc-room.is-over .alloc-room__fill--this { background: var(--error); opacity: 1; }
.alloc-room__error { margin: 8px 0 0; font-size: 12px; color: var(--error); }
.alloc-room__error:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .alloc-room__fill--this { transition: none; } }
.alloc-room__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}
.alloc-room__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: baseline;
}
.alloc-room__dot--taken { background: var(--primary); }
.alloc-room__dot--free { background: var(--surface-cream-strong); }
/* In the dialog it is the last thing in its field, where the form's copy has
   the field's own margin below it. Its bottom margin there would read as a gap
   before the buttons. */
#confirm-modal-input-room .alloc-room {
  margin-top: var(--space-sm);
  margin-bottom: 0;
}

/* Row disclosure, shared by spend limits, token usage and prompt history: the
   whole parent row is the target, the chevron turns rather than swapping glyph,
   and the revealed rows sit on the soft wash. */
.limit-child-row, .prompt-detail-row, .usage-model-row { display: none; }
.limit-child-row > td, .prompt-detail-row > td, .usage-model-row > td,
table.data-table tbody tr.limit-child-row:hover td,
table.data-table tbody tr.prompt-detail-row:hover td,
table.data-table tbody tr.usage-model-row:hover td { background: var(--surface-soft); }
.limit-parent-row, .prompt-row, .usage-user-row { cursor: pointer; }
.limit-toggle, .prompt-toggle, .usage-toggle {
  background: none; border: none; padding: 5px; margin: -5px -1px -5px -5px;
  cursor: pointer; color: var(--muted); vertical-align: middle; line-height: 1;
}
.limit-toggle .material-symbols-outlined,
.prompt-toggle .material-symbols-outlined,
.usage-toggle .material-symbols-outlined {
  font-size: 18px; vertical-align: middle; display: inline-block;
  transition: transform 0.12s ease;
}
.limit-toggle[aria-expanded="true"] .material-symbols-outlined,
.prompt-toggle[aria-expanded="true"] .material-symbols-outlined,
.usage-toggle[aria-expanded="true"] .material-symbols-outlined { transform: rotate(90deg); }
/* The meter beside a spend figure in a table row, the same width on every table. */
.data-table .limit-meter { grid-template-columns: 95px minmax(min-content, 1fr); }

/* A long name shortens rather than widening the table past its container --
   that overflow is what pushed the Delete button off the right edge. The full
   name is on the cell's title attribute. */
.cell-clip {
  display: block;
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
table.data-table tbody tr:hover td { background: var(--surface-soft); }
table.data-table .numeric { text-align: right; font-family: var(--font-mono); font-size: 12px; }
table.data-table th.numeric { font-family: var(--font-body); }
table.data-table .cell-sub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}
.pagination__range, .pagination__page {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.pagination__nav { display: flex; align-items: center; gap: var(--space-xxs); }
.pagination__page { padding: 0 var(--space-xs); }
.pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--primary);
  background: var(--canvas);
  color: var(--primary);
  text-decoration: none;
}
.pagination__btn:hover { background: rgba(204, 120, 92, 0.08); }
.pagination__btn .material-symbols-outlined { font-size: 16px; }
.pagination__btn--disabled { opacity: 0.3; pointer-events: none; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-card);
  color: var(--ink);
  white-space: nowrap;
}
.badge .material-symbols-outlined { font-size: 13px; line-height: 16px; }
.badge--success { background: rgba(93, 184, 114, 0.16); color: #2f6b3f; }
.badge--warning { background: rgba(212, 160, 23, 0.16); color: #7a5c05; }
.badge--error { background: rgba(198, 69, 69, 0.14); color: var(--error); }
/* In flight: the allow-list is written, the gateway is restarting. Coral rather
   than green or grey, because it is neither state yet. */
.badge--pending { background: rgba(217, 119, 87, 0.16); color: #8f4526; }
.badge--pending .spinner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(143, 69, 38, 0.3);
  border-top-color: #8f4526;
  animation: metric-spin 0.7s linear infinite;
}
.badge--info { background: var(--surface-card); color: var(--body-strong); }

/* One chip shape for "who sent this", on both audit pages: a person and a key
   are the same kind of answer to the same column, so they differ by icon and
   tint and by nothing else. The person's was a solid-primary uppercase badge
   before this, which read as a status next to the key's soft grey pill rather
   than as its counterpart; that variant had no other user and is gone. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  max-width: 100%;
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.chip__text { overflow: hidden; text-overflow: ellipsis; }
.chip .material-symbols-outlined { font-size: 13px; line-height: 16px; flex-shrink: 0; }
.chip--person {
  background: rgba(204, 120, 92, 0.12);
  border-color: rgba(204, 120, 92, 0.34);
  color: #8f4526;
}
.chip--key {
  background: rgba(93, 184, 166, 0.14);
  border-color: rgba(93, 184, 166, 0.38);
  color: #2f6b62;
}
/* Not a third kind of subject: a row nobody could be matched to. Muted and
   dashed so it reads as an absent answer rather than as a party called
   Unattributed. */
.chip--none {
  background: transparent;
  border-color: var(--hairline);
  border-style: dashed;
  color: var(--muted);
}
/* ---- Alerts (sit above the page header) ---- */
.alert {
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  display: flex;
  gap: var(--space-sm);
  font-size: 12px;
  border: 1px solid var(--hairline);
  background: var(--canvas);
  color: var(--body-strong);
}
.alert > .material-symbols-outlined { font-size: 18px; flex-shrink: 0; }
.alert__body { flex: 1; min-width: 0; }
.alert__body > :first-child { margin-top: 0; }
.alert__body > :last-child { margin-bottom: 0; }
.alert--error { border-color: rgba(198, 69, 69, 0.4); background: #faf1f0; }
.alert--error > .material-symbols-outlined { color: var(--error); }
.alert--info > .material-symbols-outlined { color: var(--primary); }
/* display:flex above beats the UA's [hidden] rule, same as .select__panel and
   .modal below. Without this an alert toggled by the hidden attribute shows as
   an empty coloured box. */
.alert[hidden] { display: none; }

/* ---- Utility ---- */
.text-secondary { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: 0.94em; }
/* A row's own name, where the row opens onto a page of its own. Coral is the
   CTA colour and a column of it reads as a column of buttons, so the name keeps
   the body ink and earns its underline on hover instead. */
.link-row { color: var(--ink); text-decoration: none; display: block; min-width: 0; }
.link-row:hover .group-name__text { text-decoration: underline; }
/* Its own padding, so the gap is even on both sides: a plain space before a
   .mono run reads narrower than the one after the body-font word. */
.dot-sep { padding: 0 0.5em; color: var(--muted-soft); }
.flex-row { display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; }
.flex-row--top { align-items: flex-start; gap: var(--space-md); }
.flex-row--between { display: flex; align-items: center; justify-content: space-between; }
.flex-row--end { justify-content: flex-end; flex-wrap: nowrap; }
.grow { flex: 1; }
.icon-inline { display: inline-flex; align-items: center; gap: 6px; }
.icon-inline .material-symbols-outlined { font-size: 16px; }
.footnote { color: var(--muted); font-size: 11px; margin: var(--space-md) 0 0; }
.empty-state {
  padding: 64px var(--space-lg);
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}
/* Direct child only. An empty state may carry the action that fills it, and
   as a descendant rule this landed on that button's own icon too: 32px, muted,
   and display: block, which dropped the glyph onto its own line above the
   label and drew it in the empty state's grey rather than the button's. */
.empty-state > .material-symbols-outlined {
  font-size: 32px;
  color: var(--muted-soft);
  display: block;
  margin: 0 auto var(--space-sm);
}
.prose-block p { margin: 0 0 var(--space-xs); color: var(--muted); font-size: 12px; }
.prose-block p:last-child { margin-bottom: 0; }

/* ---- Model cards: the offered catalog, laid out like Bedrock's own model
   catalog. These sit directly on the canvas -- no panel around them, or the
   grid becomes cards inside a card. ---- */
.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: var(--space-md);
}
.model-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}
.model-card__head { display: flex; align-items: flex-start; gap: var(--space-sm); }
.model-mark { display: block; width: 36px; height: 36px; flex-shrink: 0; }
.model-card__title { min-width: 0; }
.model-card__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.model-card__by { font-size: 11px; color: var(--muted); margin-top: 2px; }
/* Two lines, clipped: the cards sit on a grid and a long blurb would push one
   card taller than its row. The full text is on the model's own page. */
.model-card__desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.model-card__foot {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--hairline-soft);
}
.model-card__trait {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  font-size: 11px;
  color: var(--muted);
}
.model-card__trait .material-symbols-outlined { font-size: 14px; }
/* The whole card is the link to the model's page. */
.model-card { text-decoration: none; color: inherit; transition: border-color 0.15s ease; }
.model-card:hover { border-color: var(--primary); }
.model-card__go { margin-left: auto; font-size: 18px; color: var(--muted-soft); }
.model-card:hover .model-card__go { color: var(--primary); }

/* Label-and-value rows for a detail page: the label column is the 11px
   uppercase one, and the rule sits between rows only. */
.kv-table { width: 100%; border-collapse: collapse; }
.kv-table th,
.kv-table td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--hairline-soft);
  font-size: 14px;
  color: var(--body-strong);
  font-weight: 400;
}
.kv-table tr:first-child th,
.kv-table tr:first-child td { border-top: none; }
.kv-table th {
  width: 220px;
  padding-right: var(--space-lg);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 500;
  color: var(--ink);
  /* Optical: an 11px label against a 14px value reads as sitting high. */
  padding-top: calc(var(--space-sm) + 3px);
}
.kv-table__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: var(--space-xs);
  font-size: 12px;
}
.kv-table__link .material-symbols-outlined { font-size: 13px; }

/* The overview paragraph sits between the section heading and the detail rows,
   so it reads at body size rather than as a second subtitle. */
.model-detail__lede {
  margin: var(--space-md) 0 var(--space-xl);
  font-size: 14px;
  line-height: 1.6;
  color: var(--body-strong);
  max-width: 100ch;
}

/* One card per token kind: four numbers that are read against each other. */
.rate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-md);
}
.rate-card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}
.rate-card .label { display: block; margin-bottom: var(--space-xs); }
.rate-card strong { display: block; }
.rate-card__sub { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }

/* Documentation the console does not host: the target named rather than left to
   the URL. */
.doc-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}
.doc-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease;
}
.doc-link:hover { border-color: var(--primary); }
.doc-link > .material-symbols-outlined { font-size: 18px; color: var(--primary); }
.doc-link__text { display: block; font-size: 14px; font-weight: 500; }
.doc-link__sub { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.doc-link__go { margin-left: auto; font-size: 15px; color: var(--muted-soft); }

/* ---- One-time secret reveal: its own page state, not an alert. ---- */
.reveal {
  display: flex;
  flex-direction: column;
  /* Generous on purpose. This page is read once, under time pressure, by
     somebody about to lose the only copy of a credential -- the density that
     suits a list of ten keys works against it here. */
  gap: var(--space-lg);
}
.reveal__lede { font-size: 12px; color: var(--muted); margin: 0; max-width: 672px; }
/* Facts divided by rules between them, not by rules above and below the row --
   two full-width horizontal lines read as a table the row was not. */
.reveal__meta--grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md) 0;
}
.reveal__meta--grid > div {
  padding: 0 var(--space-lg);
  border-left: 1px solid var(--hairline);
  min-width: 0;
  flex: 1 1 auto;
}
/* No leading rule on the first, nor on whichever item wraps to a new line --
   a divider hanging off the left edge of a row reads as a mistake. */
.reveal__meta--grid > div:first-child { padding-left: 0; border-left: none; }

.reveal__step {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
/* The same shape as .section-heading: coral icon, serif title, muted line under.
   A sans-serif title with no icon read as a form label rather than a heading. */
.reveal__step-head__title {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.reveal__step-head__title .material-symbols-outlined {
  font-size: 18px;
  color: var(--primary);
}
.reveal__step-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.reveal__step-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

/* ---- Light code block. Dark surfaces are product chrome only (DESIGN-claude
   .md); a snippet the reader is meant to copy off a cream form is not chrome,
   and the dark slab read as an error state on this page. ---- */
.code-block {
  position: relative;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.code-block pre {
  margin: 0;
  padding: var(--space-md);
  /* Room for the copy button, which floats over the first line. */
  padding-right: 96px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--body-strong);
  white-space: pre;
  -moz-tab-size: 2;
  tab-size: 2;
}
.code-block__copy {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
}
.code-block--key pre {
  font-size: 13px;
  /* The one string on the page that must survive a narrow window intact. */
  white-space: pre-wrap;
  word-break: break-all;
}

/* Tabs over one code block: the same key, four ways to use it. */
.code-tabs { display: flex; flex-wrap: wrap; gap: var(--space-xxs); margin-bottom: var(--space-xs); }
.code-tabs__tab {
  border: 1px solid transparent;
  background: none;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.code-tabs__tab:hover { color: var(--body-strong); background: var(--surface-soft); }
.code-tabs__tab[aria-selected="true"] {
  color: var(--primary-text);
  border-color: var(--hairline);
  background: var(--canvas);
  font-weight: 500;
}

/* ---- Field validation. The browser's own bubble is a native popup that
   ignores every token in this file, so forms carry novalidate and this
   renders the message inline instead. ---- */
.form-field--invalid input,
.form-field--invalid .select__button {
  border-color: var(--error);
}
.form-field--invalid input:focus {
  border-color: var(--error);
  box-shadow: 0 0 0 2px rgba(198, 69, 69, 0.25);
}
.form-field__error {
  display: flex;
  align-items: center;
  gap: var(--space-xxs);
  margin-top: 6px;
  font-size: 11px;
  color: var(--error);
}
.form-field__error .material-symbols-outlined { font-size: 14px; }
/* The hint is replaced by the error rather than stacked under it: two lines of
   small print below one field is where this form started looking cramped. */
.form-field--invalid .form-field__hint { display: none; }
.reveal__meta { display: flex; flex-wrap: wrap; gap: var(--space-lg); }
.reveal__meta div { min-width: 0; }
.reveal__meta .label { display: block; }
.reveal__meta p { margin: 2px 0 0; font-size: 12px; color: var(--body); }

/* ---- Toasts: page-level outcomes, top right (Selekta's placement). Below the
   confirm dialog in the stack, so a toast never covers the question it will
   answer. ---- */
.toast-stack {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: 380px;
  max-width: calc(100vw - 2 * var(--space-lg));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--canvas);
  box-shadow: 0 8px 24px rgba(20, 20, 19, 0.10);
  font-size: 13px;
  line-height: 1.5;
  color: var(--body-strong);
  animation: toast-in 250ms cubic-bezier(0.22, 1, 0.36, 1);
}
.toast p { margin: 0; flex: 1; min-width: 0; }
.toast > .material-symbols-outlined { font-size: 18px; margin-top: 1px; }
.toast--success { border-color: rgba(93, 184, 114, 0.4); background: #f2f8f2; }
.toast--success > .material-symbols-outlined { color: #2f6b3f; }
.toast--error { border-color: rgba(198, 69, 69, 0.4); background: #faf1f0; }
.toast--warning { border-color: rgba(214, 158, 46, 0.45); background: #fdf6e8; }
.toast--warning > .material-symbols-outlined { color: var(--warning); }
.toast--error > .material-symbols-outlined { color: var(--error); }
.toast__close {
  flex-shrink: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.toast__close:hover { opacity: 1; }
.toast__close .material-symbols-outlined { font-size: 16px; }
.toast.is-leaving { animation: toast-out 150ms cubic-bezier(0.22, 1, 0.36, 1) forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(12px); }
}

/* ---- Confirm dialog. Backdrop and panel appear at once: no fade, no pop. ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: rgba(20, 20, 19, 0.4);
  backdrop-filter: blur(2px);
}
.modal[hidden] { display: none; }
.modal__panel {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 45px rgba(20, 20, 19, 0.22);
  width: 100%;
  max-width: 460px;
  padding: var(--space-lg);
}
.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
}
.modal__head h2 {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  margin: 0;
}
.modal__close {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
}
.modal__close:hover { color: var(--ink); }
.modal__body {
  font-size: 12px;
  line-height: 1.6;
  color: var(--body);
  margin: var(--space-sm) 0 var(--space-lg);
  white-space: pre-line;
}
.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-xs);
}
/* The dialog's optional input. Sits between the body and the actions, so the
   sentence explaining the change is read before the control that makes it. */
.modal__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 var(--space-lg);
}
.modal__field[hidden] { display: none; }
.modal__field > .label { font-size: 11px; }
.modal__field .select { width: 100%; }
/* The amount an action collects alongside its select. The input itself is
   already styled globally; only its width belongs to the dialog. */
.modal__input { width: 100%; }
/* Above the dialog's own panel: the list is fixed-positioned and would otherwise
   paint underneath the surface it was opened from. */
.modal__field .select__panel { z-index: 60; }

/* The dialog's multiple-choice list. Scrolls rather than growing the panel: a
   deployment offering a dozen models must not push the actions off the screen. */
.modal__choices {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 6px;
  background: var(--canvas);
}
.modal__choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--body-strong);
  cursor: pointer;
}
.modal__choice:hover { background: var(--surface-soft); }
.modal__choice-text { display: flex; align-items: baseline; gap: var(--space-xs); min-width: 0; }
.modal__choice-text .mono { font-size: 11px; color: var(--muted); }

/* Native spinners are the one piece of browser chrome left on a form control,
   and they differ per browser. The field still accepts only numbers. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* A single row action needs no menu around it: the icon is the control, and the
   confirm dialog is what actually guards it. */
.icon-button {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  line-height: 1;
}
.icon-button:hover { color: var(--ink); background: var(--surface-soft); }
.icon-button--danger:hover { color: var(--error); background: rgba(198, 69, 69, 0.08); }
/* Sized like a small button's icon. The face defaults to 24px, which next to a
   12px table cell reads as a different control entirely. */
.icon-button .material-symbols-outlined { font-size: 18px; }

/* An info control sits *inside* a line of text rather than beside a row, so it
   is not an .icon-button: no padding box, no hover fill, and it rides the line
   it explains. Its own element and not a title attribute, because the text it
   opens is two paragraphs and a tooltip truncates. */
.info-button {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  cursor: pointer;
  color: var(--muted-soft);
  display: inline-flex;
  vertical-align: middle;
  line-height: 1;
}
.info-button:hover { color: var(--primary); }
.info-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
/* Matched to the 11px meta line it sits on, not to the 18px row actions use. */
.info-button .material-symbols-outlined { font-size: 15px; }

/* The info control's own bubble. Fixed and placed from script for the same
   reason .kebab__menu is: it is opened from a row inside a scroll container,
   which would clip it. Sized to be read, not to be a dialog. */
.info-tip {
  position: fixed;
  z-index: 45;
  max-width: 300px;
  padding: 10px 12px;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 24px rgba(20, 20, 19, 0.16);
}
.info-tip[hidden] { display: none; }
.info-tip__head {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.info-tip__head[hidden] { display: none; }
.info-tip__body {
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--body);
  /* The text is written with its own paragraph breaks and set as textContent,
     so the breaks have to survive without any markup. */
  white-space: pre-line;
}

/* ---- Row actions: one kebab per row ---- */
.kebab { position: relative; display: inline-flex; }
.kebab__button {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  line-height: 1;
}
.kebab__button .material-symbols-outlined { font-size: 18px; }
.kebab__button:hover { color: var(--ink); background: var(--surface-soft); }
.kebab__button[aria-expanded="true"] { color: var(--ink); border-color: var(--hairline); background: var(--surface-soft); }
/* Fixed and placed from script, exactly like .select__panel: the table's own
   scroll container clips an absolutely positioned menu, and the last row's would
   be cut off by the panel edge. That is also why it closes on scroll. */
.kebab__menu {
  position: fixed;
  z-index: 40;
  min-width: 180px;
  padding: 4px;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgba(20, 20, 19, 0.16);
  display: flex;
  flex-direction: column;
}
.kebab__menu[hidden] { display: none; }
.kebab__menu form { display: contents; }
.kebab__item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
/* An item that navigates is an anchor, which arrives underlined and in the link
   colour. Nothing in the menu may look different for being a link. */
a.kebab__item { text-decoration: none; }
.kebab__item:hover { background: var(--surface-soft); }
.kebab__item .material-symbols-outlined { font-size: 16px; color: var(--muted); }
.kebab__item--danger { color: var(--error); }
.kebab__item--danger .material-symbols-outlined { color: var(--error); }
.kebab__item--danger:hover { background: rgba(198, 69, 69, 0.08); }

/* ---- Sign-in / not-authorized pages ---- */
.signin-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  background: var(--page-bg);
}
.signin-card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 460px;
  width: 100%;
  text-align: center;
}
.signin-card__mark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  margin-bottom: var(--space-md);
}
.signin-card h1 {
  font-size: 24px;
  line-height: 1.2;
  margin: 0 0 var(--space-xs);
}
.signin-card p { font-size: 12px; }
.signin-card .btn { width: 100%; margin-top: var(--space-md); }

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

/* KPI strip: figures inside the section's own panel, split by vertical rules
   (Selekta's shape) rather than boxed one card each -- these are one reading of
   one period, and a card per figure made five of them. */
.kpi-strip {
  display: flex;
  flex-wrap: wrap;
}
/* 140px, not 180: the five figures have to hold one row down to where the media
   query below stacks them, or a wrapped row starts with a rule against nothing. */
.kpi {
  position: relative;
  flex: 1 1 140px;
  padding: 0 var(--space-lg);
}
/* A pseudo-element, not a border: the rule is a short mark between figures
   rather than a full-height edge, so it separates without ruling the panel. */
.kpi::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 34px;
  background: var(--hairline);
}
/* The first figure sits on the text column, so the mark between figures never
   becomes a rule down the left of the page. */
.kpi:first-child { padding-left: 0; }
.kpi:first-child::before { content: none; }
.kpi__head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--space-xs);
}
.kpi__head .material-symbols-outlined { font-size: 16px; color: var(--muted-soft); }
.kpi strong { display: inline-block; }
/* The strip arrives on its own request, and while it is in flight each figure
   carries the ring the chart sections use -- one loading idiom on the page, or
   two animations in one card read as two things happening. The label above stays
   put, so the strip still says what is loading.

   `color: transparent` rather than hiding the em dash: the character keeps the
   line at its own height, so nothing moves when the figure lands. */
.kpi-strip.is-loading strong[data-kpi] {
  color: transparent;
  /* The ring is placed off the figure's own box, not the cell: `.kpi` starts at
     the label above, so anchoring there put the ring over the wrong line. */
  position: relative;
  display: inline-block;
}
.kpi-strip.is-loading strong[data-kpi]::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  margin-top: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--hairline);
  border-top-color: var(--primary);
  animation: metric-spin 0.7s linear infinite;
}

.section-heading { margin: var(--space-xl) 0 var(--space-md); }
/* Heading left, the section's own control right, both on the same baseline as
   the page header's action. */
.section-heading--row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
}
.section-heading__text { min-width: 0; flex: 1 1 280px; }
.section-heading h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
  /* Explicit, so the heading box matches the icon's and align-items actually
     centres the two against each other rather than against inherited leading. */
  line-height: 1.2;
}
/* Icon in a column of its own, title and line under it in the next one, so the
   description starts exactly where the title text does. Padding cannot do this:
   the icon box is an em of a font whose glyph is narrower than its advance. */
.section-heading:not(.section-heading--row),
.section-heading__text {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: var(--space-xs);
}
/* The icon and the h2 become items of the grid above; the wrapper stays in the
   markup because the row variant still needs something to sit beside. */
.section-heading__title { display: contents; }
.section-heading p {
  grid-column: 2;
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.section-heading__title .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
  color: var(--primary);
}

/* Two cards per row. Cards sit on the canvas, never inside a panel: a card
   nested in a card is the one thing this system does not do. */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}
.metric-card {
  margin: 0;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}
.metric-card--wide { grid-column: 1 / -1; }
.metric-card figcaption { margin-bottom: var(--space-lg); }
.metric-card figcaption h3 {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
.metric-card figcaption p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

/* Fixed height: Chart.js sizes to its container, and a percentage height would
   collapse to zero inside the grid. */
.chart__canvas { position: relative; height: 240px; }
/* The canvas's own box. It kept a script-set height back when a ranked bar list
   scrolled inside the card; those cards are HTML lists now, and what is left is
   the wrapper barList draws its rows into. */
.chart__scroll { position: relative; height: 100%; }

/* Bar lists: the per-developer and per-key cards draw HTML rows rather than a
   canvas, so every entity gets a row of its own instead of being folded into
   "Other (n)". The holder stops being a fixed box and becomes a window: it is
   as tall as the rows up to the height every other card stands at, and scrolls
   past that. min-height keeps the loading ring's box from collapsing to nothing
   between two renders. */
.chart__canvas--list {
  height: auto;
  min-height: 96px;
  max-height: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.chart__canvas--list .chart__scroll { height: auto; }
.bar-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
/* The card sits in a minmax(0, 1fr) grid column, so a cell that will not shrink
   pushes this card wider than the one beside it. The name is minmax(0, ...) and
   crops; the figure column is the only fixed width on the row. */
/* The figure column is a fixed width rather than `auto`: the two cards in a row
   are read across, and a column sized to its own contents made the cost card's
   bars measurably longer than the models card's beside it. */
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 104px) minmax(0, 1fr) 58px;
  align-items: center;
  gap: var(--space-xs);
}
.bar-row__who {
  font-size: 12px;
  color: var(--body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* No rail behind the bar: the row is already bounded by the card and the figure
   at its end, and a full-width tint read as a bar of its own. */
.bar-row__track {
  display: flex;
  align-items: stretch;
  height: 20px;
  min-width: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.bar-row__fill { border-radius: var(--radius-sm); }
/* The gap between stacked segments is the card's own canvas, the same way the
   charts draw it. */
.bar-row__fill--segment { border-radius: 0; }
.bar-row__fill--segment + .bar-row__fill--segment { border-left: 2px solid var(--canvas); }
.bar-row__value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  text-align: right;
}
/* Hover tooltip for a bar row. Fixed to the viewport and pointer-transparent,
   so it never has to chase the card's own scrolling or block the row under it. */
/* Every token here is the one the Chart.js tooltips are configured with in
   console-charts.js (ground, hairline, 6px corner, 10px pad, 11px text, no
   shadow). The two kinds of card sit side by side in one grid and a tip that
   changes shape as the pointer crosses between them reads as a fault. */
.bar-tip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  min-width: 160px;
  padding: 10px;
  background: var(--tooltip-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--body);
  /* Closed is a class, not `hidden`: `display: none` would cancel the fade, and
     the box has to survive between two rows so it can travel between them the
     way the Chart.js tooltips on the cards above do. */
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s linear, visibility 0s linear .2s;
}
/* The glide is slower than the fade on purpose, and both are the figures
   Chart.js tooltips use by default: 200ms linear for opacity, 400ms easeOutQuart
   for position. A quick travel makes the box feel like it is snapping between
   rows and reads as unstable; the fade has to stay short or the box lingers over
   a row the pointer has left. cubic-bezier below is easeOutQuart. */
.bar-tip.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity .2s linear,
              left .4s cubic-bezier(.165, .84, .44, 1),
              top .4s cubic-bezier(.165, .84, .44, 1);
}
/* The frame a first open is positioned in. Without it the box slides in from
   wherever the last one was left, across the whole card. */
.bar-tip.is-placing { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .bar-tip, .bar-tip.is-open { transition: opacity .001s linear; }
  .bar-tip::before, .bar-tip::after { transition: none; }
}
/* The caret, drawn as two stacked triangles so the hairline border carries
   around it: the back one is the border colour, the front one the surface, one
   pixel in. --tip-caret is set from script and is the row's centre measured
   from the top of the box, which is not the box's own middle once it has been
   pushed off a window edge. */
.bar-tip::before,
.bar-tip::after {
  content: "";
  position: absolute;
  top: var(--tip-caret, 50%);
  width: 0;
  height: 0;
  border: 6px solid transparent;
  margin-top: -6px;
  transition: top .4s cubic-bezier(.165, .84, .44, 1);
}
.bar-tip::before { right: 100%; border-right-color: var(--hairline); }
.bar-tip::after { right: 100%; margin-right: -1px; border-right-color: var(--tooltip-bg); }
.bar-tip--left::before { right: auto; left: 100%; border-right-color: transparent; border-left-color: var(--hairline); }
.bar-tip--left::after {
  right: auto;
  left: 100%;
  margin-right: 0;
  margin-left: -1px;
  border-right-color: transparent;
  border-left-color: var(--tooltip-bg);
}
.bar-tip strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
}
.bar-tip__line {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px 0;
}
.bar-tip__line.is-total {
  margin-top: var(--space-xxs);
  padding-top: var(--space-xxs);
  border-top: 1px solid var(--hairline-soft);
  color: var(--ink);
}
.bar-tip__lines { display: block; }
.bar-tip__swatch { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
/* Popover mode: the same box, opened from the legend's overflow count rather
   than a bar. It carries no caret (it sits under its trigger, not beside a row),
   takes the pointer so a long list can be scrolled, and lays out in columns
   before it reaches for height -- a fifty-key list is the case this exists for. */
.bar-tip--pop { pointer-events: auto; max-width: min(520px, calc(100vw - 24px)); }
/* The popover's heading labels a list rather than naming one row, so it is set
   as a label: the bar tooltip's heading stays a name in the body face. */
.bar-tip--pop strong {
  margin-bottom: var(--space-xs);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted-soft);
}
.bar-tip--pop::before,
.bar-tip--pop::after { display: none; }
.bar-tip--pop .bar-tip__lines {
  display: grid;
  gap: 2px 20px;
  max-height: 264px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.bar-tip--columns .bar-tip__lines { grid-template-columns: 1fr 1fr; }
.bar-tip--three .bar-tip__lines { grid-template-columns: repeat(3, 1fr); }
.bar-tip--pop .bar-tip__label { white-space: nowrap; }
.bar-tip__label { flex: 1 1 auto; }
.bar-tip__value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.chart__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: var(--radius-md);
}

/* Built in JS, not by Chart.js: clicking an entry isolates that series, and a
   canvas legend can only strike the others through where dimming reads better. */
.chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px var(--space-lg);
  padding-top: var(--space-sm);
}
/* A chart that draws no legend still keeps the box, and its padding would sit
   under the axis as a gap that reads as a missing element. */
.chart__legend:empty { padding-top: 0; }
.chart__legend button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  margin: -6px -4px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.chart__legend .swatch { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chart__legend button.is-isolated { color: var(--ink); font-weight: 600; }
.chart__legend button.is-dimmed { opacity: 0.6; }
.chart__legend button.is-dimmed:hover { opacity: 0.7; }
/* The entity charts draw every developer and every key, so the legend names the
   first few and folds the rest behind this. Display only: the lines are all on
   the chart either way. */
.chart__legend button.is-more { color: var(--muted); text-decoration: underline; }
.chart__legend button.is-more:hover { color: var(--ink); }

.alert--warning { border-color: rgba(212, 160, 23, 0.4); background: #fbf6e9; }
.alert--warning > .material-symbols-outlined { color: #8a6a10; }

.panel + .section-heading { margin-top: var(--space-xl); }

/* Each dashboard section is its own panel and keeps its chart cards inside.
   Both stay on --canvas: the card's own border is what separates them, so a
   second surface tint is not needed. */
.metric-panel { padding: var(--space-lg); }
.metric-panel .section-heading { margin: 0 0 var(--space-md); }
.metric-panel .chart__empty { background: var(--surface-soft); }

/* Sections arrive one fetch at a time. The spinner sits over the canvas only,
   so each card's title still says what is loading. */
.metric-panel.is-loading .chart__canvas::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  border: 2px solid var(--hairline);
  border-top-color: var(--primary);
  animation: metric-spin 0.7s linear infinite;
}
@keyframes metric-spin {
  to { transform: rotate(360deg); }
}

/* A list that arrives after the page it is on. The spinner is the dashboard's,
   so both kinds of deferred load read as one thing, and the row is table-height
   so the panel does not visibly jump when the rows land. */
.deferred-state {
  display: flex;
  align-items: center;
  /* Centred, not ranged left where a row of text would start: there is nothing
     for it to line up with until the rows land, and against the width of an
     empty card it read as a stray line rather than as the card working. */
  justify-content: center;
  gap: 10px;
  min-height: 96px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.deferred-state::before {
  content: '';
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--hairline);
  border-top-color: var(--primary);
  animation: metric-spin 0.7s linear infinite;
}

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: minmax(0, 1fr); }
  .rate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-links { grid-template-columns: minmax(0, 1fr); }
  /* Stacked, the rules turn horizontal and the side padding goes: every figure
     starts on the text column. */
  .kpi {
    flex-basis: 100%;
    border-top: 1px solid var(--hairline);
    padding: var(--space-md) 0;
  }
  .kpi::before { content: none; }
  .kpi:first-child { border-top: none; padding-top: 0; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .app-main { margin-left: 0; padding: var(--space-lg) 0; }
  .side-nav {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--hairline);
  }
  .side-nav__groups { overflow-y: visible; }
  .rail-toggle { display: none; }
  /* Twelve links stacked above the page pushed every page a screen down. */
  .phone-nav-toggle { display: inline-flex; }
  html:not([data-phone-nav="open"]) .side-nav__groups,
  html:not([data-phone-nav="open"]) .side-nav__footer { display: none; }
  .kv-table th, .kv-table td { display: block; width: auto; padding-right: 0; }
  .kv-table td { border-top: none; padding-top: 0; }
  /* The rail is a stacked block here, so the collapsed rules would hide the
     whole nav behind a 68px column. */
  html[data-sidebar="collapsed"] .rail-label {
    position: static; width: auto; height: auto; overflow: visible; clip-path: none;
  }
  html[data-sidebar="collapsed"] .rail-only-open { display: revert; }
  .rail-only-open.rail-toggle { display: none; }
  html[data-sidebar="collapsed"] .side-nav__link,
  html[data-sidebar="collapsed"] .side-nav__identity {
    justify-content: flex-start;
    height: auto;
    width: auto;
    padding: 10px var(--space-sm);
  }
  html[data-sidebar="collapsed"] .side-nav__brand { justify-content: space-between; padding: 0 var(--space-md); }
  .page-header { flex-direction: column; align-items: stretch; }
  .filter-bar,
  .filter-bar form,
  .filter-bar .search-input,
  .filter-bar .select { width: 100%; }
}

/* ---- Setup guide. One panel, one pane shown at a time: separate panels would
   break the .panel + .panel adjacency rule the moment one is hidden. ---- */
.guide-tabs .code-tabs__tab { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.guide-tabs .material-symbols-outlined { font-size: 16px; }
.guide-pane { border-bottom: none; max-width: 860px; }
.guide-pane p { margin: 0 0 var(--space-sm); font-size: 13px; line-height: 1.6; color: var(--body); }
.guide-pane code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: 4px;
  padding: 1px 5px;
}
.guide__title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 var(--space-sm);
}
.guide__subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: var(--space-lg) 0 var(--space-sm);
}
.guide-steps { list-style: none; margin: 0 0 var(--space-md); padding: 0; }
.guide-step { display: flex; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.guide-step__num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-fill);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.guide-step__body { min-width: 0; flex: 1; }
.guide-shot {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  margin-top: var(--space-xs);
}
.guide-shot--lg { width: 720px; }
.guide-shot--md { width: 520px; }
.guide-shot--sm { width: 340px; }
.guide-code { margin: var(--space-xs) 0 var(--space-sm); }
.guide-code pre { padding: var(--space-sm) var(--space-md); padding-right: 96px; }
.guide-pane .guide-code pre { font-size: 12px; }
.guide-table { width: 100%; border-collapse: collapse; margin: var(--space-xs) 0 var(--space-md); font-size: 13px; }
.guide-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--surface-soft);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--hairline);
}
.guide-table td { padding: var(--space-xs) var(--space-sm); border: 1px solid var(--hairline); vertical-align: top; color: var(--body); }
.guide-table td:first-child { font-weight: 600; color: var(--ink); width: 30%; }
.guide-pane .alert { margin: var(--space-md) 0 0; font-size: 13px; line-height: 1.6; }

/* ---- Accessibility layer (UI review 20 Nov 2026) ---- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-md); top: -48px; z-index: 1000;
  padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-md);
  background: var(--canvas); color: var(--primary-text); font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(20, 20, 19, 0.10);
}
.skip-link:focus { top: var(--space-sm); }
main:focus { outline: none; }

/* One keyboard ring for every control, in the system's coral. Mouse clicks do
   not show it. Items inside scrolling lists draw it inset so it is not clipped. */
:where(a, button, [tabindex], summary):focus-visible {
  outline: 2px solid var(--primary-text);
  outline-offset: 2px;
}
:where(.select__option, .kebab__item, .daterange__option, .daterange__day):focus-visible { outline-offset: -2px; }
.select__button:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(204, 120, 92, 0.30); }

/* Small icons keep their look; the click area grows to 40px (44px on touch). */
:is(.info-button, .toast__close, .modal__close, .search-input__clear, .kebab__button, .pagination__btn) { position: relative; }
:is(.info-button, .toast__close, .modal__close, .search-input__clear, .kebab__button, .pagination__btn)::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 40px; height: 40px; transform: translate(-50%, -50%);
}
@media (pointer: coarse) {
  :is(.info-button, .toast__close, .modal__close, .search-input__clear, .kebab__button, .pagination__btn)::after { width: 44px; height: 44px; }
}

.phone-nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-left: auto;
  border: 0; border-radius: var(--radius-md); background: none; color: var(--body); cursor: pointer;
}
.phone-nav-toggle:hover { background: var(--surface-soft); }
/* After the base rule above, or that display:none wins on phones too. */
@media (max-width: 768px) { .phone-nav-toggle { display: inline-flex; } }

/* Reduced motion: things still change, they just do not travel. Spinners keep
   turning, slowly, so loading still reads as loading. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .filter-bar__refresh.is-refreshing .material-symbols-outlined, .badge--pending .spinner,
  .kpi-strip.is-loading strong[data-kpi]::after, .metric-panel.is-loading .chart__canvas::after,
  .deferred-state::before, .metric-panel.is-loading .daily-table:empty::after {
    animation-duration: 2.4s !important;
    animation-iteration-count: infinite !important;
  }
  .btn:active:not(:disabled) { scale: none; }
}
