/* 94API AWS operations console */
:root {
  --ink: #171717;
  --ink-soft: #4f4f4f;
  --muted: #737373;
  --canvas: #f6f6f4;
  --paper: #ffffff;
  --paper-cool: #f5f5f3;
  --nav: #181818;
  --nav-soft: #e7e7e4;
  --line: #deded9;
  --line-strong: #bdbdb7;
  --accent: #171717;
  --accent-dark: #000000;
  --accent-soft: #efffc7;
  --lime: #d8ff3e;
  --ok: #08795a;
  --ok-soft: #e6f7f0;
  --warn: #946000;
  --warn-soft: #fff4d8;
  --err: #bd3443;
  --err-soft: #ffebee;
  --radius: 7px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 14px rgba(0, 0, 0, .035);
  --shadow: 0 8px 24px rgba(0, 0, 0, .07);
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  overflow-x: hidden;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font: 14px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; color: var(--ink); font-weight: 760; letter-spacing: -.025em; }
h1 { font-size: clamp(24px, 2vw, 32px); line-height: 1.12; }
h2 { font-size: 18px; }
h3 { font-size: 14px; }
p { margin: 0 0 10px; }
::selection { color: var(--nav); background: var(--lime); }
:focus-visible { outline: 3px solid rgba(183, 219, 43, .55); outline-offset: 2px; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 100; padding: 9px 12px; color: #fff; background: var(--accent-dark); border-radius: 7px; transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Application shell */
.shell { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 30px;
  padding: 24px 14px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  color: #f7f8f2;
  background: #151713;
  border-right: 1px solid #2d3029;
}
.side::after { display: none; }
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px; color: inherit; font-size: 14px; font-weight: 760; line-height: 1.2; }
.brand:hover { text-decoration: none; }
.brand .logo { display: grid; width: 38px; height: 38px; flex: none; place-items: center; color: #111; background: var(--lime); border: 1px solid #bedf35; border-radius: 10px; box-shadow: none; font: 900 12px/1 var(--mono); letter-spacing: -.05em; }
.brand small { display: block; margin-top: 4px; color: #929889; font-size: 9px; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
.side nav { display: flex; flex-direction: column; gap: 5px; }
.side nav::before { padding: 0 11px 7px; color: #737a6b; content: "Workspace"; font-size: 9px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.side nav a { display: flex; min-height: 42px; align-items: center; gap: 11px; padding: 10px 12px; color: #b3b9ac; border: 1px solid transparent; border-radius: 7px; font-weight: 650; transition: color .16s, background .16s, border-color .16s; }
.side nav a:hover { color: #fff; background: #242720; text-decoration: none; }
.side nav a.active { color: #111; background: var(--lime); border-color: #bedf35; box-shadow: none; }
.side nav a .ico { display: grid; width: 18px; flex: none; place-items: center; }
.side .spacer { flex: 1; }
.who { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 10px; background: #20231d; border: 1px solid #34382f; border-radius: 8px; }
.who .avatar { display: grid; width: 34px; height: 34px; flex: none; place-items: center; color: var(--nav); background: var(--lime); border-radius: 50%; font-weight: 850; }
.who .meta { flex: 1; min-width: 0; }
.who .meta b { display: block; overflow: hidden; color: #fff; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.who .meta span { color: #929889; font-size: 9px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.who .btn { color: #aeb5a7; }
.who .btn:hover { color: #fff; background: #30342b; }
.content { min-width: 0; max-width: 100%; }
.main { width: 100%; min-width: 0; margin: 0; padding: 28px 34px 64px; }
.login-page .main { max-width: none; padding: 0; }

/* Page hierarchy and surfaces */
.card { min-width: 0; max-width: 100%; margin-bottom: 16px; padding: 22px 24px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.proxy-manager > .section-heading { align-items: center; margin-bottom: 12px; }
.proxy-manager h1 { font-size: 25px; }
.proxy-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.proxy-metrics .card { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; margin-bottom: 10px; }
.proxy-metrics span { text-transform: uppercase; font-size: 11px; font-weight: 750; letter-spacing: .06em; color: var(--muted); }
.proxy-metrics strong { font-size: 21px; }
.proxy-filters { display: flex; gap: 12px; align-items: end; padding: 12px 14px; margin-bottom: 8px; }
.proxy-filters label { display: flex; flex-direction: column; gap: 5px; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.proxy-filters input { width: 100%; }
.proxy-filters label:first-child { flex: 1; }
.proxy-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 220px) auto; gap: 16px; align-items: center; }
.proxy-list .proxy-card { padding: 12px 14px; margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; overflow-wrap: anywhere; }
.proxy-list .proxy-card:last-child { border-bottom: 0; }
.proxy-account { font-size: 12px; font-weight: 650; }
.proxy-address { margin: 4px 0; }
.proxy-address strong { font-size: 18px; letter-spacing: -.025em; }
.proxy-heading p { margin: 0; }
.badge.proxy-state { font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.proxy-speed { display: flex; flex-direction: column; align-items: flex-start; border-left: 1px solid var(--line); padding-left: 16px; }
.proxy-speed > strong { font-size: 21px; line-height: 1.4; }
.proxy-websites { margin: 8px 0 0; gap: 6px; }
.proxy-last-check { margin-left: auto; }
.proxy-list-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; font-size: 12px; }
.card.proxy-list-frame { padding: 0; overflow: hidden; }
.proxy-list { border-radius: inherit; }
.proxy-connectivity { padding: 12px 16px; background: var(--paper-cool); border-radius: var(--radius); }
.proxy-observation .row { margin: 6px 0; }
.proxy-observation p { margin: 4px 0; }
.proxy-actions { gap: 6px; }
.proxy-routes { margin-top: 6px; }
.proxy-routes > summary { padding: 5px 0; cursor: pointer; font-size: 12px; font-weight: 650; }
.proxy-routes > summary, .proxy-access > summary, .proxy-technical > summary { display: flex; align-items: center; gap: 8px; }
.proxy-routes > summary::after, .proxy-access > summary::after, .proxy-technical > summary::after { content: "+"; margin-left: auto; font-size: 16px; color: var(--muted); }
.proxy-routes[open] > summary::after, .proxy-access[open] > summary::after, .proxy-technical[open] > summary::after { content: "−"; }
.proxy-route { padding: 16px 0; border-top: 1px solid var(--line); }
.proxy-route form { margin-top: 12px; align-items: end; }
.proxy-route label { min-width: 160px; max-width: 100%; }
.proxy-route select { max-width: 100%; }
.proxy-log { margin-top: 8px !important; padding-left: 10px; border-left: 2px solid var(--line-strong); }
[data-proxy-manager][aria-busy="true"] [data-proxy-check] button { opacity: .6; cursor: wait; }
@media (max-width: 700px) {
  .proxy-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .proxy-metrics .card { padding: 8px 12px; }
  .proxy-filters { flex-wrap: wrap; gap: 10px; }
  .proxy-filters label { flex: 1 1 100px; min-width: 0; }
  .proxy-filters label:first-child { flex: 1 1 100%; }
  .proxy-heading { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .proxy-speed { border-left: 0; padding: 0; }
  .proxy-speed > strong { font-size: 18px; }
  .proxy-last-check { flex-basis: 100%; margin-left: 0; }
  .proxy-connectivity { padding: 10px; }
  .proxy-route form { flex-wrap: wrap; }
  .proxy-route label { flex: 1 1 100%; min-width: 0; }
}
.proxy-settings-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.proxy-setup-heading { align-items: center; margin-bottom: 14px; }
.proxy-setup-heading h1 { margin-top: 4px; font-size: 26px; }
.proxy-owner { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 18px; overflow-wrap: anywhere; }
.proxy-owner a { font-weight: 700; }
.proxy-setup-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 18px; align-items: start; }
.proxy-config { padding: 22px; }
.proxy-create-form { gap: 20px; }
.proxy-create-form fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
.proxy-create-form legend { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; padding: 0; font-weight: 750; }
.proxy-create-form legend span { display: grid; place-items: center; width: 25px; height: 25px; font-size: 12px; background: var(--paper-cool); border: 1px solid var(--line); border-radius: 50%; }
.proxy-create-form select, .proxy-create-form textarea { width: 100%; }
.proxy-create-form fieldset > p { margin: 7px 0 0; }
.proxy-field-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.proxy-access { margin-top: 10px; padding: 10px 12px; background: var(--paper-cool); border-radius: var(--radius); }
.proxy-access summary, .proxy-technical summary { cursor: pointer; font-size: 12px; font-weight: 650; }
.proxy-access[open] summary { margin-bottom: 12px; }
.proxy-access p { margin: 8px 0 0; }
.proxy-form-footer { padding-top: 16px; border-top: 1px solid var(--line); }
.proxy-form-footer .row { margin-top: 12px; }
.proxy-setup-guide h2 { font-size: 15px; }
.proxy-setup-guide ol { display: grid; gap: 16px; margin: 18px 0; padding-left: 20px; }
.proxy-setup-guide li { padding-left: 4px; }
.proxy-setup-guide li::marker { color: var(--muted); font-size: 12px; }
.proxy-setup-guide li span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.proxy-setup-tip { margin: 14px 0 0; }
.proxy-status-message { margin: 14px 0; overflow-wrap: anywhere; }
.proxy-endpoint { padding: 14px 16px; background: var(--paper-cool); border: 1px solid var(--line); border-radius: var(--radius); }
.proxy-endpoint strong { font-size: 21px; overflow-wrap: anywhere; }
.proxy-endpoint .row { margin-top: 4px; }
.proxy-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.proxy-facts dt { color: var(--muted); font-size: 11px; }
.proxy-facts dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.proxy-fact-wide { grid-column: 1 / -1; }
.proxy-technical { border-top: 1px solid var(--line); padding-top: 14px; }
.proxy-status-actions { margin-top: 20px; }
.proxy-cleanup { display: flex; gap: 16px; justify-content: space-between; align-items: center; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.proxy-cleanup p { max-width: 420px; margin: 0; }
.proxy-cleanup form { flex-shrink: 0; }
@media (max-width: 900px) {
  .proxy-setup-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 600px) {
  .proxy-field-grid, .proxy-facts { grid-template-columns: minmax(0, 1fr); }
  .proxy-cleanup { flex-direction: column; align-items: start; gap: 12px; }
  .proxy-endpoint strong { font-size: 18px; }
}
.proxy-settings-grid > *, .proxy-fields > * { min-width: 0; }
.proxy-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.proxy-balances { margin: 0; }
.proxy-balances > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.proxy-balances dd { margin: 0; font-family: var(--mono); font-weight: 750; }
@media (max-width: 800px) { .proxy-settings-grid, .proxy-fields { grid-template-columns: minmax(0, 1fr); } }
.page-head { position: relative; display: flex; min-height: 112px; align-items: center; justify-content: space-between; gap: 28px; margin-bottom: 18px; padding: 24px 28px; overflow: hidden; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-left: 4px solid var(--lime); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.page-head::before, .page-head::after { display: none; }
.page-head > * { position: relative; z-index: 1; }
.page-head h1 { max-width: 760px; color: var(--ink); font-size: clamp(26px, 3vw, 38px); }
.page-head .eyebrow { color: #6c6c66; }
.page-head-copy { max-width: 650px; margin: 8px 0 0; color: var(--muted); }
.page-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.overview-actions { margin-bottom: 12px; }
.overview-checks { display: flex; align-items: center; gap: 8px; min-width: 0; }
.overview-actions [data-cost-progress] { white-space: nowrap; }
.page-head .btn:not(.btn-primary) { color: var(--ink); background: #fff; border-color: var(--line-strong); }
.page-head .btn:not(.btn-primary):hover { color: #000; background: var(--paper-cool); }
.page-head .btn-primary { color: #fff; background: #1d1d1d; border-color: #1d1d1d; }
.page-head .btn-primary:hover { color: #fff; background: #000; border-color: #000; }
.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: 16px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.metric { position: relative; min-width: 0; width: 100%; padding: 18px 20px; color: inherit; background: var(--paper); border: 0; font: inherit; text-align: left; transition: background .14s; }
button.metric, a.metric { display: block; cursor: pointer; appearance: none; text-decoration: none; }
button.metric:hover, a.metric:hover { background: var(--paper-cool); }
.metric[aria-pressed="true"] { background: var(--paper-cool); }
.metric[aria-pressed="true"]::before { position: absolute; top: 0; right: 0; left: 0; height: 3px; content: ""; background: var(--lime); }
.metric::after { position: absolute; right: 16px; bottom: 0; left: 16px; height: 2px; content: ""; background: var(--accent-soft); }
.metric:nth-child(2)::after { background: #8bd9bd; }
.metric:nth-child(3)::after { background: #ef9ba5; }
.metric:nth-child(4)::after { background: #e7ca8d; }
.metric span { display: block; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.metric b { display: block; margin-top: 7px; color: var(--ink); font: 800 27px/1 var(--mono); letter-spacing: -.05em; }
.section-kicker, .eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.section-intro { margin: 4px 0 0; color: var(--muted); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-heading h2 { margin: 0; }
.filter-field { display: grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.filter-field input { width: min(260px, 32vw); min-height: 38px; letter-spacing: 0; text-transform: none; }
/* Server-side search: label + input stacked, buttons on the input's baseline. */
form.filter-field { grid-template-columns: auto auto auto; align-items: end; gap: 8px; }
form.filter-field label { display: grid; gap: 4px; }
form.filter-field .btn { letter-spacing: 0; text-transform: none; }
.filter-status { min-height: 1em; font-size: 10px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.table-filters { display: flex; align-items: flex-start; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.table-filters select { min-width: 150px; min-height: 38px; letter-spacing: 0; text-transform: none; }
.overview-filters { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(170px, 220px) auto auto; align-items: center; width: 100%; margin-bottom: 12px; padding: 6px; gap: 6px; background: var(--paper-cool); border: 1px solid var(--line); border-radius: 10px; }
.overview-search { position: relative; min-width: 0; }
.overview-search input { width: 100%; min-height: 42px; padding-right: 12px; padding-left: 38px; background: var(--paper); border-color: transparent; box-shadow: var(--shadow-sm); }
.overview-filters select { width: 100%; min-height: 42px; background: var(--paper); border-color: transparent; box-shadow: var(--shadow-sm); }
.overview-search .filter-status { position: absolute; top: 50%; right: 12px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.search-mark { position: absolute; top: 50%; left: 14px; z-index: 1; width: 12px; height: 12px; border: 1.5px solid var(--muted); border-radius: 50%; transform: translateY(-58%); pointer-events: none; }
.search-mark::after { position: absolute; right: -4px; bottom: -3px; width: 5px; height: 1.5px; content: ""; background: var(--muted); transform: rotate(45deg); transform-origin: left center; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row h1, .row h2 { flex: 1; min-width: 220px; }
.toolbar { margin: 15px 0; }
.toolbar .toolbar-end { margin-left: auto; }
.tree-controls { justify-content: flex-end; margin: 6px 0 -6px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label, .row > label { display: flex; flex-direction: column; gap: 6px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.row > label { flex-direction: row; align-items: center; }
.kv { display: grid; grid-template-columns: 180px minmax(0, 1fr); margin: 18px 0 0; border-top: 1px solid var(--line); }
.kv dt, .kv dd { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--muted); font-size: 12px; font-weight: 650; }
.kv dd { color: var(--ink); }
.stats { display: flex; gap: 7px; flex-wrap: wrap; }
.stats span { display: grid; min-width: 74px; padding: 8px 11px; color: var(--muted); background: var(--paper-cool); border: 1px solid var(--line); border-radius: 9px; font-size: 9px; font-weight: 750; letter-spacing: .08em; line-height: 1.15; text-transform: uppercase; }
.stats b { margin-top: 3px; color: var(--ink); font-size: 19px; line-height: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.ok { color: var(--ok); }
.err { color: var(--err); }
.hidden, [hidden] { display: none !important; }

/* Inputs and actions */
input, select, textarea { min-width: 0; padding: 9px 11px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: #91a3b6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly] { color: var(--muted); background: var(--paper-cool); }
input[type="color"] { width: 44px; height: 38px; padding: 3px; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
/* Consent card: the whole box toggles, so the target is not a 17px square.
   Overrides .stack label, which would otherwise stack the box above the text. */
.consent { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 11px; padding: 12px 14px; background: var(--paper-cool); border: 1px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; }
.consent.hidden, .consent[hidden] { display: none !important; }
.consent:hover { background: #fff; border-color: #94a4b5; }
.consent input { flex: none; margin-top: 1px; width: 18px; height: 18px; }
.consent-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.consent-text b { color: var(--ink); font-size: 13px; font-weight: 750; }
.consent-text span { color: var(--muted); font-size: 11.5px; font-weight: 600; line-height: 1.45; }
.consent:has(input:checked) { background: var(--accent-soft); border-color: #bedf35; box-shadow: inset 3px 0 var(--lime); }
.consent:has(input:focus-visible) { outline: 3px solid rgba(183, 219, 43, .55); outline-offset: 2px; }
.btn { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px; padding: 8px 13px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; font: inherit; font-weight: 720; line-height: 1.1; white-space: nowrap; transition: color .15s, background .15s, border-color .15s, box-shadow .15s, transform .08s; }
.btn:hover { background: var(--paper-cool); border-color: #94a4b5; box-shadow: 0 4px 12px rgba(15, 35, 60, .08); text-decoration: none; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-primary { color: #fff; background: #1d1d1d; border-color: #1d1d1d; }
.btn-primary:hover { color: #fff; background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { color: var(--ink-soft); background: transparent; border-color: transparent; }
.btn-ghost:hover { color: var(--ink); background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.btn-danger { color: var(--err); background: transparent; border-color: #e9b5bb; }
.btn-danger:hover { color: var(--err); background: var(--err-soft); border-color: #db8f98; }
.btn-sm { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
details summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
summary.btn { display: inline-flex; margin-top: 14px; }
details[open] > summary.btn { margin-bottom: 14px; }

/* Feedback and status */
.flash { display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: 16px; border: 1px solid; border-radius: var(--radius); font-weight: 650; }
.flash::before { width: 8px; height: 8px; flex: none; background: currentColor; border-radius: 50%; content: ""; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 12%, transparent); }
.flash-ok { color: var(--ok); background: var(--ok-soft); border-color: #a6ddc9; }
.flash-error { color: var(--err); background: var(--err-soft); border-color: #ebb5bc; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; color: var(--ink-soft); background: #edf1f5; border: 1px solid #d5dde5; border-radius: 999px; font-size: 11px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.badge::before { width: 6px; height: 6px; flex: none; background: currentColor; border-radius: 50%; content: ""; }
.state-badges { display: inline-flex; align-items: center; gap: 6px; }
.badge-tier { color: #1f4bb8; background: #e8effd; border-color: #b9caf5; white-space: nowrap; }
.badge-tier::before { display: none; }
.badge-live, .badge-available, .badge-enabled, .badge-healthy, .badge-synced, .badge-active { color: var(--ok); background: var(--ok-soft); border-color: #a6ddc9; }
.badge-down, .badge-disabled, .badge-proxy_issue, .badge-unavailable, .badge-failed, .badge-quarantined, .badge-deleted, .badge-expired { color: var(--err); background: var(--err-soft); border-color: #ebb5bc; }
.badge-pending, .badge-stale, .badge-reauth_required, .badge-unconfigured, .badge-quarantine_pending, .badge-restore_pending, .badge-unknown, .badge-warned, .badge-pastdue { color: var(--warn); background: var(--warn-soft); border-color: #e7ca8d; }
/* Subscription cell: several states wrap as a row of badges; grey for "we cannot see it". */
.badge-not_visible, .badge-none { color: var(--muted); background: var(--paper-cool); border-color: var(--line-strong); }
td[data-cell="subs"] { white-space: normal; }
td[data-cell="subs"] .badge + .badge { margin-left: 4px; }
.gw-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gw-tag { display: inline-block; max-width: 220px; padding: 3px 9px; overflow: hidden; font-size: 11px; font-weight: 650; line-height: 1.5; white-space: nowrap; text-overflow: ellipsis; border: 1px solid; border-radius: 999px; }
.gw-tag-0 { color: #0b6b3a; background: #e3f6ec; border-color: #a6ddc9; }
.gw-tag-1 { color: #1f4bb8; background: #e8effd; border-color: #b9caf5; }
.gw-tag-2 { color: #8a4b12; background: #fdefe2; border-color: #f2c9a5; }
.gw-tag-3 { color: #6b2fa0; background: #f1e8fb; border-color: #d3bcef; }
.gw-tag-4 { color: #0f6f73; background: #e3f6f6; border-color: #a8dfe0; }
.gw-tag-5 { color: #7a5a00; background: #fbf3d6; border-color: #eadb9c; }
.tag-none { color: var(--muted); font-size: 11px; font-weight: 650; }
.copy-value { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 10px; }
.copy-value > span { min-width: 0; overflow-wrap: anywhere; }
.copy-btn { flex: none; padding: 3px 7px; color: var(--accent); background: var(--accent-soft); border: 0; border-radius: 6px; cursor: pointer; font: 700 11px/1.4 Inter, ui-sans-serif, system-ui, sans-serif; }
.copy-btn:hover { color: #fff; background: var(--accent); }
.count-pill { padding: 4px 9px; color: var(--ink-soft); background: var(--paper-cool); border: 1px solid var(--line); border-radius: 99px; font-size: 11px; font-weight: 750; }

/* Data tables */
.table { width: 100%; margin-top: 16px; border-spacing: 0; border-collapse: separate; font-size: 13.5px; }
.table th, .table td { padding: 13px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.table thead th { color: var(--muted); background: var(--paper-cool); border-top: 1px solid var(--line); font-size: 9px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.table thead th:first-child { border-left: 1px solid var(--line); border-radius: 9px 0 0; }
.table thead th:last-child { border-right: 1px solid var(--line); border-radius: 0 9px 0 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f8ffe7; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.row-updated { animation: row-flash 1.1s ease-out; }
@keyframes row-flash { from { background: #f0ffcd; } to { background: transparent; } }
.row-note { display: block; margin-top: 3px; font-size: 11px; }
.account-note { width: fit-content; max-width: min(28rem, 100%); margin-top: 6px; padding: 6px 10px; color: #fff; background: #1f4bb8; border-radius: 8px; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.table td:first-child a { font-weight: 750; }
.table td:last-child { text-align: right; white-space: nowrap; }
.table td:last-child .inline { margin-left: 4px; }
.table-card { padding-top: 21px; }
.table-card > .section-heading { margin-bottom: 4px; }
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-gutter: stable; }
.table-scroll .table { min-width: 720px; }
.table-scroll.audit-scroll .table { min-width: 760px; }
.table-scroll.users-scroll .table { min-width: 860px; }
/* Keep list controls outside the independently scrollable rows. */
.scroll-card { display: flex; flex-direction: column; }
.scroll-card > :not(.bounded-scroll) { flex-shrink: 0; }
.scroll-card > .section-heading { margin-bottom: 20px; }
.table-scroll.bounded-scroll { max-height: 65dvh; overflow: auto; }
.bounded-scroll .table { margin-top: 0; }
.bounded-scroll thead th { position: sticky; top: 0; z-index: 1; }
#accounts-table td[data-label="Account"] { overflow-wrap: anywhere; }
@media (min-width: 981px) {
  .main:has(> .scroll-card), .main:has(> .proxy-manager), .main:has(> .gateway-manager) { display: flex; flex-direction: column; height: 100dvh; min-height: 600px; padding-bottom: 24px; }
  .main:has(> .scroll-card) > :not(.scroll-card) { flex-shrink: 0; }
  .proxy-manager { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .proxy-manager > :not(.proxy-list-frame) { flex-shrink: 0; }
  .scroll-card { flex: 1; min-height: 0; margin-bottom: 0; }
  .table-scroll.bounded-scroll { flex: 1; min-height: 0; max-height: none; }
}
.empty-state { display: grid; justify-items: center; gap: 8px; padding: 38px 20px 30px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--paper-cool); }
.empty-state h3 { font-size: 17px; }
.empty-state p { max-width: 520px; margin: 0; color: var(--muted); }
.empty-state .btn { margin-top: 8px; }
/* Pager footer under paged tables: range on the left, Previous/Next on the right. */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.pager .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* Login */
.login-wrap { position: relative; display: grid; min-height: 100vh; min-height: 100dvh; place-items: center end; padding: 48px clamp(28px, 9vw, 140px); overflow-x: hidden; overflow-y: auto; background: radial-gradient(circle at 18% 20%, #2d3227 0, transparent 32rem), #11130f; }
.login-wrap::before { position: absolute; left: clamp(28px, 8vw, 130px); top: 50%; color: var(--lime); content: "94"; font: 900 clamp(190px, 29vw, 470px)/.75 var(--mono); letter-spacing: -.16em; opacity: .92; transform: translateY(-50%); }
.login-wrap::after { position: absolute; left: clamp(32px, 9vw, 145px); bottom: 8vh; color: #8d9583; content: "AWS OPERATIONS / CONTROL PLANE"; font: 750 10px/1 var(--mono); letter-spacing: .2em; }
.login-wrap > div { position: relative; z-index: 1; width: min(440px, 100%); min-width: 0; }
.login { width: 100%; margin: 0; padding: 34px; background: rgba(255, 255, 255, .98); border: 1px solid rgba(255, 255, 255, .7); box-shadow: 0 32px 90px rgba(0, 0, 0, .35); }
.login .brand { margin: 0 0 42px; padding: 0; color: var(--ink); }
.login .brand .logo { box-shadow: 0 0 0 5px var(--accent-soft); }
.login .brand small { color: var(--muted); }
.login h1 { margin-bottom: 8px; font-size: 32px; }
.login .login-copy { margin-bottom: 24px; color: var(--muted); }
.login .stack { gap: 16px; }
.login input:not([type="checkbox"]):not([type="hidden"]) { width: 100%; min-height: 44px; }
.login .login-remember { flex-direction: row; align-items: center; gap: 9px; min-height: 36px; cursor: pointer; }
.login-remember input { flex: none; margin: 0; padding: 0; }
.login-captcha { display: flex; justify-content: center; min-width: 0; min-height: 65px; }
.login-captcha > div { width: 100%; }
.login-captcha > [data-size="compact"] { width: 150px; min-height: 140px; }
.login .btn-primary { min-height: 44px; margin-top: 4px; }
.login .login-foot { margin: 24px 0 0; padding-top: 18px; color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; }

/* Dialogs */
dialog:not([open]) { display: none !important; }
[data-security-secret] svg { max-width: 100%; height: auto; }
#totp-secret, #recovery-codes { overflow-wrap: anywhere; white-space: pre-wrap; }
.modal { width: min(570px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 27px; overflow-y: auto; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 30px 100px rgba(8, 24, 45, .3); }
.modal::backdrop { background: rgba(17, 19, 15, .76); backdrop-filter: blur(4px); }
.modal.login-2fa { width: min(410px, calc(100vw - 32px)); }
.login-2fa:not(:modal) { position: static; margin: 16px 0 0; }
.login-2fa input[name="otp"] { width: 100%; min-height: 48px; }
.login-2fa .login-otp { font: 700 28px/1.4 var(--mono); text-align: center; letter-spacing: .25em; }
.login-2fa-actions { gap: 8px; }
.login-2fa-actions .btn-primary { flex: 1; }
.login-2fa-switch { display: inline-block; margin: 18px 0 10px; font-size: 13px; text-decoration: underline; }
.modal h2 { margin-bottom: 10px; font-size: 22px; }
.gateway-actions-toggle { width: 40px; min-height: 40px; padding: 0; }
.gateway-actions-toggle svg { width: 18px; height: 18px; }
.modal.gateway-instance-dialog { width: min(440px, calc(100vw - 32px)); }
.gateway-options-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.gateway-options-heading > div { min-width: 0; }
.gateway-options-heading h2 { margin-bottom: 0; overflow-wrap: anywhere; }
.gateway-options-url { margin: 8px 0 22px; overflow-wrap: anywhere; }
.gateway-options-actions { display: grid; gap: 8px; }
.gateway-options-actions > form .btn, .gateway-token-editor > summary.btn { width: 100%; min-height: 44px; justify-content: flex-start; }
.gateway-token-editor > summary.btn { margin: 0; }
.gateway-token-editor > summary::after { content: "+"; margin-left: auto; color: var(--muted); font-size: 18px; }
.gateway-token-editor[open] > summary::after { content: "−"; }
.gateway-token-editor[open] > summary { background: var(--accent-soft); }
.gateway-token-editor form { margin-top: 8px; padding: 14px; text-align: left; background: var(--paper-cool); border: 1px solid var(--line); border-radius: 8px; }
.gateway-options-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.gateway-options-footer > [data-close] { margin-left: auto; }
/* Shared confirm dialog: one icon tile, message, two actions. */
.confirm-modal { width: min(440px, calc(100vw - 32px)); text-align: left; }
.confirm-modal .confirm-icon { width: 44px; height: 44px; margin-bottom: 14px; border-radius: 12px; background: var(--accent-soft) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23162033' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 9v4'/><path d='M12 17h.01'/><path d='M10.3 3.9 1.8 18.6A2 2 0 0 0 3.5 21.6h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/></svg>") center / 22px no-repeat; }
.confirm-modal.is-danger .confirm-icon { background-color: #fdeaec; }
.confirm-modal h2 { font-size: 19px; }
.confirm-modal p { margin: 0 0 18px; color: var(--ink-soft); line-height: 1.5; overflow-wrap: anywhere; }
.confirm-actions { justify-content: flex-end; gap: 8px; }
/* Result toasts: bottom-right stack; success auto-dismisses, errors stay. */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-left: 4px solid; border-radius: 10px; box-shadow: 0 10px 30px rgba(17, 19, 15, .18); font-size: 13px; line-height: 1.45; pointer-events: auto; animation: toast-in .16s ease-out; }
.toast-ok { border-left-color: var(--ok); }
.toast-err { border-left-color: var(--err); }
.toast::before { width: 18px; height: 18px; flex: none; margin-top: 1px; content: ""; background: center / 18px no-repeat; }
.toast-ok::before { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b6b3a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>"); }
.toast-err::before { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23bd3443' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 9v4'/><path d='M12 17h.01'/><circle cx='12' cy='12' r='10'/></svg>"); }
.toast-text { flex: 1 1 auto; overflow-wrap: anywhere; }
.toast-close { flex: none; width: 26px; height: 26px; margin: -4px -4px -4px 0; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 6px; font-size: 18px; line-height: 1; cursor: pointer; }
.toast-close:hover { color: var(--ink); background: var(--paper-cool); }
.toast-out { opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } .toast-out { transition: none; } }
@media (max-width: 640px) { .toasts { right: 10px; left: 10px; bottom: 10px; width: auto; } }
.flow { padding: 15px; background: var(--accent-soft); border: 1px dashed #8eb8ed; border-radius: var(--radius); }
/* Quota next to the deployment type: available capacity before submitting. */
.quota-hint { margin: -6px 0 0; font-size: 11.5px; font-weight: 650; }
.quota-hint:empty { display: none; }
.quota-ok { color: var(--ok); }
.quota-unknown { color: var(--muted); }
.quota-short { color: var(--warn); }
.quota-none { color: var(--err); }
/* Green "limit was raised" line: under the deploy dialog's Model select and in
   the Capacity cell of the deployments table. */
.quota-increase { margin: -8px 0 0; color: var(--ok); font-size: 11.5px; font-weight: 650; }
.quota-increase:empty { display: none; }
td .quota-increase { margin: 2px 0 0; white-space: nowrap; }
.code { margin: 10px 0; color: var(--ink); font: 800 30px/1.2 var(--mono); letter-spacing: 5px; text-align: center; }
.reveal { padding: 12px 14px; overflow-wrap: anywhere; background: var(--paper-cool); border: 1px solid var(--line); border-radius: 8px; }
.key-panel { margin: 10px 0 4px; padding: 11px 13px; background: var(--paper-cool); border: 1px solid var(--line-strong); border-left: 3px solid var(--lime); border-radius: 8px; }
.key-panel .copy-value { gap: 12px; }
.key-panel .mono { font-size: 12.5px; overflow-wrap: anywhere; }
.key-panel p { margin: 7px 0 0; }
.key-panel .btn { margin-top: 8px; }
.card.danger { background: #fffafb; border-color: #ebb5bc; }
.card.danger h2 { color: var(--err); }

/* Resources tree */
details.rg { margin: 12px 0; overflow: hidden; background: var(--paper-cool); border: 1px solid var(--line); border-left: 3px solid #d3a427; border-radius: 8px; }
details.rg > summary { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 12px; }
details.rg > summary:hover { background: var(--accent-soft); }
details.rg > summary b { font-size: 14px; }
details.res { margin: 9px 0 9px 8px; padding-left: 14px; border-left: 2px solid #bedf35; }
details.res > summary { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
details.rg > summary::before, details.res > summary::before { width: 6px; height: 6px; flex: none; margin: 0 6px 0 2px; content: ""; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
details.rg[open] > summary::before, details.res[open] > summary::before { transform: rotate(45deg); }
.tree-icon { display: inline-block; width: 14px; height: 12px; flex: none; }
.rg-ico { border: 2px solid #a87800; border-top-width: 4px; border-radius: 3px; }
.res-ico { width: 12px; border: 2px solid #789410; border-radius: 50%; }
.side .ico svg, .who .btn svg { display: block; }
.branch { padding: 3px 16px 14px 29px; }
.branch .table { overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; }
.resource-subscription > .row:first-child { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.resource-endpoint { padding: 7px 9px; overflow-wrap: anywhere; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.gateway-badges { margin-top: 6px; flex-wrap: wrap; gap: 6px; }
.gateway-badges .badge { text-decoration: none; }
.row-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-form input { min-width: 0; }
.model-row { align-items: center; gap: 8px; }
.model-row .consent { flex: 1 1 200px; margin: 0; }
.model-row input[type="text"], .model-row input:not([type]) { flex: 1 1 160px; }

/* Gateways: website tabs -> account tree -> channel cards -> model chips */
.spacer { flex: 1 1 auto; }
.gateway-manager { min-width: 0; }
.gw-page-heading { align-items: center; margin-bottom: 16px; }
.gw-page-heading h1 { font-size: 27px; }
.gw-page-heading p { margin: 5px 0 0; }
.gw-page-heading > .btn { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.gw-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.gw-metrics > div { padding: 12px 17px; border-right: 1px solid var(--line); }
.gw-metrics > div:last-child { border: 0; }
.gw-metrics span { display: block; font-size: 11px; color: var(--muted); }
.gw-metrics strong { display: block; margin-top: 3px; font: 700 21px/1.2 var(--mono); }
.gw-metrics > div:last-child strong { color: var(--warn); }
.gw-websites { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
.gw-websites > summary { display: flex; align-items: center; gap: 8px; padding: 9px 13px; font-size: 12px; font-weight: 650; cursor: pointer; list-style: none; }
.gw-websites > summary::-webkit-details-marker { display: none; }
.gw-websites > summary::after { content: "+"; margin-left: auto; color: var(--muted); }
.gw-websites[open] > summary::after { content: "−"; }
.gw-sites-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-height: 220px; padding: 3px 12px 12px; overflow: auto; }
.gw-site { padding: 12px; background: var(--paper-cool); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.gw-site-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gw-site-heading > div { min-width: 0; }
.gw-site-heading b { font-size: 13px; }
.gw-site-heading p { margin: 2px 0 0; overflow-wrap: anywhere; }
.gw-site-meta { margin-top: 10px; font-size: 11px; color: var(--muted); }
.card.gw-published { padding: 0; border-radius: 10px; overflow: hidden; }
.gw-published .gw-tabs { margin: 0 16px; padding: 0; width: auto; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--paper); gap: 18px; }
.gw-published .gw-tabs a { flex: 0 0 auto; gap: 8px; padding: 12px 0; border: 0; border-radius: 0; border-bottom: 2px solid transparent; font-size: 12px; }
.gw-published .gw-tabs a.active { background: var(--paper); border-bottom-color: #a8c735; }
.gw-tabs .count-pill { min-width: 24px; padding: 2px 7px; }
.gw-filters { display: flex; align-items: center; gap: 9px; padding: 12px 16px; }
.gw-search { flex: 1; min-width: 0; }
.gw-search input { width: 100%; }
.gw-filters input, .gw-filters select { height: 36px; font-size: 12px; }
.gw-filters select { max-width: 190px; }
.gw-overview { justify-content: space-between; gap: 8px; padding: 0 16px 10px; overflow-wrap: anywhere; }
.gw-overview .small { font-size: 11px; }
.table-scroll.gw-scroll { padding: 0 14px 14px; border-top: 1px solid var(--line); overscroll-behavior: contain; }
details.gw-account { margin: 12px 0 0; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; }
details.gw-account > summary { flex-wrap: nowrap; padding: 11px 12px; border-radius: 0; background: #f5f7f0; }
details.gw-account > summary .gw-email { min-width: 0; max-width: 100%; font-size: 12px; overflow-wrap: anywhere; }
.gw-account-identity { flex: 1; min-width: 0; }
.gw-account-identity .row { gap: 6px; }
.gw-account-identity .badge { font-size: 9px; padding: 2px 6px; }
details.gw-account > summary .gw-summary { display: block; margin-top: 3px; font-size: 10px; }
.gw-account-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.gw-account-actions .btn { font-size: 11px; }
.gw-account > .branch { padding: 0; }
.gw-channel { margin: 0; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--paper); }
.gw-channel-main { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.gw-channel-info { flex: 1; min-width: 0; }
.gw-channel-head { align-items: center; gap: 7px; flex-wrap: wrap; }
.gw-channel-head .badge { font-size: 10px; padding: 2px 6px; }
.gw-channel-head .small { font-size: 11px; }
.gw-channel-head .mono { font-weight: 600; }
.gw-channel-head > span { max-width: 100%; overflow-wrap: anywhere; }
.gw-err { margin: 9px 0 0; padding: 7px 10px; font-size: 11px; color: var(--err); background: var(--err-soft); border-radius: 6px; overflow-wrap: anywhere; }
.gw-channel-actions { display: flex; align-items: center; flex-shrink: 0; gap: 5px; }
.gw-channel-actions .btn { font-size: 11px; min-height: 31px; }
.gw-channel-actions .gateway-actions-toggle, .gw-account-actions .gateway-actions-toggle { width: 29px; min-height: 29px; }
.gw-channel .chip { max-width: 100%; padding: 2px 7px; border-radius: 5px; font-size: 11px; border-color: var(--line); overflow-wrap: anywhere; }
.gw-channel .chips { gap: 5px; margin-top: 8px; }
.gw-extra-models > summary { cursor: pointer; font-size: 11px; color: var(--ink-soft); padding: 3px 4px; }
.gw-extra-models[open] { flex-basis: 100%; }
.gw-channel-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.gw-channel-meta b { color: var(--ink-soft); font-weight: 550; }
.gw-synced { margin-left: auto; }
.gw-scroll > .empty-state { margin-top: 14px; }
.modal.gw-dialog { width: min(480px, calc(100vw - 32px)); padding: 24px; border-radius: 12px; }
.gw-dialog .gateway-options-heading { margin-bottom: 16px; }
.gw-dialog .gateway-options-heading h2 { font-size: 21px; }
.gw-dialog .gateway-options-heading p { margin: 5px 0 0; overflow-wrap: anywhere; }
.gw-dialog-context { padding: 12px 14px; margin-bottom: 17px; border: 1px solid var(--line); background: var(--paper-cool); border-radius: 8px; overflow-wrap: anywhere; }
.gw-dialog-context p { margin: 4px 0 0; }
.gw-dialog-context b { font-size: 13px; }
.gw-menu-action { width: 100%; text-align: left; justify-content: flex-start; min-height: 48px; }
.gw-menu-action small { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); font-weight: 400; white-space: normal; }
.gw-danger-zone { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 5px; }
.gw-form-body { margin-top: 20px; }
.gw-form-body input, .gw-form-body select { width: 100%; }
.gw-setting-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.gw-setting-grid small { color: var(--muted); font-size: 11px; font-weight: 400; }
.gw-dialog .gateway-options-footer { justify-content: flex-end; }
@media (min-width: 981px) {
  .gateway-manager { display: flex; flex: 1; min-height: 0; flex-direction: column; }
  .gateway-manager > :not(.gw-published) { flex-shrink: 0; }
  .gw-published { min-height: 180px; }
}
@media (max-width: 600px) {
  .gw-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gw-metrics > div:nth-child(2) { border-right: 0; }
  .gw-metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .gw-metrics > div { padding: 9px 12px; }
  .gw-websites > summary > .small { display: none; }
  .gw-sites-grid { grid-template-columns: minmax(0, 1fr); }
  .gw-filters { flex-wrap: wrap; padding: 10px; gap: 6px; }
  .gw-search { flex-basis: 100%; }
  .gw-filters select { flex: 1; max-width: none; }
  .gw-published .gw-tabs { margin: 0 10px; gap: 12px; }
  .gw-published .gw-tabs a { padding: 9px 0; font-size: 11px; }
  .table-scroll.gw-scroll { padding: 0 8px 10px; }
  .gw-account-actions > button:not(.gateway-actions-toggle) { display: none; }
  details.gw-account > summary { padding: 10px 8px; gap: 5px; align-items: start; }
  .gw-account-identity .badge { font-size: 8px; }
  .gw-channel { padding: 10px; }
  .gw-channel-main { flex-wrap: wrap; gap: 8px; }
  .gw-channel-info { flex-basis: 100%; }
  .gw-channel-actions { margin-left: auto; }
  .gw-synced { flex-basis: 100%; margin-left: 0; }
  .gw-overview { padding: 0 10px 9px; }
  .gw-setting-grid { grid-template-columns: minmax(0, 1fr); }
}
.badge-provider { text-transform: none; }
.badge-openai { color: #0b6b3a; background: #e3f6ec; border-color: #a6ddc9; }
.badge-anthropic { color: #8a4b12; background: #fdefe2; border-color: #f2c9a5; }
.badge-deepseek { color: #1f4bb8; background: #e8effd; border-color: #b9caf5; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { display: inline-block; padding: 3px 9px; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); background: var(--paper-cool); border: 1px solid var(--line-strong); border-radius: 999px; }
.chip-bad { color: var(--err); background: #fdeaec; border-color: #f0b8bf; text-decoration: line-through; }
.dep-reason { margin-top: 4px; max-width: 60ch; overflow-wrap: anywhere; }
/* Resize dialog: model and type are shown but not changeable. */
select.locked { pointer-events: none; background-color: var(--paper-cool); color: var(--ink-soft); }
/* Deployment capacity against the regional grant: current / granted, bar, headroom. */
.cap-cell { min-width: 150px; }
.cap-cur { font-weight: 700; }
.cap-bar { height: 5px; margin: 5px 0 3px; background: var(--paper-cool); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.cap-bar i { display: block; height: 100%; background: var(--ok); }
.cap-bar .w0 { width: 2%; } .cap-bar .w10 { width: 10%; } .cap-bar .w20 { width: 20%; } .cap-bar .w30 { width: 30%; } .cap-bar .w40 { width: 40%; }
.cap-bar .w50 { width: 50%; } .cap-bar .w60 { width: 60%; } .cap-bar .w70 { width: 70%; } .cap-bar .w80 { width: 80%; } .cap-bar .w90 { width: 90%; } .cap-bar .w100 { width: 100%; background: var(--muted); }
.cap-free { color: var(--ok); font-size: 12px; font-weight: 650; }
.btn-raise { color: #0b6b3a; border-color: #a6ddc9; background: var(--ok-soft); }

/* Account pages */
.breadcrumb { display: flex; align-items: center; gap: 7px; margin: 0 2px 8px; color: var(--muted); font-size: 11px; font-weight: 650; }
.breadcrumb span:last-child { color: var(--ink-soft); }
.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; color: var(--muted); font-weight: 700; }
.back-link:hover { color: var(--ink); text-decoration: none; }
.back-link > span { font-size: 14px; line-height: 1; }
.account-hero { margin-bottom: 12px; padding: 12px 18px 0; overflow: hidden; background: var(--paper); border-top: 0; border-left: 3px solid var(--lime); }
.account-hero ~ .card { margin-bottom: 12px; padding: 16px 18px; }
.account-hero ~ .card .section-kicker { margin-bottom: 3px; font-size: 9px; }
.account-hero ~ .card .section-heading h2 { font-size: 16px; font-weight: 700; }
.account-hero ~ .card .section-intro { margin-top: 2px; font-size: 12px; }
.account-hero ~ .card .table { margin-top: 10px; font-size: 12px; }
.account-hero ~ .card .table th, .account-hero ~ .card .table td { padding: 9px 10px; }
.account-health .btn { min-height: 34px; padding: 6px 11px; font-size: 12px; }
/* Email, tag, status and action share one row when they fit; the row wraps
   only when the tenant email is too long, instead of always stacking. */
.account-heading { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap; }
.account-heading > div { min-width: 0; max-width: 100%; }
.account-identity { display: flex; align-items: baseline; gap: 10px; flex: 1 1 300px; flex-wrap: wrap; }
.account-heading h1 { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; font-size: clamp(16px, 1.55vw, 20px); font-weight: 700; line-height: 1.3; }
.account-status-cluster { display: flex; align-items: center; gap: 10px; flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; }
.account-states { display: grid; grid-template-columns: repeat(2, minmax(104px, 1fr)); gap: 8px; flex: none; }
.account-state { padding: 7px 11px; background: var(--paper-cool); border: 1px solid var(--line); border-radius: 7px; }
.account-state > span { display: block; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.account-state strong { display: flex; align-items: center; gap: 7px; margin-top: 3px; font: 800 12px/1.2 var(--mono); }
.account-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.account-hero-actions form { margin: 0; }
.account-hero-actions .btn { min-height: 40px; }
.account-state i { width: 7px; height: 7px; flex: none; background: currentColor; border-radius: 50%; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent); }
.account-state-live { color: var(--ok); background: var(--ok-soft); border-color: #a6ddc9; }
.account-state-die { color: var(--err); background: var(--err-soft); border-color: #ebb5bc; }
.account-state-unknown { color: var(--warn); background: var(--warn-soft); border-color: #e7ca8d; }
.page-tabs { display: flex; width: 100%; gap: 4px; margin-top: 10px; padding: 4px; overflow-x: auto; background: var(--paper-cool); border: 1px solid var(--line); border-radius: 8px; scrollbar-width: thin; }
.page-tabs a { display: flex; min-height: 42px; align-items: center; justify-content: center; flex: 1 1 0; min-width: max-content; padding: 9px 14px; color: var(--muted); border: 1px solid transparent; border-radius: 5px; font-size: 13px; font-weight: 750; }
.page-tabs a:hover { color: var(--ink); background: #fff; text-decoration: none; }
.page-tabs a.active { color: #111; background: var(--lime); border-color: #bedf35; }
.account-health .section-heading { align-items: center; justify-content: flex-end; }
.account-health .health-grid { margin-top: 8px; }
.identity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 11px 0 0; }
.identity-grid > div { min-width: 0; padding: 9px 11px; background: var(--paper-cool); border: 1px solid var(--line); border-radius: 7px; }
.identity-grid dt, .identity-grid dd { margin: 0; }
.identity-grid dt { margin-bottom: 3px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.identity-grid dd { color: var(--ink); font-size: 12px; overflow-wrap: anywhere; }
.identity-grid .mono { font-size: 11px; }
.health-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 11px 0; }
.health-grid > div { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 9px; padding: 9px 11px; background: var(--paper-cool); border: 1px solid var(--line); border-radius: 7px; }
.health-grid > div > span:first-child { color: var(--muted); font-size: 10px; font-weight: 650; }
.health-state { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.health-state > span { width: 6px; height: 6px; background: currentColor; border-radius: 50%; box-shadow: 0 0 0 3px #e9edf0; }
.health-healthy { color: var(--ok); }
.health-healthy > span { box-shadow: 0 0 0 4px var(--ok-soft); }
.health-failed { color: var(--err); }
.health-failed > span { box-shadow: 0 0 0 4px var(--err-soft); }
.health-warning { display: flex; flex-direction: column; gap: 3px; margin: 0 0 16px; padding: 10px 12px; color: var(--err); background: var(--err-soft); border-radius: 8px; font-size: 12px; }
.organization-form { display: grid; gap: 14px; margin-top: 12px; }
/* Only the stacked fields; .tag-choice is also a label but lays out inline. */
.organization-form > label { display: flex; flex-direction: column; gap: 6px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.note-field textarea { width: 100%; resize: vertical; }
.field-help { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.organization-actions { grid-column: 1 / -1; }
.danger { padding: 0; overflow: hidden; }
.danger-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; }
.danger-summary:hover { background: var(--err-soft); }
.danger-summary .eyebrow { display: block; }
.danger-summary strong { display: block; color: var(--err); font-size: 17px; letter-spacing: -.02em; }
.danger-summary::after { width: 7px; height: 7px; flex: none; margin-left: auto; content: ""; border-right: 2px solid var(--err); border-bottom: 2px solid var(--err); transform: rotate(45deg); transition: transform .15s; }
.danger[open] .danger-summary::after { transform: rotate(225deg); }
.danger-body { padding: 0 24px 24px; border-top: 1px solid #f0c8cd; }
.danger-body > p { margin-top: 18px; }
.danger-body > form.row input[name="proxy"] { flex: 1 1 420px; }
/* Publish dialog: gateway proxy row on top. Label above a full-width input, buttons trail. */
.gw-proxy > label { flex: 1 1 100%; min-width: 0; flex-direction: column; align-items: stretch; }
.gw-proxy select { width: 100%; min-width: 0; max-width: 100%; }
.gw-proxy + hr { border: 0; border-top: 1px solid var(--line, #e5e7eb); margin: 14px 0; }
.danger-actions { margin-top: 14px; }
.snapshot { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.snapshot::before { width: 7px; height: 7px; content: ""; background: var(--ok); border-radius: 50%; box-shadow: 0 0 0 4px var(--ok-soft); }
.usage-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-bottom: 16px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.usage-summary > div { min-width: 0; padding: 16px 18px; background: var(--paper); }
.usage-summary span { display: block; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.usage-summary b { display: block; margin-top: 5px; overflow-wrap: anywhere; font: 800 20px/1.2 var(--mono); }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; width: 100%; height: auto; padding: 10px 14px; flex-direction: row; align-items: center; gap: 10px; overflow-x: auto; }
  .side::after, .side nav::before { display: none; }
  .side .brand { padding: 0; }
  .side .brand > span:last-child { display: none; }
  .side .brand .logo { width: 34px; height: 34px; }
  .side nav { flex: 1; flex-direction: row; gap: 2px; }
  .side nav a { min-height: 38px; padding: 8px 10px; }
  .side nav a.active { box-shadow: inset 0 -2px var(--lime); }
  .side .spacer { display: none; }
  .who { padding: 5px; background: transparent; border: 0; }
  .who .meta { display: none; }
  .who .avatar { width: 32px; height: 32px; }
  .main { padding: 24px 20px 50px; }
  .identity-grid { grid-template-columns: 1fr; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-summary { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .side { position: static; align-items: flex-start; flex-wrap: wrap; }
  .side nav { order: 3; width: 100%; flex-basis: 100%; overflow-x: auto; }
  .side nav a { flex: 1 0 auto; justify-content: center; }
  .main { padding: 16px 12px 40px; }
  .card { padding: 19px 16px; border-radius: 13px; }
  .card > .row:first-child { align-items: flex-start; }
  .section-heading { flex-wrap: wrap; }
  .table-filters, .filter-field, .filter-field input, .table-filters select { width: 100%; }
  .overview-filters { grid-template-columns: 1fr; }
  .overview-checks { width: 100%; }
  .overview-actions form.cost-period { flex: 0 0 auto; }
  .row h1, .row h2 { min-width: 100%; }
  .stats { width: 100%; }
  .stats span { flex: 1; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { padding-bottom: 1px; border-bottom: 0; }
  .kv dd { padding-top: 2px; }
  /* One horizontal scroller: the .table-scroll wrapper. The table itself must
     not scroll too, or a swipe drags one region while the other stays put. */
  .table { max-width: 100%; margin-top: 12px; }
  .table th, .table td { padding: 11px 10px; }
  .toolbar .btn, .toolbar form { flex: 1 1 auto; }
  .toolbar form .btn { width: 100%; }
  .branch { padding-left: 12px; }
  details.res { margin-left: 0; padding-left: 10px; }
  details.rg > summary, details.res > summary { align-items: flex-start; flex-wrap: wrap; }
  .login-wrap { place-items: center; padding: 16px; }
  .login-wrap::before { left: 50%; top: 13%; font-size: 180px; opacity: .12; transform: translate(-50%, -50%); }
  .login-wrap::after { display: none; }
  .login { padding: 26px 22px; }
  .login .brand { margin-bottom: 34px; }
  .login h1 { font-size: 28px; }
  .account-hero { padding: 14px 12px 0; }
  .account-hero ~ .card { padding: 15px 13px; }
  .account-heading { align-items: stretch; flex-direction: column; gap: 12px; }
  /* Column direction makes flex-basis a height, so reset the row basis. */
  .account-identity { flex: 0 0 auto; }
  .account-status-cluster { align-items: stretch; flex-direction: column; flex: 0 0 auto; justify-content: flex-start; }
  .account-states { width: 100%; }
  .account-hero-actions .btn, .account-hero-actions form { flex: 1 1 auto; }
  .account-hero-actions form .btn { width: 100%; }
  .danger-summary { padding: 18px 16px; }
  .danger-body { padding: 0 16px 18px; }
  .health-grid { grid-template-columns: 1fr; }
  .health-grid > div { min-height: 48px; }
  .page-tabs { width: 100%; }
  .page-tabs a { min-height: 44px; flex: 1 1 auto; }
  .page-head { min-height: 0; align-items: flex-start; flex-direction: column; padding: 24px 20px; }
  .page-head-actions { width: 100%; justify-content: flex-start; }
  .page-head-actions .btn, .page-head-actions form { flex: 1 1 auto; }
  .page-head-actions form .btn { width: 100%; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 14px 15px; }
  .metric b { font-size: 22px; }
  .modal { padding: 22px 18px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .breadcrumb { align-items: flex-start; }
  .breadcrumb span:last-child { min-width: 0; overflow-wrap: anywhere; }
  .audit-scroll { overflow: visible; }
  .stacked-scroll { overflow: visible; }
  .table-scroll.audit-scroll .audit-table, .table-scroll.stacked-scroll .stacked-table { display: block; min-width: 0; }
  .audit-table thead, .stacked-table thead { display: none; }
  .audit-table tbody, .audit-table tr, .audit-table td,
  .stacked-table tbody, .stacked-table tr, .stacked-table td { display: block; width: 100%; }
  .audit-table tr, .stacked-table tr { margin-top: 12px; padding: 14px; background: var(--paper-cool); border: 1px solid var(--line); border-radius: 10px; }
  .audit-table td, .stacked-table td { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; padding: 5px 0; border: 0; text-align: left; overflow-wrap: anywhere; }
  .audit-table td::before, .stacked-table td::before { color: var(--muted); content: attr(data-label); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
  .audit-table td:last-child, .stacked-table td:last-child { text-align: left; white-space: normal; }
  .stacked-table tr[hidden] { display: none; }
  .stacked-table tr.is-empty { padding: 0; background: transparent; border: 0; }
  .stacked-table tr.is-empty td { display: block; padding: 0; }
  .stacked-table tr.is-empty td::before { display: none; }
  .stacked-table td:empty { display: none; }
  .stacked-table td[data-label="Actions"] { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
  .stacked-table td[data-label="Actions"]::before { display: none; }
  .stacked-table td[data-label="Actions"] .inline { margin-left: 0; }
  .stacked-table td[data-label="Actions"] .btn { flex: 1 1 auto; }
  .gateway-instances-table td[data-label="Actions"] { justify-content: flex-end; }
  .gateway-instances-table td[data-label="Actions"] .gateway-actions-toggle { flex: 0 0 40px; }
}

/* Overview opens a same-origin account document in a right-hand drawer. */
.account-drawer-link { cursor: pointer; }
html:has(#account-drawer[open]), body:has(#account-drawer[open]) { overflow: hidden; }
dialog.account-drawer { position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0; width: min(1120px, calc(100% - 300px)); max-width: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-left: 1px solid var(--line); border-radius: 14px 0 0 14px; overflow: hidden; background: var(--paper); box-shadow: -16px 0 60px #14220d26; }
.account-drawer[open] { display: flex; flex-direction: column; }
.account-drawer::backdrop { background: #17210f38; }
.account-drawer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; flex-shrink: 0; border-bottom: 1px solid var(--line); background: var(--paper); }
.account-drawer-bar > span { color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.account-drawer-bar .btn { min-width: 32px; min-height: 32px; padding: 3px 9px; font-size: 20px; }
[data-account-frame-host] { display: flex; flex: 1; min-height: 0; width: 100%; }
iframe[data-account-frame] { display: block; width: 100%; height: 100%; border: 0; }
.account-frame-status { padding: 25px; color: var(--muted); font-size: 13px; }
.account-embedded { overflow: hidden; background: var(--canvas); }
.account-embedded .side, .account-embedded .breadcrumb, .account-embedded > .skip-link { display: none; }
.account-embedded .shell { display: block; height: 100dvh; min-height: 0; }
.account-embedded .content { height: 100%; }
.account-embedded .main { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; padding: 0; }
.account-embedded .account-hero { flex-shrink: 0; padding: 17px 23px 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.account-embedded .account-heading { display: block; }
.account-embedded .account-heading h1 { font-size: 18px; }
.account-embedded .account-status-cluster { display: flex; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.account-embedded .account-states { width: auto; }
.account-embedded .account-state { padding: 5px 8px; min-width: 100px; }
.account-embedded .account-state span { font-size: 10px; }
.account-embedded .account-state strong { font-size: 12px; }
.account-embedded .account-hero-actions .btn { min-height: 32px; font-size: 11px; }
.account-embedded .page-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: auto; margin: 14px -23px 0; padding: 0; gap: 0; border: 0; border-block: 1px solid var(--line); border-radius: 0; background: var(--paper); }
.account-embedded .page-tabs a { min-width: 0; min-height: 56px; padding: 12px 8px; font-size: 15px; line-height: 1.35; text-align: center; border: 0; border-radius: 0; border-bottom: 3px solid transparent; }
.account-embedded .page-tabs a + a { border-left: 1px solid var(--line); }
.account-embedded .page-tabs a:focus-visible { outline-offset: -4px; }
.ai-usage-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ai-usage-summary small { display: block; color: var(--muted); font-size: 11px; margin-top: 6px; }
.ai-usage-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block: 18px 10px; }
.ai-usage-filter > label:first-child { flex: 1 1 220px; }
.ai-usage-filter input[type=search] { width: 100%; }
.ai-usage-filter select { max-width: 240px; }
.ai-show-all { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.ai-show-all input { width: 16px; height: 16px; }
.ai-chart { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 18px; }
.ai-chart h3 { font-size: 13px; margin: 0; overflow-wrap: anywhere; }
.ai-chart svg { display: block; width: 100%; max-height: 220px; }
.ai-chart svg rect { fill: #7b9831; }
.ai-chart svg .ai-bar-partial { fill: #c6ceaa; }
.ai-chart svg text { fill: var(--muted); font: 11px var(--mono); }
.ai-chart svg line { stroke: var(--line); }
.ai-resource { border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; overflow: hidden; }
.ai-resource > summary { display: flex; align-items: center; gap: 14px; padding: 14px; cursor: pointer; background: var(--paper-cool); }
.ai-resource > summary::before { content: '▸'; color: var(--muted); }
.ai-resource[open] > summary::before { content: '▾'; }
.ai-resource > summary > div { flex: 1; min-width: 0; }
.ai-resource > summary b, .ai-resource > summary small { display: block; overflow-wrap: anywhere; }
.ai-resource > summary small { color: var(--muted); font-size: 11px; margin-top: 4px; }
.ai-resource > summary > span { font: 11px var(--mono); text-align: right; }
.ai-resource-observed, .ai-usage-error { margin: 10px 14px; overflow-wrap: anywhere; }
.ai-usage-error { padding: 10px; border-radius: 6px; color: var(--err); background: var(--err-soft); font-size: 12px; }
.ai-usage-scroll { max-height: 440px; }
.ai-usage-table { min-width: 760px; font-size: 12px; }
.ai-usage-table thead th { position: sticky; top: 0; z-index: 1; background: var(--paper-cool); }
.ai-usage-table td:not(:first-child), .ai-usage-table th:not(:first-child) { text-align: right; }
.ai-usage-table td:first-child { min-width: 220px; max-width: 350px; overflow-wrap: anywhere; }
.ai-usage-table small, .ai-errors span { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.ai-model-link { border: 0; padding: 0; background: none; color: var(--ink); font: inherit; font-weight: 750; text-align: left; cursor: pointer; }
.ai-model-link:hover { text-decoration: underline; }
.ai-table-empty { padding: 18px; font-size: 12px; color: var(--muted); }
@media (max-width: 600px) {
  .ai-usage > .section-heading { display: block; }
  .ai-usage > .section-heading > .row { margin-top: 12px; }
  .ai-usage-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-usage-filter select { flex: 1 1 120px; max-width: 100%; min-width: 0; }
  .ai-resource > summary { flex-wrap: wrap; gap: 6px; }
  .ai-resource > summary > span { flex-basis: 100%; text-align: left; padding-left: 22px; }
}
.account-embedded .page-tabs a.active { border-bottom-color: #a7c735; background: var(--accent-soft); }
.account-frame-content { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 18px 23px 24px; outline-offset: -3px; }
.account-frame-content > .card { padding: 16px 17px; margin-bottom: 14px; border-radius: 10px; box-shadow: none; }
.account-frame-content h2 { font-size: 16px; }
.account-embedded .identity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.account-embedded .health-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.account-embedded .health-grid > div { display: block; padding: 9px; }
.account-embedded .health-state { display: block; margin-top: 6px; }
.proxy-route-list { margin: 12px 0 0; }
.proxy-route-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.proxy-route-list dt { font-size: 13px; font-weight: 650; }
.proxy-route-list dt small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 400; }
.proxy-route-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.proxy-route-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; grid-column: 1 / -1; }
.account-embedded .proxy-route-list .btn { min-height: 30px; font-size: 11px; }
.account-embedded .resource-subscription .branch { padding: 4px 10px 12px; }
.account-embedded .resource-subscription details.res { padding-left: 4px; margin-left: 0; }
.account-embedded .resource-subscription .table-scroll .table { min-width: 0; table-layout: fixed; }
.account-embedded .resource-subscription .table td { overflow-wrap: anywhere; padding: 8px 6px; font-size: 11px; }
.account-embedded .resource-subscription .table td:last-child { white-space: normal; }
.account-embedded .resource-subscription .btn { font-size: 11px; }
.account-embedded .resource-subscription > .row h2 { min-width: 0; }
.account-embedded .proxy-setup-grid { grid-template-columns: minmax(0, 1fr); }
.account-scan-note { padding: 9px 12px; font-size: 12px; color: var(--warn); background: var(--warn-soft); border-radius: 7px; }
.tier-card .section-heading { align-items: center; margin-bottom: 8px; }
.tier-card p { margin: 5px 0 0; }
.tier-scroll { max-height: 24dvh; overflow: auto; overscroll-behavior: contain; }
.tier-scroll .table { width: 100%; min-width: 0; table-layout: fixed; }
.tier-scroll td, .tier-scroll td:last-child { font-size: 11px; white-space: normal; overflow-wrap: anywhere; }
.tier-scroll summary { margin-top: 5px; cursor: pointer; font-size: 11px; }
.quota-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quota-card { display: flex; flex-direction: column; }
.quota-card > :not(.quota-scroll) { flex-shrink: 0; }
.quota-card .section-heading { margin-bottom: 10px; align-items: center; }
.quota-card h2 { font-size: 17px; }
.quota-card p { margin: 5px 0 10px; }
.quota-search { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.quota-search label { flex: 1; min-width: 0; }
.quota-search input { width: 100%; font-size: 12px; }
.quota-scroll { max-height: 65dvh; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 8px; }
.quota-scroll .quota-table { width: 100%; min-width: 0; table-layout: fixed; margin: 0; }
.quota-table th { position: sticky; top: 0; z-index: 1; text-align: right; }
.quota-table th:first-child { width: 44%; text-align: left; }
.quota-table td { padding: 10px; text-align: right; font-size: 12px; overflow-wrap: anywhere; }
.quota-table td:first-child { text-align: left; }
.quota-table small { display: block; margin-top: 4px; font-size: 10px; color: var(--muted); }
.quota-table small.ok { color: var(--ok); }
.account-frame-content:has(> .quota-card) { display: flex; flex-direction: column; overflow: auto; }
.account-frame-content:has(> .quota-card) > :not(.quota-card) { flex-shrink: 0; }
.account-frame-content > .quota-card { flex: 1; min-height: 360px; margin-bottom: 0; }
.account-frame-content > .quota-card .quota-scroll { flex: 1; min-height: 0; max-height: none; }
.cost-check-state { margin-top: 15px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; background: var(--paper-cool); }
.account-cost-total { padding: 15px; margin-top: 15px; border: 1px solid var(--line); border-radius: 8px; }
.account-cost-total span, .account-cost-total small { display: block; color: var(--muted); font-size: 11px; }
.account-cost-total b { display: block; margin: 6px 0; font: 700 23px var(--mono); overflow-wrap: anywhere; }
.account-cost-filter { display: flex; gap: 8px; margin-top: 15px; }
.account-cost-filter input { flex: 1; min-width: 0; font-size: 12px; }
.custom-cost-range { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.custom-cost-range summary { cursor: pointer; font-size: 12px; }
.custom-cost-range form { margin-top: 12px; }
.account-model-tooltip { position: fixed; z-index: 50; display: flex; flex-direction: column; width: min(560px, calc(100% - 24px)); max-height: min(420px, calc(100dvh - 24px)); border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 12px 36px #18270d30; }
.account-model-tooltip > header { padding: 11px 13px; flex-shrink: 0; font-size: 13px; }
.account-model-tooltip header > span { float: right; font-size: 10px; color: var(--muted); }
.account-model-tooltip header p { margin: 4px 0 0; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.model-tooltip-list { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.model-tooltip-list table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.model-tooltip-list th { position: sticky; top: 0; padding: 8px; background: var(--paper-cool); text-align: right; font-size: 10px; }
.model-tooltip-list th:first-child { width: 52%; text-align: left; }
.model-tooltip-list td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: right; font: 11px var(--mono); overflow-wrap: anywhere; }
.model-tooltip-list td:first-child { text-align: left; font-family: inherit; }
.model-tooltip-list small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.account-model-tooltip footer, .model-tooltip-loading { padding: 10px 13px; margin: 0; font-size: 10px; color: var(--muted); }
.quota-bubble-close { float: right; margin: -4px -5px 0 10px; font-size: 18px; min-height: 28px; padding: 2px 7px; }
.account-model-tooltip { transition: none !important; }
.quota-bubble-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.quota-bubble-actions .btn { min-height: 34px; font-size: 11px; }
.quota-refresh-status { margin: 8px 0 0; font-size: 11px; }
.quota-refresh-changes { padding: 10px 13px; background: var(--ok-soft); color: var(--ok); font-size: 12px; overflow-wrap: anywhere; }
.quota-refresh-changes p { margin: 8px 0; padding-top: 8px; border-top: 1px solid #08795a26; }
.quota-refresh-changes small { display: block; font-size: 10px; }
.model-tooltip-list .quota-last-increase { color: var(--ok); }
@media (max-width: 980px) { dialog.account-drawer { width: 94%; } }
@media (max-width: 680px) {
  dialog.account-drawer { width: 100%; border-radius: 0; }
  .account-embedded .account-hero { padding: 14px 13px 0; }
  .account-embedded .account-heading h1 { font-size: 16px; }
  .account-frame-content { padding: 13px; }
  .account-frame-content > .card { padding: 13px; }
  .account-embedded .identity-grid { grid-template-columns: minmax(0, 1fr); }
  .account-embedded .account-state { min-width: 90px; }
  .account-embedded .page-tabs { margin-inline: -13px; }
  .account-embedded .page-tabs a { font-size: 13px; padding-inline: 5px; }
  .proxy-route-list > div { grid-template-columns: minmax(0, 1fr); }
  .account-embedded .quota-summary { gap: 6px; }
  .account-embedded .quota-summary > div { padding: 8px; }
  .account-embedded .quota-summary b { font-size: 14px; }
  .account-embedded .quota-summary span { font-size: 9px; }
  .quota-table th { padding: 8px 4px; font-size: 9px; }
  .quota-table td { padding: 9px 5px; font-size: 10px; }
  .quota-card .section-heading { gap: 8px; }
  .account-model-tooltip { width: calc(100% - 24px); }
  .model-tooltip-list td { font-size: 10px; }
  .account-costs .section-heading { display: block; }
  .account-costs .section-heading > .row { margin-top: 10px; }
}
.is-busy::before, [data-proxy-manager][aria-busy="true"] [data-proxy-progress]::before,
[data-azure-proxy-poll] h2::before, #flow-state[data-flow-id]::before,
[data-provisioning="Creating"]::before, [data-provisioning="Accepted"]::before, [data-provisioning="Updating"]::before {
  content: ""; display: inline-block; width: 13px; height: 13px; flex: 0 0 13px; vertical-align: -2px;
  margin-right: 7px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: aam-spin .7s linear infinite;
}
.resource-operations:empty { display: none; }
.resource-operations { flex-shrink: 0; }
.resource-operation { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin: 0 0 10px; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; font-size: 12px; }
.modal.batch-dialog { width: min(1040px, calc(100vw - 32px)); }
.batch-templates { align-items: flex-end; }
.batch-templates label { flex: 1 1 200px; }
.batch-types { margin-top: 10px; }
.stack .batch-types label { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; cursor: pointer; }
[data-batch-skipped] { font-size: 12px; }
[data-batch-skipped] ul { max-height: 180px; overflow-y: auto; }
.batch-pick input[type="search"] { flex: 1 1 260px; }
.batch-pick-list { max-height: 300px; overflow-y: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; }
.batch-pick-list label { display: grid; grid-template-columns: 17px minmax(0, 1fr) minmax(0, 12em) 8em; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.batch-pick-list label:last-child { border-bottom: 0; }
.batch-pick-list label:hover { background: var(--paper-cool); }
.batch-pick-list label:has(input:checked) { background: var(--accent-soft); }
.batch-pick-list .batch-pick-name { font-weight: 650; overflow-wrap: anywhere; }
.batch-pick-list .quota-hint { margin: 0; text-align: right; }
.batch-pick-list > p { margin: 10px; }
@media (max-width: 640px) {
  .batch-pick-list label { grid-template-columns: 17px minmax(0, 1fr) auto; }
  .batch-pick-list label > .muted { display: none; }
}
.batch-rows th, .batch-rows td { padding: 6px; }
.batch-rows input, .batch-rows select { min-width: 0; width: 100%; }
.batch-rows select[data-version] { min-width: 9.5em; }
.batch-rows .quota-hint { margin: 2px 0 0; white-space: nowrap; }
.batch-progress { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; font-size: 12px; }
.batch-progress summary { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.batch-progress summary > span { margin-right: auto; }
.batch-progress ol { margin: 8px 0 0; padding-left: 20px; }
.batch-progress li { margin: 3px 0; }
@keyframes aam-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .is-busy::before { animation-duration: 2s; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
