:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-soft: #f7f9f8;
  --surface-muted: #edf1ef;
  --ink: #202725;
  --muted: #68736f;
  --line: #d9e0dd;
  --line-strong: #c5cfcb;
  --green: #456c61;
  --green-strong: #315248;
  --green-soft: #e7f0ec;
  --blue: #52758e;
  --blue-soft: #eaf0f4;
  --amber: #a97a31;
  --amber-soft: #f6efe1;
  --red: #a4514e;
  --red-soft: #f6eae9;
  --violet: #6f6786;
  --sidebar: #202927;
  --sidebar-text: #dfe7e4;
  --sidebar-muted: #93a39d;
  --shadow: 0 8px 22px rgba(34, 49, 44, 0.06);
  --radius: 8px;
  --sidebar-width: 220px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "SF Pro Text", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

body.auth-locked > .sidebar,
body.auth-locked > .app-shell { visibility: hidden; }
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg);
}
.auth-gate[hidden] { display: none; }
.auth-panel {
  width: min(100%, 390px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.auth-brand h1, .auth-brand p { margin: 0; }
.auth-brand h1 { font-size: 20px; }
.auth-brand p { margin-top: 2px; color: var(--muted); font-size: 11px; }
.auth-panel form { display: grid; gap: 14px; margin-top: 18px; }
.auth-panel label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.auth-panel input, .auth-panel select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--surface); }
.auth-panel .primary-button { width: 100%; }
.auth-status { min-height: 20px; margin: 0; color: var(--red); font-size: 11px; }

button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
svg { display: block; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  padding: 18px 14px;
  color: var(--sidebar-text);
  background: var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 0 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #24372f;
  background: #d8b468;
  font-family: Georgia, "Songti SC", serif;
  font-size: 18px;
  font-weight: 700;
}

.brand strong, .brand small, .sidebar-foot strong, .sidebar-foot small { display: block; }
.brand strong { font-size: 15px; }
.brand small, .sidebar-foot small { margin-top: 2px; color: var(--sidebar-muted); font-size: 11px; }

.main-nav {
  display: grid;
  gap: 4px;
  margin-top: 18px;
}

.main-nav button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 0;
  border-radius: 7px;
  color: var(--sidebar-muted);
  background: transparent;
  text-align: left;
}

.main-nav button:hover { color: var(--sidebar-text); background: rgba(255, 255, 255, 0.055); }
.main-nav button.active { color: #ffffff; background: rgba(255, 255, 255, 0.1); }
.main-nav button.active::before {
  position: absolute;
  left: -14px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  background: #d8b468;
  content: "";
}
.main-nav svg { width: 18px; height: 18px; stroke-width: 1.8; }

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 14px 8px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}
.environment-dot { width: 8px; height: 8px; border-radius: 50%; background: #d8b468; }
.sidebar-foot strong { font-size: 12px; }

.app-shell { min-height: 100vh; margin-left: var(--sidebar-width); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(150px, auto) minmax(260px, 560px) auto;
  align-items: center;
  gap: 24px;
  height: 68px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 249, 248, 0.96);
}

.page-identity span, .page-identity strong { display: block; }
.page-identity span { color: var(--muted); font-size: 11px; }
.page-identity strong { margin-top: 2px; font-size: 16px; }

.global-search, .field-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.global-search { min-height: 38px; padding: 0 10px; }
.global-search svg, .field-search svg { width: 16px; height: 16px; color: var(--muted); }
.global-search input, .field-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}
.global-search kbd {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
}

.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
}
.icon-button:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-button.small { width: 32px; height: 32px; }
.icon-button svg { width: 17px; height: 17px; }
.mobile-menu { display: none; }

.identity-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 8px 4px 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}
.identity-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  color: var(--green-strong);
  background: var(--green-soft);
  font-weight: 700;
}
.identity-button strong, .identity-button small { display: block; white-space: nowrap; }
.identity-button strong { font-size: 12px; }
.identity-button small { color: var(--muted); font-size: 10px; }

.content { width: min(100%, 1480px); margin: 0 auto; padding: 28px; }
.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  min-height: 82px;
  margin-bottom: 22px;
}
.view-header p, .view-header h1, .view-header span { margin: 0; }
.view-header p { color: var(--green); font-size: 11px; font-weight: 750; }
.view-header h1 { margin-top: 5px; font-size: 25px; line-height: 1.2; font-weight: 690; }
.view-header div > span { display: block; margin-top: 7px; color: var(--muted); line-height: 1.5; }

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
}
.segmented button {
  min-width: 70px;
  min-height: 32px;
  padding: 5px 10px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}
.segmented button.active { color: var(--green-strong); background: var(--surface); box-shadow: 0 2px 5px rgba(35, 50, 45, 0.06); }

.primary-button, .secondary-button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 7px;
  font-weight: 680;
}
.primary-button { border: 1px solid var(--green-strong); color: #ffffff; background: var(--green-strong); }
.secondary-button { border: 1px solid var(--line-strong); color: var(--green-strong); background: var(--surface); }
.text-button { min-height: auto; padding: 4px; border: 0; color: var(--green); background: transparent; }
.primary-button svg, .secondary-button svg { width: 16px; height: 16px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.kpi-grid.compact { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi {
  min-width: 0;
  min-height: 112px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.kpi-label { color: var(--muted); font-size: 12px; }
.kpi-value { display: flex; align-items: baseline; gap: 5px; margin-top: 17px; }
.kpi-value strong { overflow-wrap: anywhere; font-size: 23px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-value span { color: var(--muted); font-size: 12px; }
.kpi-delta { display: block; margin-top: 10px; color: var(--muted); font-size: 11px; }
.kpi.warning { border-color: #decba8; }
.kpi.warning .kpi-value strong { color: var(--amber); }

.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.panel-heading h2, .panel-heading p { margin: 0; }
.panel-heading h2 { font-size: 15px; }
.panel-heading p { margin-top: 4px; color: var(--muted); font-size: 11px; }

.chart { min-height: 250px; }
.interactive-chart { position: relative; min-width: 0; }
.interactive-chart svg { width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 10px; }
.chart-line { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-line.secondary { stroke: var(--red); }
.chart-line.cost { stroke: var(--amber); }
.chart-area { fill: rgba(69, 108, 97, 0.1); }
.chart-dot { fill: var(--surface); stroke: var(--green); stroke-width: 2; cursor: crosshair; transition: r 0.1s ease, stroke-width 0.1s ease; }
.chart-dot.secondary { stroke: var(--red); }
.chart-dot.cost { stroke: var(--amber); }
.chart-dot.active, .chart-dot:hover, .chart-dot:focus { r: 6; stroke-width: 3; outline: none; }
.chart-cursor { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 4 4; pointer-events: none; }
.chart-series-0.is-hidden, .chart-series-1.is-hidden, .chart-series-2.is-hidden { opacity: 0; pointer-events: none; }
.chart-tooltip {
  position: absolute;
  top: 8px;
  z-index: 3;
  min-width: 128px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(32, 45, 41, 0.12);
  pointer-events: none;
  transform: translateX(-50%);
}
.chart-tooltip strong, .chart-tooltip span { display: block; }
.chart-tooltip strong { margin-bottom: 5px; font-size: 11px; }
.chart-tooltip span { color: var(--muted); font-size: 10px; line-height: 1.55; }
.chart-tooltip b { float: right; margin-left: 14px; color: var(--ink); font-weight: 680; }
.chart-controls { display: flex; justify-content: flex-end; gap: 8px; margin-top: -4px; }
.chart-controls button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}
.chart-controls button:hover { border-color: var(--line); background: var(--surface-soft); }
.chart-controls button[aria-pressed="false"] { opacity: 0.42; text-decoration: line-through; }
.chart-controls i { width: 16px; height: 3px; border-radius: 2px; background: var(--green); }
.chart-controls i.secondary { background: var(--red); }
.chart-controls i.cost { background: var(--amber); }

.alert-list { display: grid; gap: 1px; }
.alert-item {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.alert-item:last-child { border-bottom: 0; }
.alert-signal { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--blue); }
.alert-item.warning .alert-signal { background: var(--amber); }
.alert-item strong, .alert-item span, .alert-item small { display: block; }
.alert-item strong { font-size: 12px; }
.alert-item span { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.alert-item small { margin-top: 7px; color: var(--blue); font-size: 10px; }

.table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; }
th { color: var(--muted); background: var(--surface-soft); font-size: 11px; font-weight: 650; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: #f8faf9; }
tbody tr[data-clickable] { cursor: pointer; }
td strong, td small { display: block; }
td small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.number { text-align: right; font-variant-numeric: tabular-nums; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 10px;
  font-weight: 700;
}
.status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status.healthy, .status.active, .status.verified, .status.settled, .status.observed { color: var(--green); background: var(--green-soft); }
.status.degraded, .status.warn, .status.warning, .status.reviewing, .status.quota { color: var(--amber); background: var(--amber-soft); }
.status.error, .status.suspended, .status.privacy { color: var(--red); background: var(--red-soft); }
.status.planned, .status.invited, .status.draft { color: var(--blue); background: var(--blue-soft); }
.status.deletion_pending { color: var(--violet); background: #eeebf3; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}
.field-search { width: min(100%, 340px); min-height: 38px; padding: 0 10px; }
.field-search.wide { width: min(100%, 460px); }
select {
  min-height: 38px;
  padding: 7px 32px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
}
.result-count { margin-left: auto; color: var(--muted); font-size: 11px; }

.service-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.summary-item { padding: 13px 15px; border-left: 3px solid var(--line-strong); background: var(--surface); }
.summary-item strong, .summary-item span { display: block; }
.summary-item strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.summary-item span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.summary-item.warning { border-left-color: var(--amber); }

.capacity-list, .bar-list, .funnel-list, .governance-list, .policy-list { display: grid; gap: 13px; }
.capacity-row, .bar-row { display: grid; grid-template-columns: 110px minmax(140px, 1fr) 110px; gap: 12px; align-items: center; }
.capacity-row > span, .bar-row > span { color: var(--muted); font-size: 12px; }
.capacity-row > strong, .bar-row > strong { text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; }
.mini-chart { min-height: 54px; }
.mini-chart svg { display: block; width: 100%; height: 54px; }
.mini-baseline { stroke: var(--line); stroke-width: 1; }
.mini-line { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.mini-dot { fill: var(--surface); stroke: var(--green); stroke-width: 2; cursor: crosshair; transition: r 0.1s ease, stroke-width 0.1s ease; }
.mini-dot.active, .mini-dot:hover, .mini-dot:focus { r: 5; stroke-width: 3; outline: none; }
.bar-row:nth-child(2n) .mini-line, .bar-row:nth-child(2n) .mini-dot { stroke: var(--blue); }
.bar-row:nth-child(3n) .mini-line, .bar-row:nth-child(3n) .mini-dot { stroke: var(--amber); }
.mini-chart .chart-tooltip { top: 48px; }

.governance-item { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.governance-item:last-child { border-bottom: 0; }
.governance-item svg { flex: 0 0 17px; width: 17px; height: 17px; color: var(--amber); }
.governance-item strong, .governance-item span { display: block; }
.governance-item strong { font-size: 12px; }
.governance-item span { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }

.funnel-list .compact-chart { min-height: 250px; }

.policy-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 110px 110px;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.policy-item:last-child { border-bottom: 0; }
.policy-item strong { font-size: 13px; }
.policy-item span:not(.status) { color: var(--muted); font-size: 11px; }

.owner-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid #dbc58f;
  border-radius: var(--radius);
  background: var(--surface);
}
.owner-banner svg { flex: 0 0 20px; width: 20px; height: 20px; color: var(--amber); }
.owner-banner strong, .owner-banner span { display: block; }
.owner-banner strong { font-size: 13px; }
.owner-banner span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.access-layout { display: grid; grid-template-columns: minmax(320px, 0.85fr) minmax(380px, 1.15fr); gap: 14px; }
.principal-list { display: grid; gap: 6px; }
.principal-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.principal-item:hover { background: var(--surface-soft); }
.principal-item.active { border-color: var(--green); background: var(--surface-soft); }
.principal-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; color: var(--green-strong); background: var(--green-soft); font-weight: 750; }
.principal-item strong, .principal-item small { display: block; }
.principal-item strong { font-size: 12px; }
.principal-item small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.principal-role { color: var(--muted); font-size: 11px; }
.access-editor form { display: grid; gap: 14px; }
.access-editor label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.access-editor select { width: 100%; }
.access-editor .primary-button { width: 100%; }
.owner-badge { padding: 4px 8px; border-radius: 999px; color: var(--amber); background: var(--amber-soft); font-size: 10px; font-weight: 750; }
.permission-preview { min-height: 180px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.permission-group + .permission-group { margin-top: 12px; }
.permission-group > strong { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.permission-chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.permission-chip { padding: 4px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: var(--surface); font-size: 10px; }
.permission-matrix th, .permission-matrix td { text-align: center; }
.permission-matrix th:first-child, .permission-matrix td:first-child { position: sticky; left: 0; z-index: 1; min-width: 180px; text-align: left; background: var(--surface); }
.permission-matrix thead th:first-child { z-index: 2; background: var(--surface-soft); }
.permission-mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--green-strong); background: var(--green-soft); font-size: 12px; font-weight: 750; }
.permission-empty { color: var(--line-strong); }

.detail-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 50;
  width: min(430px, 100vw);
  padding: 22px;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -14px 0 38px rgba(35, 48, 44, 0.12);
  overflow-y: auto;
}
.detail-drawer[hidden], .drawer-scrim[hidden], .sidebar-scrim[hidden] { display: none; }
.detail-drawer header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.detail-drawer h2, .detail-drawer header span { margin: 0; }
.detail-drawer h2 { margin-top: 4px; font-size: 20px; }
.detail-drawer header span { color: var(--green); font-size: 11px; font-weight: 700; }
.drawer-scrim, .sidebar-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(28, 35, 33, 0.28); }
.detail-section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; }
.detail-section h3 { margin: 0 0 11px; font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.detail-grid div { min-width: 0; }
.detail-grid span, .detail-grid strong { display: block; }
.detail-grid span { color: var(--muted); font-size: 10px; }
.detail-grid strong { margin-top: 4px; overflow-wrap: anywhere; font-size: 13px; }
.action-preview {
  width: 100%;
  margin-top: 14px;
  padding: 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-soft);
  text-align: left;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  max-width: min(380px, calc(100vw - 32px));
  padding: 12px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(32, 45, 41, 0.16);
}

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar { grid-template-columns: auto minmax(220px, 1fr) auto; gap: 14px; }
  .identity-button span:last-child { display: none; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.18s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { z-index: 25; }
  .app-shell { margin-left: 0; }
  .mobile-menu { display: inline-grid; }
  .topbar { grid-template-columns: auto minmax(110px, auto) minmax(0, 1fr) auto; padding: 0 16px; }
  .content { padding: 22px 16px; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .span-3 { grid-column: 1 / -1; }
  .service-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .access-layout { grid-template-columns: 1fr; }
  .access-layout .span-2 { grid-column: auto; }
}

@media (max-width: 680px) {
  .topbar { height: auto; min-height: 62px; grid-template-columns: auto minmax(0, 1fr) auto; padding: 9px 12px; }
  .global-search { grid-column: 1 / -1; grid-row: 2; }
  .global-search kbd { display: none; }
  .identity-button { padding-right: 5px; }
  .view-header { align-items: stretch; flex-direction: column; min-height: 0; }
  .view-header h1 { font-size: 22px; }
  .segmented { width: 100%; }
  .segmented button { min-width: 0; flex: 1; }
  .kpi-grid, .kpi-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { min-height: 104px; padding: 13px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .panel { padding: 14px; }
  .panel-heading { align-items: flex-start; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .field-search, .field-search.wide { width: 100%; }
  .toolbar select { width: 100%; }
  .result-count { margin-left: 0; }
  .capacity-row, .bar-row { grid-template-columns: 82px minmax(120px, 1fr) 78px; gap: 8px; }
  .service-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .policy-item { grid-template-columns: minmax(0, 1fr) 80px; }
  .policy-item > span:nth-child(3), .policy-item > span:nth-child(4) { display: none; }
  .chart { min-height: 210px; }
}

@media (max-width: 420px) {
  .page-identity span { display: none; }
  .kpi-grid, .kpi-grid.compact { grid-template-columns: 1fr 1fr; }
  .kpi-value strong { font-size: 20px; }
  .content { padding-inline: 12px; }
}
