:root {
  color-scheme: light;
  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --subtle: #F8FAFC;
  --text: #172B35;
  --muted: #52636F;
  --border: #7C8C98;
  --divider: #E3E9EF;
  --mint: #31C99B;
  --green: #087D61;
  --green-bg: #E8F8F1;
  --red: #C13B48;
  --red-bg: #FFF0F2;
  --amber: #946100;
  --amber-bg: #FFF4DD;
  --unknown: #5E6A76;
  --focus: #087D61;
  --primary: #087D61;
  --primary-hover: #06674F;
  --on-primary: #FFFFFF;
  --radius-control: 8px;
  --radius-card: 12px;
  --radius-dialog: 16px;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #101C24;
  --surface: #182731;
  --subtle: #21333F;
  --text: #EFF5F8;
  --muted: #B6C6D0;
  --border: #7D929F;
  --divider: #344954;
  --green: #55D6AC;
  --green-bg: #193E35;
  --red: #FF9FA9;
  --red-bg: #462F38;
  --amber: #F1CA79;
  --amber-bg: #413824;
  --unknown: #B6C6D0;
  --focus: #55D6AC;
  --primary: #55D6AC;
  --primary-hover: #79E4C0;
  --on-primary: #102B24;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.5rem, 2vw, 1.75rem); line-height: 1.25; font-weight: 650; letter-spacing: -.025em; }
h2 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
h3 { font-size: 1rem; font-weight: 600; }
h1, h2, h3, p { overflow-wrap: anywhere; }
button, input, select { font: inherit; }
button, input, select, summary, a { touch-action: manipulation; }
button { min-height: 44px; min-width: 44px; padding: .5rem .875rem; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); color: var(--text); cursor: pointer; font-size: .875rem; font-weight: 600; transition: background-color 150ms, border-color 150ms; }
button:hover { background: var(--subtle); }
button:active { background: var(--divider); }
button:disabled { opacity: .65; cursor: wait; }
button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button.danger { color: var(--red); }
input, select { min-height: 44px; width: 100%; min-width: 0; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-control); padding: .625rem .75rem; }
input::placeholder { color: var(--muted); opacity: 1; }
label { display: block; font-size: .875rem; font-weight: 600; margin: 1.25rem 0 .5rem; }
a { color: var(--green); overflow-wrap: anywhere; }
a:not(.skip-link) { display: inline-flex; align-items: center; min-height: 44px; }
summary { min-height: 44px; padding: .625rem 0; cursor: pointer; font-size: .875rem; font-weight: 600; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button.primary:focus-visible { outline-offset: 4px; }
[hidden] { display: none !important; }
.muted, .section-label { color: var(--muted); }
.section-label, .small { font-size: .875rem; }
.error-text { color: var(--red); overflow-wrap: anywhere; }
.number, .metric dd { font-variant-numeric: tabular-nums; }
.wordmark { font-size: 1.375rem; font-weight: 750; letter-spacing: -.045em; }
.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 50; padding: .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-control); }
.skip-link:focus { top: .5rem; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--divider); }
.topbar-inner { min-height: 64px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand-group { display: flex; align-items: center; min-width: 0; }
.nav-current { font-size: .875rem; color: var(--muted); }
.header-actions, .action-group { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.account { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; max-width: 12rem; }
.mobile-menu { display: flex; align-items: center; gap: .5rem; }
.hamburger { display: grid; gap: 4px; width: 17px; }
.hamburger i { height: 2px; background: currentColor; }
.workspace { width: 100%; max-width: 1600px; margin: auto; display: grid; grid-template-columns: minmax(0, 1fr); }
.detail { min-width: 0; padding: 24px 16px 40px; }
.monitor-panel { min-width: 0; padding: 24px 16px; background: var(--surface); }
.workspace-nav { display: grid; gap: .5rem; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--divider); }
.workspace-nav a { padding: .625rem .75rem; border-radius: var(--radius-control); color: var(--muted); font-size: .875rem; font-weight: 550; text-decoration: none; }
.workspace-nav a:hover { background: var(--subtle); color: var(--text); }
.workspace-nav a[aria-current] { background: var(--green-bg); color: var(--green); font-weight: 650; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 20px; }
.panel-heading h2 { font-size: 1rem; }
.panel-heading button { padding-inline: .625rem; }
.monitor-count { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.filter-controls { display: grid; gap: 12px; }
.filter-controls label { margin-top: 0; }
.filter-controls input, .filter-controls select { font-size: .875rem; }
.monitor-list { display: grid; gap: .5rem; margin-top: 24px; }
.monitor-item { width: 100%; text-align: left; border: 1px solid var(--border); padding: .75rem; display: grid; gap: .625rem; border-radius: var(--radius-control); font-weight: 400; background: var(--surface); }
.monitor-item:hover { background: var(--subtle); }
.monitor-item[aria-pressed=true] { background: var(--green-bg); border-color: var(--green); }
.monitor-row { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.monitor-name { font-size: .875rem; font-weight: 650; overflow-wrap: anywhere; min-width: 0; }
.monitor-percentage { font-size: .8125rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.monitor-meta { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; color: var(--muted); font-size: .8125rem; }
.status-up { color: var(--green); }
.status-down { color: var(--red); }
.status-pending { color: var(--unknown); }
.mini-bars { display: flex; gap: 3px; height: 10px; width: 100%; align-items: stretch; }
.beat { background: var(--green); flex: 1; min-width: 0; border-radius: 2px; }
.beat.failed { background: var(--red); border-radius: 0; }
.list-message { padding: 1.5rem .25rem; color: var(--muted); font-size: .875rem; }
.panel-footer { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--divider); display: grid; gap: .375rem; font-size: .75rem; color: var(--muted); }
.notice { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-control); margin-bottom: 24px; background: var(--surface); overflow-wrap: anywhere; }
.notice.error { color: var(--red); border-color: var(--red); }
.notice button { margin-top: .75rem; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-heading p { margin-top: .5rem; }
.sync-status { font-size: .8125rem; color: var(--muted); }
.fleet-kpis { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0; }
.kpi-card { min-width: 0; background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius-card); padding: 20px; }
.kpi-card dt { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--muted); font-weight: 550; }
.kpi-card dd { margin: 8px 0; font-size: 2rem; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.kpi-card p { font-size: .75rem; color: var(--muted); }
.status-mark { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--unknown); }
.status-mark.up { background: var(--green); }
.status-mark.down { background: var(--red); border-radius: 2px; }
.overview-strip { display: flex; align-items: baseline; gap: .375rem; flex-wrap: wrap; color: var(--muted); font-size: .8125rem; margin: 16px 0 32px; }
.overview-strip span { flex-basis: 100%; }
.context-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem; margin-bottom: 16px; }
.context-heading h2 { font-size: .875rem; color: var(--muted); }
.context-heading span { font-size: .8125rem; }
.detail-heading { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; padding: 20px 20px 0; background: var(--surface); border: 1px solid var(--divider); border-bottom: 0; border-radius: var(--radius-card) var(--radius-card) 0 0; }
.detail-heading > div { min-width: 0; }
.detail-heading > div:first-child { flex: 1 1 180px; }
#target-title { font-size: clamp(1.25rem, 2vw, 1.5rem); font-weight: 650; letter-spacing: -.02em; }
.target-url { font-size: .875rem; max-width: 100%; overflow-wrap: anywhere; }
.status-block { background: var(--surface); border: 1px solid var(--divider); border-top: 0; border-radius: 0 0 var(--radius-card) var(--radius-card); padding: 16px 20px 20px; }
.status-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.status-badge { display: inline-block; padding: .25rem .75rem; border-radius: 20px; font-size: .875rem; font-weight: 650; }
.status-badge.status-up { background: var(--green-bg); }
.status-badge.status-down { background: var(--red-bg); }
.status-badge.status-pending { background: var(--subtle); }
.status-block .error-text { margin-bottom: .75rem; }
.heartbeats { display: flex; gap: 4px; height: 32px; }
.heartbeat-caption { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-top: 12px; font-size: .75rem; color: var(--muted); }
.legend { display: flex; gap: .75rem; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: .375rem; }
.legend .swatch { width: 10px; height: 10px; background: var(--green); border-radius: 2px; }
.legend .swatch.failed { background: var(--red); border-radius: 0; }
.metrics { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin: 24px 0 32px; }
.metric { min-width: 0; }
.metric dt { color: var(--muted); font-size: .8125rem; }
.metric dd { margin: .375rem 0 0; font-size: clamp(1.375rem, 2.5vw, 1.75rem); font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.data-section { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius-card); padding: 20px; margin-top: 20px; }
.section-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ranges { display: flex; gap: .5rem; flex-wrap: wrap; }
.ranges button { padding-inline: .75rem; }
.ranges button[aria-pressed=true] { background: var(--green-bg); border-color: var(--green); color: var(--green); }
#chart-container { min-width: 0; }
.chart { width: 100%; height: auto; display: block; margin: 16px 0; }
.chart-line { fill: none; stroke: var(--green); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-dot { fill: var(--green); }
.chart-failure { stroke: var(--red); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-axis { stroke: var(--border); stroke-width: 1; }
.chart-label { fill: var(--muted); font-family: inherit; font-size: 14px; }
.chart-summary { color: var(--muted); font-size: .8125rem; }
.table-wrap { max-height: 24rem; overflow: auto; margin-top: .5rem; border: 1px solid var(--divider); border-radius: var(--radius-control); }
table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: .875rem; table-layout: fixed; }
th, td { text-align: left; padding: .75rem; vertical-align: top; border-bottom: 1px solid var(--divider); overflow-wrap: anywhere; }
th { font-weight: 600; color: var(--muted); }
thead { background: var(--subtle); }
caption { text-align: left; padding: .75rem; font-weight: 600; }
.incident-section { margin-top: 24px; }
.incident-list { display: grid; }
.incident { padding: 16px 0; border-top: 1px solid var(--divider); }
.incident:first-child { border-top: 0; }
.incident-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.incident p { font-size: .875rem; color: var(--muted); margin-top: .375rem; overflow-wrap: anywhere; }
.empty-detail { padding: 32px 24px; background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius-card); }
.empty-detail p { margin: .75rem 0 1.25rem; color: var(--muted); max-width: 38rem; }
.mobile-only { display: block; }
.desktop-only { display: none; }
.drawer { display: none; inset: 0 auto 0 0; width: min(24rem, 100%); max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-right: 1px solid var(--border); border-radius: 0; background: var(--surface); color: var(--text); padding: 16px; overflow: auto; }
.drawer[open] { display: block; }
.drawer-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 24px; }
.drawer-actions { display: flex; gap: .5rem; flex-wrap: wrap; border-top: 1px solid var(--divider); padding-top: 16px; margin-top: 16px; }
.drawer .monitor-panel { padding: 0; }
.drawer-account { font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; margin-top: 16px; }
dialog::backdrop { background: rgb(12 27 38 / .6); }
.editor { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-dialog); width: min(30rem, calc(100% - 2rem)); padding: 24px; max-height: calc(100dvh - 2rem); overflow: auto; box-shadow: 0 12px 40px rgb(20 40 60 / 16%); }
.editor h2 { font-size: 1.25rem; }
.form-help { color: var(--muted); font-size: .875rem; margin-top: .5rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .75rem; flex-wrap: wrap; margin-top: 24px; }
.editor .error-text { margin-top: .75rem; }
.login-page { min-height: 100dvh; padding: 0 16px 40px; }
.login-header { max-width: 1280px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 80px; }
.login-card { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius-dialog); max-width: 440px; margin: clamp(16px, 8vh, 80px) auto 0; padding: 24px; box-shadow: 0 2px 8px rgb(20 40 60 / 4%); }
.login-card h1 { margin: 8px 0 12px; font-size: 1.75rem; }
.login-card form { margin-top: 32px; }
.login-card .primary { width: 100%; margin-top: 20px; }
.login-card .error-text { margin-top: 16px; }
.password-field { display: flex; gap: .5rem; align-items: stretch; }
.password-field input { min-width: 0; }
.password-field button { font-size: .8125rem; padding: .5rem; }
.login-note { font-size: .8125rem; color: var(--muted); margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--divider); }
@media (min-width: 22rem) {
  .fleet-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card { padding: 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 42rem) {
  .detail { padding: 32px; }
  .topbar-inner { padding-inline: 32px; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
  .metric + .metric { border-left: 1px solid var(--divider); padding-left: 24px; }
  .kpi-card { padding: 24px; }
  .status-block, .data-section { padding: 24px; }
  .detail-heading { padding: 24px 24px 0; }
  .overview-strip span { flex-basis: auto; margin-left: auto; }
  .login-card { padding: 32px; }
}
@media (min-width: 64rem) {
  .workspace { grid-template-columns: 224px minmax(0, 1fr); }
  #desktop-sidebar { background: var(--surface); border-right: 1px solid var(--divider); }
  .desktop-only { display: flex; }
  .mobile-only { display: none; }
  .topbar-inner { min-height: 63px; height: 63px; padding: 9px 32px 9px 24px; }
  .wordmark { width: 200px; }
  .login-header .wordmark { width: auto; }
  .header-actions { flex-wrap: nowrap; }
  .monitor-panel { padding-top: 32px; }
  .fleet-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
  .kpi-card { padding: 20px; }
}
@media (max-width: 24rem) {
  .editor { width: 100%; max-height: 100dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; padding: 20px 16px; }
  .form-actions button { flex: 1 1 auto; }
  .data-section { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
