:root {
  color-scheme: light;
  --md-sys-color-primary: #005ac1;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d8e2ff;
  --md-sys-color-on-primary-container: #001a41;
  --md-sys-color-secondary: #565f71;
  --md-sys-color-secondary-container: #dbe4e6;
  --md-sys-color-on-secondary-container: #111e2b;
  --md-sys-color-tertiary: #715573;
  --md-sys-color-surface: #fefbff;
  --md-sys-color-surface-dim: #ded8e1;
  --md-sys-color-surface-bright: #fefbff;
  --md-sys-color-surface-container-low: #f7f2fa;
  --md-sys-color-surface-container: #f3edf7;
  --md-sys-color-surface-container-high: #ece6f0;
  --md-sys-color-surface-container-highest: #e6e0e9;
  --md-sys-color-on-surface: #1b1b1f;
  --md-sys-color-on-surface-variant: #44474f;
  --md-sys-color-outline: #74777f;
  --md-sys-color-outline-variant: #c4c6d0;
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #ffdad6;
  --md-sys-color-on-error-container: #410002;
  --md-sys-color-warning: #805600;
  --md-sys-color-warning-container: #ffdea6;
  --md-sys-color-on-warning-container: #291800;
  --md-sys-color-success: #2e6b34;
  --md-sys-color-inverse-surface: #303034;
  --md-sys-color-inverse-on-surface: #f2f0f4;
  --md-sys-color-shadow: rgba(0, 0, 0, .18);
  --md-sys-state-hover: rgba(27, 27, 31, 0.08);
  --md-sys-state-focus: rgba(27, 27, 31, 0.10);
  --md-sys-state-pressed: rgba(27, 27, 31, 0.12);
  --md-sys-motion-easing-standard: cubic-bezier(.2, 0, 0, 1);
  --md-sys-motion-easing-standard-decelerate: cubic-bezier(0, 0, 0, 1);
  --md-sys-motion-easing-standard-accelerate: cubic-bezier(.3, 0, 1, 1);
  --md-sys-motion-easing-emphasized-decelerate: cubic-bezier(.05, .7, .1, 1);
  --md-sys-motion-easing-emphasized-accelerate: cubic-bezier(.3, 0, .8, .15);
  --md-sys-motion-duration-short-2: 100ms;
  --md-sys-motion-duration-short-4: 200ms;
  --md-sys-motion-duration-medium-1: 250ms;
  --md-sys-motion-duration-medium-2: 300ms;
  --md-sys-motion-duration-long-1: 450ms;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --md-sys-color-primary: #adc6ff;
  --md-sys-color-on-primary: #002e69;
  --md-sys-color-primary-container: #004494;
  --md-sys-color-on-primary-container: #d8e2ff;
  --md-sys-color-secondary: #bec6dc;
  --md-sys-color-secondary-container: #3b4858;
  --md-sys-color-on-secondary-container: #d7e3f7;
  --md-sys-color-tertiary: #dfbbdf;
  --md-sys-color-surface: #1b1b1f;
  --md-sys-color-surface-dim: #131317;
  --md-sys-color-surface-bright: #39393d;
  --md-sys-color-surface-container-low: #1f1f23;
  --md-sys-color-surface-container: #211f26;
  --md-sys-color-surface-container-high: #2b2930;
  --md-sys-color-surface-container-highest: #36343b;
  --md-sys-color-on-surface: #e3e2e6;
  --md-sys-color-on-surface-variant: #c4c6d0;
  --md-sys-color-outline: #8e9099;
  --md-sys-color-outline-variant: #44474f;
  --md-sys-color-error: #ffb4ab;
  --md-sys-color-on-error: #690005;
  --md-sys-color-error-container: #93000a;
  --md-sys-color-on-error-container: #ffdad6;
  --md-sys-color-warning: #ffba46;
  --md-sys-color-warning-container: #624000;
  --md-sys-color-on-warning-container: #ffdea6;
  --md-sys-color-success: #7ddc87;
  --md-sys-color-inverse-surface: #e3e2e6;
  --md-sys-color-inverse-on-surface: #303034;
  --md-sys-color-shadow: rgba(0, 0, 0, .48);
  --md-sys-state-hover: rgba(227, 226, 230, 0.08);
  --md-sys-state-focus: rgba(227, 226, 230, 0.10);
  --md-sys-state-pressed: rgba(227, 226, 230, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --md-sys-color-primary: #adc6ff;
    --md-sys-color-on-primary: #002e69;
    --md-sys-color-primary-container: #004494;
    --md-sys-color-on-primary-container: #d8e2ff;
    --md-sys-color-secondary: #bec6dc;
    --md-sys-color-secondary-container: #3b4858;
    --md-sys-color-on-secondary-container: #d7e3f7;
    --md-sys-color-tertiary: #dfbbdf;
    --md-sys-color-surface: #1b1b1f;
    --md-sys-color-surface-dim: #131317;
    --md-sys-color-surface-bright: #39393d;
    --md-sys-color-surface-container-low: #1f1f23;
    --md-sys-color-surface-container: #211f26;
    --md-sys-color-surface-container-high: #2b2930;
    --md-sys-color-surface-container-highest: #36343b;
    --md-sys-color-on-surface: #e3e2e6;
    --md-sys-color-on-surface-variant: #c4c6d0;
    --md-sys-color-outline: #8e9099;
    --md-sys-color-outline-variant: #44474f;
    --md-sys-color-error: #ffb4ab;
    --md-sys-color-on-error: #690005;
    --md-sys-color-error-container: #93000a;
    --md-sys-color-on-error-container: #ffdad6;
    --md-sys-color-warning: #ffba46;
    --md-sys-color-warning-container: #624000;
    --md-sys-color-on-warning-container: #ffdea6;
    --md-sys-color-success: #7ddc87;
    --md-sys-color-inverse-surface: #e3e2e6;
    --md-sys-color-inverse-on-surface: #303034;
    --md-sys-color-shadow: rgba(0, 0, 0, .48);
    --md-sys-state-hover: rgba(227, 226, 230, 0.08);
    --md-sys-state-focus: rgba(227, 226, 230, 0.10);
    --md-sys-state-pressed: rgba(227, 226, 230, 0.12);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: Roboto, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

body.public-page,
body.auth-page {
  display: block;
  height: auto;
  min-height: 100vh;
  overflow-y: auto;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--md-sys-color-primary) 72%, transparent); outline-offset: 2px; }

.icon { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.icon-sm { width: 18px; height: 18px; }
.material-symbol { display: inline-flex; width: 20px; height: 20px; line-height: 0; flex-shrink: 0; }
.material-symbol svg { width: 100%; height: 100%; }
.hidden { display: none !important; }

/* Navigation Rail and application frame */
.nav-rail {
  width: 216px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 12px;
  overflow-y: auto;
  background: var(--md-sys-color-surface);
  border-right: 1px solid var(--md-sys-color-outline-variant);
}
.rail-brand { display: flex; align-items: center; gap: 12px; padding: 8px 12px 20px; }
.rail-logo {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 12px;
  color: var(--md-sys-color-on-primary-container);
  background: var(--md-sys-color-primary-container);
}
.rail-logo .icon, .rail-logo .material-symbol { width: 22px; height: 22px; }
.rail-title { font-size: 16px; font-weight: 500; line-height: 1.25; }
.rail-sub { color: var(--md-sys-color-outline); font-size: 11px; letter-spacing: .04em; }
.nav-group-title { padding: 16px 16px 8px; color: var(--md-sys-color-outline); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.nav-item {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  padding: 0 16px;
  border: none;
  border-radius: 24px;
  color: var(--md-sys-color-on-surface);
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), background-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), transform var(--md-sys-motion-duration-short-2) var(--md-sys-motion-easing-standard);
}
.nav-item:hover { background: var(--md-sys-state-hover); }
.nav-item:active { transform: scale(.985); }
.nav-item.active { color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); }
.nav-port { margin-left: auto; color: var(--md-sys-color-outline); font-size: 11px; font-variant-numeric: tabular-nums; }
.nav-item.active .nav-port { color: inherit; opacity: .7; }
.rail-bottom { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.md-icon-button.mobile-menu-trigger, .mobile-nav-menu { display: none; }

.main-content { min-width: 0; flex: 1; display: flex; flex-direction: column; overflow-y: auto; background: var(--md-sys-color-surface-container); }
.top-app-bar {
  height: 64px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  background: color-mix(in srgb, var(--md-sys-color-surface-container) 85%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
}
.appbar-title { font-size: 18px; font-weight: 500; }
.appbar-sub { color: var(--md-sys-color-outline); font-size: 11px; letter-spacing: .03em; }
.appbar-spacer { flex: 1; }
.content-area { width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px; }
.view { display: none; }
.view.active { display: block; }
.view.entering { animation: view-enter var(--md-sys-motion-duration-medium-2) var(--md-sys-motion-easing-emphasized-decelerate) both; }
.appbar-title.updating { animation: title-enter var(--md-sys-motion-duration-medium-1) var(--md-sys-motion-easing-emphasized-decelerate) both; }

/* Cards, metrics, lists */
.md-card { margin-bottom: 16px; padding: 16px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 16px; background: var(--md-sys-color-surface-container-highest); }
.md-card-title { font-size: 16px; font-weight: 500; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.card-hint { margin-top: 4px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; line-height: 1.6; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { margin: 0; padding: 16px 18px; border: none; background: var(--md-sys-color-surface-container-high); }
.stat-card.accent { color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .8; }
.stat-value { margin-top: 6px; font-size: 30px; font-weight: 400; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-value.compact { font-size: 24px; }
.quota-composite { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.quota-component { display: inline-flex; flex-direction: column; gap: 1px; }
.quota-component small { font-size: 10px; font-weight: 700; line-height: 1; letter-spacing: .08em; opacity: .68; }
.quota-timed-component { display: inline-flex; align-items: flex-end; gap: 8px; }
.quota-plus { padding-bottom: 1px; font-size: .72em; font-weight: 400; opacity: .62; }
.stat-foot { margin-top: 4px; font-size: 11px; opacity: .65; font-variant-numeric: tabular-nums; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.list-item:last-child { border-bottom: none; }
.list-item-body { min-width: 0; flex: 1; }
.list-item-title { word-break: break-all; font-size: 14px; font-weight: 500; }
.list-item-sub { margin-top: 2px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
.list-metrics { display: flex; flex-shrink: 0; gap: 18px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; font-variant-numeric: tabular-nums; }
.list-metrics b { display: block; color: var(--md-sys-color-on-surface); font-size: 14px; font-weight: 500; }
.model-item { align-items: flex-start; }
.model-locked { opacity: .72; background: color-mix(in srgb, var(--md-sys-color-error-container) 32%, transparent); }
.model-locked:hover { background: color-mix(in srgb, var(--md-sys-color-error-container) 46%, transparent); }
.model-price-grid { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); gap: 10px 16px; margin-top: 14px; color: var(--md-sys-color-on-surface-variant); font-size: 11px; font-variant-numeric: tabular-nums; }
.model-price-grid b { display: block; margin-top: 3px; color: var(--md-sys-color-on-surface); font-size: 14px; font-weight: 500; }
.model-price-grid small { display: block; margin-top: 2px; color: var(--md-sys-color-outline); font-size: 10px; }
.model-endpoints { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.model-endpoints .tag { font-size: 10px; }
.empty { padding: 28px 8px; color: var(--md-sys-color-outline); font-size: 13px; text-align: center; }
.compact-row { min-height: 48px; }
.list-actions { display: flex; flex-shrink: 0; gap: 2px; }
.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 10px; color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); font-size: 10px; white-space: nowrap; }
.tag.muted { color: var(--md-sys-color-outline); border: 1px solid var(--md-sys-color-outline-variant); background: transparent; }
.tag.success { color: var(--md-sys-color-success); }
.tag.error { color: var(--md-sys-color-error); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--md-sys-color-success); }
.status-sep { color: var(--md-sys-color-outline-variant); }
.status-err { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: 12px; color: var(--md-sys-color-on-error-container); background: var(--md-sys-color-error-container); font-size: 12px; line-height: 1.5; word-break: break-all; }
code, pre, kbd, samp { font-family: ui-monospace, 'Cascadia Code', 'SFMono-Regular', Consolas, monospace; }
code:not(pre code):not(.generated-code) { padding: 2px 6px; border-radius: 6px; color: inherit; background: var(--md-sys-color-surface-container-low); font-size: .86em; overflow-wrap: anywhere; }
pre, .code-block, .generated-code {
  width: 100%;
  display: block;
  margin: 12px 0 16px;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-low);
  font-size: 12px;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
  scrollbar-width: thin;
}
pre code { display: block; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; white-space: inherit; overflow-wrap: inherit; word-break: inherit; }
.filter-card { padding-bottom: 14px; }
.list-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; gap: 12px; }
.list-filter .md-textfield { margin-bottom: 0; }
.list-filter-actions { display: flex; justify-content: flex-end; gap: 8px; }
.filter-check { display: flex; min-height: 56px; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--md-sys-color-outline); border-radius: 12px 12px 0 0; color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-high); cursor: pointer; transition: border-bottom-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), background-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard); }
.filter-check:hover { background: var(--md-sys-color-surface-container-highest); }
.filter-check:focus-within { border-bottom: 2px solid var(--md-sys-color-primary); }
.filter-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--md-sys-color-primary); }
.filter-check span { font-size: 14px; }
.usage-filter-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.usage-filter-summary > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.usage-filter-summary span { color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
.usage-filter-summary b { overflow: hidden; font-size: 17px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.pagination-bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.pagination-summary { margin-right: auto; color: var(--md-sys-color-on-surface-variant); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Channel rows use the same list treatment as the reference panel. */
.channel-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; padding: 12px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 14px; background: var(--md-sys-color-surface-container-low); transition: background-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard); }
.channel-row:last-child { margin-bottom: 0; }
.channel-row:hover { background: var(--md-sys-color-surface-container); }
.channel-radio { display: flex; color: var(--md-sys-color-outline); }
.channel-body { min-width: 0; flex: 1; }
.channel-name { font-size: 14px; font-weight: 500; }
.channel-target { margin-top: 2px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; word-break: break-all; }
.channel-actions { display: flex; flex-shrink: 0; gap: 2px; }
.error-count { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Buttons */
.md-btn { height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 24px; border: none; border-radius: 20px; font-size: 14px; font-weight: 500; transition: box-shadow var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), background-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), transform var(--md-sys-motion-duration-short-2) var(--md-sys-motion-easing-standard); }
.md-btn-filled { color: var(--md-sys-color-on-primary); background: var(--md-sys-color-primary); }
.md-btn-filled:hover { box-shadow: 0 1px 3px 1px rgba(0, 0, 0, .15); }
.md-btn-text { padding: 0 16px; color: var(--md-sys-color-primary); background: transparent; }
.md-btn-text:hover { background: var(--md-sys-state-hover); }
.md-btn-outlined { color: var(--md-sys-color-primary); border: 1px solid var(--md-sys-color-outline); background: transparent; }
.md-btn-outlined:hover { background: var(--md-sys-state-hover); }
.md-btn-compact { height: 36px; padding-inline: 12px; }
.md-icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: none; border-radius: 18px; color: var(--md-sys-color-on-surface-variant); background: transparent; transition: color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), background-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), transform var(--md-sys-motion-duration-short-2) var(--md-sys-motion-easing-standard); }
.md-icon-button:hover { background: var(--md-sys-state-hover); }
.md-icon-button.danger:hover { color: var(--md-sys-color-error); }
.md-btn:active { transform: scale(.97); }
.md-icon-button:active { transform: scale(.92); }
.md-btn, .md-icon-button { position: relative; overflow: hidden; isolation: isolate; }
.md-btn::before, .md-icon-button::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: currentColor; opacity: 0; pointer-events: none; transition: opacity var(--md-sys-motion-duration-short-2) linear; }
.md-btn:hover::before, .md-icon-button:hover::before { opacity: .08; }
.md-btn:focus-visible::before, .md-icon-button:focus-visible::before { opacity: .10; }
.md-btn:active::before, .md-icon-button:active::before { opacity: .12; }
.md-btn[data-busy="true"]::after, .md-icon-button[data-busy="true"]::after { content: ''; width: 14px; height: 14px; flex: 0 0 auto; order: -1; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: busy-spin 700ms linear infinite; }

/* Text fields and dialogs */
.md-textfield { position: relative; margin-bottom: 18px; }
.md-input { width: 100%; height: 56px; padding: 24px 16px 8px; border: none; border-bottom: 1px solid var(--md-sys-color-outline); border-radius: 4px 4px 0 0; outline: none; color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-highest); font-size: 15px; transition: border-bottom-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), background-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard); }
.md-input:focus { padding-bottom: 7px; border-bottom: 2px solid var(--md-sys-color-primary); }
.md-input:hover { background: color-mix(in srgb, var(--md-sys-color-surface-container-highest) 92%, var(--md-sys-color-on-surface)); }
.md-input-label { position: absolute; top: 18px; left: 16px; color: var(--md-sys-color-on-surface-variant); font-size: 15px; pointer-events: none; transition: top var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), font-size var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard); }
.md-input:focus ~ .md-input-label, .md-input:not(:placeholder-shown) ~ .md-input-label { top: 6px; color: var(--md-sys-color-primary); font-size: 11px; }
.md-input:is(select) ~ .md-input-label { top: 6px; color: var(--md-sys-color-on-surface-variant); font-size: 11px; }
.md-textarea { min-height: 96px; height: auto; padding-top: 26px; resize: vertical; line-height: 1.5; }
.field-hint { margin: -12px 0 16px; padding-left: 16px; color: var(--md-sys-color-on-surface-variant); font-size: 11px; }
.field-title { margin: 20px 0 4px; font-size: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.protocol-picker { margin: 0 0 18px; padding: 14px 16px 16px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 16px; }
.protocol-picker legend { padding: 0 6px; color: var(--md-sys-color-on-surface); font-size: 14px; font-weight: 600; }
.protocol-picker-hint { margin-bottom: 12px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; line-height: 1.5; }
.protocol-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.protocol-option { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 12px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 12px; cursor: pointer; transition: border-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), background-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard); }
.protocol-option:hover { background: var(--md-sys-state-hover); }
.protocol-option:has(input:checked) { border-color: var(--md-sys-color-primary); background: color-mix(in srgb, var(--md-sys-color-primary) 10%, transparent); }
.protocol-option input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--md-sys-color-primary); }
.protocol-option span { min-width: 0; }
.protocol-option b, .protocol-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.protocol-option b { font-size: 13px; font-weight: 600; }
.protocol-option small { margin-top: 3px; color: var(--md-sys-color-on-surface-variant); font-size: 10px; }
.radio-line { display: flex; align-items: center; gap: 10px; padding: 8px 4px; font-size: 14px; cursor: pointer; }
.radio-line input, .switch-line input { width: 18px; height: 18px; accent-color: var(--md-sys-color-primary); }
.radio-line .sub { color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
.switch-line { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; }
.switch-body { flex: 1; }
.switch-title { display: block; font-size: 14px; }
.switch-desc { display: block; margin-top: 2px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; line-height: 1.5; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dialog-backdrop { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .5); backdrop-filter: blur(2px); }
.dialog-backdrop.show { display: flex; animation: backdrop-enter var(--md-sys-motion-duration-medium-1) linear both; }
.dialog-backdrop.show.closing { animation: backdrop-exit var(--md-sys-motion-duration-short-4) linear both; pointer-events: none; }
.md-dialog { width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; padding: 24px; border-radius: 28px; background: var(--md-sys-color-surface-container-high); box-shadow: 0 24px 38px 3px rgba(0, 0, 0, .14); animation: dialog-enter var(--md-sys-motion-duration-medium-2) var(--md-sys-motion-easing-emphasized-decelerate) both; transform-origin: center; }
.dialog-backdrop.closing .md-dialog { animation: dialog-exit var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-emphasized-accelerate) both; }
.md-dialog.wide { max-width: 620px; }
@keyframes backdrop-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-exit { from { opacity: 1; } to { opacity: 0; } }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes dialog-exit { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(8px) scale(.97); } }
.md-dialog-title { margin-bottom: 20px; font-size: 22px; font-weight: 400; }
.dialog-close { float: right; margin-top: -52px; }
.generated-code { min-height: 160px; outline: none; resize: vertical; }
.generated-code:focus-visible { border-color: var(--md-sys-color-primary); outline: 2px solid color-mix(in srgb, var(--md-sys-color-primary) 28%, transparent); outline-offset: 0; }
code.generated-code { min-height: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Public page and authentication page */
.public-shell { width: min(100% - 32px, 960px); min-height: 100vh; display: flex; flex-direction: column; margin: 0 auto; }
.auth-shell { width: min(100% - 32px, 760px); margin: 0 auto; }
.public-header { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.public-header nav { display: flex; align-items: center; gap: 4px; }
.public-nav-actions { display: inline-flex; align-items: center; gap: 4px; }
.public-user-name { display: inline-flex; align-items: center; gap: 6px; max-width: 180px; padding-inline: 10px; color: var(--md-sys-color-on-surface-variant); font-weight: 600; }
.public-user-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.public-user-name .material-symbol { width: 20px; height: 20px; flex: 0 0 20px; }
.public-brand, .auth-brand { display: inline-flex; align-items: center; gap: 12px; }
.public-brand .rail-logo, .auth-brand .rail-logo { width: 38px; height: 38px; }
.public-brand strong, .auth-brand strong { display: block; font-size: 16px; font-weight: 500; }
.public-brand small, .auth-brand small { display: block; color: var(--md-sys-color-outline); font-size: 11px; }
.public-main { flex: 1; display: grid; align-content: center; gap: 16px; padding: 40px 0 32px; }
.public-hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .75fr); gap: 32px; margin: 0; padding: 32px; }
.public-hero-copy { align-self: center; }
.public-hero h1 { margin-bottom: 12px; font-size: 40px; font-weight: 400; line-height: 1.15; }
.public-hero p { max-width: 570px; color: var(--md-sys-color-on-surface-variant); font-size: 15px; line-height: 1.7; }
.public-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.public-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 24px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
.public-endpoints { align-self: stretch; padding: 18px; border-radius: 14px; background: var(--md-sys-color-surface-container-low); }
.public-endpoint { display: grid; gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.public-endpoint:last-child { padding-bottom: 0; border-bottom: none; }
.public-endpoint > span { color: var(--md-sys-color-on-surface-variant); font-size: 11px; }
.public-endpoint code { width: fit-content; max-width: 100%; overflow-wrap: anywhere; }
.public-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.public-feature { min-height: 172px; margin: 0; padding: 20px; background: var(--md-sys-color-surface-container-high); }
.public-feature-icon { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 20px; border-radius: 12px; color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); }
.public-feature p { margin-top: 8px; color: var(--md-sys-color-on-surface-variant); font-size: 13px; line-height: 1.6; }
.public-footer { padding: 4px 4px 24px; color: var(--md-sys-color-outline); font-size: 11px; line-height: 1.8; }
.auth-page { background: var(--md-sys-color-surface-container); }
.auth-shell { max-width: 480px; padding: 32px 0; }
.auth-header { margin-bottom: 24px; }
.auth-card { padding: 28px; }
.auth-card h1 { margin-bottom: 8px; font-size: 28px; font-weight: 400; }
.auth-card > p { margin-bottom: 24px; color: var(--md-sys-color-on-surface-variant); font-size: 13px; }
.auth-submit { width: 100%; }
.auth-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--md-sys-color-outline); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; height: 1px; flex: 1; background: var(--md-sys-color-outline-variant); }

/* Snackbar */
.snackbar { position: fixed; bottom: 24px; left: 50%; z-index: 300; display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: calc(100% - 32px); padding: 14px 18px; transform: translate(-50%, calc(100% + 32px)); opacity: 0; pointer-events: none; border-radius: 8px; color: var(--md-sys-color-surface); background: var(--md-sys-color-on-surface); font-size: 14px; box-shadow: 0 6px 10px rgba(0, 0, 0, .14); transition: transform var(--md-sys-motion-duration-medium-2) var(--md-sys-motion-easing-emphasized-decelerate), opacity var(--md-sys-motion-duration-short-4) linear; }
.snackbar.error { color: var(--md-sys-color-on-error-container); background: var(--md-sys-color-error-container); }
.snackbar.show { transform: translate(-50%, 0); opacity: 1; }
.snackbar.hide { transform: translate(-50%, 8px); opacity: 0; transition-timing-function: var(--md-sys-motion-easing-emphasized-accelerate), linear; }
.footer { padding: 4px 4px 24px; color: var(--md-sys-color-outline); font-size: 11px; line-height: 1.8; word-break: break-all; }

/* Material Design 3 component and surface refinement */
html { background: var(--md-sys-color-surface-container-low); }
body { background: var(--md-sys-color-surface-container-low); line-height: 1.45; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); }

.nav-rail { width: 236px; padding: 16px 12px; border-right: 0; background: var(--md-sys-color-surface-container-low); }
.rail-brand { min-height: 64px; padding: 4px 12px 16px; border-radius: 20px; }
.rail-logo { width: 42px; height: 42px; border-radius: 14px; box-shadow: 0 1px 2px var(--md-sys-color-shadow); }
.rail-title { font-weight: 650; letter-spacing: -.01em; }
.nav-group-title { padding: 18px 16px 8px; color: var(--md-sys-color-on-surface-variant); }
.nav-item { height: 52px; margin-bottom: 4px; border-radius: 26px; }
.nav-item.active { font-weight: 700; }
.nav-item .material-symbol { transition: transform var(--md-sys-motion-duration-medium-1) var(--md-sys-motion-easing-emphasized-decelerate); }
.nav-item.active .material-symbol { transform: scale(1.08); }
.rail-bottom { border-color: color-mix(in srgb, var(--md-sys-color-outline-variant) 70%, transparent); }

.main-content { margin: 8px 8px 8px 0; border-radius: 28px; background: var(--md-sys-color-surface); box-shadow: 0 1px 3px color-mix(in srgb, var(--md-sys-color-shadow) 42%, transparent); }
.top-app-bar { height: 72px; padding: 0 32px; border-bottom: 0; background: color-mix(in srgb, var(--md-sys-color-surface) 88%, transparent); }
.appbar-title { font-size: 20px; font-weight: 650; letter-spacing: -.015em; }
.appbar-sub { margin-top: 1px; color: var(--md-sys-color-on-surface-variant); }
.content-area { max-width: 1160px; padding: 28px 32px 40px; }

.md-card { margin-bottom: 18px; padding: 20px; border: 0; border-radius: 20px; background: var(--md-sys-color-surface-container-low); }
.md-card-title { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.card-head { margin-bottom: 16px; }
.card-hint { max-width: 760px; color: var(--md-sys-color-on-surface-variant); }
.dashboard-grid { gap: 16px; margin-bottom: 20px; }
.admin-today-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.admin-today-grid .stat-label .material-symbol { width: 18px; height: 18px; }
.admin-trend-section .card-head { align-items: flex-start; }
.trend-period-switch { display: inline-flex; flex: 0 0 auto; padding: 4px; border-radius: 18px; background: var(--md-sys-color-surface-container); }
.trend-period-switch button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 14px; color: var(--md-sys-color-on-surface-variant); background: transparent; font-size: 12px; font-weight: 650; transition: color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), background-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), box-shadow var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard); }
.trend-period-switch button.active { color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); box-shadow: 0 1px 2px color-mix(in srgb, var(--md-sys-color-shadow) 35%, transparent); }
.admin-trend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.trend-card { min-width: 0; padding: 16px; border-radius: 16px; background: var(--md-sys-color-surface-container); }
.trend-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.trend-card-head > span { display: inline-flex; align-items: center; gap: 7px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; font-weight: 650; }
.trend-card-head .material-symbol { width: 18px; height: 18px; }
.trend-card-head b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.trend-bars { height: 112px; display: flex; align-items: flex-end; gap: 3px; margin-top: 14px; padding: 8px 2px 0; border-bottom: 1px solid var(--md-sys-color-outline-variant); background: repeating-linear-gradient(to bottom, transparent 0, transparent 36px, color-mix(in srgb, var(--md-sys-color-outline-variant) 55%, transparent) 37px); }
.trend-bar-column { height: 100%; min-width: 2px; display: flex; flex: 1 1 0; align-items: flex-end; }
.trend-bar-fill { width: 100%; height: var(--bar-height); min-height: 4px; border-radius: 5px 5px 2px 2px; background: var(--md-sys-color-primary); opacity: .82; transition: height var(--md-sys-motion-duration-medium-2) var(--md-sys-motion-easing-emphasized-decelerate), opacity var(--md-sys-motion-duration-short-4) linear; }
.trend-bar-column:hover .trend-bar-fill { opacity: 1; }
.trend-card[data-trend-metric="quota"] .trend-bar-fill { background: var(--md-sys-color-tertiary); }
.trend-card[data-trend-metric="requests"] .trend-bar-fill { background: var(--md-sys-color-secondary); }
.trend-card[data-trend-metric="active_users"] .trend-bar-fill { background: var(--md-sys-color-success); }
.trend-card[data-trend-metric="error_rate"] .trend-bar-fill { background: var(--md-sys-color-error); }
.trend-range { display: flex; justify-content: space-between; margin-top: 7px; color: var(--md-sys-color-outline); font-size: 10px; font-variant-numeric: tabular-nums; }
.admin-ranking-section .card-head { align-items: flex-start; }
.admin-ranking-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ranking-card { min-width: 0; padding: 16px; border-radius: 16px; background: var(--md-sys-color-surface-container); }
.ranking-card-head { display: flex; align-items: center; gap: 11px; min-height: 42px; }
.ranking-card-head > div { min-width: 0; }
.ranking-card-head b { display: block; font-size: 14px; font-weight: 680; }
.ranking-card-head small { display: block; margin-top: 2px; color: var(--md-sys-color-on-surface-variant); font-size: 10px; line-height: 1.4; }
.ranking-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); }
.ranking-icon .material-symbol { width: 19px; height: 19px; }
.ranking-card-alert .ranking-icon { color: var(--md-sys-color-on-error-container); background: var(--md-sys-color-error-container); }
.ranking-card-warning .ranking-icon { color: var(--md-sys-color-tertiary); background: color-mix(in srgb, var(--md-sys-color-tertiary) 16%, var(--md-sys-color-surface-container-high)); }
.ranking-list { margin-top: 12px; }
.ranking-row { min-width: 0; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 58px; padding: 8px 6px; border-top: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 62%, transparent); }
.ranking-position { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; color: var(--md-sys-color-on-surface-variant); background: var(--md-sys-color-surface-container-high); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ranking-row:first-child .ranking-position { color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); }
.ranking-copy { min-width: 0; }
.ranking-copy b, .ranking-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-copy b { font-size: 13px; font-weight: 650; }
.ranking-copy small { margin-top: 3px; color: var(--md-sys-color-on-surface-variant); font-size: 10px; }
.ranking-value { min-width: 72px; text-align: right; font-variant-numeric: tabular-nums; }
.ranking-value b, .ranking-value small { display: block; }
.ranking-value b { font-size: 13px; font-weight: 720; }
.ranking-value small { margin-top: 3px; color: var(--md-sys-color-outline); font-size: 9px; }
.ranking-value-error b { color: var(--md-sys-color-error); }
.ranking-value-warning b { color: var(--md-sys-color-tertiary); }
.ranking-empty { min-height: 66px; display: grid; place-items: center; padding: 14px; border-top: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 62%, transparent); color: var(--md-sys-color-on-surface-variant); font-size: 11px; text-align: center; }
.overview-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.overview-summary-grid > .md-card { min-width: 0; }
.stat-card { min-height: 136px; padding: 20px; border-radius: 20px; background: var(--md-sys-color-surface-container); transition: transform var(--md-sys-motion-duration-medium-1) var(--md-sys-motion-easing-standard), box-shadow var(--md-sys-motion-duration-medium-1) var(--md-sys-motion-easing-standard), color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), background-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard); }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 3px 8px color-mix(in srgb, var(--md-sys-color-shadow) 48%, transparent); }
.stat-card.accent { background: var(--md-sys-color-primary-container); }
.stat-label { color: var(--md-sys-color-on-surface-variant); font-weight: 550; }
.stat-card.accent .stat-label { color: var(--md-sys-color-on-primary-container); }
.stat-card.error-rate-warning { color: var(--md-sys-color-on-warning-container); background: var(--md-sys-color-warning-container); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-sys-color-warning) 34%, transparent); }
.stat-card.error-rate-critical { color: var(--md-sys-color-on-error-container); background: var(--md-sys-color-error-container); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-sys-color-error) 34%, transparent); }
.stat-card.error-rate-warning .stat-label, .stat-card.error-rate-critical .stat-label { color: inherit; }
.error-rate-foot { display: flex; flex-direction: column; gap: 2px; opacity: .82; }
.error-rate-foot strong { font-size: 10px; font-weight: 750; }
.stat-value { margin-top: auto; padding-top: 14px; font-weight: 500; letter-spacing: -.035em; }
.subscription-hero { display: flex; align-items: center; gap: 18px; color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); }
.subscription-hero-icon { width: 52px; height: 52px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 18px; color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); }
.subscription-hero-icon .material-symbol { width: 26px; height: 26px; }
.subscription-hero-body { min-width: 0; flex: 1; }
.subscription-hero-title { margin: 2px 0 4px; font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.subscription-hero .card-hint { color: var(--md-sys-color-on-primary-container); opacity: .78; }
.subscription-hero .md-btn-text { color: var(--md-sys-color-on-primary-container); }
.subscription-model-rules { display: grid; gap: 8px; max-height: 320px; margin: 12px 0 20px; padding: 8px; overflow-y: auto; border-radius: 16px; background: var(--md-sys-color-surface-container-low); }
.subscription-model-rule { display: grid; grid-template-columns: minmax(0, 1fr) 150px; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; }
.subscription-model-rule:hover { background: var(--md-sys-state-hover); }
.subscription-model-rule > label { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.subscription-model-rule > label input { width: 20px; height: 20px; accent-color: var(--md-sys-color-primary); }
.subscription-model-rule > label span { min-width: 0; display: grid; gap: 2px; }
.subscription-model-rule > label b { font-size: 14px; font-weight: 600; }
.subscription-model-rule > label small { color: var(--md-sys-color-on-surface-variant); font-size: 11px; }
.subscription-model-rule .md-textfield { margin: 0; }
.admin-plan-group + .admin-plan-group { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.admin-plan-group-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 2px 8px 12px; }
.admin-plan-group-head b { display: block; font-size: 16px; }
.admin-plan-group-head small { display: block; margin-top: 3px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.settings-grid .md-card { margin-bottom: 0; }
.settings-card-wide { grid-column: 1 / -1; }
.settings-meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 4px 0 22px; }
.settings-meta { min-width: 0; padding: 12px 14px; border-radius: 14px; background: var(--md-sys-color-surface-container); }
.settings-meta span { display: block; margin-bottom: 4px; color: var(--md-sys-color-on-surface-variant); font-size: 11px; }
.settings-meta b { display: block; overflow: hidden; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.settings-divider { height: 1px; margin: 20px 0; background: var(--md-sys-color-outline-variant); }
.danger-zone { border: 1px solid color-mix(in srgb, var(--md-sys-color-error) 38%, transparent); background: color-mix(in srgb, var(--md-sys-color-error-container) 42%, var(--md-sys-color-surface-container-low)); }
.danger-zone .md-card-title { color: var(--md-sys-color-error); }
.danger-zone-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.danger-zone-copy { min-width: 0; }
.security-status-line { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 8px 0; }
.security-status-line p { margin: 6px 0 0; }
.security-inline-form { display: flex; align-items: flex-start; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.security-inline-form .md-textfield { flex: 1; margin: 0; }
.security-secret { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.security-secret span { color: var(--md-sys-color-on-surface-variant); font-size: .82rem; }
.security-secret code { white-space: normal; overflow-wrap: anywhere; user-select: all; }
.dialog-copy { margin: -4px 0 18px; color: var(--md-sys-color-on-surface-variant); line-height: 1.55; }
.md-btn.danger { color: var(--md-sys-color-error); }
.oauth-security { padding: 14px 16px; border-radius: 14px; color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); font-size: 13px; line-height: 1.6; }
.abandon-choice { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; padding: 14px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 16px; cursor: pointer; transition: border-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), background-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard); }
.abandon-choice:hover { background: var(--md-sys-state-hover); }
.abandon-choice:has(input:checked) { border-color: var(--md-sys-color-primary); background: color-mix(in srgb, var(--md-sys-color-primary-container) 48%, transparent); }
.abandon-choice input { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 1px; accent-color: var(--md-sys-color-primary); }
.abandon-choice span { min-width: 0; display: grid; gap: 4px; }
.abandon-choice b { font-size: 14px; font-weight: 650; }
.abandon-choice small { color: var(--md-sys-color-on-surface-variant); font-size: 12px; line-height: 1.55; }
.abandon-choice.disabled { cursor: not-allowed; opacity: .55; }
.plan-cascade-warning { margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; color: var(--md-sys-color-on-error-container); background: var(--md-sys-color-error-container); font-size: 12px; line-height: 1.6; }
.plan-catalog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; }
.subscription-section-head { margin-top: 32px; }
.more-plans-banner { grid-column: 1 / -1; min-height: 112px; display: flex; align-items: center; gap: 18px; width: 100%; padding: 22px 24px; border: 0; border-radius: 22px; color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); text-align: left; transition: transform var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), box-shadow var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard); }
.more-plans-banner:hover { transform: translateY(-2px); box-shadow: 0 3px 8px color-mix(in srgb, var(--md-sys-color-shadow) 42%, transparent); }
.more-plans-banner > .material-symbol:first-child { width: 30px; height: 30px; }
.more-plans-banner-copy { min-width: 0; flex: 1; }
.more-plans-banner-copy b { display: block; font-size: 19px; font-weight: 680; }
.more-plans-banner-copy small { display: block; margin-top: 5px; font-size: 12px; line-height: 1.55; opacity: .76; }
.benefit-entry-banner { margin-bottom: 18px; }
.token-loan-card { margin-bottom: 18px; }
.token-loan-card .token-loan-stats { margin: 14px 0; }
.token-loan-borrow, .token-loan-active { display: grid; gap: 12px; }
.token-loan-active { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.token-loan-history-title { margin-top: 18px; font-weight: 700; }
.token-loan-history-row { display: grid; grid-template-columns: minmax(110px, 1fr) auto auto; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--outline-variant); align-items: center; }
.token-loan-history-row small { color: var(--on-surface-variant); }
.benefit-section-head { margin-top: 18px; }
@media (max-width: 720px) { .token-loan-active { grid-template-columns: 1fr; } .token-loan-history-row { grid-template-columns: 1fr auto; } .token-loan-history-row small { grid-column: 1 / -1; } }
.benefit-card { margin-bottom: 12px; }
.md-dialog.more-plans-dialog { max-width: 1120px; }
.more-plans-dialog > .card-head { align-items: flex-start; }
.more-plans-dialog .md-dialog-title { margin-bottom: 2px; }
.more-plans-grid { margin-top: 20px; }
.plan-card { min-height: 340px; display: flex; flex-direction: column; margin: 0; padding: 22px; }
.plan-card.locked { opacity: .76; }
.plan-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.plan-card-name { font-size: 21px; font-weight: 680; letter-spacing: -.02em; }
.plan-card-code { margin-top: 4px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
.plan-card-description { min-height: 42px; margin-top: 14px; color: var(--md-sys-color-on-surface-variant); font-size: 13px; line-height: 1.6; white-space: pre-line; }
.plan-card-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 20px 0; }
.plan-card-metric { padding: 12px; border-radius: 14px; background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-surface-variant); font-size: 11px; }
.plan-card-metric b { display: block; margin-top: 3px; color: var(--md-sys-color-on-surface); font-size: 15px; font-weight: 650; }
.plan-card-models { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; margin-bottom: 20px; }
.plan-card-upgrade { margin: -6px 0 14px; padding: 10px 12px; border-radius: 12px; color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); font-size: 12px; line-height: 1.5; }
.plan-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }

.list-item { min-height: 64px; margin: 2px 0; padding: 14px 12px; border-bottom-color: color-mix(in srgb, var(--md-sys-color-outline-variant) 65%, transparent); border-radius: 12px; transition: background-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard); }
.list-item:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 5%, transparent); }
.list-item-title { font-weight: 600; }
.list-item-sub { line-height: 1.55; }
.channel-row { align-items: flex-start; margin-bottom: 10px; padding: 16px; border: 0; border-radius: 18px; background: var(--md-sys-color-surface-container); }
.channel-row:hover { background: var(--md-sys-color-surface-container-high); }
.channel-name { font-weight: 650; }
.channel-radio { margin-top: 3px; }
.channel-health-grid { display: grid; grid-template-columns: repeat(5, minmax(82px, 1fr)) minmax(180px, 1.7fr); gap: 8px; margin-top: 14px; }
.channel-health-metric { min-width: 0; padding: 10px 11px; border-radius: 12px; background: var(--md-sys-color-surface-container-high); font-variant-numeric: tabular-nums; }
.channel-health-metric > span { display: block; color: var(--md-sys-color-on-surface-variant); font-size: 10px; font-weight: 650; }
.channel-health-metric > b { display: block; margin-top: 3px; overflow: hidden; color: var(--md-sys-color-on-surface); font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.channel-health-metric > small { display: block; margin-top: 2px; overflow: hidden; color: var(--md-sys-color-outline); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.channel-health-metric.health-good > b { color: var(--md-sys-color-success); }
.channel-health-metric.health-warn > b { color: var(--md-sys-color-tertiary); }
.channel-health-metric.health-bad > b { color: var(--md-sys-color-error); }
.channel-last-error > b { font-size: 12px; }
.tag { min-height: 24px; padding: 3px 10px; border-radius: 8px; font-size: 11px; font-weight: 600; }
.tag.success { background: color-mix(in srgb, var(--md-sys-color-success) 12%, transparent); }
.tag.error { background: color-mix(in srgb, var(--md-sys-color-error) 12%, transparent); }
.filter-card { padding: 18px 20px; background: var(--md-sys-color-surface-container); }
.code-filter { grid-template-columns: minmax(220px, 2fr) minmax(140px, .8fr) minmax(140px, .8fr) auto; }
.pagination-bar { margin-top: 12px; padding-top: 16px; border-color: color-mix(in srgb, var(--md-sys-color-outline-variant) 70%, transparent); }

.md-btn { padding-inline: 24px; font-weight: 650; letter-spacing: .01em; }
.md-btn-filled { box-shadow: 0 1px 2px color-mix(in srgb, var(--md-sys-color-shadow) 55%, transparent); }
.md-btn-danger { color: var(--md-sys-color-on-error); background: var(--md-sys-color-error); box-shadow: 0 1px 2px color-mix(in srgb, var(--md-sys-color-shadow) 55%, transparent); }
.md-btn-outlined { border-color: var(--md-sys-color-outline-variant); }
.md-icon-button { width: 40px; height: 40px; border-radius: 20px; }
.list-actions, .channel-actions { align-items: center; gap: 4px; }

.md-input { border-radius: 12px 12px 0 0; background: var(--md-sys-color-surface-container-high); }
.md-input:hover { background: var(--md-sys-color-surface-container-highest); }
.switch-line { min-height: 60px; padding: 12px 4px; }
.switch-line input { appearance: none; width: 52px; height: 32px; position: relative; flex: 0 0 auto; border: 2px solid var(--md-sys-color-outline); border-radius: 16px; outline: none; background: var(--md-sys-color-surface-container-highest); transition: border-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard), background-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard); }
.switch-line input::before { content: ''; width: 16px; height: 16px; position: absolute; top: 6px; left: 6px; border-radius: 50%; background: var(--md-sys-color-outline); transition: width var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-emphasized-decelerate), height var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-emphasized-decelerate), transform var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-emphasized-decelerate), background-color var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-standard); }
.switch-line input:checked { border-color: var(--md-sys-color-primary); background: var(--md-sys-color-primary); }
.switch-line input:checked::before { width: 24px; height: 24px; top: 2px; left: 2px; transform: translateX(20px); background: var(--md-sys-color-on-primary); }
.switch-line input:focus-visible { outline: 3px solid color-mix(in srgb, var(--md-sys-color-primary) 30%, transparent); outline-offset: 2px; }
.switch-title { font-weight: 600; }

.dialog-backdrop { background: color-mix(in srgb, #000 55%, transparent); backdrop-filter: blur(3px); }
.md-dialog { border: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 55%, transparent); background: var(--md-sys-color-surface-container-high); box-shadow: 0 12px 36px var(--md-sys-color-shadow); }
.md-dialog-title { font-weight: 500; letter-spacing: -.02em; }
.confirm-dialog { max-width: 430px; }
.confirm-dialog-message { margin: -6px 0 22px; color: var(--md-sys-color-on-surface-variant); font-size: 14px; line-height: 1.65; }

.public-header { padding-inline: 4px; }
.public-hero { border-radius: 28px; color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); }
.public-hero p { color: color-mix(in srgb, var(--md-sys-color-on-primary-container) 78%, transparent); }
.public-endpoints { background: color-mix(in srgb, var(--md-sys-color-surface) 64%, transparent); }
.public-feature { border-radius: 22px; background: var(--md-sys-color-surface-container); }
.auth-card { border-radius: 28px; background: var(--md-sys-color-surface-container-low); box-shadow: 0 2px 10px color-mix(in srgb, var(--md-sys-color-shadow) 42%, transparent); }

@keyframes view-enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes title-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes item-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes surface-enter { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes busy-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: no-preference) {
  .list-item, .channel-row, [data-model-binding-row] { animation: item-enter var(--md-sys-motion-duration-medium-1) var(--md-sys-motion-easing-emphasized-decelerate) both; }
  .list-item:nth-child(2), .channel-row:nth-child(2) { animation-delay: 30ms; }
  .list-item:nth-child(3), .channel-row:nth-child(3) { animation-delay: 60ms; }
  .list-item:nth-child(4), .channel-row:nth-child(4) { animation-delay: 90ms; }
  .public-header, .auth-header { animation: surface-enter var(--md-sys-motion-duration-medium-2) var(--md-sys-motion-easing-emphasized-decelerate) both; }
  .public-hero, .auth-card { animation: surface-enter var(--md-sys-motion-duration-long-1) var(--md-sys-motion-easing-emphasized-decelerate) 60ms both; }
  .public-feature { animation: surface-enter var(--md-sys-motion-duration-long-1) var(--md-sys-motion-easing-emphasized-decelerate) 120ms both; }
  .public-feature:nth-child(2) { animation-delay: 160ms; }
  .public-feature:nth-child(3) { animation-delay: 200ms; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border-radius: 4px; background: var(--md-sys-color-outline-variant); }
::-webkit-scrollbar-thumb:hover { background: var(--md-sys-color-outline); }

@media (max-width: 820px) {
  body { flex-direction: column; }
  .nav-rail { display: none; }
  .md-icon-button.mobile-menu-trigger { display: inline-flex; flex-shrink: 0; }
  .mobile-nav-menu {
    display: block;
    position: fixed;
    top: 76px;
    left: 12px;
    z-index: 55;
    width: min(320px, calc(100vw - 24px));
    max-height: calc(100dvh - 88px);
    padding: 8px;
    overflow-y: auto;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 20px;
    background: var(--md-sys-color-surface-container-high);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--md-sys-color-shadow) 24%, transparent);
    opacity: 0;
    transform: translateY(-8px) scale(.98);
    transform-origin: top left;
    pointer-events: none;
    transition: opacity var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-emphasized-decelerate), transform var(--md-sys-motion-duration-short-4) var(--md-sys-motion-easing-emphasized-decelerate);
  }
  .mobile-nav-menu[hidden] { display: none; }
  .mobile-nav-menu.open { opacity: 1; transform: none; pointer-events: auto; }
  .mobile-nav-menu-title { padding: 10px 14px 8px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
  .mobile-nav-option {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
    border: 0;
    border-radius: 16px;
    color: var(--md-sys-color-on-surface);
    background: transparent;
    font-size: 14px;
    font-weight: 550;
    text-align: left;
  }
  .mobile-nav-option:hover { background: var(--md-sys-state-hover); }
  .mobile-nav-option.active { color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); }
  .content-area { padding: 16px; }
  .list-metrics { gap: 12px; }
  .public-hero { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
	.usage-filter-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-app-bar { padding-inline: 16px; }
  .dashboard-grid, .form-grid { grid-template-columns: 1fr; }
  .protocol-options { grid-template-columns: 1fr; }
  .list-item, .channel-row { flex-wrap: wrap; }
  .list-metrics { width: 100%; justify-content: space-between; }
  .model-price-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .list-actions, .channel-actions { margin-left: auto; }
  .channel-actions { width: 100%; flex-wrap: wrap; justify-content: flex-end; }
  .list-filter { grid-template-columns: 1fr; }
  .pagination-bar { flex-wrap: wrap; }
  .pagination-summary { width: 100%; }
  .public-header { height: 64px; }
  .public-header .md-btn { padding-inline: 14px; }
  .public-main { padding-top: 32px; }
  .public-hero, .auth-card { padding: 22px; }
  .public-hero h1 { font-size: 32px; }
  .public-feature-grid { grid-template-columns: 1fr; }
  .public-feature { min-height: 0; }
  .auth-links { flex-direction: column; }
}

@media (max-width: 400px) {
  .public-brand > span:last-child { display: none; }
}

@media (max-width: 820px) {
  .main-content { margin: 0; border-radius: 0; box-shadow: none; }
  .top-app-bar { height: 68px; padding-inline: 20px; }
  .content-area { padding: 20px; }
  .code-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.admin-today-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.admin-ranking-grid { grid-template-columns: 1fr; }
	.overview-summary-grid { grid-template-columns: 1fr; gap: 0; }
	.channel-health-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .channel-last-error { grid-column: span 2; }
	.trace-event-head { align-items: flex-start; flex-direction: column; gap: 2px; }
}

@media (max-width: 560px) {
  .rail-brand { min-height: 0; }
  .content-area { padding: 16px 12px 28px; }
  .md-card { padding: 16px; border-radius: 18px; }
  .card-head { align-items: flex-start; }
  .stat-card { min-height: 112px; }
  .list-item, .channel-row { padding: 13px 10px; }
  .code-filter { grid-template-columns: 1fr; }
  .list-filter-actions { justify-content: stretch; }
  .list-filter-actions .md-btn { flex: 1; }
  .pagination-bar .md-btn { flex: 1; }
  .public-hero { border-radius: 24px; }
  .subscription-hero { align-items: flex-start; flex-wrap: wrap; }
  .subscription-hero .md-btn { margin-left: auto; }
  .subscription-model-rule { grid-template-columns: 1fr; }
  .more-plans-dialog { padding: 18px; }
  .more-plans-dialog .plan-catalog-grid { grid-template-columns: minmax(0, 1fr); }
  .more-plans-banner { min-height: 96px; padding: 18px; }
  .settings-grid, .settings-meta-grid { grid-template-columns: 1fr; }
  .settings-card-wide { grid-column: auto; }
  .danger-zone-row { align-items: flex-start; flex-direction: column; }
  .security-status-line, .security-inline-form { align-items: stretch; flex-direction: column; }
  .security-secret { grid-template-columns: 1fr; gap: 6px; }
	.admin-today-grid { grid-template-columns: 1fr; }
	.admin-trend-section .card-head { flex-wrap: wrap; }
	.trend-period-switch { width: 100%; }
	.trend-period-switch button { flex: 1; }
	.admin-trend-grid { grid-template-columns: 1fr; }
	.admin-ranking-section .card-head { flex-wrap: wrap; }
	.channel-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.channel-last-error { grid-column: span 2; }
}

.list-item-button {
  width: 100%;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
}
.list-item-button:hover { background: var(--md-sys-color-surface-container-low, #f7f2fa); }
.admin-log-row.has-trace { cursor: context-menu; touch-action: pan-y; }
.admin-log-row.has-trace:hover { background: var(--md-sys-color-surface-container-low, #f7f2fa); }
.trace-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 20px; }
.trace-timeline { position: relative; display: grid; gap: 0; }
.trace-event { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 12px; padding: 0 0 22px; }
.trace-event::before { content: ""; position: absolute; left: 5px; top: 13px; bottom: -1px; width: 2px; background: var(--md-sys-color-outline-variant, #cac4d0); }
.trace-event:last-child::before { display: none; }
.trace-dot { position: relative; z-index: 1; width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; background: var(--md-sys-color-primary, #005ac1); box-shadow: 0 0 0 4px var(--md-sys-color-primary-container, #d8e2ff); }
.trace-event-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.trace-event-head span, .trace-event p { color: var(--md-sys-color-on-surface-variant, #49454f); }
.trace-event p { margin: 5px 0 8px; }
.trace-event code { overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.payment-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(280px,.72fr); gap:16px; margin-bottom:16px; }
.payment-quote { display:grid; grid-template-columns:auto 1fr; gap:4px 12px; align-items:baseline; margin:4px 0 20px; padding:18px; border-radius:18px; background:var(--surface-container, #f4eff7); }
.payment-quote span { color:var(--on-surface-variant, #49454f); }
.payment-quote b { justify-self:end; font-size:1.35rem; }
.payment-quote small { grid-column:1 / -1; color:var(--on-surface-variant, #49454f); }
@media (max-width:760px) { .payment-layout { grid-template-columns:1fr; } }

:root[data-reduced-motion="true"] { scroll-behavior: auto; }
:root[data-reduced-motion="true"] *, :root[data-reduced-motion="true"] *::before, :root[data-reduced-motion="true"] *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }

.prepaid-card { max-width: 580px; }
.prepaid-card [data-prepaid-balance-login] { margin-top: 10px; }
.prepaid-card [data-prepaid-balance-login] + .field-hint { margin: 8px 4px 0; padding: 0; line-height: 1.55; }
.prepaid-success-icon { display: block; width: 56px; height: 56px; margin-bottom: 16px; color: #18794e; font-size: 56px; }
.prepaid-key-box { display: grid; gap: 10px; margin: 22px 0; padding: 16px; border-radius: 16px; background: var(--md-sys-color-surface-container, #f3edf7); }
.prepaid-key-box code { overflow-wrap: anywhere; user-select: all; font-size: 14px; }
.prepaid-key-box .md-btn { justify-self: start; }
.prepaid-meta { margin: 18px 0; }
.prepaid-disclaimer { display: flex; align-items: flex-start; gap: 12px; margin: 16px 0; padding: 13px 14px; border: 1px solid color-mix(in srgb, var(--md-sys-color-warning) 42%, transparent); border-radius: 14px; color: var(--md-sys-color-on-warning-container); background: var(--md-sys-color-warning-container); font-size: 13px; line-height: 1.55; }
.prepaid-disclaimer .material-symbol { margin-top: 1px; color: var(--md-sys-color-warning); }
.prepaid-disclaimer div { display: grid; gap: 2px; }
.prepaid-disclaimer b { font-size: 14px; }
.prepaid-balance-buckets { display: grid; gap: 10px; margin: 18px 0; }
.prepaid-balance-row { display: flex; justify-content: space-between; gap: 20px; padding: 14px 16px; border-radius: 14px; background: var(--md-sys-color-surface-container, #f3edf7); }
.prepaid-balance-row > div { display: grid; gap: 3px; }
.prepaid-balance-row > div:last-child { text-align: right; }
.prepaid-balance-row span, .prepaid-key-box small { color: var(--md-sys-color-on-surface-variant); font-size: 12px; }

.disabled-channels-shell { width: min(100% - 32px, 1120px); max-width: 1120px; padding: 32px 0; }
.disabled-channels-shell .auth-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.disabled-channels-card { padding: 28px; }
.disabled-channels-card .card-head { margin-bottom: 18px; }
.disabled-channel-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 18px; }
.disabled-channel-list { display: grid; gap: 10px; }
.disabled-channel-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 18px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 18px; background: var(--md-sys-color-surface-container-low); }
.disabled-channel-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: var(--md-sys-color-error); background: var(--md-sys-color-error-container); }
.disabled-channel-icon.manual { color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); }
.disabled-channel-main { min-width: 0; }
.disabled-channel-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.disabled-channel-title b { font-size: 16px; }
.disabled-channel-url { margin-top: 3px; overflow: hidden; color: var(--md-sys-color-on-surface-variant); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.disabled-channel-reason { margin-top: 11px; font-size: 13px; line-height: 1.55; }
.disabled-channel-meta { display: flex; flex-wrap: wrap; gap: 7px 16px; margin-top: 8px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
.disabled-channel-side { display: grid; justify-items: end; gap: 10px; }
.disabled-channel-time { color: var(--md-sys-color-on-surface-variant); font-size: 12px; white-space: nowrap; }
.channel-key-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.channel-key-filters { display: grid; grid-template-columns: minmax(220px, 1.4fr) minmax(170px, 1fr) minmax(170px, 1fr); gap: 12px; margin-bottom: 18px; }
.channel-key-filters .md-textfield { margin-bottom: 0; }
.channel-key-list { display: grid; gap: 10px; }
.channel-key-management-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 18px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 18px; background: var(--md-sys-color-surface-container-low); }
.channel-key-management-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; }
.channel-key-management-icon.usable { color: var(--md-sys-color-success); background: color-mix(in srgb, var(--md-sys-color-success) 16%, transparent); }
.channel-key-management-icon.unusable { color: var(--md-sys-color-error); background: var(--md-sys-color-error-container); }
.channel-key-management-main { min-width: 0; }
.channel-key-management-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.channel-key-management-title b { font-size: 16px; }
.channel-key-management-channel { margin-top: 4px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
.channel-key-management-secret { display: block; width: fit-content; max-width: 100%; margin-top: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-key-management-side { display: grid; min-width: 140px; justify-items: end; gap: 12px; }
.channel-key-management-side > div:first-child { display: grid; justify-items: end; gap: 2px; }
.channel-key-management-side > div:first-child b { font-size: 17px; }
.channel-key-management-side > div:first-child span { color: var(--md-sys-color-on-surface-variant); font-size: 11px; }
.channel-key-management-side .quota-exhausted { color: var(--md-sys-color-error); }
.channel-key-management-actions { display: flex; align-items: center; gap: 4px; }
@media (max-width: 720px) {
  .disabled-channels-shell .auth-header { align-items: flex-start; }
  .disabled-channels-card { padding: 20px; }
  .disabled-channel-row { grid-template-columns: 40px minmax(0, 1fr); padding: 15px; }
  .disabled-channel-icon { width: 40px; height: 40px; }
  .disabled-channel-side { grid-column: 1 / -1; width: 100%; justify-items: stretch; }
  .disabled-channel-time { text-align: right; }
  .disabled-channel-summary { grid-template-columns: 1fr; }
  .channel-key-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .channel-key-filters { grid-template-columns: 1fr; }
  .channel-key-management-row { grid-template-columns: 40px minmax(0, 1fr); padding: 15px; }
  .channel-key-management-icon { width: 40px; height: 40px; }
  .channel-key-management-side { grid-column: 1 / -1; width: 100%; grid-template-columns: 1fr auto; align-items: end; justify-items: stretch; }
  .channel-key-management-side > div:first-child { justify-items: start; }
  .channel-key-management-actions { justify-content: flex-end; }
}

.emergency-stop-card { border: 2px solid color-mix(in srgb, var(--md-sys-color-outline, #79747e) 35%, transparent); transition: border-color .2s, background .2s, box-shadow .2s; }
.emergency-stop-card.active { border-color: #ba1a1a; background: color-mix(in srgb, #ffdad6 34%, var(--md-sys-color-surface, #fffbfe)); box-shadow: 0 8px 28px rgba(186,26,26,.12); }
.emergency-stop-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.emergency-stop-icon { display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 52px; border-radius: 18px; color: #ba1a1a; background: #ffdad6; }
.emergency-stop-icon .material-symbol { font-size: 30px; }
.emergency-master-switch { display: grid; grid-template-columns: 92px minmax(0,1fr); align-items: center; gap: 18px; padding: 20px; border-radius: 20px; background: var(--md-sys-color-surface-container, #f3edf7); cursor: pointer; }
.emergency-master-switch input { position: absolute; opacity: 0; pointer-events: none; }
.emergency-switch-track { position: relative; width: 88px; height: 46px; border-radius: 24px; background: #79747e; transition: background .2s; }
.emergency-switch-thumb { position: absolute; top: 5px; left: 5px; width: 36px; height: 36px; border-radius: 50%; background: white; box-shadow: 0 2px 6px rgba(0,0,0,.28); transition: transform .2s; }
.emergency-master-switch input:checked + .emergency-switch-track { background: #ba1a1a; }
.emergency-master-switch input:checked + .emergency-switch-track .emergency-switch-thumb { transform: translateX(42px); }
.emergency-master-switch input:focus-visible + .emergency-switch-track { outline: 3px solid var(--md-sys-color-primary, #005ac1); outline-offset: 3px; }
.emergency-switch-copy { display: grid; gap: 4px; }
.emergency-switch-copy b { font-size: 20px; }
.emergency-switch-copy small { color: var(--md-sys-color-on-surface-variant, #49454f); }
.emergency-stop-controls { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0,1fr) auto; align-items: center; gap: 16px; margin-top: 18px; }
.emergency-stop-controls .field-hint { margin: 0; }
.emergency-stop-status { margin-top: 16px; }
.emergency-stop-card.active .emergency-stop-status .dot { background: #ba1a1a; }
@media (max-width: 820px) { .emergency-stop-controls { grid-template-columns: 1fr; } .emergency-stop-controls .md-btn { justify-self: stretch; } }
@media (max-width: 560px) { .emergency-master-switch { grid-template-columns: 1fr; } }
