/* MX Nexus tokens. Dark is the default; Settings → Appearance can pick Light or follow the system.
   Source of truth: the MX Nexus design system (same values, both themes). */
:root {
  --ground: #101920; --surface-1: #16212A; --surface-2: #1D2A35; --surface-rail: #0B1217;
  --line: #263440; --line-strong: #687886;
  --ink: #EEF2F5; --ink-muted: #9AA8B4; --ink-faint: #6E7D8A;
  --signal: #FFE714; --signal-deep: #B8A000; --on-signal: #101920; --signal-ink: #FFE714;
  --crit: #FF6166; --crit-soft: #3A1D22; --warn: #F5A524; --warn-soft: #3A2B14;
  --info: #6CB2FF; --info-soft: #15283D; --ok: #3DD68C; --ok-soft: #12301F;
  --globe-land: #FFE714; --globe-water: #3A4A57; --focus: #FFE714;
  --nav-glass: rgba(46, 60, 72, .55); --nav-edge: rgba(255, 255, 255, .1); --nav-disc: rgba(255, 255, 255, .13);
  /* app surfaces derived from the tokens: translucent bars, sheets, pressed rows, the neutral swipe action */
  --bar: rgba(16, 25, 32, .8); --sheet: rgba(29, 42, 53, .94); --press: rgba(255, 255, 255, .07); --swipe-neutral: #3A4A57;
  --font-display: Archivo, "Arial Black", sans-serif;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px; --radius-pill: 999px;
  --rail: 64px; --hinge: 24px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --ground: #F3F4EF; --surface-1: #FFFFFF; --surface-2: #E8EAE3; --surface-rail: #E2E5DE;
  --line: #D3D7CF; --line-strong: #848C82;
  --ink: #101920; --ink-muted: #4E5A63; --ink-faint: #7A8580;
  --signal: #FFE714; --signal-deep: #C9B000; --on-signal: #101920; --signal-ink: #6E5C00;
  --crit: #C2252C; --crit-soft: #FBE3E3; --warn: #9A5300; --warn-soft: #FCEBD2;
  --info: #1F5FBF; --info-soft: #DDE9FA; --ok: #137343; --ok-soft: #DDF3E6;
  --globe-land: #1A242D; --globe-water: #B9C0B6; --focus: #101920;
  --nav-glass: rgba(255, 255, 255, .72); --nav-edge: rgba(16, 25, 32, .12); --nav-disc: rgba(16, 25, 32, .08);
  --bar: rgba(243, 244, 239, .85); --sheet: rgba(255, 255, 255, .94); --press: rgba(16, 25, 32, .06); --swipe-neutral: #C9CEC4;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
  --ground: #F3F4EF; --surface-1: #FFFFFF; --surface-2: #E8EAE3; --surface-rail: #E2E5DE;
  --line: #D3D7CF; --line-strong: #848C82;
  --ink: #101920; --ink-muted: #4E5A63; --ink-faint: #7A8580;
  --signal: #FFE714; --signal-deep: #C9B000; --on-signal: #101920; --signal-ink: #6E5C00;
  --crit: #C2252C; --crit-soft: #FBE3E3; --warn: #9A5300; --warn-soft: #FCEBD2;
  --info: #1F5FBF; --info-soft: #DDE9FA; --ok: #137343; --ok-soft: #DDF3E6;
  --globe-land: #1A242D; --globe-water: #B9C0B6; --focus: #101920;
  --nav-glass: rgba(255, 255, 255, .72); --nav-edge: rgba(16, 25, 32, .12); --nav-disc: rgba(16, 25, 32, .08);
  --bar: rgba(243, 244, 239, .85); --sheet: rgba(255, 255, 255, .94); --press: rgba(16, 25, 32, .06); --swipe-neutral: #C9CEC4;
  color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--ground); color: var(--ink); font: 400 14px/20px var(--font-sans); -webkit-text-size-adjust: 100%; }
/* Anchored like a native app: the page never zooms, pans or bounces. Only the panes scroll, vertically,
   and they don't rubber-band either. touch-action leaves out pinch-zoom and double-tap zoom everywhere. */
html, body { position: fixed; inset: 0; overflow: hidden; overscroll-behavior: none; touch-action: none; }
.pane { touch-action: pan-y; overscroll-behavior: none; }
button, a, input, select, textarea, label { touch-action: manipulation; }
/* App chrome isn't selectable text; long-press doesn't pop the link/image callout. Facts you may copy stay selectable. */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
img { -webkit-user-drag: none; }
input, textarea, select, .detail .msg, .kv dd, .copybox > span, .steptext, .detail .hero .mono { -webkit-user-select: text; user-select: text; }
/* iOS zooms into any focused field under 16px. */
@media (pointer: coarse) { input, select, textarea { font-size: 16px !important; } }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button svg, button img { pointer-events: none; } /* taps land on the button itself (needed for the haptic label) */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: var(--signal-ink); text-decoration: none; }
h1, h2, h3 { margin: 0; }
.mono { font-family: var(--font-mono); font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.muted { color: var(--ink-muted); }
.hidden { display: none !important; }

/* ---------- shell: cover display (default, < 600px wide) ---------- */
/* Pinned to the screen edges rather than sized with 100dvh: in an installed iOS web app dvh can come out short
   (notably after rotating), which left a dead band under the app. */
.shell { position: fixed; inset: 0; display: grid; grid-template-rows: 1fr; }
.left { display: flex; min-height: 0; min-width: 0; position: relative; }
.left .pane { flex: 1; }
.rail { display: none; }
.pane { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) 24px calc(16px + var(--safe-l)); min-width: 0; }
.pane-right { display: none; }
.hinge { display: none; }
/* Tab bar: a floating glass capsule (iOS 26 style). Content scrolls under it; the yellow highlight springs
   from tab to tab, and the active icon fills in. */
.tabs { position: absolute; z-index: 5; left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); bottom: max(10px, calc(var(--safe-b) - 12px));
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); height: 64px; padding: 5px; border-radius: 32px;
  background: rgba(22, 33, 42, .72); -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%);
  border: .5px solid rgba(255, 255, 255, .1); box-shadow: 0 14px 34px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .07); }
.tab-ink { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px) / 4); border-radius: 27px; background: var(--signal);
  transition: transform .5s cubic-bezier(.3, 1.3, .5, 1); }
.tabs:not([data-i]) .tab-ink, .tabs[data-i="-1"] .tab-ink { opacity: 0; }
.tabs[data-i="1"] .tab-ink { transform: translateX(100%); }
.tabs[data-i="2"] .tab-ink { transform: translateX(200%); }
.tabs[data-i="3"] .tab-ink { transform: translateX(300%); }
.tab { position: relative; z-index: 1; height: 54px; border: 0; background: none; color: var(--ink-muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .01em; transition: color .25s; }
.tab svg { width: 24px; height: 24px; transition: transform .2s cubic-bezier(.3, 1.3, .5, 1); }
.tab svg .f { fill: currentColor; fill-opacity: 0; transition: fill-opacity .25s; }
.tab:active svg { transform: scale(.86); }
.tab[aria-current="page"] { color: var(--on-signal); }
.tab[aria-current="page"] svg .f { fill-opacity: .22; }
.tab-label { line-height: 13px; }
@media (max-width: 599.98px) {
  /* Content fades out toward the floating bar instead of being cut by an edge. */
  .shell::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; height: calc(72px + var(--safe-b)); pointer-events: none;
    background: linear-gradient(transparent, var(--bar) 70%); }
}
@media (prefers-reduced-motion: reduce) { .tab-ink { transition-duration: .01s; } }

/* ---------- inner display (opened Duo: ≥ 600px) — rail + two panes, gutter on the fold ---------- */
@media (min-width: 600px) {
  .shell {
    grid-template-rows: 1fr;
    /* Fallback: the fold is the physical centre of the screen, so measure from 50vw (not the
       safe-area-padded box: the Duo reports a right inset that would push the gutter off the hinge). */
    grid-template-columns: calc(50vw - var(--hinge) / 2) var(--hinge) 1fr;
    grid-template-areas: "left hinge right";
  }
  .left { grid-area: left; display: flex; min-width: 0; min-height: 0; }
  /* The rail is the same glass capsule as on the cover display, floating in a plain column (no dark strip). */
  .rail { display: flex; flex-direction: column; align-items: center; gap: 8px; width: calc(var(--rail) + var(--safe-l)); flex: none; padding: calc(20px + var(--safe-t)) 0 calc(20px + var(--safe-b)) var(--safe-l); }
  .rail-pill { position: relative; margin: auto 0; width: 48px; padding: 3px; display: flex; flex-direction: column; align-items: center; border-radius: 24px;
    background: var(--nav-glass); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); border: .5px solid var(--nav-edge); }
  .rail-pill[data-i="1"] .side-ink { transform: translateY(48px); }
  .rail-pill[data-i="2"] .side-ink { transform: translateY(96px); }
  .rail-pill[data-i="3"] .side-ink { transform: translateY(144px); }
  .rail-pill:not([data-i]) .side-ink, .rail-pill[data-i="-1"] .side-ink { opacity: 0; }
  .rail .brand { display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
  .rail .brand img { display: block; width: 52px; height: 52px; }
  .left .pane { flex: 1; padding: calc(24px + var(--safe-t)) 20px calc(20px + var(--safe-b)); }
  .hinge { grid-area: hinge; display: block; position: relative; background: var(--surface-rail); }
  .hinge::after { content: ""; position: absolute; left: calc(50% - 1px); top: 0; bottom: 0; width: 2px; background: var(--line); }
  .pane-right { grid-area: right; display: block; padding: calc(24px + var(--safe-t)) calc(20px + var(--safe-r)) calc(20px + var(--safe-b)) 4px; }
  .head h1 { font-size: 22px; line-height: 28px; } /* inner display: both panes use the 22px pane title */
  .tabs { display: none; }
  .cover-only { display: none !important; }
  .brandline svg { display: none; } /* the rail already carries the MX ribbon */
}
@media (max-width: 599.98px) {
  .inner-only { display: none !important; }
  /* A screen is a column: nav bar, then content; the detail fills the rest so its actions can sit at the bottom. */
  .left .pane { display: flex; flex-direction: column; padding-top: 0; padding-bottom: calc(104px + var(--safe-b)); }
  .left .pane > .detail { flex: 1 0 auto; min-height: 0; }
  .head { margin-top: 0; }
}

/* Progressive enhancement: Safari's Viewport Segments API (feature flag in Safari 27.1).
   When the browser reports two side-by-side segments, put the gutter exactly on the hinge. */
@media (horizontal-viewport-segments: 2) {
  .shell {
    grid-template-columns:
      env(viewport-segment-width 0 0)
      calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0))
      env(viewport-segment-width 1 0);
    padding: 0;
  }
  .hinge { min-width: var(--hinge); }
}
/* Tabletop (half folded, hinge horizontal): top half = glance, bottom half = touch. */
@media (vertical-viewport-segments: 2) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: env(viewport-segment-height 0 0) calc(env(viewport-segment-top 0 1) - env(viewport-segment-bottom 0 0)) 1fr;
    grid-template-areas: "left" "hinge" "right";
  }
  .rail { display: none; }
  .tabs { display: none; }
  .left .pane, .pane-right { display: block; }
  body[data-tabletop] .left .pane { pointer-events: none; } /* tilted away from the finger: read-only */
}

/* ---------- headers ---------- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.head h1 { font-size: 28px; line-height: 32px; font-weight: 600; letter-spacing: -0.02em; }
.head h2 { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.02em; }
.brandline { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-pill); font-size: 13px; font-weight: 500; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
.pulse { animation: pulse 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { padding: 12px; border-radius: var(--radius-md); background: var(--surface-1); border: 1px solid var(--line); }
.stat b { display: block; margin-bottom: 6px; font: italic 800 30px/1 var(--font-display); letter-spacing: -0.02em; white-space: nowrap; }
.stat b small { font-size: 18px; }
.stat b .den { font-style: inherit; color: var(--ink-faint); }
@media (max-width: 599.98px) { .stat b { font-size: 24px; } .stat b small { font-size: 15px; } } /* three 30px numbers don't fit the cover's width */
.stat span { display: block; font-size: 12px; line-height: 16px; color: var(--ink-muted); }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { height: 32px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: none; font-size: 12px; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }

/* ---------- alert card (the sketch: name, latest, banner, history) ---------- */
.feed { display: flex; flex-direction: column; gap: 12px; }
.card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px; border-radius: var(--radius-lg); background: var(--surface-1); border: 1.5px solid var(--line); text-align: left; width: 100%; }
.card[data-sev="crit"] { border-color: var(--crit); }
.card[data-sev="warn"] { border-color: var(--warn); }
.card[data-sev="info"] { border-color: var(--info); }
.card[data-status="resolved"], .card[data-status="acked"] { border-color: var(--line); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mono-tile { width: 36px; height: 36px; flex: none; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; color: var(--ground); background: var(--ink-faint); overflow: hidden; }
.mono-tile img { width: 100%; height: 100%; object-fit: contain; background: var(--surface-2); }
.mono-tile[data-sev="crit"] { background: var(--crit); } .mono-tile[data-sev="warn"] { background: var(--warn); }
.mono-tile[data-sev="info"] { background: var(--info); } .mono-tile[data-sev="ok"] { background: var(--ok); }
.mono-tile[data-sev="none"] { background: var(--surface-2); color: var(--ink-muted); border: 1px solid var(--line-strong); }
.card-side { display: flex; align-items: flex-start; }
.name { font-size: 16px; line-height: 22px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner { width: 112px; height: 44px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.banner img { width: 100%; height: 100%; object-fit: cover; }
.foot { grid-column: 1 / -1; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.msg { font-size: 14px; line-height: 20px; color: var(--ink); overflow-wrap: anywhere; }
.btn { min-height: 44px; padding: 0 16px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.primary { background: var(--signal); color: var(--on-signal); border-color: var(--signal); font-weight: 600; }
.btn.primary:active { background: var(--signal-deep); }
.btn.danger { color: var(--crit); border-color: var(--crit); }
.btn[disabled] { opacity: .45; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .btn { flex: 1 1 140px; }

/* ---------- badges ---------- */
.badge { font: 500 11px/14px var(--font-mono); letter-spacing: .08em; padding: 4px 8px; border-radius: var(--radius-sm); white-space: nowrap; }
.badge[data-sev="crit"] { background: var(--crit-soft); color: var(--crit); }
.badge[data-sev="warn"] { background: var(--warn-soft); color: var(--warn); }
.badge[data-sev="info"] { background: var(--info-soft); color: var(--info); }
.badge[data-sev="ok"] { background: var(--ok-soft); color: var(--ok); }

/* ---------- list rows (alert history, services) ---------- */
.list { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 10px; border-radius: var(--radius-md); border: 1px solid transparent; background: none; text-align: left; width: 100%; }
.row[aria-current="true"] { background: var(--surface-2); border-color: var(--line-strong); }
.row .bar { width: 4px; align-self: stretch; border-radius: 2px; flex: none; }
.row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .mono { font-size: 11px; }
.row .title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; }
.svc .top { display: flex; align-items: center; gap: 8px; }
.group-label { font: 500 11px/14px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); margin: 12px 10px 2px; }
.group-label:first-child { margin-top: 0; }

/* ---------- detail ---------- */
.detail { display: flex; flex-direction: column; gap: 14px; min-height: 100%; }
.detail > :is(.hero, .stats, .panel, .kv, .figure, .list, .msg, .actions, .steps) { margin-top: 0; margin-bottom: 0; } /* the column's gap is the only spacing, so every block sits the same distance apart */
.detail .actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.detail .actions.pinned { margin-top: auto; }
.detail .hero { display: flex; align-items: center; gap: 12px; }
.detail .hero .mono-tile { width: 44px; height: 44px; }
.detail h2 { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.02em; }
.figure { margin: 0; border-radius: 12px; background: var(--surface-rail); border: 1px solid var(--line); overflow: hidden; }
.figure img { display: block; width: 100%; max-height: 360px; object-fit: contain; background: #000; }
.figure figcaption { padding: 8px 12px; border-top: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kv div { padding: 10px; border-radius: var(--radius-md); background: var(--surface-1); border: 1px solid var(--line); }
.kv dt { font-size: 11px; color: var(--ink-muted); } .kv dd { margin: 0; font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }

/* ---------- globe ---------- */
.globe-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px 0 16px; }
.globe { width: min(100%, 320px); aspect-ratio: 1; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.globe.dragging { cursor: grabbing; }
@media (min-width: 600px) {
  .globe { width: min(100%, 360px); }
  .nexus { min-height: 100%; display: flex; flex-direction: column; }
  .nexus .globe-wrap { flex: 1; justify-content: center; margin-bottom: 0; }
}

/* ---------- empty, forms, login ---------- */
.empty { padding: 32px 12px; text-align: center; color: var(--ink-muted); border: 1px dashed var(--line); border-radius: var(--radius-lg); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--ink-muted); }
.field input, .field select { height: 44px; padding: 0 12px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface-2); }
.panel { padding: 14px; border-radius: var(--radius-lg); background: var(--surface-1); border: 1px solid var(--line); margin-bottom: 12px; }
.panel h3 { font-size: 16px; line-height: 22px; font-weight: 600; margin-bottom: 6px; }
.login { position: fixed; inset: 0; background: var(--ground); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 10; }
.login form { width: min(100%, 340px); display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.login .logo { display: flex; justify-content: center; margin-bottom: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(84px + max(10px, calc(var(--safe-b) - 12px))); transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--ink); color: var(--ground);
  padding: 10px 18px; border-radius: var(--radius-pill); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 50;
  animation: toast-in .32s cubic-bezier(.2, .8, .2, 1) both; pointer-events: none; }
.toast.out { animation: toast-out .22s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 8px); } }
/* Inner display: never on the fold. Toasts and sheets belong to the right pane. */
@media (min-width: 600px) { .toast { left: calc(75vw + var(--hinge) / 4); bottom: calc(24px + var(--safe-b)); max-width: calc(50vw - 48px); } }

/* ---------- settings ---------- */
.grow-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.small { font-size: 12px; line-height: 17px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.navrow { min-height: 60px; gap: 12px; }
.navrow .title { font-size: 15px; font-weight: 600; }
.navrow svg:last-child { color: var(--ink-muted); flex: none; }
.navicon { width: 36px; height: 36px; flex: none; border-radius: var(--radius-md); background: var(--surface-1); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.signout { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding: 0 10px; font-size: 12px; }

.box { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-1); overflow: hidden; margin-bottom: 12px; }
.boxrow { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 12px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; width: 100%; }
.boxrow:first-child { border-top: 0; }
.boxrow > svg { color: var(--ink-muted); flex: none; }
.boxrow .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.boxrow .title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.boxrow .mono { font-size: 11px; }
.boxrow .grow-label { font-weight: 500; }
.boxrow.sub { background: var(--surface-2); flex-wrap: wrap; }
.badge[data-sev="none"] { background: var(--surface-2); color: var(--ink-muted); }

.expander { border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface-1); margin-bottom: 12px; }
.expander-head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 12px; border: 0; background: none; text-align: left; font-size: 14px; font-weight: 600; }
.expander-head .grow-label { flex-direction: row; }
.expander-head .step { font-size: 11px; font-weight: 400; }
.expander-head > svg:last-child { color: var(--ink-muted); }
.expander[data-open="true"] .expander-head { border-bottom: 1px solid var(--line); }
.expander-body { padding: 12px; }
.expander-body .field { margin-bottom: 0; }
.label { font-size: 12px; color: var(--ink-muted); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }
.mono-input { font-family: var(--font-mono); font-size: 13px; }
.chips.static { margin: 0; gap: 6px; }
.chips.static .chip { height: 26px; display: inline-flex; align-items: center; background: var(--surface-2); border-color: var(--line); font-size: 12px; }
.expander .chips { margin-bottom: 0; }
.chip.dashed { border-style: dashed; color: var(--ink-muted); }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.choice { padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: none; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.choice b { font-size: 13px; font-weight: 600; line-height: 17px; }
.choice span { font-size: 11px; color: var(--ink-muted); }
.choice[aria-pressed="true"] { border: 1.5px solid var(--ink); background: var(--surface-2); }
.formfoot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-muted); margin-bottom: 4px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 14px; }
.expander-body .group-label { margin: 12px 0 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tiles.two { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.apptile { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: none; text-align: left; min-width: 0; }
.apptile.big { background: var(--surface-2); }
.apptile .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.apptile b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apptile .grow span { font-size: 11px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mono-tile.app { background: var(--line); color: var(--ink); width: 32px; height: 32px; font-size: 12px; }
.expander-body p.small { margin: 12px 0 0; }

.setup .hero { gap: 10px; }
.setup .hero .mono-tile.app { width: 40px; height: 40px; font-size: 14px; }
.iconbtn { width: 36px; height: 36px; flex: none; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; gap: 10px; }
.steps .num { width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-strong); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.stepbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.steptext { font-size: 14px; line-height: 20px; color: var(--ink); }
.steptext b { color: var(--ink); font-weight: 600; }
.copybox { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 4px 0 10px; border-radius: 8px; background: var(--surface-rail); border: 1px solid var(--line); }
.copybox > span { flex: 1; min-width: 0; font: 12px/16px var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copybox .btn { flex: none; }
.detail .pinned { margin-top: auto; }
.showunder { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-1); border: 1px solid var(--line); }
.showunder select, .ruleform select { height: 36px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 14px; width: 100%; }

.panel.tight { padding: 10px 12px; }
.devrow { display: flex; align-items: center; gap: 10px; }
.devrow .grow-label b { font-size: 14px; }
.devrow .mono { font-size: 11px; }
.nswitch { flex: none; margin: 0; accent-color: var(--ok); } /* a real iOS switch: native look and haptic */
.seg { display: flex; gap: 4px; padding: 3px; border-radius: 9px; background: var(--surface-rail); border: 1px solid var(--line); }
.seg button { flex: 1; min-height: 32px; padding: 0 8px; border-radius: 6px; border: 0; background: none; color: var(--ink); font-size: 12px; display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--ground); font-weight: 600; }
.seg .dot { width: 7px; height: 7px; }
.ruleform { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: center; }
.during { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.during .seg { flex: 1 1 160px; }
.during input { height: 36px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); font-family: var(--font-mono); }

/* Inline links are ink + underline: signal yellow is kept for the next action only. */
.muted a, .small a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

/* =================== native feel =================== */
/* ---------- nav bar (cover display) ---------- */
.navbar { display: none; }
@media (max-width: 599.98px) {
  .navbar { position: sticky; top: 0; z-index: 3; flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
    min-height: calc(44px + var(--safe-t)); padding: var(--safe-t) calc(16px + var(--safe-r)) 0 calc(16px + var(--safe-l));
    margin: 0 calc(-16px - var(--safe-r)) 2px calc(-16px - var(--safe-l)); border-bottom: .5px solid transparent; transition: background-color .2s, border-color .2s; }
  .navbar[data-scrolled] { background: var(--bar); -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%); border-bottom-color: var(--line); }
  .nav-title { max-width: 52vw; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
  .navbar[data-titled] .nav-title { opacity: 1; transform: none; }
  .nav-back { justify-self: start; display: flex; align-items: center; gap: 6px; height: 44px; min-width: 0; margin-left: -8px; padding: 0 8px; border: 0; background: none; color: var(--ink); font-size: 16px; transition: opacity .15s; }
  .nav-back span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-back:active { opacity: .45; }
}

/* ---------- tab / rail badges ---------- */
.nav-badge { position: absolute; top: 4px; left: calc(50% + 4px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--crit); color: #fff;
  font: 600 11px/18px var(--font-sans); text-align: center; box-shadow: 0 0 0 2px var(--surface-1); pointer-events: none; }
.tab[aria-current="page"] .nav-badge { box-shadow: 0 0 0 2px var(--signal); }
.nav-badge[data-sev="warn"] { background: var(--warn); color: var(--ground); }

/* ---------- press states (iOS dims or shrinks what you touch) ---------- */
.row, .boxrow, .apptile, .choice { transition: background-color .2s; }
.row:active, .boxrow:active, .apptile:active, .choice:active, .expander-head:active { background: var(--surface-2); transition: none; }
.btn, .chip, .iconbtn, .seg button { transition: transform .12s, filter .12s, background-color .2s; }
.btn:active, .chip:active, .iconbtn:active, .seg button:active { transform: scale(.96); }
.btn:not(.primary):active { filter: brightness(1.25); }
.card { transition: transform .18s, border-color .2s; }
.card:has(.who:active) { transform: scale(.985); }

/* ---------- swipe actions on alert cards ---------- */
.swipe { position: relative; border-radius: var(--radius-lg); }
.swipe-face { position: relative; z-index: 1; }
.swipe .row.swipe-face:not([aria-current="true"]) { background: var(--ground); }
.swipe:has(> .row), .swipe:has(> .row) .swipe-actions { border-radius: var(--radius-md); }
.swipe-btn.neutral { background: var(--swipe-neutral); color: var(--ink); }
.swipe-btn.open { background: var(--ink); color: var(--ground); }
a.swipe-btn { text-decoration: none; }
.swipe-actions { position: absolute; inset: 1px; display: flex; justify-content: flex-end; border-radius: var(--radius-lg); overflow: hidden; visibility: hidden; background: var(--surface-2); }
.swipe[data-active] .swipe-actions, .swipe[data-open] .swipe-actions { visibility: visible; }
.swipe-btn { width: 72px; flex: 0 0 auto; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 600; transition: flex-grow .25s cubic-bezier(.2, .8, .2, 1); }
.swipe-btn.ack { background: var(--signal); color: var(--on-signal); }
.swipe-btn.resolve { background: var(--ok); color: var(--ground); }
.swipe-btn.del { background: var(--crit-soft); color: var(--crit); } /* destructive: never a solid red fill */
.swipe-btn:active { filter: brightness(.85); }
.swipe[data-full] .swipe-btn:first-child { flex-grow: 1; } /* a full swipe stretches the first action across, as in Mail */

/* ---------- pull to refresh ---------- */
.ptr { position: absolute; z-index: 4; top: calc(var(--safe-t) + 54px); left: calc(50% - 14px); width: 28px; height: 28px; color: var(--ink-muted); opacity: 0; pointer-events: none; }
.ptr svg { display: block; }
.ptr circle { transform: rotate(-90deg); transform-origin: center; stroke-dasharray: 0 100; }
.ptr.spin { opacity: 1 !important; transform: none !important; }
.ptr.spin svg { animation: spin .8s linear infinite; }
.ptr.spin circle { stroke-dasharray: 70 100 !important; }
@keyframes spin { to { transform: rotate(360deg); } }
.pane[data-pulling] > :not(.navbar) { transform: translateY(var(--pull, 0px)); transition: var(--pull-t, none); }
@media (min-width: 600px) { .ptr { top: calc(var(--safe-t) + 16px); left: calc(var(--rail) + var(--safe-l) + (100% - var(--rail) - var(--safe-l)) / 2 - 14px); } }

/* ---------- swipe back (cover display) ---------- */
.left .pane.underlay { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: var(--ground); filter: brightness(.65); transform: translateX(-30%); }
.left .pane.lifted { position: relative; z-index: 1; background: var(--ground); box-shadow: -12px 0 32px rgba(0, 0, 0, .5); }

/* ---------- page transitions (View Transitions API) ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-group(page), ::view-transition-group(detail) { animation-duration: 0s; }
@media (max-width: 599.98px) { #left { view-transition-name: page; } .tabs { view-transition-name: tabs; } }
@media (min-width: 600px) { #right { view-transition-name: detail; } }
html[data-nav="push"]::view-transition-old(page) { animation: .4s cubic-bezier(.2, .8, .2, 1) both nav-under; }
html[data-nav="push"]::view-transition-new(page) { animation: .4s cubic-bezier(.2, .8, .2, 1) both nav-in; }
html[data-nav="pop"]::view-transition-old(page) { animation: .34s cubic-bezier(.2, .8, .2, 1) both nav-out; z-index: 1; }
html[data-nav="pop"]::view-transition-new(page) { animation: .34s cubic-bezier(.2, .8, .2, 1) both nav-from-under; }
@keyframes nav-in { from { transform: translateX(100%); } }
@keyframes nav-under { to { transform: translateX(-30%); filter: brightness(.65); } }
@keyframes nav-out { to { transform: translateX(100%); } }
@keyframes nav-from-under { from { transform: translateX(-30%); filter: brightness(.65); } }
html[data-nav="detail"]::view-transition-old(detail) { animation: .14s ease-out both fade-out; }
html[data-nav="detail"]::view-transition-new(detail) { animation: .26s cubic-bezier(.2, .8, .2, 1) both detail-in; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes detail-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- action sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); animation: fade-in .25s both; }
.sheet { position: relative; width: min(100%, 420px); padding: 0 8px calc(8px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; animation: sheet-up .34s cubic-bezier(.2, .8, .2, 1) both; }
.sheet-card { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: var(--sheet); -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%); }
.sheet-head { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; text-align: center; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.sheet-head b { color: var(--ink); font-size: 14px; font-weight: 600; }
.sheet-form { padding: 0 14px 14px; }
.sheet-input { width: 100%; height: 44px; padding: 0 12px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface-rail); }
.sheet-btn { min-height: 56px; border: 0; border-top: .5px solid var(--line); background: none; color: var(--ink); font-size: 18px; }
.sheet-card > .sheet-btn:first-child { border-top: 0; }
.sheet-btn.danger { color: var(--crit); }
.sheet-btn.primary { color: var(--signal-ink); font-weight: 600; }
.sheet-btn.cancel { border: 0; border-radius: 14px; background: var(--surface-2); font-weight: 600; }
.sheet-btn:active { background: var(--press); }
.sheet-wrap.out .sheet { animation: sheet-down .24s ease-in both; }
.sheet-wrap.out .sheet-backdrop { animation: fade-out .24s both; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(110%); } }
@media (min-width: 600px) { .sheet-wrap { padding-left: calc(50vw + var(--hinge) / 2); } } /* centred in the right pane, clear of the fold */

/* ---------- offline + first-launch skeleton ---------- */
.offline { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius-md); background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.skeleton { display: flex; flex-direction: column; gap: 12px; padding-top: calc(52px + var(--safe-t)); }
.skeleton i { display: block; height: 16px; border-radius: var(--radius-md); background: linear-gradient(90deg, var(--surface-1) 30%, var(--surface-2) 50%, var(--surface-1) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton .stats { margin: 0; } .skeleton .stats i { height: 58px; }
.skeleton .sk-card { height: 112px; border-radius: var(--radius-lg); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (min-width: 600px) { .skeleton { padding-top: 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton i, .ptr.spin svg { animation-duration: 3s; } .toast, .sheet, .sheet-backdrop { animation-duration: .01s; } }

/* ---------- haptic switches: an invisible native switch over a button takes the tap and ticks ---------- */
.chip, .choice, .seg button, .btn, .swipe-btn, .sheet-btn, .tab, .side-btn { position: relative; }
.hx { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; margin: 0; padding: 0; opacity: .0001; cursor: pointer;
  -webkit-appearance: none; appearance: none; border-radius: inherit; }
@supports (-webkit-touch-callout: none) { .hx { -webkit-appearance: auto; appearance: auto; } } /* iOS needs the real switch */

/* ---------- iPhone Duo cover display: side rail (like Music) ----------
   "column": the page owns the status column (a right inset), so the capsules sit in it.
   "inside": the usual case for a web app: the capsules sit at the right edge of the page, next to the column,
   with a gutter kept free for them. */
.side-actions, .sidetabs { display: none; }
html[data-siderail] { --rail-w: 48px; --rail-right: calc(var(--safe-r) + 6px); --gutter: calc(var(--rail-w) + 14px + var(--safe-r)); }
html[data-siderail="column"] { --rail-right: calc((var(--safe-r) - var(--rail-w)) / 2); --gutter: calc(16px + var(--safe-r)); }
html[data-siderail] .tabs, html[data-siderail] .shell::after, html[data-siderail] .navbar { display: none; }
html[data-siderail] .left .pane { padding-top: calc(28px + var(--safe-t)); padding-right: var(--gutter); padding-bottom: calc(28px + var(--safe-b)); }
html[data-siderail] .sidetabs, html[data-siderail] .side-actions {
  position: absolute; z-index: 5; right: var(--rail-right); width: var(--rail-w); padding: 3px;
  display: flex; flex-direction: column; align-items: center; border-radius: calc(var(--rail-w) / 2);
  background: var(--nav-glass); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border: .5px solid var(--nav-edge); }
html[data-siderail] .sidetabs { bottom: max(24px, var(--safe-b)); view-transition-name: sidetabs; }
/* Back sits in its own capsule near the top, where Music keeps its screen actions. */
html[data-siderail] .side-actions { top: calc(var(--safe-t) + 28px); opacity: 0; transform: scale(.6); pointer-events: none;
  transition: opacity .2s, transform .3s cubic-bezier(.3, 1.3, .5, 1); view-transition-name: sideactions; }
html[data-siderail="column"] .side-actions { top: calc(var(--safe-t) + 172px); } /* under the clock and Wi-Fi */
html[data-siderail] .side-actions[data-show] { opacity: 1; transform: none; pointer-events: auto; }
.side-btn { z-index: 1; width: 42px; height: 48px; border: 0; padding: 0; background: none; color: var(--ink);
  display: flex; align-items: center; justify-content: center; transition: color .25s; }
.side-btn svg { width: 25px; height: 25px; transition: transform .2s cubic-bezier(.3, 1.3, .5, 1); }
.side-actions .side-btn { height: 42px; }
.side-actions .side-btn svg { width: 13px; height: 22px; }
.side-btn:active svg { transform: scale(.84); }
.side-btn svg .f { fill: currentColor; fill-opacity: 0; transition: fill-opacity .25s; }
.side-btn[aria-current="page"] { color: var(--signal-ink); }
.side-btn[aria-current="page"] svg .f { fill-opacity: .25; }
/* the active tab's lighter disc slides between items */
.side-ink { position: absolute; left: 3px; top: 6px; width: 42px; height: 42px; border-radius: 21px; background: var(--nav-disc);
  transition: transform .5s cubic-bezier(.3, 1.3, .5, 1); }
.sidetabs:not([data-i]) .side-ink, .sidetabs[data-i="-1"] .side-ink { opacity: 0; }
.sidetabs[data-i="1"] .side-ink { transform: translateY(48px); }
.sidetabs[data-i="2"] .side-ink { transform: translateY(96px); }
.sidetabs[data-i="3"] .side-ink { transform: translateY(144px); }
.side-btn .nav-badge { top: 4px; left: auto; right: -4px; box-shadow: 0 0 0 2px var(--surface-2); }
/* toasts, spinner and sheets centre on the content, not under the rail */
html[data-siderail] .toast { left: calc((100vw - var(--gutter) + 16px) / 2); bottom: calc(24px + var(--safe-b)); max-width: calc(100vw - var(--gutter) - 32px); }
html[data-siderail] .ptr { top: calc(var(--safe-t) + 10px); left: calc((100% - var(--gutter) + 16px) / 2 - 14px); }
html[data-siderail] .sheet-wrap { padding-right: calc(var(--gutter) - 16px); }
@media (prefers-reduced-motion: reduce) { .side-ink, .side-actions { transition-duration: .01s; } }
.brandline .mono { white-space: nowrap; }
.globe-wrap > .mono { text-align: center; text-wrap: balance; }
.list-end { display: flex; justify-content: center; margin-top: 24px; }
.list-end .btn { min-width: 220px; }

/* ---------- pulse line (services) ---------- */
canvas.pulse { display: block; width: 100%; height: 30px; }
canvas.pulse.big { height: 72px; }
.axis { display: flex; justify-content: space-between; margin-top: 4px; font: 400 10px/12px var(--font-mono); color: var(--ink-faint); }
.pulse-sample { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--line); }
.pulse-sample .top { display: flex; align-items: center; gap: 8px; }
.pulse-sample .title { flex: 1; font-weight: 500; }
.panel.tight .seg { width: 100%; }

/* The mark has a dark and a light version; show the one made for the current ground. */
.on-light { display: none !important; }
:root[data-theme="light"] .on-dark { display: none !important; }
:root[data-theme="light"] .on-light { display: block !important; }
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .on-dark { display: none !important; }
  :root[data-theme="system"] .on-light { display: block !important; }
}

/* Stat numbers shrink to fit their tile (e.g. "96.1%" on the narrow cover display) instead of spilling out. */
.stat { container-type: inline-size; min-width: 0; }
.stat b { font-size: min(30px, 27cqi); }
.stat b small { font-size: .6em; }
@media (max-width: 599.98px) { .stat b { font-size: min(24px, 27cqi); } .stat b small { font-size: .6em; } }
.signout .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.signout { flex-direction: column; align-items: stretch; gap: 10px; }
.signout .actions { justify-content: stretch; }
.signout .actions .btn { flex: 1 1 0; }
