:root {
  --navy: #1F3A5F;
  --navy-deep: #152a45;
  --amber: #D97706;
  --cream: #FBFAF5;
  --ink: #1a2332;
  --muted: #5c6b7a;
  --line: #d9dee5;
  --ok: #0f7a4a;
  --err: #b42318;
  --card: #ffffff;
  --sidebar: #152a45;

  --status-up: var(--ok);
  --status-up-bg: #edf8f1;
  --status-down: var(--err);
  --status-down-bg: #fdf2f0;
  --status-paused: var(--muted);
  --status-paused-bg: #eef2f6;
  --status-unknown: var(--amber);
  --status-unknown-bg: #f5f1e8;

  --font-sans: "Source Sans 3", system-ui, sans-serif;
  --font-serif: "Libre Baskerville", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.5;
}

h1, h2, h3, .brand-mark {
  font-family: var(--font-serif);
  font-weight: 700;
}

a { color: var(--navy); }
a:hover { color: var(--amber); }

.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar);
  color: #d7dee8;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
}
.sidebar-brand {
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo {
  display: block;
  max-width: 160px;
  max-height: 48px;
  width: auto;
  height: auto;
  margin-bottom: 0.65rem;
  object-fit: contain;
}
.sidebar-brand strong {
  display: block;
  font-family: var(--font-serif);
  color: #fff;
  font-size: 1.15rem;
}
.sidebar-brand span { font-size: 0.85rem; color: #9aabbd; }
.sidebar nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.75rem 1rem;
  gap: 0.15rem;
  flex: 1;
}
.sidebar nav .nav-group {
  margin: 0.85rem 0.75rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a8ea3;
}
.sidebar nav .nav-group:first-child { margin-top: 0.25rem; }
.sidebar nav a {
  color: #c5d0dc;
  text-decoration: none;
  padding: 0.45rem 0.75rem;
  border-left: 3px solid transparent;
  font-size: 0.92rem;
}
.sidebar nav a:hover { color: #fff; background: rgba(255,255,255,0.04); }
.sidebar nav a.is-active {
  color: #fff;
  background: rgba(217,119,6,0.15);
  border-left-color: var(--amber);
}
.sidebar-foot {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.82rem;
  color: #9aabbd;
}

.main { padding: 1.5rem 1.75rem 2.5rem; min-width: 0; }
@media (min-width: 961px) {
  .main-top { display: none; }
}
.main-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.main-top-left {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.main-top-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.main-top h1 { margin: 0; color: var(--navy); font-size: 1.75rem; }
.lede {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.45rem;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--navy);
}
.sidebar-overlay { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  background: var(--navy);
  color: #fff;
}
.btn:hover { color: #fff; filter: brightness(1.05); }
.btn-primary { background: var(--amber); color: #fff; }
.btn-primary:hover { color: #fff; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--navy);
}
.btn-ghost:hover { color: var(--amber); border-color: var(--amber); }
.sso-buttons { display: grid; gap: 0.55rem; margin: 0.85rem 0 0.35rem; }
.sso-buttons .sso-btn { display: block; text-align: center; width: 100%; }
.sso-or { text-align: center; margin: 0.75rem 0 0.25rem; }
.btn.loading { opacity: 0.7; pointer-events: none; }

.badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.15rem 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #eef2f6;
  color: var(--navy);
  vertical-align: middle;
}
.badge.ok { background: #edf8f1; color: var(--ok); }
.badge.down { background: #fdf2f0; color: var(--err); }
.badge.warn { background: var(--status-unknown-bg); color: #8a6a2f; }

.dash-toolbar { margin-left: auto; }
.main-top { margin-bottom: 0.75rem; align-items: center; }
.dash-hero {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 1.5rem;
  align-items: center;
  background: var(--navy-deep);
  color: #e8eef4;
  padding: 1.6rem 1.75rem;
  margin-bottom: 1.15rem;
  border: 1px solid var(--navy);
}
.dash-hero.some-down { border-left: 4px solid var(--err); }
.dash-hero.demo-down { border-left: 4px solid var(--amber); }
.dash-hero.all-up { border-left: 4px solid var(--ok); }
.dash-eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9aabbd;
}
.dash-hero h1 {
  margin: 0;
  color: #fff;
  font-size: 1.7rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.dash-hero .badge { margin-left: 0; }
.dash-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.dash-hero .btn-ghost {
  border-color: rgba(255,255,255,0.25);
  color: #fff;
  background: transparent;
}
.dash-hero .btn-ghost:hover { border-color: var(--amber); color: var(--amber); }
.mobile-title {
  display: none;
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--navy);
}
.dash-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.15rem;
  margin-top: 1.05rem;
  font-size: 0.82rem;
  color: #c5d0dc;
  align-items: center;
}
.dash-legend .swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 0.4rem;
  vertical-align: middle;
  background: #9aabbd;
}
.dash-legend .swatch.up { background: #3dbe7a; }
.dash-legend .swatch.down { background: #e36b63; }
.dash-legend .swatch.paused { background: #8aa0b5; }
.dash-updated { color: #9aabbd; }
.dash-hero-viz {
  position: relative;
  width: 180px;
  height: 180px;
  justify-self: end;
}
.health-ring {
  width: 180px;
  height: 180px;
  transform: rotate(-90deg);
}
.ring-track, .ring-arc {
  fill: none;
  stroke-width: 10;
  stroke-linecap: butt;
}
.ring-track { stroke: rgba(255,255,255,0.08); }
.ring-arc.up { stroke: #3dbe7a; }
.ring-arc.down { stroke: #e36b63; }
.ring-arc.paused { stroke: #8aa0b5; }
.health-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.health-ring-label strong {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  color: #fff;
  line-height: 1.1;
}
.health-ring-label span {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9aabbd;
}

.stat-card { position: relative; padding-top: 1.15rem; }
.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--navy);
}
.stat-card.tone-ok::before { background: var(--ok); }
.stat-card.tone-err::before { background: var(--err); }
.stat-card.tone-amber::before { background: var(--amber); }
.stat-hint {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.dash-infra-summary {
    margin: 0.65rem 0 0;
    font-size: 0.82rem;
    color: var(--muted);
}
.fleet-section { margin-bottom: 1.5rem; }
.fleet-lede { margin: 0; }
.fleet-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.fleet-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--navy);
  text-decoration: none;
  font-size: 0.85rem;
}
.fleet-chip:hover { border-color: var(--navy); color: var(--navy); }
.fleet-chip.down { border-color: #f0c2bd; background: #fdf2f0; }
.fleet-chip.paused { opacity: 0.7; }
.fleet-dot {
  width: 8px;
  height: 8px;
  background: var(--muted);
  flex-shrink: 0;
}
.fleet-chip.up .fleet-dot { background: var(--ok); }
.fleet-chip.down .fleet-dot { background: var(--err); }
.fleet-chip-host {
    border-style: dashed;
}
.fleet-name { font-weight: 600; }
.fleet-meta { color: var(--muted); font-size: 0.75rem; }

.monitor-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}
.monitor-search {
  width: 14rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
}
.monitor-search:focus {
  outline: 2px solid rgba(31,58,95,0.25);
  border-color: var(--navy);
}
.monitor-kicker {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}
.scope-pill {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.12rem 0.4rem;
  border: 1px solid var(--line);
  color: var(--navy);
  background: #eef2f6;
}
.scope-pill.live { background: #edf8f1; color: var(--ok); border-color: #b7e0c8; }
.scope-pill.demo { background: #f5f1e8; color: #8a6a2f; border-color: #e6d3a3; }
.scope-pill.infra { background: #eef2f8; color: #3d4f6f; border-color: #c5d0dc; }
.monitor-card { border-left: 3px solid var(--line); }
.monitor-card[data-status="up"] { border-left-color: var(--ok); }
.monitor-card[data-status="down"] { border-left-color: var(--err); }
.monitor-card[data-status="paused"] { border-left-color: #c5d0dc; }
.timeline-blocks { height: 14px; }
.timeline-block { min-width: 4px; }
.overall-status-banner.demo-down {
  border-color: #e6d3a3;
  background: #f5f1e8;
  color: #8a6a2f;
}

.overall-status-banner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.15rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--line);
  background: var(--card);
}
.overall-status-banner.all-up {
  border-color: #b7e0c8;
  background: #edf8f1;
  color: var(--ok);
}
.overall-status-banner.some-down {
  border-color: #f0c2bd;
  background: #fdf2f0;
  color: var(--err);
}
.overall-status-banner h2 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
}
.status-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  position: relative;
}
.status-pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0.35;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(2); opacity: 0; }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1rem 1.15rem;
}
.stat-label {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 0.35rem;
}
.stat-value {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--navy);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.section-title-row .section-title { margin-bottom: 0; }
.scope-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.scope-filter {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}
.scope-filter:hover { border-color: var(--navy); }
.scope-filter.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.monitor-card.is-down { border-color: #f0c2bd; }
.monitors-section, .incidents-section, .usage-section, .hosts-section { margin-bottom: 1.5rem; }
#status, #hosts, #usage, #monitors, #incidents { scroll-margin-top: 1rem; }

.hosts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}
.host-card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.host-card.healthy { border-left: 3px solid var(--ok); }
.host-card.warn { border-left: 3px solid var(--amber); }
.host-card.critical, .host-card.down { border-left: 3px solid var(--err); }
.host-card.unknown { border-left: 3px solid #c5d0dc; }
.host-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}
.host-card-top h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--navy);
}
.host-meta, .host-reason {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.host-card-tags { display: flex; gap: 0.35rem; flex-shrink: 0; align-items: center; }
.host-meters { display: flex; flex-direction: column; gap: 0.45rem; }
.host-meter {
  display: grid;
  grid-template-columns: 4.2rem 1fr 7.2rem;
  gap: 0.5rem;
  align-items: center;
}
.host-meter span {
  font-size: 0.78rem;
  color: var(--navy);
  font-weight: 600;
}
.host-meter em {
  font-style: normal;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.usage-bar-fill.host-fill { background: var(--navy); }
.usage-bar-fill.host-fill.warn { background: var(--amber); }
.host-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.host-apps { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.host-app {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  color: var(--navy);
  text-decoration: none;
  background: #fff;
}
.host-app:hover { border-color: var(--amber); color: var(--amber); }
a.host-app { cursor: pointer; }
span.host-app { cursor: default; }
span.host-app:hover { border-color: var(--line); color: var(--navy); }
.host-app.down { border-color: #f0c2bd; background: #fdf2f0; color: var(--err); }
.host-app.paused { opacity: 0.7; }
.status-badge.healthy { background: #edf8f1; color: var(--ok); }
.status-badge.warn { background: #f5f1e8; color: #8a6a2f; }
.status-badge.critical { background: #fdf2f0; color: var(--err); }

.usage-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.usage-charts .panel h3 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  color: var(--navy);
}
.usage-bars {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 420px;
  overflow-y: auto;
}
.usage-bar-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr 3.5rem;
  gap: 0.55rem;
  align-items: center;
}
.usage-bar-label {
  font-size: 0.8rem;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.usage-bar-track {
  height: 10px;
  background: #eef2f6;
  border: 1px solid var(--line);
}
.usage-bar-fill { height: 100%; background: var(--ok); }
.usage-bar-fill.uptime.warn { background: var(--amber); }
.usage-bar-fill.uptime.paused { background: #c5d0dc; }
.usage-bar-fill.latency { background: var(--navy); }
.usage-bar-value {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.usage-table-panel { padding: 0; }
.usage-table-panel .incidents-table-wrapper { padding: 0.25rem 0.5rem 0.5rem; }
.usage-url {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.usage-url a { color: inherit; text-decoration: none; }
.usage-url a:hover { color: var(--amber); }
.usage-lede { margin: -0.35rem 0 1rem; }

.monitors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.monitor-card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.monitor-card:hover { border-color: var(--navy); }
.monitor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}
.monitor-info { min-width: 0; flex: 1; }
.monitor-name {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.monitor-url {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.15rem;
}
.monitor-url a {
  color: inherit;
  text-decoration: none;
}
.monitor-url a:hover { color: var(--amber); }

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: #eef2f6;
  color: var(--navy);
  flex-shrink: 0;
}
.status-badge.up { background: #edf8f1; color: var(--ok); }
.status-badge.down { background: #fdf2f0; color: var(--err); }
.status-badge.paused { background: #eef2f6; color: var(--muted); }
.status-badge.unknown { background: #f5f1e8; color: #8a6a2f; }

.monitor-metrics {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.metric-item { display: flex; flex-direction: column; }
.metric-label { color: var(--muted); font-size: 0.75rem; margin-bottom: 0.1rem; }
.metric-value { font-weight: 600; color: var(--ink); }

.history-timeline { display: flex; flex-direction: column; gap: 0.4rem; }
.timeline-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
}
.timeline-blocks { display: flex; gap: 3px; height: 18px; }
.timeline-block {
  flex: 1;
  background: var(--line);
  cursor: pointer;
  position: relative;
}
.timeline-block.up { background: var(--ok); }
.timeline-block.down { background: var(--err); }
.timeline-block.paused { background: #c5d0dc; }
.timeline-block:hover { transform: scaleY(1.25); z-index: 2; }
.timeline-block .tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-deep);
  color: #fff;
  padding: 0.4rem 0.6rem;
  font-size: 0.7rem;
  white-space: nowrap;
  z-index: 20;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.timeline-block:hover .tooltip { visibility: visible; opacity: 1; }

.monitor-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: auto;
}
.btn-card-action {
  background: transparent;
  border: 1px solid var(--line);
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
}
.btn-card-action:hover { color: var(--amber); border-color: var(--amber); }
.btn-card-action.danger:hover {
  color: var(--err);
  border-color: var(--err);
  background: #fdf2f0;
}

.panel, .incidents-section {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.25rem;
}
.incidents-table-wrapper { overflow-x: auto; }
.incidents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.incidents-table th, .incidents-table td {
  text-align: left;
  padding: 0.65rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.incidents-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
.incidents-table tr:hover td { background: rgba(31,58,95,0.03); }
.incidents-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.45rem;
}
.incidents-status-dot.active { background: var(--err); }
.incidents-status-dot.resolved { background: var(--ok); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 42, 69, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(1rem, 4vh) 1rem 1.5rem;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff;
  border: 1px solid var(--line);
  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(21, 42, 69, 0.18);
  flex-shrink: 0;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 1.35rem 0.85rem;
  margin-bottom: 0;
  color: var(--navy);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-header h3 { margin: 0; font-size: 1.15rem; }
.modal-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}
.modal-close:hover { color: var(--navy); }
.modal-stack {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.modal-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1.35rem;
  flex: 1 1 auto;
  min-height: 0;
}
.modal:not(:has(.modal-body)) {
  padding: 1.25rem 1.35rem 1.4rem;
  overflow-y: auto;
}
.form-group { margin-bottom: 0.9rem; }
.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: var(--navy);
}
.form-control {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.form-control:focus {
  outline: 2px solid rgba(31,58,95,0.25);
  border-color: var(--navy);
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0;
  padding: 0.9rem 1.35rem 1.15rem;
  border-top: 1px solid var(--line);
  background: #fff;
  flex-shrink: 0;
}
.alerts-section { margin: 1.5rem 0 2rem; }
.alert-email-list, .alert-email-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-height: 2rem;
}
.alert-email-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  font-size: 0.85rem;
}
.alert-email-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.alert-email-remove:hover { color: var(--err); }
.alert-add-row {
  display: flex;
  gap: 0.5rem;
}
.alert-add-row .form-control { flex: 1; }
.alert-enabled {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.9rem;
  color: var(--navy);
  font-weight: 600;
}
.subsection-title {
  margin: 1rem 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
}
.alert-host-summary {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.35rem;
}
.alert-host-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  background: #fff;
}
.alert-host-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.5rem;
}
.alert-host-row {
  padding: 0.75rem;
  border: 1px solid var(--line);
  background: #fafafa;
}
.alert-host-row-head {
  margin-bottom: 0.45rem;
}
.alert-host-section {
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}
.host-notify {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}
.host-notify-head {
  margin-bottom: 0.45rem;
}
.host-notify-label {
  font-weight: 600;
  color: var(--navy);
}
.host-notify-chips {
  min-height: 0;
  margin-bottom: 0.45rem;
}
.host-notify-add {
  margin-top: 0.15rem;
}
.host-notify-add .form-control {
  font-size: 0.82rem;
  padding: 0.35rem 0.5rem;
}
.host-notify-add .btn {
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
}

.alert-smtp-section {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.alert-smtp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.85rem;
  margin-top: 0.5rem;
}
.alert-smtp-test-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.65rem;
}
@media (max-width: 640px) {
  .alert-smtp-grid { grid-template-columns: 1fr; }
}

.smtp-settings-section { margin: 1.5rem 0 2rem; }
.smtp-summary {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  margin-top: 0.5rem;
}
.smtp-summary-row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
}
.smtp-summary-label {
  font-weight: 600;
  color: var(--navy);
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  background: #fff;
}
.empty-state p { margin: 0 0 1rem; }
.empty { color: var(--muted); text-align: center; padding: 1.5rem 0; }

.app-footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.app-footer p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.sidebar-foot a {
  color: #9aabbd;
  text-decoration: none;
  font-weight: 600;
}
.sidebar-foot a:hover { color: #fff; }
.sidebar-user {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.65rem;
}
.sidebar-user strong { color: #fff; font-size: 0.95rem; }
.sidebar-user span { color: #9aabbd; font-size: 0.8rem; text-transform: capitalize; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
    radial-gradient(ellipse at top right, rgba(217,119,6,0.12), transparent 45%),
    linear-gradient(160deg, #eef2f6, var(--cream));
}
.auth-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  padding: 2rem;
}
.auth-card h1 { margin: 0.25rem 0 0.75rem; font-size: 1.6rem; color: var(--navy); }
.auth-logo {
  display: block;
  max-width: 200px;
  max-height: 64px;
  margin: 0 auto 0.35rem;
}
.brand-mark { margin: 0; text-align: center; }
.lede, .hint { color: var(--muted); font-size: 0.95rem; }
.auth-card label {
  display: block;
  margin: 0.85rem 0 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
}
.auth-card input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
}
.auth-card input:focus {
  outline: 2px solid rgba(31,58,95,0.25);
  border-color: var(--navy);
}
.flash {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  background: #fff;
}
.flash.err { border-color: #f0c2bd; background: #fdf2f0; color: var(--err); }
.captcha-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.35rem 0 0.55rem;
}
.captcha-image {
  border: 1px solid var(--line);
  background: #fff;
  line-height: 0;
}
.captcha-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  text-decoration: none;
  font-size: 1.2rem;
}
.captcha-refresh:hover { color: var(--amber); }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-hero { grid-template-columns: 1fr 160px; }
  .dash-hero-viz, .health-ring { width: 150px; height: 150px; }
}
@media (max-width: 960px) {
  .usage-charts { grid-template-columns: 1fr; }
  .usage-bar-row { grid-template-columns: 7rem 1fr 3.2rem; }
  .host-meter { grid-template-columns: 3.6rem 1fr 5.8rem; }
  .hosts-grid { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .mobile-title { display: block; align-self: center; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    z-index: 1000;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    overflow-y: auto;
  }
  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 8px 0 24px rgba(0,0,0,0.2);
  }
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 999;
  }
  .sidebar-overlay[hidden] { display: none !important; }
  body.nav-open { overflow: hidden; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-hero { grid-template-columns: 1fr; }
  .dash-hero-viz { justify-self: start; }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
  .main { padding: 1rem; }
  .main-top-right { width: 100%; }
  .main-top-right .btn { flex: 1; }
}

/* RBAC & User Management */
.users-section { margin-top: 0; }

/* Multi-Page / View Management */
.view-page {
  display: none !important;
}
.view-page.is-active-view {
  display: block !important;
  animation: fadeInView 0.16s ease-in-out;
}
@keyframes fadeInView {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header-left {
  flex: 1;
  min-width: 250px;
}
.page-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}
.page-crumb {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.page-crumb a {
  color: var(--muted);
  text-decoration: none;
}
.page-crumb a:hover {
  color: var(--navy);
  text-decoration: underline;
}

.dash-quick-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
.quick-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.quick-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.07);
  border-color: #cbd5e1;
}
.quick-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}
.quick-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}
.quick-card-badge {
  font-size: 0.76rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}
.quick-card-desc {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0 0 0.85rem;
  line-height: 1.45;
}
.quick-card-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.quick-card:hover .quick-card-link {
  color: var(--amber);
}

.role-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 4px;
}
.role-badge.admin {
  background: #ede9fe;
  color: #5b21b6;
}
.role-badge.customer {
  background: #e0f2fe;
  color: #0369a1;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.status-pill.active {
  background: #edf8f1;
  color: var(--ok);
}
.status-pill.inactive {
  background: #fdf2f0;
  color: var(--err);
}
.scope-count-badge {
  display: inline-block;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-size: 0.8rem;
  font-weight: 500;
}
.checkbox-list-container {
  max-height: 180px;
  overflow-y: auto;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.2rem;
  border-bottom: 1px solid #edf2f7;
  font-size: 0.86rem;
  cursor: pointer;
}
.checkbox-item:last-child {
  border-bottom: none;
}
.checkbox-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--amber);
}
.checkbox-helper-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.btn-link-action {
  background: none;
  border: none;
  padding: 0;
  color: var(--navy);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.btn-link-action:hover {
  color: var(--amber);
}
.user-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

/* Firewall & WAN page */
.firewall-sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}
.firewall-site-card {
  padding: 1rem 1.15rem;
}
.firewall-site-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.firewall-site-name {
  margin: 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.15rem;
  color: var(--navy);
}
.firewall-probe-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.firewall-probe-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
}
.firewall-probe-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.firewall-probe-info strong {
  font-size: 0.9rem;
  color: var(--ink);
}
.firewall-probe-info span {
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.firewall-probe-row .fleet-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.firewall-probe-row .fleet-dot.up { background: var(--ok); }
.firewall-probe-row .fleet-dot.down { background: var(--err); }
.firewall-probe-row .fleet-dot.paused { background: #94a3b8; }
.fleet-chip-wan {
  border-style: dashed;
}
.modal-wide {
  max-width: 640px;
}
@media (max-width: 640px) {
  .firewall-sites-grid {
    grid-template-columns: 1fr;
  }
}

/* Customer portfolios */
.customers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}
.customer-card {
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.customer-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.customer-card-name {
  margin: 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.25rem;
  color: var(--navy);
}
.customer-card-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.customer-col-title {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}
.customer-mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.customer-mini-list li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-mini-list .fleet-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #94a3b8;
}
.customer-mini-list .fleet-dot.up { background: var(--ok); }
.customer-mini-list .fleet-dot.down { background: var(--err); }
.customer-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
@media (max-width: 640px) {
  .customers-grid { grid-template-columns: 1fr; }
  .customer-card-cols { grid-template-columns: 1fr; }
}

