:root {
  color-scheme: light;
  --bg: #eef2f6;
  --panel: #ffffff;
  --panel-hover: #f1f5f9;
  --border: #94a3b8;
  --border-soft: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #1e293b;
  --muted: #475569;
  --accent: #003F87;
  --accent-dim: rgba(0, 63, 135, 0.09);
  --error: #d32f2f;
  --warn: #c75500;
  --good: #006B3F;
  /* Darker steps of the status colors for text. The base tokens stay for fills,
     borders and chart marks; as text on a tinted pill they fall under 4.5:1. */
  --warning-text: #9a4200;
  --error-text: #b42318;
  --warning: #c75500;
  --serious: #c75500;
  --critical: #d32f2f;
  --surface: #ffffff;
  --grid: #cbd5e1;

  /* Categorical palette, fixed order. Every step is at least 3:1 against the
     white panel surface (WCAG 1.4.11 for chart marks). The JS never hardcodes
     colors — charts.js reads these through var(--series-N). */
  --series-1: #3987e5;
  /* google */
  --series-2: #d95926;
  /* here */
  --series-3: #199e70;
  /* mapbox */
  --series-4: #c98500;
  /* transitland */
  --series-5: #d55181;
  /* open-meteo */
  --series-6: #008300;
  /* frankfurter */
  --series-7: #9085e9;
  /* airlabs */
  --series-8: #e66767;
  /* fallback / unknown */

  --radius: 6px;
  --shadow-card: none;
  --max-width: 1180px;

  font-family: "Overpass", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

h1 {
  font-size: 1.2rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.2rem 0 1.75rem;
}

h2 {
  font-size: 0.95rem;
  margin: 0 0 1rem;
  color: var(--text);
  font-weight: 600;
}

/* -- Shell / layout ---------------------------------------------------- */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.app-body {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 100vh;
}

.shell {
  flex: 1;
  min-width: 0;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.25rem 2.75rem 4rem;
}

.section {
  /* Clears the sticky chrome above when an outline link jumps straight to a
     section, so the heading doesn't land underneath the topbar and the
     range bar. */
  margin: 2.5rem 0;
  scroll-margin-top: calc(var(--topbar-h, 0px) + 5rem);
}

.section:first-of-type {
  margin-top: 0;
}

/* Section-jump sidebar — positioned firmly on the left as a dedicated full-height nav panel */
.outline {
  display: none;
}

@media (min-width: 960px) {
  .outline {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: sticky;
    top: 0;
    width: 250px;
    flex-shrink: 0;
    height: 100vh;
    background: var(--panel);
    border-right: 1px solid var(--border-soft);
    padding: 1.5rem 1.1rem;
    box-sizing: border-box;
    overflow: hidden;
    opacity: 1;
    transition: width 0.2s ease, padding 0.2s ease, border-color 0.2s ease, opacity 0.15s ease;
  }

  .app-body.sidebar-collapsed .outline {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    border-right-color: transparent;
    opacity: 0;
  }
}

/* Between 960 and 1100 the sidebar is present but narrower, so the reading
   column keeps its width on a small laptop. */
@media (min-width: 960px) and (max-width: 1099.98px) {
  .outline {
    width: 200px;
    padding: 1.25rem 0.85rem;
  }

  .sidebar-collapsed-rail {
    width: 48px;
  }

  .shell {
    padding: 2rem 1.75rem 4rem;
  }
}

/* Desktop-only collapse toggle. It lives inside the sidebar's own brand
   row so it reads as part of the sidebar chrome rather than a control
   floating in empty space. When the sidebar is collapsed that row goes
   with it, so a second copy of the button lives in the slim collapsed
   rail (below) to reopen it. Not shown on mobile, which already has its
   own hamburger toggle for the dropdown nav. */
.sidebar-toggle-btn {
  display: none;
}

.sidebar-collapsed-rail {
  display: none;
}

@media (min-width: 960px) {
  .sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 7px;
    border: 1px solid var(--border-soft);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
  }

  .sidebar-toggle-btn:hover {
    color: var(--text);
    border-color: var(--accent);
    background: var(--panel-hover);
  }

  /* Slim rail that takes the sidebar's place once it's collapsed — keeps
     the logo and reopen control anchored to a real panel instead of
     leaving a lone icon floating over the page. Always in the layout
     (width/opacity animated, not display-toggled) so it crossfades with
     the sidebar instead of popping in the instant the sidebar hits 0. */
  .sidebar-collapsed-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    width: 0;
    flex-shrink: 0;
    height: 100vh;
    overflow: hidden;
    background: var(--panel);
    border-right: 1px solid transparent;
    padding: 1.5rem 0;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: width 0.2s ease, border-color 0.2s ease, opacity 0.15s ease;
  }

  .app-body.sidebar-collapsed .sidebar-collapsed-rail {
    width: 56px;
    border-right-color: var(--border-soft);
    opacity: 1;
    pointer-events: auto;
  }

  .collapsed-rail-top,
  .collapsed-rail-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
  }

  /* Icon-only stand-ins for the sidebar footer's "Open app" / "Log out"
     buttons, sized to match the toggle button above them. */
  .icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 7px;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }

  .icon-btn-app {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
  }

  .icon-btn-app:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--panel-hover);
  }

  .icon-btn-lock {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
  }

  .icon-btn-lock:hover {
    border-color: var(--error);
    color: var(--error-text);
    background: rgba(211, 47, 47, 0.08);
  }
}

.outline-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding-bottom: 1.1rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border-soft);
}

.outline-brand-left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  overflow: hidden;
}

.outline-brand-titles {
  overflow: hidden;
  white-space: nowrap;
}

.outline-brand-titles h1 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
}

.outline-brand-titles .subtitle {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0.15rem 0 0;
}

.outline-content {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 0.2rem;
}

.outline-footer {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
  margin-top: 1rem;
}

.outline-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.85rem;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav-group {
  margin-bottom: 0.45rem;
}

.sidebar-nav-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: 1px solid transparent;
  padding: 0.5rem 0.65rem;
  border-radius: 7px;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-nav-tab:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.sidebar-nav-tab.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(0, 63, 135, 0.25);
  font-weight: 700;
}

.sidebar-sub-links {
  margin: 0.25rem 0 0.45rem 0.6rem;
  padding-left: 0.6rem;
  border-left: 2px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-sub-links .section-link {
  display: block;
  padding: 0.35rem 0.55rem;
  border-radius: 5px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.15s, color 0.15s;
}

.sidebar-sub-links .section-link:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.sidebar-sub-links .section-link.active {
  background: rgba(0, 63, 135, 0.09);
  color: var(--accent);
  font-weight: 600;
}

.nav-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 0.6rem 0;
}

/* Distinct action buttons for Open App and Logout */
.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}

.nav-btn:active {
  transform: translateY(1px);
}

.nav-btn-app {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.nav-btn-app:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--panel-hover);
}

.nav-btn-lock {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.nav-btn-lock:hover {
  border-color: var(--error);
  color: var(--error-text);
  background: rgba(211, 47, 47, 0.08);
}

.mobile-outline-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-soft);
  margin-top: 0.5rem;
}

/* Mobile equivalent of the sidebar: a hamburger toggle in the sticky
   topbar that drops the same section links down as a dismissible panel */
#mobile-outline-toggle {
  display: none;
  padding: 0.5rem;
  line-height: 0;
}

.mobile-outline {
  display: none;
}

@media (max-width: 959.98px) {
  #mobile-outline-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-outline.open {
    display: flex;
  }

  .mobile-outline {
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--panel);
    border-bottom: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card);
    padding: 0.75rem 1rem 1rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
  }

  .mobile-outline .section-link {
    display: block;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
  }

  .mobile-outline .section-link:active,
  .mobile-outline .section-link.active {
    background: var(--accent-dim);
    color: var(--accent);
  }
}

/* Table Toolbar Search and Copy Chips */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.table-search-box {
  position: relative;
  flex: 1;
  max-width: 320px;
  min-width: 200px;
}

.table-search-box svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* [type="text"] bumps specificity above the generic input[type="text"]
   rule below (same 0-1-1 otherwise, and that one previously won because
   it comes later in the file — collapsing this padding-left back down
   and putting the search icon on top of the placeholder text). */
.table-search-box input[type="text"] {
  padding-left: 2.2rem;
  width: 100%;
  height: 2.2rem;
  font-size: 0.82rem;
  box-sizing: border-box;
}

.sidebar-search-box {
  max-width: none;
  min-width: 0;
  margin-bottom: 1rem;
}

.sidebar-search-empty {
  margin: 0.5rem 0 0;
  padding: 0 0.15rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}

.copy-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  font-family: monospace;
  font-size: 0.78rem;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.copy-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* .mobile-outline's position:absolute anchors to .topbar below (already
   position: sticky, which establishes a containing block for absolutely
   positioned descendants the same way relative/fixed would) — so the
   dropdown lines up with the topbar's actual rendered height
   automatically, no hardcoded offset or JS measurement needed. */

.topbar {
  display: none;
}

@media (max-width: 959.98px) {
  :root {
    --topbar-h: 61px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-soft);
  }
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
}

.topbar-titles h1 {
  font-size: 1rem;
  line-height: 1.2;
}

.topbar-titles .subtitle {
  margin: 0.1rem 0 0;
  font-size: 0.74rem;
}

.section {
  margin: 2.75rem 0;
}

.section:first-of-type {
  margin-top: 2.25rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-soft);
  font-size-adjust: 0.6;
}

.section-head p {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.section-guide-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
  margin-left: 0.45rem;
  vertical-align: 0.1em;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease, color 0.15s ease;
  line-height: 1;
}

.section-head:hover .section-guide-help,
.section-guide-help:focus-visible {
  opacity: 0.65;
  transform: scale(1);
}

.section-guide-help:hover {
  opacity: 1 !important;
  background: var(--accent);
  color: #ffffff;
}

/* Marks a view whose numbers describe infrastructure rather than the
   product — the audit's non-technical reader needs that said out loud. */
.audience-note {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.audience-note strong {
  color: var(--text);
}

/* Global time range. Sticky so it stays reachable while reading a long
   view — every card it governs carries a matching .window-chip. */
.range-bar {
  position: sticky;
  /* Below the topbar, which is itself sticky at top:0 on narrow screens.
     The desktop breakpoint has no topbar, so this resets to 0 there. */
  top: var(--topbar-h, 0px);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-card);
}

/* `display: flex` above outranks the UA stylesheet's [hidden] rule, so the
   attribute alone would set the property and change nothing on screen. */
.range-bar[hidden] {
  display: none;
}

.range-bar-label,
.range-custom label,
.range-custom span {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1;
  color: var(--muted);
}

.range-bar-label {
  margin-right: 0.25rem;
}

.range-options {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}

.range-btn {
  background: var(--panel);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  margin-left: -1px;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.range-btn[data-days="7"] {
  margin-left: 0;
  border-radius: 5px 0 0 5px;
}

.range-btn[data-days="90"] {
  border-radius: 0 5px 5px 0;
}

.range-btn:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.range-btn.active {
  position: relative;
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.range-custom {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1.1rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.range-bar .range-custom input {
  width: 3.75rem;
  max-width: 3.75rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  border-radius: 5px;
  background: var(--panel);
  -moz-appearance: textfield;
  appearance: textfield;
}

.range-bar .range-custom input::-webkit-outer-spin-button,
.range-bar .range-custom input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.range-bar #refresh-usage-btn {
  margin-left: auto;
}

/* Stamps the window a number is measured over onto the card itself, so a
   tile still reads correctly when its heading has scrolled out of view. */
.window-chip {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  white-space: nowrap;
}

.tile .window-chip {
  display: inline-block;
  margin-top: 0.4rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

@media (max-width: 720px) {

  /* Phones: the three presets fill the first row as one segmented control;
     the custom field and Refresh share the second. display: contents lets the
     preset buttons and the custom group sit directly on the bar's grid. */
  .range-bar {
    /* Static on phones: sticking it under the already-sticky topbar cost
       ~145px of a 812px viewport before any content appeared. */
    position: static;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem 0;
    align-items: center;
    padding: 0.65rem;
  }

  .range-options {
    display: contents;
  }

  /* The preset buttons say "days" themselves, and the grid has no room for
     the label. */
  .range-bar-label {
    display: none;
  }

  .range-btn {
    padding: 0.55rem 0.5rem;
    text-align: center;
  }

  .range-custom {
    grid-column: 1 / span 2;
    margin-left: 0;
  }

  .range-bar #refresh-usage-btn {
    grid-column: 3;
    justify-self: end;
    margin-left: 0;
  }
}

/* A tile that can answer "which ones?" is a link (M7). */
.tile-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.tile-link:hover {
  border-color: var(--accent);
  background: var(--panel);
}

.tile-link .label::after {
  content: " →";
  color: var(--accent);
}

.summary-drill {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.summary-drill:hover {
  text-decoration: underline;
}

/* P2 — every async card used to show the bare word "Loading…" and then
   swap in content, so the page reflowed as each of the eight loaders
   landed. A skeleton holds the final height instead. */
.skeleton-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 1rem;
}

.skeleton-tile {
  height: 92px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
}

.skeleton-line {
  height: 12px;
  border-radius: 999px;
  background: var(--border-soft);
  margin-bottom: 0.7rem;
}

.skeleton-shimmer {
  position: relative;
  overflow: hidden;
}

.skeleton-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: skeleton-sweep 1.4s infinite;
}

@keyframes skeleton-sweep {
  to {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-shimmer::after {
    animation: none;
  }
}

/* P3 — several lists rendered nothing at all when empty, and a blank card
   reads as broken to someone who has not seen it populated. */
/* M9 — the stated target beside a measurement, with a verdict colour when
   the metric has a published threshold. */
.tile-target {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
}

.tile-target.is-good {
  color: var(--good);
}

.tile-target.is-good::before {
  content: "✓ ";
}

.tile-target.is-over {
  color: var(--warning-text);
}

.tile-target.is-over::before {
  content: "! ";
}

.tile-target.is-critical {
  color: var(--error-text);
}

.tile-target.is-critical::before {
  content: "▲ ";
}

.empty-state {
  padding: 1.4rem 0.25rem;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.card-head h2 {
  margin: 0;
}

.section-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* -- Login gate ---------------------------------------------------- */
#gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

#gate .gate-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

#gate .brand-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
}

#gate h1 {
  font-size: 1.15rem;
}

#gate .subtitle {
  margin-bottom: 1.75rem;
}

#gate form {
  text-align: left;
}

label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

input[type="password"],
input[type="url"],
input[type="email"],
input[type="text"],
input[type="number"] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  border-radius: 7px;
  /* 16px is the threshold below which iOS Safari auto-zooms the page on
     focus — anything smaller (this was 0.9rem/14.4px) triggers it. */
  font-size: 16px;
  width: 100%;
  max-width: 320px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

button {
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s, transform 0.05s;
}

button:hover {
  opacity: 0.88;
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

button.secondary:hover {
  color: var(--text);
  border-color: var(--muted);
  opacity: 1;
}

.row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.row>div {
  margin-top: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0 1rem;
}

.checkbox-row label {
  margin: 0;
  font-size: 0.8rem;
}

.checkbox-row input {
  width: auto;
  accent-color: var(--accent);
}

.password-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.password-row input {
  flex: 1;
}

.password-row button {
  margin-top: 0;
}

#passkey-signin-btn {
  width: 100%;
  margin-bottom: 0.75rem;
}

#toggle-password-fallback-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
  padding: 0;
  margin-bottom: 1rem;
  text-decoration: underline;
  cursor: pointer;
}

#toggle-password-fallback-btn:hover {
  color: var(--text);
  opacity: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
}

th:hover {
  color: var(--text);
}

th.sorted {
  color: var(--accent);
}

th.sorted::after {
  content: ' \25BE';
}

th.sorted.asc::after {
  content: ' \25B4';
}

th.num,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tbody tr:hover td {
  background: rgba(15, 23, 42, 0.04);
}

tbody tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.02);
}

tbody tr:nth-child(even):hover td {
  background: rgba(15, 23, 42, 0.04);
}

tr.anomaly td {
  background: rgba(199, 85, 0, 0.07);
}

tr.anomaly:nth-child(even) td {
  background: rgba(199, 85, 0, 0.09);
}

tr.anomaly td:first-child {
  border-left: 2px solid var(--warn);
}

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 480px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* R4 — the wrap scrolls in both axes, so without this the column headers
   leave the box and you are left scrolling a grid of unlabelled cells. */
.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
}

.table-wrap table {
  border: none;
}

.table-wrap tr:last-child td {
  border-bottom: none;
}

.status {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.5rem 0 1rem;
}

.status.error {
  color: var(--error-text);
}

/* -- Cards: panels + tile groups share one visual language ------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.panel {
  padding: 1.5rem 1.6rem;
}

.tiles-group.card {
  padding: 1.3rem 1.6rem 1.5rem;
}

.tiles-group-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.tiles-group-head h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0;
}

.tiles-group-head .row {
  margin: 0;
  align-items: flex-end;
  flex-wrap: nowrap;
}

.tiles-group-head .row input,
.tiles-group-head .row button {
  height: 2.4rem;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
}

/* Grid rather than flex-wrap: with `flex: 1` a four-tile group at ~700px
   became 3 + 1 and the orphan stretched to full width, reading as the most
   important of the four purely because it was the widest. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 1rem;
}

.tile {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  min-width: 0;
}

.tile .value-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.tile .value {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.tile .delta {
  font-size: 0.75rem;
  font-weight: 600;
}

.tile .delta.up {
  color: var(--good);
}

.tile .delta.down {
  color: var(--muted);
}

/* -- Featured stat block (bigger than a .tile) — used above the
   Accounts table for the trip/usage numbers, so they read as headline
   figures rather than one more small tile among many. */
.stat-feature-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.75rem;
  margin: 0 0 1.4rem;
  padding: 1.3rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

/* Before the first load resolves the container has no tiles — without this
   it renders as an empty bordered box above the summary card. */
.stat-feature-row:empty {
  display: none;
}

.stat-feature {
  min-width: 0;
}

.stat-feature .value {
  font-size: 2.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.stat-feature .label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.tile .label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

/* -- At-a-glance summary (plain language, non-developer read) -------- */
.summary-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.summary-top {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.summary-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.summary-pill.good {
  color: var(--good);
  background: rgba(0, 107, 63, 0.14);
}

.summary-pill.warning {
  color: var(--warning-text);
  background: rgba(199, 85, 0, 0.14);
}

.summary-pill.critical {
  color: var(--error-text);
  background: rgba(211, 47, 47, 0.14);
}

.summary-headline {
  font-size: 0.92rem;
  color: var(--text);
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-soft);
}

.summary-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.82rem;
  flex-wrap: wrap;
}

.summary-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transform: translateY(-1px);
}

.summary-dot.good {
  background: var(--good);
}

.summary-dot.warning {
  background: var(--warning);
}

.summary-dot.critical {
  background: var(--critical);
}

.summary-dot.info {
  background: var(--accent);
}

.summary-label {
  color: var(--text);
  font-weight: 600;
  flex-shrink: 0;
}

.summary-detail {
  color: var(--muted);
}

/* -- Time-series charts (stacked area, SVG) -------------------------- */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.chart-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.chart-legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-wrap {
  position: relative;
  /* Reserves the height the SVG will occupy, so the chart swapping in
     doesn't shove everything below it down the page (P2). */
  min-height: 300px;
}

.chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-size: 0.76rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15);
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 5;
  white-space: nowrap;
}

.chart-tooltip.visible {
  opacity: 1;
}

.chart-tooltip .tt-date {
  color: var(--muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.chart-tooltip .tt-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.15rem 0;
}

.chart-tooltip .tt-key {
  width: 10px;
  height: 2px;
  border-radius: 1px;
  flex-shrink: 0;
}

.chart-tooltip .tt-label {
  color: var(--text-secondary);
  flex: 1;
}

.chart-tooltip .tt-value {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-left: 0.6rem;
}

.chart-tooltip .tt-total {
  border-top: 1px solid var(--border);
  margin-top: 0.35rem;
  padding-top: 0.35rem;
}

/* -- Provider budget meters (Cost this month) ------------------------ */
.meter-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.meter-row .meter-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
  gap: 1rem;
}

.meter-row .meter-name {
  color: var(--text);
  font-weight: 600;
}

.meter-row .meter-endpoint {
  color: var(--muted);
  font-weight: 400;
}

.meter-row .meter-figures {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  flex-shrink: 0;
}

.meter-row .meter-figures .meter-cost {
  color: var(--text);
  font-weight: 700;
  margin-left: 0.5rem;
}

.meter-track {
  height: 8px;
  border-radius: 4px;
  background: #cbd5e1;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.2s;
}

.meter-fill.good {
  background: var(--good);
}

.meter-fill.warning {
  background: var(--warning);
}

.meter-fill.critical {
  background: var(--critical);
}

.meter-fill.neutral {
  background: var(--muted);
}

.meter-note {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* -- Budget vs. free allowance gauges --------------------------------- */
.budget-gauge-grid {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.budget-gauge-tile {
  display: grid;
  grid-template-columns: auto minmax(180px, 1.4fr) auto auto;
  align-items: center;
  gap: 1.75rem;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  padding: 0.85rem 1.4rem;
  min-width: 0;
}

@media (max-width: 720px) {
  .budget-gauge-tile {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "gauge main"
      "gauge figures"
      "gauge status";
    row-gap: 0.35rem;
    column-gap: 1.25rem;
  }

  .budget-gauge-tile .gauge-wrap {
    grid-area: gauge;
  }

  .budget-gauge-tile .gauge-main {
    grid-area: main;
  }

  .budget-gauge-tile .gauge-figures {
    grid-area: figures;
    justify-self: start;
  }

  .budget-gauge-tile .gauge-status {
    grid-area: status;
  }
}

.gauge-wrap {
  position: relative;
  width: 84px;
  flex-shrink: 0;
}

.gauge-svg {
  width: 100%;
  display: block;
  overflow: visible;
}

.gauge-track {
  fill: none;
  stroke: rgba(15, 23, 42, 0.08);
  stroke-width: 9;
}

.gauge-fill {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dasharray 0.3s ease;
}

.gauge-fill.good {
  stroke: var(--good);
}

.gauge-fill.warning {
  stroke: var(--warning);
}

.gauge-fill.critical {
  stroke: var(--critical);
}

.gauge-pct {
  position: absolute;
  bottom: -0.1rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.gauge-pct.over {
  font-size: 1.05rem;
  color: var(--error-text);
}

.gauge-pct.gauge-pct-unlimited {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--muted);
}

.gauge-main {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.gauge-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.gauge-endpoint {
  font-weight: 400;
  color: var(--muted);
}

.gauge-note {
  font-size: 0.76rem;
  color: var(--muted);
}

.gauge-figures {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  white-space: nowrap;
  justify-self: end;
}

.gauge-figures-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.gauge-figures-suffix {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.gauge-cost {
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  margin-left: 0.3rem;
}

.gauge-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  justify-self: end;
}

.gauge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
}

.gauge-dot.good {
  background: var(--good);
}

.gauge-dot.warning {
  background: var(--warning);
}

.gauge-dot.critical {
  background: var(--critical);
}

/* -- View Panes ------------------------------------------------------- */
.view-pane {
  display: none;
  width: 100%;
}

/* P1 — switching views was an instant cut, which combined with the old
   lack of a scroll reset made it read as disorienting rather than fast.
   Kept under 200ms: this is a tool people switch dozens of times a session. */
.view-pane.active {
  display: block;
  animation: view-enter 160ms ease-out;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .view-pane.active {
    animation: none;
  }
}

/* -- Scale Simulator UI ----------------------------------------------- */
/* Page header at the top of each view: a plain title and one sentence, ruled
   off from the content. No card, no accent edge. */
.page-head {
  margin: 0 0 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 0.3rem;
}

.page-head p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
  max-width: 62ch;
}

.page-head .audience-note {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.sim-presets {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  align-items: center;
}

.sim-presets-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  margin-right: 0.3rem;
}

.sim-preset-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.sim-preset-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.sim-preset-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.sim-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.sim-control-group {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 1rem 1.2rem;
}

.sim-control-group label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.sim-control-val {
  font-size: 0.95rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.sim-slider-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sim-slider-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

.sim-slider-wrap input[type="number"] {
  width: 80px;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  text-align: right;
}

.sim-control-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.badge-tier {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

.badge-tier.ok {
  background: rgba(0, 107, 63, 0.15);
  color: var(--good);
}

.badge-tier.warning {
  background: rgba(199, 85, 0, 0.15);
  color: var(--warning-text);
}

.badge-tier.critical {
  background: rgba(211, 47, 47, 0.15);
  color: var(--error-text);
}

.badge-tier.info {
  background: var(--accent-dim);
  color: var(--accent);
}

.sim-insights-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.sim-insight-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-secondary);
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border-soft);
}

.sim-insight-item.highlight {
  border-color: var(--accent);
}

.sim-insight-item.warn {
  border-color: var(--warning);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.feature-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feature-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.feature-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.feature-card-pct {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.feature-card-detail {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.feature-track {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.3rem;
}

.feature-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.feature-fill.flights {
  background: var(--series-8);
}

.feature-fill.transit {
  background: var(--series-4);
}

.feature-fill.places {
  background: var(--series-1);
}

.feature-fill.weather {
  background: var(--series-5);
}

/* Visitor Demographics */
.demographics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.demographics-card {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  padding: 1.1rem 1.2rem;
}

.demographics-card h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0 0 0.9rem;
}

.demographics-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.demographics-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.demographics-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.demographics-item-label {
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.demographics-item-val {
  font-weight: 600;
  color: var(--muted);
  font-feature-settings: "tnum";
}

.demographics-bar-track {
  width: 100%;
  height: 5px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
}

.demographics-bar-fill {
  height: 100%;
  background: var(--series-1);
  border-radius: 999px;
  transition: width 0.3s ease;
}


@media (max-width: 720px) {
  :root {
    --topbar-h: 57px;
  }

  .topbar {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
  }

  .shell {
    /* Needs real top padding: the topbar is sticky and translucent, so a
       zero here slides the first card under it with no separation. */
    padding: 1.25rem 1rem 2.5rem;
  }

  .panel {
    padding: 1.1rem 1rem;
  }

  .chart-wrap svg {
    height: 260px;
  }
}

/* -- System Operations Styles ------------------------------------------ */
.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.diag-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
}

.diag-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.diag-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.2rem;
}

.diag-card-cat {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.good,
.status-indicator.good .status-dot {
  background: var(--good);
}

.status-dot.warn,
.status-indicator.warn .status-dot {
  background: var(--warn);
}

.status-dot.error,
.status-indicator.error .status-dot {
  background: var(--error);
}

.status-dot.unconfigured,
.status-indicator.unconfigured .status-dot {
  background: var(--muted);
}

.status-indicator.good {
  color: var(--good);
}

.status-indicator.warn {
  color: var(--warning-text);
}

.status-indicator.error {
  color: var(--error-text);
}

.status-indicator.unconfigured {
  color: var(--muted);
}

.diag-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  border-top: 1px solid var(--border-soft);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
}

.diag-quota {
  font-size: 0.72rem;
  color: var(--muted);
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
}

.btn-danger {
  background: rgba(211, 47, 47, 0.15) !important;
  color: var(--error-text) !important;
  border: 1px solid rgba(211, 47, 47, 0.35) !important;
}

.btn-danger:hover {
  background: var(--error) !important;
  color: #fff !important;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.settings-form-row label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

textarea.settings-input {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  min-height: 80px;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
}

textarea.settings-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

select.settings-select {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  border-radius: 7px;
  font-size: 14px;
  max-width: 320px;
}

select.settings-select:focus {
  outline: none;
  border-color: var(--accent);
}

.banner-preview-box {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.85rem 1.2rem;
  font-size: 0.85rem;
  margin: 0.5rem 0;
  text-align: center;
  transition: all 0.2s ease;
}

.banner-preview-box.info {
  background: #dbeafe;
  border-color: rgba(0, 63, 135, 0.4);
  color: #003F87;
}

.banner-preview-box.warning {
  background: #ffedd5;
  border-color: rgba(199, 85, 0, 0.45);
  color: #7c2d12;
}

.banner-preview-box.critical {
  background: #fee2e2;
  border-color: rgba(211, 47, 47, 0.45);
  color: #7f1d1d;
}

.banner-preview-box .system-announcement-btn {
  display: inline-block;
  margin-left: 0.6rem;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
  text-decoration: none;
  border: 1px solid rgba(15, 23, 42, 0.2);
  vertical-align: middle;
}

/* Toggle switch styles */
.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s ease;
}

.toggle-item:hover {
  border-color: var(--border-soft);
}

.toggle-item.danger-highlight {
  border-color: rgba(211, 47, 47, 0.35);
  background: rgba(211, 47, 47, 0.05);
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.toggle-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.toggle-desc {
  font-size: 0.75rem;
  color: var(--muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: 0.2s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

.switch input:checked+.slider {
  background-color: var(--accent);
}

.switch.danger input:checked+.slider {
  background-color: var(--error);
}

.switch input:focus-visible+.slider {
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.switch input:checked+.slider:before {
  transform: translateX(20px);
}

/* Threshold indicators */
.thresh-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.thresh-good {
  background: rgba(0, 107, 63, 0.15);
  color: #006B3F;
  border: 1px solid rgba(0, 107, 63, 0.3);
}

.thresh-warning {
  background: rgba(199, 85, 0, 0.15);
  color: #9a4200;
  border: 1px solid rgba(199, 85, 0, 0.35);
}

.thresh-critical {
  background: rgba(211, 47, 47, 0.15);
  color: #b42318;
  border: 1px solid rgba(211, 47, 47, 0.35);
}

.threshold-alert-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
  background: rgba(199, 85, 0, 0.1);
  border: 1px solid rgba(199, 85, 0, 0.3);
  color: #9a4200;
}

.threshold-alert-banner.critical {
  background: rgba(211, 47, 47, 0.1);
  border-color: rgba(211, 47, 47, 0.3);
  color: #b42318;
}

.audit-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.audit-filter-btn {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}

.audit-filter-btn.active {
  background: var(--panel-hover);
  border-color: var(--accent);
  color: var(--text);
}

.audit-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.audit-entry {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.82rem;
}

.audit-entry-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.audit-entry-title {
  font-weight: 600;
  color: var(--text);
}

.audit-entry-desc {
  color: var(--muted);
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-entry-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* Dialog modal */
dialog.admin-dialog {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0;
  max-width: 580px;
  width: 90vw;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.25);
}

dialog.admin-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.admin-dialog-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 0.75rem;
}

.admin-dialog-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.dialog-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.3rem;
}

.dialog-close-btn:hover {
  color: var(--text);
}

/* Changelog cards */
.changelog-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.changelog-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: border-color 0.15s ease;
}

/* Published vs draft: published cards are solid and raised; drafts are
   hollow, with a dashed outline and quieter text, like a placeholder. */
.changelog-item.is-published {
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.35);
}

.changelog-item.is-draft {
  background: transparent;
  border: 1.5px dashed var(--muted);
}

.changelog-item.is-draft .cl-bullets,
.changelog-item.is-draft .changelog-desc {
  opacity: 0.72;
}

.changelog-item:hover {
  border-color: var(--border-soft);
}

.changelog-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.changelog-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cl-badge-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.cl-badge-pill.Feature {
  background: rgba(57, 135, 229, 0.15);
  color: #003F87;
}

.cl-badge-pill.Improvement {
  background: rgba(25, 158, 112, 0.15);
  color: #006B3F;
}

.cl-badge-pill.Fix {
  background: rgba(201, 133, 0, 0.15);
  color: #9a4200;
}

.cl-badge-pill.Security {
  background: rgba(213, 81, 129, 0.15);
  color: #a8256a;
}

.cl-date {
  font-size: 0.75rem;
  color: var(--muted);
}

.cl-status-tag {
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-weight: 600;
}

.cl-status-tag.published {
  background: rgba(0, 107, 63, 0.15);
  color: #006B3F;
}

.cl-status-tag.draft {
  background: rgba(199, 85, 0, 0.15);
  color: #9a4200;
}

/* Release notes only: the guide-health "Issue" tag keeps its warning color. */
.changelog-item .cl-status-tag.draft {
  background: transparent;
  border: 1px dashed var(--muted);
  color: var(--muted);
}

.changelog-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.cl-bullets {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cl-bullets li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.cl-badge-pill.cl-type-new {
  background: rgba(57, 135, 229, 0.15);
  color: #003F87;
}

.cl-badge-pill.cl-type-improved {
  background: rgba(25, 158, 112, 0.15);
  color: #006B3F;
}

.cl-badge-pill.cl-type-fixed {
  background: rgba(201, 133, 0, 0.15);
  color: #9a4200;
}

.cl-paste summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--muted);
}

.cl-paste[open] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cl-paste .subtitle {
  margin: 0.4rem 0 0;
}

.cl-editor {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}

.cl-editor[hidden] {
  display: none;
}

.cl-editor-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.cl-editor-top {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 0.75rem;
}

.cl-editor input[type="text"],
.cl-editor input[type="date"] {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  background: var(--surface, var(--bg));
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border-radius: 7px;
  font-size: 16px;
  font-family: inherit;
}

#cl-merge-hint {
  margin: -0.4rem 0 0;
}

.cl-editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cl-item-row {
  display: grid;
  grid-template-columns: 7.25rem 1fr 2.75rem;
  gap: 0.5rem;
  align-items: start;
}

/* Tag menu and remove button share the bullet field's height and border, so
   the row reads as one set of controls. appearance: none drops the browser's
   native (and very small) select and button chrome. */
.cl-item-row .cl-item-type {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: 2.75rem;
  padding: 0 1.9rem 0 0.8rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background-color: var(--surface, var(--bg));
  /* Chevron drawn with gradients: the admin CSP does not allow data: images. */
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-repeat: no-repeat;
  background-position: calc(100% - 1.15rem) 50%, calc(100% - 0.8rem) 50%;
  background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
}

.cl-item-row .cl-item-type:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.cl-item-row .cl-item-remove {
  position: relative;
  box-sizing: border-box;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  font-size: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
}

/* The X is two crossed bars (no icon file or data: image needed). */
.cl-item-row .cl-item-remove::before,
.cl-item-row .cl-item-remove::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.95rem;
  height: 2px;
  margin: -1px 0 0 -0.475rem;
  border-radius: 1px;
  background: currentColor;
}

.cl-item-row .cl-item-remove::before {
  transform: rotate(45deg);
}

.cl-item-row .cl-item-remove::after {
  transform: rotate(-45deg);
}

.cl-item-row .cl-item-remove:hover,
.cl-item-row .cl-item-remove:focus-visible {
  color: #b42318;
  background: rgba(180, 35, 24, 0.08);
  border-color: #b42318;
}

.cl-item-text {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.75rem;
  max-height: 14rem;
  resize: none;
  overflow-y: auto;
  padding: 0.6rem 0.8rem;
  line-height: 1.4;
  background: var(--surface, var(--bg));
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  font-size: 16px;
  font-family: inherit;
}

.cl-item-text:focus,
.cl-editor input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

@media (max-width: 560px) {
  .cl-editor-top {
    grid-template-columns: 1fr;
  }

  .cl-item-row {
    grid-template-columns: 1fr 2.75rem;
  }

  .cl-item-row .cl-item-type {
    grid-column: 1 / -1;
  }
}

.changelog-item.is-editing {
  display: none;
}

.cl-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.changelog-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.45;
  white-space: pre-wrap;
  margin: 0;
  font-weight: 800;
  padding: 0.4rem 0 0.2rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

.changelog-actions {
  display: flex;
  gap: 0.5rem;
}

.target-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.07);
  color: var(--text-secondary);
  margin-left: 0.35rem;
}

/* -- Admin Guide styles ------------------------------------------------ */
.outline-title-spaced {
  margin-top: 1.25rem;
}

.guide-toc {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.5rem;
}

.guide-toc h3 {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.6rem;
}

.guide-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.guide-toc-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  color: var(--accent);
  text-decoration: none;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  transition: background 0.15s;
  width: fit-content;
}

.guide-toc-link:hover {
  background: var(--panel-hover);
  text-decoration: underline;
}

.guide-toc-num {
  font-weight: 700;
  color: var(--muted);
  font-size: 1rem;
}

.guide-prose {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.guide-prose p {
  margin: 0 0 1rem;
}

.guide-prose p:last-child {
  margin-bottom: 0;
}

.guide-prose h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 1.4rem 0 0.5rem;
}

.guide-prose h3:first-child {
  margin-top: 0;
}

.guide-prose h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin: 1rem 0 0.4rem;
}

.guide-prose ul,
.guide-prose ol {
  margin: 0.4rem 0 1rem 1.25rem;
  padding: 0;
}

.guide-prose li {
  margin-bottom: 0.35rem;
}

.guide-code {
  display: inline-block;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  background: rgba(15, 23, 42, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: var(--text);
}

.guide-callout {
  border: 1px solid rgba(0, 63, 135, 0.3);
  background: var(--accent-dim);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin: 1rem 0;
  font-size: 0.84rem;
  line-height: 1.5;
}

.guide-callout.warning {
  border-color: rgba(199, 85, 0, 0.4);
  background: rgba(199, 85, 0, 0.08);
}

.guide-callout.good {
  border-color: rgba(0, 107, 63, 0.35);
  background: rgba(0, 107, 63, 0.08);
}

.guide-callout[data-required-permission] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.guide-callout-body {
  flex: 1;
  min-width: 240px;
}

.guide-perm-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: 4px;
  white-space: nowrap;
}

.guide-perm-badge.granted {
  background: rgba(0, 107, 63, 0.15);
  color: var(--good);
  border: 1px solid rgba(0, 107, 63, 0.3);
}

.guide-perm-badge.missing {
  background: rgba(199, 85, 0, 0.15);
  color: var(--warning-text);
  border: 1px solid rgba(199, 85, 0, 0.3);
}

.guide-callout strong {
  color: var(--text);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.guide-card-inner {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.guide-card-inner:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 63, 135, 0.08);
}

.guide-card-inner h4 {
  margin: 0 0 0.4rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
}

.guide-card-inner h4 a.guide-screen-link {
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide-card-inner:hover h4 a.guide-screen-link {
  color: var(--accent);
}

.guide-prose a.guide-screen-link,
.guide-table a.guide-screen-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: color 0.15s ease;
}

.guide-prose a.guide-screen-link:hover,
.guide-table a.guide-screen-link:hover {
  color: #002b5e;
}

.guide-table-wrap {
  margin: 1rem 0;
  overflow-x: auto;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.guide-table th,
.guide-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

.guide-table th {
  background: rgba(15, 23, 42, 0.03);
  font-weight: 600;
  color: var(--text);
  border-top: 1px solid var(--border-soft);
}

.guide-badge-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}

.guide-badge-pill.public {
  background: rgba(0, 107, 63, 0.12);
  color: var(--good);
}

.guide-badge-pill.ops {
  background: rgba(0, 63, 135, 0.12);
  color: var(--accent);
}

.guide-badge-pill.user {
  background: rgba(199, 85, 0, 0.12);
  color: var(--warning-text);
}

.guide-badge-pill.super {
  background: rgba(108, 43, 217, 0.12);
  color: #6c2bd9;
}

.guide-badge-pill.current {
  background: var(--accent);
  color: #ffffff;
  margin-left: 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

tr.current-tier td {
  background: rgba(0, 63, 135, 0.05);
}

/* ==========================================================================
   Utilities and extracted inline styles
   The `hidden` attribute drives every show/hide in the admin. Several
   components set their own `display`, which would otherwise beat the UA
   [hidden] rule, so it is restated here with !important.
   ========================================================================== */
[hidden] {
  display: none !important;
}

.m-0 {
  margin: 0;
}

.m-sm {
  margin: 0.5rem 0;
}

.mt-05 {
  margin-top: 0.5rem;
}

.mt-075 {
  margin-top: 0.75rem;
}

.mt-125 {
  margin-top: 1.25rem;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-05 {
  margin: 0 0 0.5rem;
}

.mb-06 {
  margin: 0 0 0.6rem;
}

.mb-075 {
  margin-bottom: 0.75rem;
}

.mb-08 {
  margin: 0 0 0.8rem;
}

.mb-1 {
  margin: 0 0 1rem;
}

.mb-12 {
  margin-bottom: 1.2rem;
}

.mb-125 {
  margin-bottom: 1.25rem;
}

.mbo-08 {
  margin-bottom: 0.8rem;
}

.mbo-1 {
  margin-bottom: 1rem;
}

.my-025 {
  margin: 0.25rem 0;
}

.ml-1 {
  margin: 0 0 0 1rem;
}

.ml-auto {
  margin-left: auto;
}

.self-center {
  align-self: center;
}

.flex-1 {
  flex: 1;
}

.text-right {
  text-align: right;
}

.text-error {
  color: var(--error-text);
}

.text-muted {
  color: var(--muted);
}

.w-full {
  width: 100%;
  box-sizing: border-box;
}

.minh-110 {
  min-height: 110px;
}

.maxw-280 {
  max-width: 280px;
}

.maxw-full {
  max-width: 100%;
}

.row-end {
  justify-content: flex-end;
  gap: 0.75rem;
}

.row-wrap {
  gap: 0.75rem;
  flex-wrap: wrap;
}

.grid-1-1,
.grid-2-1 {
  display: grid;
  gap: 1rem;
}

.grid-1-1 {
  grid-template-columns: 1fr 1fr;
}

.grid-2-1 {
  grid-template-columns: 2fr 1fr;
}

.check-row {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.label-strong {
  font-weight: 600;
  font-size: 0.8rem;
}

.label-inline {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-right: 0.5rem;
}

/* Small in-table / in-card action button */
.btn-compact {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
}

.sim-model-desc {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.sim-cost {
  font-weight: 700;
  color: var(--text);
}

.sim-cost.has-cost {
  color: var(--warning-text);
}

.diag-message {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.diag-latency {
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.delta-warn {
  color: var(--warning-text);
}

.badge-row {
  margin-top: 0.4rem;
}

.actor-mono {
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
}

.gap-badge {
  color: var(--error-text);
  background: rgba(211, 47, 47, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.75rem;
}

.doc-link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.doc-link:hover {
  text-decoration: underline;
}

.doc-path {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ==========================================================================
   Keyboard focus
   One visible ring for everything focusable that doesn't already draw its own
   (inputs and the switch have their own :focus styles above).
   ========================================================================== */
:where(button, a[href], [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Elements clipped by a scrolling or overflow-hidden parent draw the ring inside. */
th[tabindex]:focus-visible,
.sidebar-nav-tab:focus-visible,
.section-link:focus-visible {
  outline-offset: -2px;
}

/* Segmented control: lift the focused segment so its ring isn't covered by the neighbour. */
.range-btn:focus-visible {
  position: relative;
  z-index: 1;
  outline-offset: 1px;
}

/* "View as table" disclosure under each chart */
.chart-data {
  margin-top: 0.75rem;
}

.chart-data summary {
  display: inline-block;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

.chart-data summary:hover {
  text-decoration: underline;
}

.chart-data .table-wrap {
  max-height: 18rem;
  overflow: auto;
  margin-top: 0.5rem;
}

.chart-data th {
  cursor: default;
}

.chart-data th[scope="row"] {
  position: static;
  background: transparent;
  text-align: left;
  font-weight: 600;
  font-size: inherit;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  white-space: nowrap;
}