:root {
  color-scheme: light;
  --ink: #162522;
  --muted: #60706c;
  --line: #dce4e1;
  --line-strong: #c7d2ce;
  --canvas: #f4f7f5;
  --surface: #ffffff;
  --surface-soft: #edf3f0;
  --brand: #17665d;
  --brand-dark: #104942;
  --brand-soft: #d8ebe6;
  --coral: #bd4f3c;
  --coral-soft: #fae5df;
  --gold: #9a6a08;
  --gold-soft: #fff0c8;
  --blue: #356b8f;
  --blue-soft: #e1eef6;
  --danger: #a23434;
  --danger-soft: #fbe5e4;
  --shadow: 0 14px 40px rgba(30, 51, 46, 0.12);
  --sidebar-width: 250px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; overflow-x: hidden; background: var(--canvas); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  letter-spacing: 0;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.tone-0 { --metric-color: #17665d; --metric-soft: #d8ebe6; --bar-color: #17665d; --plan-color: #17665d; --usage-color: #17665d; --usage-soft: #d8ebe6; }
.tone-1 { --metric-color: #356b8f; --metric-soft: #e1eef6; --bar-color: #356b8f; --plan-color: #356b8f; --usage-color: #356b8f; --usage-soft: #e1eef6; }
.tone-2 { --metric-color: #bd4f3c; --metric-soft: #fae5df; --bar-color: #bd4f3c; --plan-color: #bd4f3c; --usage-color: #bd4f3c; --usage-soft: #fae5df; }
.tone-3 { --metric-color: #9a6a08; --metric-soft: #fff0c8; --bar-color: #9a6a08; --plan-color: #9a6a08; --usage-color: #9a6a08; --usage-soft: #fff0c8; }
.tone-4 { --metric-color: #745486; --metric-soft: #eee4f3; --bar-color: #745486; --plan-color: #745486; --usage-color: #745486; --usage-soft: #eee4f3; }
.width-0 { width: 0; }
.width-5 { width: 5%; }
.width-10 { width: 10%; }
.width-15 { width: 15%; }
.width-20 { width: 20%; }
.width-25 { width: 25%; }
.width-30 { width: 30%; }
.width-35 { width: 35%; }
.width-40 { width: 40%; }
.width-45 { width: 45%; }
.width-50 { width: 50%; }
.width-55 { width: 55%; }
.width-60 { width: 60%; }
.width-65 { width: 65%; }
.width-70 { width: 70%; }
.width-75 { width: 75%; }
.width-80 { width: 80%; }
.width-85 { width: 85%; }
.width-90 { width: 90%; }
.width-95 { width: 95%; }
.width-100 { width: 100%; }

:focus-visible {
  outline: 3px solid #69a9cf;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: 0; }
h1 { margin-bottom: 0; font-size: 24px; line-height: 1.2; }
h2 { margin-bottom: 0; font-size: 18px; line-height: 1.3; }
h3 { margin-bottom: 0; font-size: 15px; line-height: 1.35; }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand img { flex: 0 0 auto; border-radius: 8px; }
.brand > span { display: grid; line-height: 1.15; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.brand-light { color: white; font-size: 16px; font-weight: 750; }

.auth-layout {
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(480px, 1.1fr);
  min-height: 100vh;
  background: var(--surface);
}

.auth-brand {
  display: flex;
  min-height: 100vh;
  padding: 42px clamp(38px, 6vw, 88px);
  flex-direction: column;
  justify-content: space-between;
  color: white;
  background: #143d3a;
}

.auth-brand .eyebrow { color: #90d0c5; }
.auth-brand h1 { max-width: 580px; margin-bottom: 20px; font-size: clamp(38px, 4.7vw, 66px); line-height: 1.03; }
.auth-summary { max-width: 520px; margin: 0; color: #d3e3df; font-size: 18px; line-height: 1.6; }
.security-note { display: flex; align-items: center; gap: 9px; margin: 0; color: #c8dbd6; font-size: 13px; }
.security-note svg { width: 18px; }

.auth-panel {
  display: grid;
  min-height: 100vh;
  padding: 32px;
  place-items: center;
  background: #fbfcfb;
}

.login-form { width: min(100%, 410px); }
.login-form h2 { margin-bottom: 10px; font-size: 34px; }
.form-intro { margin-bottom: 30px; color: var(--muted); line-height: 1.55; }
.login-form label { display: block; margin: 17px 0 8px; font-size: 13px; font-weight: 750; }
.mobile-brand { display: none; align-items: center; gap: 11px; margin-bottom: 42px; }

.input-shell, .search-shell, .filter-search {
  display: flex;
  min-width: 0;
  align-items: center;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.input-shell { min-height: 48px; border-radius: 6px; }
.input-shell:focus-within, .search-shell:focus-within, .filter-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23, 102, 93, .12); }
.input-shell > svg, .search-shell > svg, .filter-search > svg { width: 18px; margin-left: 14px; color: var(--muted); flex: 0 0 auto; }
.input-shell input, .search-shell input, .filter-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.input-shell input { min-height: 46px; padding: 0 12px; }
.input-action { margin-right: 5px; }
.form-error { min-height: 20px; margin: 10px 0 2px; color: var(--danger); font-size: 12px; line-height: 1.45; }

.primary-button, .secondary-button, .danger-button, .text-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
}

.primary-button { border: 1px solid var(--brand); color: white; background: var(--brand); }
.primary-button:hover { background: var(--brand-dark); }
.secondary-button { border: 1px solid var(--line-strong); padding: 0 13px; background: var(--surface); }
.secondary-button:hover { border-color: #9fb0ab; background: var(--surface-soft); }
.danger-button { border: 1px solid #ddaaa7; padding: 0 13px; color: var(--danger); background: white; }
.danger-button:hover { background: var(--danger-soft); }
.text-button { min-height: 32px; border: 0; padding: 0; color: var(--brand); background: transparent; }
.text-button:hover { color: var(--brand-dark); text-decoration: underline; }
.primary-button svg, .secondary-button svg, .danger-button svg, .text-button svg { width: 16px; height: 16px; }
.full-button { width: 100%; min-height: 48px; margin-top: 4px; padding: 0 18px; }
.quiet-link { display: block; margin-top: 22px; color: var(--brand); text-align: center; font-weight: 700; }
button:disabled { opacity: .55; cursor: not-allowed; }

.auth-divider {
  display: grid;
  margin: 20px 0;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after { height: 1px; background: var(--line); content: ""; }
.google-sign-in { width: 100%; min-height: 44px; }
.google-button-host { display: flex; min-height: 44px; justify-content: center; }
.google-sign-in[data-state="busy"] { opacity: .65; pointer-events: none; }
.google-status { margin: 8px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.google-status:empty { display: none; }
.google-sign-in[data-state="error"] .google-status { color: var(--danger); }

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  place-items: center;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover { border-color: var(--line); background: var(--surface-soft); }
.icon-button svg { width: 18px; height: 18px; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--sidebar-width);
  padding: 22px 16px 16px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.sidebar > .brand { margin: 0 8px 28px; }
.primary-nav { display: grid; gap: 5px; }
.nav-item {
  display: grid;
  width: 100%;
  min-height: 43px;
  padding: 0 11px;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 0;
  border-radius: 6px;
  color: #485a55;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-weight: 700;
}

.nav-item svg { width: 18px; }
.nav-item b { min-width: 22px; padding: 3px 6px; border-radius: 999px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; text-align: center; }
.nav-item b:empty { display: none; }
.nav-item:hover { color: var(--ink); background: var(--surface-soft); }
.nav-item.is-active { color: var(--brand-dark); background: var(--brand-soft); }
.sidebar-footer { display: flex; margin-top: auto; padding-top: 16px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.admin-identity { display: flex; min-width: 0; align-items: center; gap: 9px; }
.admin-identity > span:last-child { display: grid; min-width: 0; }
.admin-identity strong, .admin-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-identity strong { font-size: 12px; }
.admin-identity small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; place-items: center; color: white; background: var(--brand); font-size: 11px; font-weight: 800; }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 78px;
  padding: 14px clamp(20px, 3vw, 38px);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
}

.breadcrumb { margin: 0 0 5px; color: var(--muted); font-size: 11px; font-weight: 650; }
.breadcrumb span { color: var(--brand); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.search-shell { width: min(31vw, 340px); min-height: 40px; border-radius: 6px; background: #f8faf9; }
.search-shell input { min-height: 38px; padding: 0 10px; }
.search-shell kbd { margin-right: 8px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: white; font-size: 10px; }
.mobile-menu { display: none; }

.content { width: 100%; max-width: 1640px; margin: 0 auto; padding: 28px clamp(20px, 3vw, 38px) 48px; }
.view { display: none; }
.view.is-active { display: block; }
.metric-grid { display: grid; margin-bottom: 20px; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 12px; }
.metric {
  position: relative;
  min-height: 126px;
  padding: 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.metric::before { position: absolute; inset: 0 auto 0 0; width: 3px; content: ""; background: var(--metric-color, var(--brand)); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 750; }
.metric-icon { display: grid; width: 32px; height: 32px; border-radius: 6px; place-items: center; color: var(--metric-color, var(--brand)); background: var(--metric-soft, var(--brand-soft)); }
.metric-icon svg { width: 16px; }
.metric-value { display: block; margin-top: 15px; font-size: 27px; line-height: 1; }
.metric-caption { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }

.dashboard-grid { display: grid; margin-bottom: 20px; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 20px; }
.panel { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.panel-heading, .section-summary {
  display: flex;
  min-height: 72px;
  padding: 17px 20px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.section-summary { min-height: auto; margin-bottom: 18px; padding: 0 0 16px; }
.section-summary > div > p:last-child { margin: 7px 0 0; color: var(--muted); }
.distribution-list { display: grid; padding: 20px; gap: 18px; }
.distribution-row { display: grid; grid-template-columns: 110px minmax(100px, 1fr) 44px; align-items: center; gap: 13px; }
.distribution-name { font-weight: 750; }
.distribution-track, .usage-track { display: block; height: 8px; overflow: hidden; border-radius: 999px; background: #e8eeeb; }
.distribution-fill, .usage-fill { display: block; height: 100%; border-radius: inherit; background: var(--bar-color, var(--brand)); }
.distribution-count { color: var(--muted); text-align: right; font-size: 12px; font-weight: 750; }
.compact-list { display: grid; padding: 6px 20px 16px; }
.compact-item { display: grid; min-height: 66px; padding: 11px 0; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); }
.compact-item:last-child { border-bottom: 0; }
.compact-item strong, .compact-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-item small { margin-top: 4px; color: var(--muted); }
.empty-inline { margin: 28px 0; color: var(--muted); text-align: center; }

.table-panel { overflow: hidden; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 17px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); background: #fafcfb; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfc; }
.customer-cell { display: grid; max-width: 260px; }
.customer-cell strong, .customer-cell small { overflow: hidden; text-overflow: ellipsis; }
.customer-cell small { margin-top: 3px; color: var(--muted); }
.table-open { width: 34px; height: 34px; }
.table-open svg { width: 16px; }
.table-apps { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.table-apps svg { width: 15px; }
.usage-cell { display: flex; align-items: center; gap: 9px; }
.usage-cell span { min-width: 38px; font-size: 12px; font-weight: 750; }
.usage-cell .usage-track { width: 66px; height: 6px; }

.badge {
  display: inline-flex;
  min-height: 24px;
  padding: 3px 8px;
  align-items: center;
  border-radius: 999px;
  color: #3d504b;
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
.badge.active, .badge.approved { color: #145348; background: var(--brand-soft); }
.badge.suspended, .badge.rejected { color: var(--danger); background: var(--danger-soft); }
.badge.pending { color: #755100; background: var(--gold-soft); }
.badge.cancelled, .badge.revoked { color: #596a66; background: #e8edeb; }

.toolbar { display: flex; margin-bottom: 16px; align-items: end; gap: 12px; }
.filter-search { width: min(460px, 100%); min-height: 42px; border-radius: 6px; }
.filter-search input { min-height: 40px; padding: 0 12px; }
.select-label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0; }
.select-label select, .form-field input, .form-field select, .form-field textarea {
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  color: var(--ink);
  background: var(--surface);
  text-transform: none;
  letter-spacing: 0;
}
.select-label select:focus, .form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23, 102, 93, .12); }
.result-count { color: var(--muted); font-size: 12px; }
.empty-state { padding: 64px 20px; color: var(--muted); text-align: center; }
.empty-state svg { width: 28px; height: 28px; margin-bottom: 12px; }
.empty-state h3 { margin-bottom: 5px; color: var(--ink); }
.status-callout { display: inline-flex; max-width: 430px; padding: 9px 12px; align-items: center; gap: 8px; border: 1px solid #e3c773; border-radius: 6px; color: #694a00; background: var(--gold-soft); font-size: 12px; font-weight: 700; }
.status-callout svg { width: 17px; flex: 0 0 auto; }

.plan-editor-grid { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; }
.plan-editor { display: flex; min-height: 510px; padding: 20px; flex-direction: column; border: 1px solid var(--line); border-top: 4px solid var(--plan-color, var(--brand)); border-radius: 7px; background: var(--surface); }
.plan-editor-head { display: flex; margin-bottom: 18px; align-items: flex-start; justify-content: space-between; gap: 10px; }
.plan-price { margin: 13px 0 4px; font-size: 28px; font-weight: 800; }
.plan-price small { color: var(--muted); font-size: 11px; font-weight: 600; }
.plan-editor-description { min-height: 50px; margin-bottom: 16px; color: var(--muted); line-height: 1.5; }
.plan-form { display: grid; height: 100%; gap: 13px; }
.form-field { display: grid; gap: 6px; }
.form-field > span { color: var(--muted); font-size: 11px; font-weight: 750; }
.form-field textarea { min-height: 70px; padding-top: 9px; resize: vertical; }
.plan-form .primary-button { min-height: 40px; margin-top: auto; }
.switch-row { display: flex; min-height: 40px; align-items: center; justify-content: space-between; gap: 12px; }
.switch-row > span { font-size: 12px; font-weight: 750; }
.switch { position: relative; width: 42px; height: 24px; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #bdc8c4; cursor: pointer; }
.switch span::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; content: ""; transition: transform .18s ease; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }

.detail-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 70;
  width: min(560px, 94vw);
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.drawer-scrim, .mobile-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(16, 31, 27, .38); }
.drawer-header { position: sticky; top: 0; z-index: 2; display: flex; min-height: 78px; padding: 16px 20px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.drawer-content { padding: 20px 20px 50px; }
.detail-hero { display: flex; padding-bottom: 20px; align-items: center; gap: 13px; border-bottom: 1px solid var(--line); }
.detail-avatar { display: grid; width: 48px; height: 48px; flex: 0 0 auto; border-radius: 8px; place-items: center; color: white; background: var(--brand); font-size: 17px; font-weight: 800; }
.detail-hero > div { min-width: 0; }
.detail-hero h3, .detail-hero p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-hero p { margin: 4px 0 0; color: var(--muted); }
.detail-section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; }
.detail-section-head { display: flex; margin-bottom: 14px; align-items: center; justify-content: space-between; gap: 12px; }
.detail-section-head h3 { font-size: 13px; }
.detail-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.detail-metric { padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #fafcfb; }
.detail-metric strong, .detail-metric span { display: block; }
.detail-metric strong { font-size: 19px; }
.detail-metric span { margin-top: 5px; color: var(--muted); font-size: 10px; }
.detail-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-form .primary-button { min-height: 40px; align-self: end; }
.record-list { display: grid; gap: 8px; }
.record { display: grid; min-height: 58px; padding: 10px 12px; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 6px; }
.record-icon { display: grid; width: 32px; height: 32px; border-radius: 6px; place-items: center; color: var(--brand); background: var(--brand-soft); }
.record-icon svg { width: 16px; }
.record-main { display: grid; min-width: 0; }
.record-main strong, .record-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-main small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.record-state { color: var(--muted); font-size: 10px; }
.drawer-actions { display: flex; justify-content: flex-end; }
.loading-block { min-height: 300px; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 24px; height: 24px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; width: min(380px, calc(100vw - 36px)); gap: 8px; }
.toast { display: grid; min-height: 54px; padding: 11px 13px; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 10px; border: 1px solid var(--line-strong); border-left: 4px solid var(--brand); border-radius: 7px; background: white; box-shadow: var(--shadow); }
.toast.error { border-left-color: var(--danger); }
.toast svg { width: 18px; color: var(--brand); }
.toast.error svg { color: var(--danger); }
.toast strong, .toast span { display: block; }
.toast span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.is-spinning svg { animation: spin .8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1240px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .plan-editor-grid { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
}

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-panel { padding: 24px; }
  .mobile-brand { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .workspace { margin-left: 0; }
  .mobile-menu { display: inline-grid; }
  .topbar { justify-content: flex-start; }
  .topbar-actions { margin-left: auto; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .plan-editor-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .mobile-scrim { z-index: 30; }
}

@media (max-width: 650px) {
  .topbar { min-height: 68px; padding: 10px 14px; gap: 10px; }
  .topbar h1 { font-size: 18px; }
  .breadcrumb { display: none; }
  .search-shell { display: none; }
  .content { padding: 18px 14px 38px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric { min-height: 112px; padding: 14px; }
  .metric-value { font-size: 23px; }
  .dashboard-grid { gap: 14px; }
  .panel-heading { padding: 15px; }
  .panel-heading .secondary-button { width: 38px; padding: 0; font-size: 0; }
  .panel-heading .secondary-button svg { width: 17px; }
  .toolbar { align-items: stretch; flex-wrap: wrap; }
  .filter-search { flex: 1 0 100%; }
  .select-label { flex: 1 1 140px; }
  .section-summary { align-items: stretch; flex-direction: column; }
  .plan-editor-grid { grid-template-columns: 1fr; }
  .plan-editor { min-height: 0; }
  .detail-form { grid-template-columns: 1fr; }
  .detail-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-metric { padding: 9px; }
  .detail-metric strong { font-size: 16px; }
  th, td { padding: 12px 14px; }
}

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

/* Orchestrator control-plane surfaces. */
.metric-grid { grid-template-columns: repeat(4, minmax(170px, 1fr)); }
.metric-card {
  display: grid;
  min-height: 118px;
  padding: 18px;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: start;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.metric-card p, .metric-card small { color: var(--muted); }
.metric-card p { margin: 0 0 10px; font-size: 11px; font-weight: 750; }
.metric-card strong { display: block; margin-bottom: 7px; font-size: 28px; line-height: 1; }
.metric-card small { font-size: 10px; }
.metric-card:nth-child(2) .metric-icon { color: var(--blue); background: var(--blue-soft); }
.metric-card:nth-child(3) .metric-icon { color: var(--coral); background: var(--coral-soft); }
.metric-card:nth-child(4) .metric-icon { color: var(--gold); background: var(--gold-soft); }

.distribution-item { display: grid; gap: 8px; }
.distribution-item > div:first-child { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 9px; }
.distribution-item b { color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.status-dot.running { background: var(--brand); }
.status-dot.stopped { background: var(--blue); }
.status-dot.error { background: var(--danger); }
.progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-soft); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.distribution-item:nth-child(2) .progress-track span { background: var(--blue); }
.distribution-item:nth-child(3) .progress-track span { background: var(--danger); }

.compact-item { grid-template-columns: 34px minmax(0, 1fr) auto; }
.compact-icon { display: grid; width: 32px; height: 32px; border-radius: 6px; place-items: center; color: var(--brand); background: var(--brand-soft); }
.compact-icon svg { width: 16px; }
.compact-item > b { font-size: 18px; }

.customer-cell {
  width: 100%;
  padding: 0;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.customer-cell > span:last-child { display: grid; min-width: 0; }
.avatar.small { width: 32px; height: 32px; }
.avatar.large { width: 52px; height: 52px; font-size: 16px; }
.cell-note { display: block; margin-top: 4px; color: var(--muted); text-transform: capitalize; }
.table-action { width: 32px; height: 32px; }
.badge.running { color: #145348; background: var(--brand-soft); }
.badge.starting, .badge.stopping { color: #755100; background: var(--gold-soft); }
.badge.stopped { color: #315d79; background: var(--blue-soft); }
.badge.error, .badge.closed { color: var(--danger); background: var(--danger-soft); }
.badge.auto { color: #315d79; background: var(--blue-soft); }

.plan-card {
  display: grid;
  padding: 20px;
  gap: 14px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  border-radius: 7px;
  background: var(--surface);
}
.plan-card:nth-child(2) { border-top-color: var(--blue); }
.plan-card:nth-child(3) { border-top-color: var(--coral); }
.plan-card:nth-child(4) { border-top-color: var(--gold); }
.plan-heading { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 11px; }
.plan-mark { display: grid; width: 36px; height: 36px; border-radius: 6px; place-items: center; color: var(--brand); background: var(--brand-soft); }
.plan-mark svg { width: 18px; }
.plan-card > label, .plan-fields label, .bandwidth-plan-setting > label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 750; }
.plan-card input, .plan-card textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  color: var(--ink);
  background: var(--surface);
  resize: vertical;
}
.plan-card input:focus, .plan-card textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23, 102, 93, .12); }
.plan-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan-fields.three { grid-template-columns: repeat(3, 1fr); }
.bandwidth-plan-setting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, .7fr); align-items: end; gap: 10px; }
.bandwidth-plan-setting .switch-row { min-height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; }
.bandwidth-plan-setting .switch-row > span { color: var(--muted); font-size: 11px; }
.plan-heading .switch { display: grid; width: auto; height: auto; grid-template-columns: 42px auto; align-items: center; gap: 7px; }
.plan-heading .switch input + span { position: relative; display: block; width: 42px; height: 24px; }
.plan-heading .switch b { color: var(--muted); font-size: 10px; }
.inline-setting { display: grid; grid-template-columns: minmax(0, 1fr) 38px; align-items: end; gap: 8px; margin-top: 13px; }
.icon-action { display: grid; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 6px; place-items: center; color: var(--brand); background: var(--surface); cursor: pointer; }
.icon-action:hover { border-color: var(--brand); background: var(--brand-soft); }
.icon-action svg { width: 17px; height: 17px; }

.detail-drawer { transform: translateX(100%); transition: transform .18s ease; }
.detail-drawer.is-open { transform: translateX(0); }
.drawer-content.is-busy { opacity: .62; pointer-events: none; }
.drawer-section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.drawer-section:first-child { padding-top: 0; }
.drawer-section:last-child { border-bottom: 0; }
.drawer-section > h3, .drawer-section-title { margin-bottom: 14px; }
.drawer-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-hero { display: flex; align-items: center; gap: 13px; }
.account-hero h3 { font-size: 19px; }
.account-hero p { margin: 4px 0 8px; color: var(--muted); }
.detail-list { display: grid; margin: 16px 0 0; gap: 10px; }
.detail-list > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; }
.detail-list dt { color: var(--muted); font-size: 11px; }
.detail-list dd { min-width: 0; margin: 0; text-align: right; overflow-wrap: anywhere; }
.detail-list code { font-size: 10px; }
.segmented-control { display: grid; margin-top: 16px; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.segmented-control button { display: flex; min-height: 42px; padding: 7px 8px; align-items: center; justify-content: center; gap: 6px; border: 0; border-right: 1px solid var(--line); background: white; cursor: pointer; font-size: 11px; font-weight: 750; }
.segmented-control button:last-child { border-right: 0; }
.segmented-control button.is-selected { color: var(--brand-dark); background: var(--brand-soft); }
.segmented-control button:disabled, .action-row button:disabled { opacity: .42; cursor: not-allowed; }
.segmented-control svg { width: 15px; }
.select-label.full { width: 100%; }
.select-label.full select { width: 100%; }
.capacity-grid { display: grid; margin-top: 14px; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.capacity-grid div { padding: 11px; border: 1px solid var(--line); border-radius: 6px; background: #fafcfb; }
.capacity-grid span, .capacity-grid strong { display: block; }
.capacity-grid span { margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.capacity-grid strong { font-size: 15px; }
.transfer-cell { display: grid; min-width: 112px; gap: 6px; }
.transfer-cell > span:first-child { font-size: 11px; font-weight: 750; }
.usage-fill.is-exceeded, .bandwidth-summary.is-exceeded .usage-fill { background: var(--danger); }
.bandwidth-summary { display: grid; margin-top: 10px; padding: 12px; gap: 9px; border: 1px solid var(--line); border-radius: 6px; background: #fafcfb; }
.bandwidth-summary > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bandwidth-summary > div span { color: var(--muted); font-size: 10px; }
.bandwidth-summary > div strong { font-size: 13px; }
.bandwidth-summary small { color: var(--muted); line-height: 1.45; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-error { margin: 12px 0 0; padding: 9px 11px; border-radius: 6px; color: var(--danger); background: var(--danger-soft); font-size: 11px; }
.audit-detail { display: block; max-width: 340px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; }
.is-loading svg { animation: spin .8s linear infinite; }

@media (max-width: 1240px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .plan-editor-grid { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
}

@media (max-width: 650px) {
  .metric-grid, .plan-editor-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 104px; }
  .plan-fields, .plan-fields.three, .bandwidth-plan-setting { grid-template-columns: 1fr; }
  .segmented-control button span { display: none; }
}
