:root {
  color-scheme: light;
  --canvas: #f5f7f6; --panel: #ffffff; --surface: #edf2ef; --line: #d3ddd6;
  --text: #18291f; --muted: #52665a; --accent: #21633f; --accent-ink: #ffffff;
  --control-border: #768a7d; --hover: #e4ece7; --pressed: #d6e3db; --focus: #21633f;
  --accent-hover: #194c31; --accent-pressed: #133a25; --active-bg: #e6f2e9;
  --success: #1f6136; --success-bg: #e7f4eb; --success-line: #a3c4ad;
  --danger: #af2924; --danger-bg: #fff0ef; --danger-hover: #fce2e0; --danger-line: #c7746f;
  --warning: #805513; --warning-bg: #fff5df; --warning-line: #ccb17e;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--canvas); font: 15px/1.5 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(28px, 3vw, 36px); letter-spacing: -.035em; line-height: 1.18; margin-bottom: 12px; text-wrap: balance; }
h2 { font-size: 19px; letter-spacing: -.015em; }
a { color: var(--accent); text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, .primary, .secondary { min-height: 44px; border: 1px solid var(--control-border); border-radius: 8px; padding: 10px 16px; }
button, .primary, .secondary { cursor: pointer; transition: background 160ms, border-color 160ms; }
button { color: var(--text); background: var(--surface); }
button:hover, .secondary:hover { background: var(--hover); border-color: var(--accent); }
button:active { background: var(--pressed); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { display: flex; justify-content: space-between; gap: 16px; background: var(--accent); color: var(--accent-ink); font-weight: 650; border-color: var(--accent); }
.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.primary:active { background: var(--accent-pressed); border-color: var(--accent-pressed); }
.secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface); color: var(--text); }
.subtle { background: transparent; border-color: transparent; color: var(--muted); }
.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.danger:hover, .danger:active { background: var(--danger-hover); border-color: var(--danger); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 13px; }
.eyebrow, .nav-label { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .13em; color: var(--muted); margin-bottom: 14px; }
.brand { display: flex; gap: 12px; align-items: center; font-size: 16px; font-weight: 650; }
.brand small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; flex: 0 0 auto; border: 1px solid var(--control-border); border-radius: 9px; color: var(--accent); font: 600 22px/1 ui-monospace, monospace; }
.app-shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { border-right: 1px solid var(--line); background: var(--panel); padding: 28px 18px; display: flex; flex-direction: column; gap: 8px; }
.sidebar .brand { margin: 0 10px 48px; }
.nav-label { margin-left: 12px; }
nav { display: grid; gap: 6px; }
nav a { display: flex; gap: 12px; align-items: center; padding: 12px; color: var(--muted); border-radius: 8px; border: 1px solid transparent; min-height: 46px; }
nav a:hover { background: var(--surface); color: var(--text); }
nav a[aria-current="page"] { color: var(--accent); background: var(--active-bg); border-color: var(--success-line); }
nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.sidebar-bottom { margin-top: auto; padding: 32px 12px 0; display: grid; gap: 20px; font-size: 12px; }
.pill { display: inline-flex; align-items: center; width: fit-content; background: var(--surface); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font-size: 12px; white-space: nowrap; }
.pill.active, .pill.succeeded { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.pill.revoked, .pill.failed, .pill.denied, .pill.failure { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.pill.unknown, .pill.expired { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-line); }
.pill.near, .pill.managed { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-line); }
.pill.exhausted { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.pill.ok { color: var(--success); background: var(--success-bg); border-color: var(--success-line); }
.topbar { min-height: 78px; padding: 16px 32px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 13px; }
.account { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.workspace { min-width: 0; }
main { max-width: 1560px; margin: auto; padding: 36px 32px 20px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 26px; }
.page-heading p:last-child { color: var(--muted); margin-bottom: 0; }
.section-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 22px 0 18px; }
.section-top h2 { margin: 0; }
.count { font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 20px; }
label { display: grid; gap: 7px; font-size: 12px; color: var(--muted); }
input, textarea, select { background: var(--canvas); border: 1px solid var(--control-border); border-radius: 6px; color: var(--text); padding: 10px 12px; min-height: 44px; min-width: 0; font-size: 14px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.grow { flex: 1; }
.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; min-width: 780px; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .065em; background: var(--surface); padding: 14px 18px; color: var(--muted); font-weight: 600; white-space: nowrap; }
td { padding: 18px; border-top: 1px solid var(--line); vertical-align: top; max-width: 320px; overflow-wrap: anywhere; }
tr:hover td { background: var(--canvas); }
td small { display: block; color: var(--muted); margin-top: 5px; font-size: 12px; }
td strong { display: block; font-weight: 600; }
td button { padding: 7px 11px; font-size: 12px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.usage-drilldown { margin-top: 10px; }
#usage-breakdown-body td:first-child { min-width: 240px; }
code, .numeric { font-family: "SFMono-Regular", Consolas, ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.empty { padding: 60px 24px; text-align: center; color: var(--muted); }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 18px; color: var(--muted); font-size: 12px; }
.pagination > div { display: flex; gap: 8px; }
.pagination button { font-size: 12px; }
.notice, .error, .callout { padding: 14px 18px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.notice { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.error { background: var(--danger-bg); color: var(--danger); }
.callout { background: var(--panel); color: var(--muted); line-height: 1.7; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.provider-defaults { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 32px; }
.provider-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 20px; }
.provider-card h3, .provider-card p { margin: 0; }
.provider-card h3 { font-size: 18px; }
.provider-card code, .provider-card p { overflow-wrap: anywhere; }
.provider-card code { color: var(--accent); font-size: 12px; }
.provider-card label { margin-top: auto; }
.provider-card select { width: 100%; }
.provider-card button { width: 100%; }
.metric { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 22px; }
.metric span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.metric strong { font-size: 26px; font-weight: 500; letter-spacing: -.025em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.workspace-footer { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.login-shell { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 80% 10%, var(--active-bg), transparent 50%); }
.login-card { max-width: 520px; width: 100%; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 42px; }
.login-card .brand { margin-bottom: 56px; }
.login-card h1 { font-size: 42px; margin-bottom: 20px; }
.login-card > p { color: var(--muted); }
.login-card .primary { margin: 32px 0 16px; }
.quiet-link { font-size: 13px; }
dialog { color: var(--text); background: var(--panel); border: 1px solid var(--control-border); border-radius: 14px; padding: 28px; width: min(680px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow: auto; }
dialog::backdrop { background: #18291f66; }
.dialog-heading, .dialog-actions { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.dialog-actions { justify-content: flex-end; margin-top: 24px; }
dialog code { display: block; overflow-wrap: anywhere; font-size: 12px; color: var(--accent); }
dialog dl { display: grid; grid-template-columns: 130px minmax(0, 1fr); font-size: 13px; margin: 24px 0; }
dialog dt, dialog dd { padding: 9px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
dialog dt { color: var(--muted); }
dialog dd { margin-left: 16px; }
.reason { margin-top: 24px; }
.limits-fields { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.limits-fields legend { font-weight: 600; margin-bottom: 16px; }
.limits-fields > input, .limits-fields > textarea { width: 100%; margin: 6px 0 14px; }
.field-error { color: var(--danger); font-size: 13px; margin: -6px 0 14px; }
[aria-invalid="true"] { border-color: var(--danger); }
#budget-notice a { text-decoration: underline; font-weight: 600; }
#budgets-body td:first-child { min-width: 210px; }
.model-options fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 16px 0; padding: 12px; min-width: 0; }
.model-options legend { font-weight: 650; font-size: 14px; padding: 0 6px; }
.model-option { display: flex; align-items: flex-start; gap: 12px; padding: 10px 6px; min-height: 44px; cursor: pointer; color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
.model-option input { flex: 0 0 auto; min-height: 20px; width: 20px; height: 20px; margin: 2px 0; padding: 0; accent-color: var(--accent); }
.model-option small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.model-tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.model-tags li { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 12px; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip { position: absolute; left: 16px; top: -100px; z-index: 10; background: var(--accent); color: var(--accent-ink); padding: 12px; }
.skip:focus { top: 12px; }
@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .sidebar { padding: 24px 10px; }
  .topbar { padding: 14px 20px; align-items: start; }
  .account { justify-content: end; font-size: 12px; }
  main { padding: 28px 20px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .provider-defaults { grid-template-columns: 1fr; }
  .section-top { flex-wrap: wrap; }
}
@media (max-width: 700px) {
  body { font-size: 16px; }
  .app-shell { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px 16px 12px; }
  .sidebar .brand { margin: 0 0 18px; }
  .nav-label, .sidebar-bottom { display: none; }
  nav { grid-template-columns: 1fr 1fr; gap: 4px; }
  nav a { font-size: 13px; padding: 10px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 4px; }
  .account { width: 100%; justify-content: space-between; }
  main { padding: 24px 16px; }
  .page-heading { align-items: start; gap: 12px; }
  .page-heading > div { min-width: 0; }
  .page-heading button { flex-shrink: 0; padding: 9px; font-size: 12px; }
  .filters label { width: 100%; }
  input, textarea, select { width: 100%; font-size: 16px; }
  .metric { padding: 16px; }
  .metric strong { font-size: 22px; }
  .workspace-footer { flex-direction: column; }
  .pagination { flex-wrap: wrap; }
  .login-card { padding: 28px; }
  .login-card h1 { font-size: 34px; }
  dialog { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
