/* LLM Gateway console - styled after the UAE Design System (designsystem.gov.ae).
   Colour tokens are the official aegov scales (OKLCH), from @aegov/design-system 3.0.7. */

:root {
  --aegold-50: oklch(0.975 0.013 97.4);
  --aegold-100: oklch(0.940 0.039 97.4);
  --aegold-200: oklch(0.879 0.071 94.2);
  --aegold-300: oklch(0.802 0.104 91.1);
  --aegold-400: oklch(0.734 0.121 85.9);
  --aegold-500: oklch(0.660 0.114 80.7);
  --aegold-600: oklch(0.570 0.097 84.4);
  --aegold-700: oklch(0.501 0.084 81.0);
  --aegold-800: oklch(0.428 0.069 57.1);
  --aegold-900: oklch(0.387 0.058 52.0);

  --aeblack-50: oklch(0.976 0.000 0.0);
  --aeblack-100: oklch(0.915 0.003 247.9);
  --aeblack-200: oklch(0.826 0.008 260.7);
  --aeblack-300: oklch(0.711 0.011 261.8);
  --aeblack-400: oklch(0.592 0.014 259.8);
  --aeblack-500: oklch(0.502 0.016 262.3);
  --aeblack-600: oklch(0.427 0.016 266.5);
  --aeblack-700: oklch(0.372 0.011 271.1);
  --aeblack-800: oklch(0.264 0.006 258.4);
  --aeblack-900: oklch(0.230 0.008 264.4);
  --aeblack-950: oklch(0.169 0.006 271.0);

  --aered-50: oklch(0.971 0.013 17.4);
  --aered-100: oklch(0.939 0.028 20.4);
  --aered-200: oklch(0.889 0.055 21.0);
  --aered-500: oklch(0.640 0.192 26.3);
  --aered-600: oklch(0.584 0.199 27.5);
  --aered-700: oklch(0.504 0.181 28.0);

  --aegreen-50: oklch(0.978 0.011 149.9);
  --aegreen-100: oklch(0.952 0.024 151.2);
  --aegreen-500: oklch(0.627 0.126 148.7);
  --aegreen-600: oklch(0.581 0.122 148.5);
  --aegreen-700: oklch(0.461 0.090 149.4);

  --camel-50: oklch(0.987 0.021 95.3);
  --camel-100: oklch(0.963 0.058 97.7);
  --camel-700: oklch(0.555 0.142 50.4);

  --techblue-50: oklch(0.963 0.020 238.7);
  --techblue-100: oklch(0.933 0.037 238.1);
  --techblue-600: oklch(0.498 0.283 264.1);
  --techblue-700: oklch(0.496 0.284 263.9);

  --whitely-50: oklch(1 0 0);
  --whitely-200: oklch(0.976 0 0);
  --whitely-400: oklch(0.946 0 0);

  --primary: var(--aegold-600);
  --primary-hover: var(--aegold-700);
  --ink: var(--aeblack-800);
  --ink-strong: var(--aeblack-950);
  --muted: var(--aeblack-500);
  --line: var(--aeblack-100);
  --surface: var(--whitely-50);
  --canvas: var(--whitely-200);
  --focus: var(--aegold-500);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px oklch(0.17 0.006 271 / 0.04), 0 1px 3px oklch(0.17 0.006 271 / 0.06);
  --shadow-pop: 0 20px 48px oklch(0.17 0.006 271 / 0.18);

  --font-en: "Roboto", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ar: "Noto Kufi Arabic", "Roboto", system-ui, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;

  color-scheme: light;
}

html { font-size: 100%; }
html.text-lg { font-size: 112.5%; }
html.text-xl { font-size: 125%; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-en);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
html[lang="ar"] body { font-family: var(--font-ar); line-height: 1.8; }

h1, h2, h3, h4 { color: var(--ink-strong); line-height: 1.25; margin: 0; font-weight: 700; }
h1 { font-size: 2rem; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }
p { margin: 0; }
a { color: var(--aegold-700); text-underline-offset: 3px; }
a:hover { color: var(--aegold-800); }
code, .mono { font-family: var(--font-mono); font-size: 0.875em; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; inset-inline-start: 1rem; top: -100px; z-index: 100;
  background: var(--ink-strong); color: #fff; padding: 0.5rem 1rem; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 0.5rem; color: #fff; }

.container { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: 1.5rem; }
@media (max-width: 640px) { .container { padding-inline: 1rem; } }

/* ---------------------------------------------------------------- header */

.utility-bar { background: var(--aeblack-950); color: var(--aeblack-100); font-size: 0.8125rem; }
.utility-bar .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 40px; }
.utility-bar .group { display: flex; align-items: center; gap: 0.25rem; }
.utility-bar button, .utility-bar a {
  background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0.375rem 0.625rem;
  border-radius: var(--radius-sm); text-decoration: none;
}
.utility-bar button:hover, .utility-bar a:hover { background: oklch(1 0 0 / 0.08); color: #fff; }
.utility-bar .lang { font-family: var(--font-ar); font-weight: 600; }
html[lang="ar"] .utility-bar .lang { font-family: var(--font-en); }
.utility-bar .sep { width: 1px; height: 16px; background: var(--aeblack-700); margin-inline: 0.25rem; }
.env-pill {
  display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.125rem 0.625rem; border-radius: 999px;
  background: oklch(1 0 0 / 0.08); color: var(--aegold-200); font-weight: 500;
}

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .brand-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.125rem; }
.brand { display: flex; align-items: center; gap: 0.875rem; text-decoration: none; color: inherit; }
.brand-mark { width: 48px; height: 48px; flex: none; }
.brand-name { font-size: 1.25rem; font-weight: 700; color: var(--ink-strong); line-height: 1.2; }
.brand-sub { font-size: 0.8125rem; color: var(--muted); }
.brand-divider { width: 1px; align-self: stretch; background: var(--line); margin-inline: 0.25rem; }

.health-pill {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.875rem; border-radius: 999px;
  font-size: 0.875rem; font-weight: 500; border: 1px solid var(--line); background: var(--surface);
}
.health-pill.ok { color: var(--aegreen-700); border-color: oklch(0.627 0.126 148.7 / 0.35); background: var(--aegreen-50); }
.health-pill.bad { color: var(--aered-700); border-color: oklch(0.640 0.192 26.3 / 0.35); background: var(--aered-50); }

.main-nav { border-top: 1px solid var(--line); }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; }
.main-nav a {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.875rem 1rem; color: var(--aeblack-700);
  text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.main-nav a:hover { color: var(--ink-strong); background: var(--aegold-50); }
.main-nav a[aria-current="page"] { color: var(--ink-strong); border-bottom-color: var(--primary); font-weight: 700; }
.main-nav svg { width: 18px; height: 18px; opacity: 0.8; }

/* ---------------------------------------------------------------- page */

main { flex: 1; padding-block: 2rem 3.5rem; }
main:focus { outline: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 2rem; }
.breadcrumb { display: flex; gap: 0.5rem; align-items: center; font-size: 0.875rem; color: var(--muted); margin-bottom: 0.625rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--aegold-700); text-decoration: underline; }
.breadcrumb .chev { opacity: 0.6; }
html[dir="rtl"] .breadcrumb .chev { transform: scaleX(-1); }
.lede { color: var(--aeblack-600); margin-top: 0.5rem; max-width: 70ch; }
.page-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

.grid { display: grid; gap: 1.25rem; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); margin-bottom: 1.25rem; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); margin-top: 1.25rem; }
.grid.split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); margin-top: 1.25rem; }
@media (max-width: 900px) { .grid.split { grid-template-columns: 1fr; } }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.125rem 1.5rem; border-bottom: 1px solid var(--line); }
.card-head p { font-size: 0.875rem; color: var(--muted); }
.card-body { padding: 1.5rem; }
.card-body.flush { padding: 0; }

.kpi { padding: 1.25rem 1.5rem; position: relative; }
.kpi::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 1.25rem; bottom: 1.25rem; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}
html[dir="rtl"] .kpi::before { border-radius: 3px 0 0 3px; }
.kpi.warn::before { background: var(--aered-500); }
.kpi-label { font-size: 0.875rem; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 1.75rem; font-weight: 700; color: var(--ink-strong); margin-top: 0.25rem; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 0.8125rem; color: var(--muted); margin-top: 0.125rem; }

/* ---------------------------------------------------------------- buttons & controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; font: inherit; font-weight: 500;
  font-size: 0.9375rem; line-height: 1.2; padding: 0.6875rem 1.25rem; border-radius: var(--radius); cursor: pointer;
  border: 1px solid transparent; text-decoration: none; transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink-strong); border-color: var(--aeblack-200); }
.btn-secondary:hover { border-color: var(--aeblack-400); background: var(--aeblack-50); color: var(--ink-strong); }
.btn-ghost { background: transparent; color: var(--aegold-700); }
.btn-ghost:hover { background: var(--aegold-50); color: var(--aegold-800); }
.btn-danger { background: var(--aered-600); color: #fff; }
.btn-danger:hover { background: var(--aered-700); }
.btn-sm { padding: 0.4375rem 0.75rem; font-size: 0.875rem; border-radius: var(--radius-sm); }
.btn-icon { padding: 0.4375rem; border-radius: var(--radius-sm); background: transparent; color: var(--aeblack-600); border: 1px solid transparent; }
.btn-icon svg { width: 18px; height: 18px; display: block; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-icon:hover { background: var(--aeblack-50); border-color: var(--line); color: var(--ink-strong); }
.btn-icon.danger:hover { background: var(--aered-50); color: var(--aered-700); border-color: var(--aered-200); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: #fff #fff transparent transparent; animation: spin 0.7s linear infinite;
}
.btn-secondary.loading::after { border-color: var(--ink) var(--ink) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.segmented { display: inline-flex; background: var(--aeblack-50); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; }
.segmented button {
  font: inherit; font-size: 0.875rem; font-weight: 500; border: 0; background: transparent; color: var(--aeblack-600);
  padding: 0.4375rem 0.875rem; border-radius: 7px; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink-strong); box-shadow: var(--shadow-card); }

.field { display: flex; flex-direction: column; gap: 0.375rem; }
.field + .field, .field-row + .field, .field + .field-row, .field-row + .field-row { margin-top: 1.125rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.field-row .field + .field { margin-top: 0; }
label, .label { font-weight: 500; font-size: 0.9375rem; color: var(--ink-strong); }
.hint { font-size: 0.8125rem; color: var(--muted); }
.req { color: var(--aered-600); margin-inline-start: 2px; }
input[type="text"], input[type="password"], input[type="number"], input[type="url"], select, textarea {
  font: inherit; font-size: 0.9375rem; color: var(--ink-strong); background: var(--surface);
  border: 1px solid var(--aeblack-200); border-radius: var(--radius); padding: 0.6875rem 0.875rem; width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: var(--font-mono); font-size: 0.8125rem; min-height: 110px; }
[data-template-only] { margin-top: 1.125rem; }
[data-template-only] + .field { margin-top: 1.125rem; }
input:hover, select:hover, textarea:hover { border-color: var(--aeblack-400); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--aegold-500); box-shadow: 0 0 0 3px oklch(0.660 0.114 80.7 / 0.25); }
input:disabled { background: var(--aeblack-50); color: var(--muted); }
select { appearance: none; padding-inline-end: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23555' stroke-width='1.8'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 18px; background-position: right 0.75rem center; }
html[dir="rtl"] select { background-position: left 0.75rem center; }

.check { display: flex; align-items: center; gap: 0.625rem; font-weight: 400; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.5rem 1rem; padding: 0.875rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--aeblack-50); }

.switch { display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer; font-weight: 500; }
.switch input { appearance: none; width: 44px; height: 24px; border-radius: 999px; background: var(--aeblack-200); position: relative; cursor: pointer; transition: background 0.15s; margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.2); transition: inset-inline-start 0.15s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { inset-inline-start: 23px; }

.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.radio-card { border: 1px solid var(--aeblack-200); border-radius: var(--radius); padding: 0.875rem 1rem; cursor: pointer; display: flex; gap: 0.75rem; align-items: flex-start; }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--aegold-50); box-shadow: 0 0 0 1px var(--primary); }
.radio-card input { accent-color: var(--primary); margin-top: 0.3rem; }
.radio-card strong { display: block; color: var(--ink-strong); }
.radio-card span { font-size: 0.8125rem; color: var(--muted); font-weight: 400; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th { text-align: start; font-weight: 500; font-size: 0.8125rem; color: var(--aeblack-600); background: var(--aeblack-50); padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 0.875rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: oklch(0.975 0.013 97.4 / 0.5); }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
td .primary-text, td.primary-text { font-weight: 500; color: var(--ink-strong); white-space: nowrap; }
td .secondary-text { font-size: 0.8125rem; color: var(--muted); max-width: 36ch; }
td.actions { text-align: end; white-space: nowrap; }
.empty { padding: 3rem 1.5rem; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--aegold-500); margin-bottom: 0.5rem; }

/* ---------------------------------------------------------------- badges, chips, status */

.badge { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.1875rem 0.625rem; border-radius: 999px; font-size: 0.75rem; font-weight: 500; line-height: 1.5; white-space: nowrap; }
.badge.neutral { background: var(--aeblack-50); color: var(--aeblack-700); border: 1px solid var(--line); }
.badge.gold { background: var(--aegold-100); color: var(--aegold-900); }
.badge.success { background: var(--aegreen-100); color: var(--aegreen-700); }
.badge.danger { background: var(--aered-100); color: var(--aered-700); }
.badge.warning { background: var(--camel-100); color: var(--camel-700); }
.badge.info { background: var(--techblue-100); color: var(--techblue-700); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.dot.pulse { box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 oklch(0.627 0.126 148.7 / 0.5); } 70% { box-shadow: 0 0 0 6px oklch(0.627 0.126 148.7 / 0); } 100% { box-shadow: 0 0 0 0 oklch(0.627 0.126 148.7 / 0); } }
.chips { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.chip { font-size: 0.8125rem; padding: 0.125rem 0.5rem; border-radius: var(--radius-sm); background: var(--aeblack-50); border: 1px solid var(--line); color: var(--aeblack-700); }
.chip.mono { font-family: var(--font-mono); font-size: 0.75rem; }

.status-list { list-style: none; margin: 0; padding: 0; }
.status-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.875rem 1.5rem; border-bottom: 1px solid var(--line); }
.status-list li:last-child { border-bottom: 0; }

.bar-cell { display: flex; align-items: center; gap: 0.625rem; min-width: 110px; }
.bar-track { flex: 1; height: 6px; border-radius: 3px; background: var(--aeblack-50); overflow: hidden; }
.bar-fill { height: 100%; background: var(--aegold-500); border-radius: 3px; }

/* ---------------------------------------------------------------- alerts / callouts */

.callout { display: flex; gap: 0.875rem; padding: 1rem 1.125rem; border-radius: var(--radius); border: 1px solid; font-size: 0.9375rem; }
.callout svg { width: 20px; height: 20px; flex: none; margin-top: 0.15rem; }
.callout.info { background: var(--techblue-50); border-color: var(--techblue-100); color: var(--aeblack-800); }
.callout.info svg { color: var(--techblue-600); }
.callout.warning { background: var(--camel-50); border-color: var(--camel-100); }
.callout.warning svg { color: var(--camel-700); }
.callout.danger { background: var(--aered-50); border-color: var(--aered-200); color: var(--aered-700); }
.callout strong { display: block; color: var(--ink-strong); }

.key-box { display: flex; gap: 0.5rem; align-items: stretch; margin-top: 1rem; }
.key-box code { flex: 1; padding: 0.75rem 1rem; background: var(--aeblack-950); color: var(--aegold-200); border-radius: var(--radius); word-break: break-all; font-size: 0.875rem; direction: ltr; line-height: 1.5; }
.key-box .btn { align-self: flex-start; }

/* ---------------------------------------------------------------- dialog */

dialog {
  border: 0; padding: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); width: min(680px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem); color: var(--ink); background: var(--surface);
}
dialog.wide { width: min(900px, calc(100vw - 2rem)); }
dialog.narrow { width: min(460px, calc(100vw - 2rem)); }
dialog::backdrop { background: oklch(0.169 0.006 271 / 0.55); backdrop-filter: blur(2px); }
dialog[open] { animation: pop 0.18s ease-out; display: flex; flex-direction: column; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.375rem 1.5rem 1rem; border-bottom: 1px solid var(--line); }
.dialog-head p { color: var(--muted); font-size: 0.875rem; margin-top: 0.25rem; }
.dialog-body { padding: 1.5rem; overflow-y: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 0.75rem; padding: 1rem 1.5rem; border-top: 1px solid var(--line); background: var(--aeblack-50); }
.form-error { margin-bottom: 1rem; }

.output-box { background: var(--aeblack-50); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.125rem; white-space: pre-wrap; word-break: break-word; font-size: 0.9375rem; min-height: 80px; }
details.prompt { margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
details.prompt summary { cursor: pointer; padding: 0.625rem 1rem; font-weight: 500; font-size: 0.875rem; }
details.prompt pre { margin: 0; padding: 0 1rem 1rem; white-space: pre-wrap; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--aeblack-700); }
.meta-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.875rem; }

/* ---------------------------------------------------------------- chart */

.chart { width: 100%; height: auto; display: block; direction: ltr; }
.chart text { font-family: var(--font-en); font-size: 11px; fill: var(--aeblack-500); }
.chart .grid-line { stroke: var(--aeblack-100); stroke-width: 1; }
.chart .bar-ok { fill: var(--aegold-500); }
.chart .bar-err { fill: var(--aered-500); }
.chart .bar-group:hover .bar-ok { fill: var(--aegold-600); }
.legend { display: flex; gap: 1.25rem; font-size: 0.8125rem; color: var(--aeblack-600); }
.legend span { display: inline-flex; align-items: center; gap: 0.375rem; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------------------------------------------------------------- provider cards */

.provider-card { display: flex; flex-direction: column; }
.provider-card .card-body { display: flex; flex-direction: column; gap: 1rem; flex: 1; }
.kv dd .chips { margin-top: -2px; }
.provider-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1rem; font-size: 0.875rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink-strong); word-break: break-all; }
.card-actions { display: flex; gap: 0.5rem; padding: 1rem 1.5rem; border-top: 1px solid var(--line); background: var(--aeblack-50); }

/* ---------------------------------------------------------------- login */

.login-wrap { flex: 1; display: grid; place-items: center; padding: 3rem 1rem; background:
  radial-gradient(1200px 400px at 50% -10%, var(--aegold-100), transparent 70%), var(--canvas); }
.login-card { width: min(440px, 100%); }
.login-card .card-body { padding: 2rem; }
.login-card h1 { font-size: 1.5rem; margin-top: 1.25rem; }
.login-card .lede { margin-bottom: 1.5rem; }

/* ---------------------------------------------------------------- footer */

.site-footer { background: var(--aeblack-950); color: var(--aeblack-200); border-top: 4px solid var(--primary); font-size: 0.875rem; }
.site-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; padding-block: 2.5rem 2rem; }
.site-footer h4 { color: #fff; font-size: 0.9375rem; margin-bottom: 0.75rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.site-footer a { color: var(--aeblack-200); text-decoration: none; }
.site-footer a:hover { color: var(--aegold-300); text-decoration: underline; }
.site-footer .bottom { border-top: 1px solid var(--aeblack-800); padding-block: 1.125rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--aeblack-400); }

/* ---------------------------------------------------------------- toasts */

#toasts { position: fixed; bottom: 1.5rem; inset-inline-end: 1.5rem; display: grid; gap: 0.75rem; z-index: 1000; max-width: min(420px, calc(100vw - 2rem)); }
.toast { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.875rem 1rem; border-radius: var(--radius); background: var(--aeblack-950); color: #fff; box-shadow: var(--shadow-pop); animation: pop 0.2s ease-out; font-size: 0.9375rem; }
.toast svg { width: 20px; height: 20px; flex: none; margin-top: 0.1rem; }
.toast.success svg { color: var(--aegreen-500); }
.toast.error { background: var(--aered-700); }

.filters { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; padding: 1rem 1.5rem; border-bottom: 1px solid var(--line); background: var(--aeblack-50); }
.filters .field { min-width: 170px; }
.filters .field + .field { margin-top: 0; }

.muted { color: var(--muted); }
.mt-1 { margin-top: 1.25rem; }
.spinner-row { padding: 3rem; text-align: center; color: var(--muted); }

@media (max-width: 720px) {
  h1 { font-size: 1.625rem; }
  .brand-sub, .brand-divider, .site-header .health-pill .txt { display: none; }
  .radio-cards { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.dialog-form { display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 3rem); width: 100%; }
.dialog-form .dialog-body { flex: 1; min-height: 0; }
.login-card .brand-mark { width: 56px; height: 56px; }

.keys-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-list .chips { align-items: center; }
.chip { white-space: nowrap; }

.add-key-card label { display: block; font-weight: 500; margin-bottom: 0.375rem; }
.key-input-row { display: flex; gap: 0.5rem; align-items: stretch; flex-wrap: wrap; }
.key-input-row input { flex: 1 1 280px; font-family: var(--font-mono); }
.key-many-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 0.75rem; flex-wrap: wrap; }
.callout.banner { align-items: center; margin-bottom: 1.25rem; }
.callout.banner > div { flex: 1; }
.callout.banner > svg { color: var(--camel-700); }
.page-actions .field + .btn { align-self: flex-end; }
.bar-fill.hot { background: var(--aered-500); }
