/*
  Plumb: uptime and status monitoring dashboard (Screenery template)
  Dark hairline terminal minimalism: near-black ground, 1px lines at low alpha, IBM Plex Sans for words,
  Azeret Mono for every measured thing (times, ms, %, hosts). Colour only means state: green up, amber degraded, red down.
  The app fills the viewport: sticky sidebar, sticky top bar, six views, side sheets and modals as native dialogs.

  Contents
   1. Tokens
   2. Base and browser surfaces
   3. Primitives: icons, glyphs, buttons, chips, selects, switches, fields
   4. Shell: sidebar, top bar, banner, footer, tab bar
   5. Monitors: summary, toolbar, table, uptime bars, check log
   6. Sheets and modals
   7. Charts and response times
   8. Incidents and postmortem
   9. Maintenance
  10. Alert rules
  11. Status page and preview
  12. Loading, empty, error, tooltip, toasts
  13. Motion
  14. Narrow screens
*/

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: dark;

  /* Ground: near-black with a faint green cast, like a phosphor terminal switched off */
  --bg: #090a09;
  --bg-1: #0d0e0d;      /* sidebar, raised panels */
  --bg-2: #121412;      /* hover, inputs */
  --bg-3: #181a18;      /* pressed, selected */

  /* Hairlines */
  --line: rgba(232, 236, 228, .085);
  --line-2: rgba(232, 236, 228, .14);
  --line-3: rgba(232, 236, 228, .24);

  /* Text */
  --text: #e7e9e4;
  --text-2: #b1b5ad;
  --text-3: #8b9087;    /* lowest text tone: 5.6:1 on --bg, 5.2:1 on --bg-2 */

  /* State: the only colours on the page */
  --up: #53d17c;
  --deg: #f0b43c;
  --down: #f4615a;
  --none: #262926;      /* a day without data */
  --up-bar: #33884f;    /* bars a step quieter than the glyph so faults read first */
  --deg-soft: rgba(240, 180, 60, .1);
  --down-soft: rgba(244, 97, 90, .1);

  /* Type */
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "Azeret Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --fs-xs: 11.5px;
  --fs-sm: 12px;
  --fs: 13px;
  --fs-md: 14.5px;
  --fs-lg: 20px;

  /* Space, radius, size */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  --r: 3px;
  --r-lg: 6px;
  --side-w: 236px;
  --top-h: 56px;
  --tab-h: 62px;

  /* Depth for overlays only: offset and soft blur */
  --sh: 0 18px 48px -12px rgba(0, 0, 0, .8), 0 4px 12px -4px rgba(0, 0, 0, .5);

  /* Motion */
  --ease: cubic-bezier(.16, 1, .3, 1);
  --t: 180ms;
}

/* ---------- 2. Base and browser surfaces ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line-3) var(--bg); scrollbar-width: thin; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs)/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  caret-color: var(--up); accent-color: var(--up);
}
::selection { background: rgba(83, 209, 124, .28); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border: 3px solid var(--bg); border-radius: 10px; }
h1, h2, h3, h4, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
h1, h2, h3, h4 { font-weight: 500; text-wrap: balance; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 1.5px solid var(--text); outline-offset: 2px; border-radius: var(--r); }
.mono, code, kbd, time { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: var(--fs-sm); letter-spacing: -.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.defs { position: absolute; }
.muted { color: var(--text-3); }
.dim { color: var(--text-3); }
[hidden] { display: none !important; }
.skip { position: absolute; left: 8px; top: -40px; z-index: 100; padding: 8px 12px; background: var(--text); color: var(--bg); border-radius: var(--r); }
.skip:focus { top: 8px; }

/* ---------- 3. Primitives ---------- */
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 14px; height: 14px; }

/* State glyphs: shape and colour both carry the meaning */
.g { display: inline-block; flex: none; width: 8px; height: 8px; vertical-align: middle; }
.g-up { background: var(--up); border-radius: 50%; }
.g-deg { width: 0; height: 0; border-left: 4.5px solid transparent; border-right: 4.5px solid transparent; border-bottom: 8px solid var(--deg); }
.g-down { background: var(--down); }
.g-paused { width: 8px; border-left: 2px solid var(--text-3); border-right: 2px solid var(--text-3); }
.g-pending { border: 1.5px solid var(--text-2); border-radius: 50%; }
.g-none { background: var(--none); outline: 1px solid var(--line-3); outline-offset: -1px; }

.st { font-size: var(--fs-sm); color: var(--text-2); }
.st-up { color: var(--up); }
.st-deg { color: var(--deg); }
.st-down { color: var(--down); }

.kbd {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px;
  border: 1px solid var(--line-2); border-radius: var(--r); color: var(--text-3);
  font-size: 10.5px; line-height: 1; background: transparent;
}

.btn {
  display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r); background: transparent; color: var(--text);
  font-size: var(--fs); font-weight: 500; white-space: nowrap;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.btn:hover { background: var(--bg-2); border-color: var(--line-3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-sm { min-height: 28px; padding: 0 9px; font-size: var(--fs-sm); }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { background: #fff; border-color: #fff; }
.btn-primary:disabled { background: var(--text-3); border-color: var(--text-3); opacity: .7; }
.btn-danger { color: var(--down); border-color: rgba(244, 97, 90, .45); }
.btn-danger:hover { background: var(--down-soft); border-color: var(--down); }
.btn .kbd { color: inherit; border-color: currentColor; opacity: .55; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px;
  border: 1.5px solid var(--bg); border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn:not(.btn-primary).is-busy::after { border-color: var(--text); border-right-color: transparent; }
.icon-btn {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 1px solid transparent; border-radius: var(--r); background: none; color: var(--text-2);
}
.icon-btn:hover { background: var(--bg-2); color: var(--text); border-color: var(--line); }
.linkbtn { padding: 0; border: 0; background: none; color: var(--text); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
.linkbtn:hover { text-decoration-color: var(--text); }
.inline { white-space: nowrap; text-decoration-color: var(--line-3); }
.inline:hover { text-decoration-color: var(--text); }

/* Segmented control and chips */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); padding: 2px; gap: 2px; }
.seg button {
  min-height: 26px; padding: 0 10px; border: 0; border-radius: 2px; background: none;
  color: var(--text-2); font-family: var(--mono); font-size: var(--fs-sm);
}
.seg button:hover { color: var(--text); background: var(--bg-2); }
.seg button[aria-checked="true"] { background: var(--bg-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-3); }
.seg-sm button { font-family: var(--sans); }
.seg-sm button .mono { color: var(--text-3); margin-left: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r); background: none; color: var(--text-2); font-size: var(--fs);
}
.chip .mono { color: var(--text-3); font-size: var(--fs-xs); }
.chip:hover { border-color: var(--line-3); color: var(--text); }
.chip[aria-checked="true"] { border-color: var(--line-3); background: var(--bg-2); color: var(--text); }

.sel { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.sel-l { color: var(--text-3); font-size: var(--fs-sm); }
.sel select {
  appearance: none; min-height: 32px; padding: 0 30px 0 10px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--bg); color: var(--text); font-size: var(--fs);
}
.sel select:hover { border-color: var(--line-3); }
.sel > .i { position: absolute; right: 9px; pointer-events: none; color: var(--text-3); }
.sel-big select { min-width: 220px; }
.sel-field { display: flex; width: 100%; }
.sel-field select { width: 100%; }
select option { background: var(--bg-1); color: var(--text); }

.switch {
  position: relative; width: 34px; height: 20px; flex: none; padding: 0;
  border: 1px solid var(--line-3); border-radius: 10px; background: var(--bg-2);
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.switch span { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--text-3); transition: transform var(--t) var(--ease), background var(--t) var(--ease); }
.switch[aria-checked="true"] { border-color: var(--up); background: rgba(83, 209, 124, .14); }
.switch[aria-checked="true"] span { transform: translateX(14px); background: var(--up); }

.pill { display: inline-block; padding: 1px 7px; border: 1px solid var(--line-2); border-radius: 10px; font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; }
.pill-done { color: var(--up); border-color: rgba(83, 209, 124, .4); }

/* Fields */
.field { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset.field { gap: 8px; }
.f-l { display: flex; justify-content: space-between; gap: 8px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; padding: 0; }
.f-sub { font-weight: 400; color: var(--text-3); }
.f-h { color: var(--text-3); font-weight: 400; font-size: var(--fs-xs); }
.field input[type="text"], .field input[type="number"], .field input[type="date"], .field input[type="time"], .field textarea {
  width: 100%; min-height: 34px; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--bg); color: var(--text); font-size: var(--fs);
}
.field textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field input:hover, .field textarea:hover { border-color: var(--line-3); }
.field input:focus-visible, .field textarea:focus-visible, .sel select:focus-visible { outline: 1.5px solid var(--text); outline-offset: 0; border-color: transparent; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--down); }
.field input[type="date"], .field input[type="time"] { font-family: var(--mono); font-size: var(--fs-sm); color-scheme: dark; }
.f-err { color: var(--down); font-size: var(--fs-sm); min-height: 0; }
.f-err:empty { display: none; }
.err-t { color: var(--down); }
.check { display: flex; align-items: flex-start; gap: 9px; min-height: 26px; font-size: var(--fs); color: var(--text-2); cursor: pointer; }
.check input { margin: 3px 0 0; width: 14px; height: 14px; flex: none; }
.check input:disabled + span { opacity: .55; }
.f-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.f-status { color: var(--text-3); font-size: var(--fs-sm); }
.f-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.f-3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: var(--s3); }
.num { display: flex; align-items: center; gap: 8px; }
.num input { max-width: 110px; font-family: var(--mono); }
.num .mono { color: var(--text-3); }
.cgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; }

/* ---------- 4. Shell ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.side {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--s6);
  padding: var(--s4) var(--s3) 56px; border-right: 1px solid var(--line); background: var(--bg);
}
.brand { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; padding: 2px 8px 0; }
.mark { width: 24px; height: 24px; grid-row: span 2; color: var(--text); }
.mark-bob { fill: var(--up); }
.brand-name { font-weight: 600; font-size: var(--fs-md); letter-spacing: -.01em; line-height: 1.2; }
.brand-org { color: var(--text-3); font-size: var(--fs-sm); line-height: 1.3; }

.nav { display: grid; gap: 1px; }
.nav-a {
  display: grid; grid-template-columns: 16px 1fr auto auto; align-items: center; gap: 10px;
  min-height: 34px; padding: 0 8px; border-radius: var(--r); color: var(--text-2); text-decoration: none;
  border: 1px solid transparent;
}
.nav-a:hover { background: var(--bg-2); color: var(--text); }
.nav-a[aria-current="page"] { color: var(--text); background: var(--bg-2); border-color: var(--line); }
.nav-a[aria-current="page"] .i { color: var(--up); }
.nav-s { display: none; }
.nav-n { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-3); }
.nav-open { color: var(--deg); }
.nav-open.nav-down { color: var(--down); }
.nav-a .kbd { opacity: 0; transition: opacity var(--t) var(--ease); }
.nav-a:hover .kbd, .nav-a:focus-visible .kbd { opacity: 1; }

.side-h { padding: 0 8px 6px; color: var(--text-3); font-size: var(--fs-sm); font-weight: 500; }
.probe-list li { display: grid; grid-template-columns: 8px 34px 1fr auto; align-items: center; gap: 10px; min-height: 26px; padding: 0 8px; }
.probe-city { color: var(--text-2); }
.probe-n { color: var(--text-3); font-size: var(--fs-xs); }

.side-foot { margin-top: auto; display: grid; gap: var(--s3); padding: var(--s3) 8px 0; border-top: 1px solid var(--line); }
.keys { color: var(--text-3); font-size: var(--fs-sm); line-height: 2; }
.keys .kbd { margin: 0 2px; }
.who { display: flex; align-items: center; gap: 10px; font-size: var(--fs); }
.who > span:last-child { display: grid; line-height: 1.35; }
.who-r { color: var(--text-3); font-size: var(--fs-sm); }
.av { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line-3); border-radius: 50%; font-family: var(--mono); font-size: 10.5px; color: var(--text-2); }

.main { display: flex; flex-direction: column; min-width: 0; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  min-height: var(--top-h); padding: 0 var(--s8); background: var(--bg); border-bottom: 1px solid var(--line);
}
.top-l { display: flex; align-items: baseline; gap: var(--s4); min-width: 0; }
.mark-sm { display: none; width: 20px; height: 20px; align-self: center; }
.view-title { font-size: var(--fs-lg); font-weight: 500; letter-spacing: -.015em; white-space: nowrap; }
.clock { color: var(--text-3); white-space: nowrap; }
.clock time { color: var(--text-2); }
.top-r { display: flex; align-items: center; gap: var(--s3); }
.search {
  display: flex; align-items: center; gap: 8px; width: 240px; height: 32px; padding: 0 6px 0 10px;
  border: 1px solid var(--line-2); border-radius: var(--r); color: var(--text-3);
}
.search:focus-within { border-color: var(--text-2); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: var(--fs); color: var(--text); }
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { filter: invert(.7); }

.banner {
  display: flex; align-items: center; gap: var(--s3); margin: var(--s4) var(--s8) 0; padding: 10px 14px;
  border: 1px solid rgba(240, 180, 60, .4); border-radius: var(--r); background: var(--deg-soft); color: var(--text);
}
.banner .i { color: var(--deg); }
.banner p { flex: 1; }

.content { flex: 1; padding: var(--s6) var(--s8) var(--s10); outline: none; min-width: 0; }
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s6); align-content: start; }
.nojs-note { color: var(--text-3); }
.js .nojs-note { display: none; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px var(--s6); padding: var(--s4) var(--s8) var(--s5); border-top: 1px solid var(--line); color: var(--text-3); font-size: var(--fs-sm); }
.foot p { max-width: 80ch; }
.tabbar { display: none; }

.sec-h { font-size: var(--fs-md); font-weight: 500; display: flex; align-items: baseline; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); }
.tool-r { display: flex; align-items: center; gap: var(--s3); }
.tool-note { color: var(--text-3); font-size: var(--fs-sm); max-width: 78ch; }
.frame { border: 1px solid var(--line); border-radius: var(--r-lg); }

/* ---------- 5. Monitors ---------- */
.sum { display: grid; gap: 8px; }
.sum-line { display: flex; align-items: baseline; gap: 12px; font-size: var(--fs-md); color: var(--text-2); max-width: 110ch; }
.sum-line .g { position: relative; top: -1px; }
.sum-line strong { color: var(--text); font-weight: 500; }
.sum-facts { display: flex; flex-wrap: wrap; gap: 4px 0; color: var(--text-3); padding-left: 20px; }
.sum-facts span + span::before { content: ""; display: inline-block; width: 1px; height: 10px; margin: 0 12px; background: var(--line-3); vertical-align: -1px; }
.sum-facts span:first-child { color: var(--text-2); }

.mtable { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mtable thead th { height: 36px; padding: 0 12px; text-align: left; font-weight: 500; font-size: var(--fs-sm); color: var(--text-3); border-bottom: 1px solid var(--line); }
.mtable td, .mtable tbody th { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: left; font-weight: 400; }
.mtable tbody tr:last-child > * { border-bottom: 0; }
.mtable tbody tr:hover { background: rgba(232, 236, 228, .022); }
.c-name { width: 30%; }
.c-state { width: 84px; }
.c-num { width: 88px; text-align: right !important; color: var(--text-2); }
.c-chk { width: 124px; white-space: nowrap; }
.mtable .lab { display: none; }
.scale { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-xs); font-weight: 400; }
.scale span:nth-child(2) { color: var(--text-3); opacity: .9; }

.mname { display: flex; align-items: center; gap: 12px; width: 100%; padding: 2px 0; border: 0; background: none; text-align: left; min-width: 0; }
.mname-t { display: grid; min-width: 0; line-height: 1.35; }
.mname-n { font-weight: 500; color: var(--text); }
.mname-u { color: var(--text-3); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mname:hover .mname-n { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-3); }

/* The uptime bars: one hairline-thin column per day */
.bars { display: flex; align-items: stretch; gap: 1.5px; height: 24px; border-radius: 1px; }
.bars .b { flex: 1 1 0; min-width: 1px; border-radius: .5px; background: var(--up-bar); transition: opacity 120ms; }
.bars .b-deg { background: var(--deg); }
.bars .b-down { background: var(--down); }
.bars .b-none { background: var(--none); }
.bars-wide { gap: 4px; }
.bars:hover .b { opacity: .55; }
.bars .b.is-cur, .bars:hover .b:hover { opacity: 1; box-shadow: 0 0 0 1px var(--text); }
.bars:focus-visible { outline-offset: 4px; }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; border-top: 1px solid var(--line); color: var(--text-3); font-size: var(--fs-sm); }
.legend .g { margin-left: 8px; }
.legend .g:first-child { margin-left: 0; }
.none-row { padding: 28px 12px !important; color: var(--text-3); text-align: center !important; }

.log { border: 1px solid var(--line); border-radius: var(--r-lg); }
.log-head { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); }
.log-head h2 { font-size: var(--fs); font-weight: 500; }
.log-meta { flex: 1; color: var(--text-3); font-size: var(--fs-xs); }
.log-lines { padding: 8px 0; min-height: 120px; }
.ll {
  display: grid; grid-template-columns: 72px 40px 80px minmax(0, 1fr) 70px 80px; gap: 14px;
  padding: 1px 14px; color: var(--text-3); font-size: var(--fs-sm); line-height: 1.75; white-space: nowrap;
}
.ll time { color: var(--text-3); }
.ll-h { overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.ll-ms { text-align: right; color: var(--text-2); }
.ll-deg .ll-ms, .ll-deg .ll-c { color: var(--deg); }
.ll-down .ll-ms, .ll-down .ll-c { color: var(--down); }

/* ---------- 6. Sheets and modals ---------- */
dialog { color: var(--text); padding: 0; border: 0; background: none; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(4, 5, 4, .72); }
.sheet { position: fixed; inset: 0 0 0 auto; width: min(600px, 100vw); height: 100vh; height: 100dvh; margin: 0; }
.sheet-in, .modal-in {
  height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: var(--s5);
  padding: var(--s5) var(--s6) var(--s8); background: var(--bg-1); border-left: 1px solid var(--line-2); box-shadow: var(--sh);
}
.sheet-in > *, .modal-in > * { flex: none; }
.modal { width: min(560px, calc(100vw - 32px)); margin: auto; }
.modal-in { height: auto; max-height: calc(100dvh - 48px); border: 1px solid var(--line-2); border-radius: var(--r-lg); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.sheet-head h2 { font-size: var(--fs-lg); letter-spacing: -.01em; line-height: 1.25; }
.sh-t { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.sh-t .g { position: relative; top: -2px; }
.sh-u { color: var(--text-3); overflow-wrap: break-word; margin-top: 2px; }
.sh-h { font-size: var(--fs); font-weight: 500; color: var(--text-2); margin-top: var(--s2); }
.sheet-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: var(--s4); border-top: 1px solid var(--line); }

.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.facts > div { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.facts dt { color: var(--text-3); font-size: var(--fs-sm); }
.facts dd { margin-top: 2px; overflow-wrap: anywhere; }
.facts-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.tframe { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tframe-scroll { overflow: auto; max-height: 420px; }
.dtable { width: 100%; border-collapse: collapse; font-size: var(--fs); }
.dtable th, .dtable td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--line); font-weight: 400; white-space: nowrap; }
.dtable thead th { color: var(--text-3); font-size: var(--fs-sm); font-weight: 500; background: var(--bg-1); position: sticky; top: 0; }
.dtable tbody tr:last-child > * { border-bottom: 0; }
.dtable td .g { margin-right: 7px; }
.dtable-pin tbody th, .dtable-pin thead th:first-child { position: sticky; left: 0; background: var(--bg-1); z-index: 1; }
.dtable-pin thead th:first-child { z-index: 2; }

.mini-inc { display: grid; border-top: 1px solid var(--line); }
.mini-inc a { display: grid; grid-template-columns: 8px 72px 1fr auto; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); text-decoration: none; }
.mini-inc a:hover span:nth-child(3) { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 7. Charts and response times ---------- */
.chart { position: relative; min-height: 150px; }
.ch { display: block; width: 100%; height: auto; overflow: visible; }
.ch .grid { stroke: var(--line); stroke-width: 1; }
.ch .ax { fill: var(--text-3); font-family: var(--mono); font-size: 10.5px; }
.ch .ln { fill: none; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.ln-50, .ln-0 { stroke: var(--text); }
.ln-95 { stroke: var(--text-3); stroke-dasharray: 3 3; }
.ln-1 { stroke: #b9bdb5; stroke-dasharray: 6 3; }
.ln-2 { stroke: #959a91; stroke-dasharray: 2 3; }
.ln-3 { stroke: #7b8077; stroke-dasharray: 10 3 2 3; }
.ch .dot { fill: var(--bg); stroke-width: 1.5; }
.ch .cross { stroke: var(--line-3); stroke-width: 1; }
.ch .hit { fill: transparent; cursor: crosshair; }
.ch .mk-deg { fill: var(--deg); }
.ch .mk-down { fill: var(--down); }
.ch .mk-up { fill: var(--text-3); }
.ch:focus-visible { outline-offset: 4px; }
.ch-key { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text-2); margin-top: -8px; }
.ch-key span { display: inline-flex; align-items: center; gap: 8px; }
.ch-key .ln { fill: none; stroke-width: 1.5; }

.resp-lede { color: var(--text-2); max-width: 90ch; }
.resp-lede .mono { color: var(--text); }
.tool-note .key-l { display: inline-block; width: 18px; height: 0; border-top: 1.5px solid var(--text); vertical-align: middle; margin: 0 6px 0 0; }
.tool-note .key-95 { border-top: 1.5px dashed var(--text-3); margin-left: 12px; }
.tool-note .key-m { display: inline-block; width: 6px; height: 6px; background: var(--deg); margin: 0 6px 0 12px; vertical-align: middle; }
.rgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.rcard { display: grid; gap: 8px; padding: var(--s4) var(--s4) var(--s3); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.rc-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.rc-head h2 { font-size: var(--fs); font-weight: 500; }
.rc-head h2 .mono { color: var(--text-3); margin-right: 4px; }
.rc-sum { display: flex; gap: 14px; }
.rc-foot { color: var(--text-3); font-size: var(--fs-xs); }
.rtab { display: grid; gap: var(--s3); }
.daily summary { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; color: var(--text-2); list-style: none; }
.daily summary::-webkit-details-marker { display: none; }
.daily summary:hover { color: var(--text); }
.daily[open] summary { margin-bottom: var(--s3); }

/* ---------- 8. Incidents ---------- */
.split { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--r-lg); min-height: 560px; }
.ilist { display: grid; align-content: start; gap: var(--s3); padding: var(--s3); border-right: 1px solid var(--line); }
.inc-list { display: grid; gap: 1px; }
.inc-a {
  display: grid; grid-template-columns: 8px 1fr; gap: 3px 12px; align-items: baseline;
  padding: 10px 10px; border-radius: var(--r); text-decoration: none; border: 1px solid transparent;
}
.inc-a .g { position: relative; top: -1px; }
.inc-a:hover { background: var(--bg-2); }
.inc-a[aria-current="true"] { background: var(--bg-2); border-color: var(--line-2); }
.inc-t { font-weight: 500; line-height: 1.35; }
.inc-m, .inc-s { grid-column: 2; }
.inc-m { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--text-3); font-size: var(--fs-xs); }
.inc-s { color: var(--text-3); font-size: var(--fs-sm); }
.inc-s strong { font-weight: 500; }

.idetail { display: grid; gap: var(--s5); align-content: start; padding: var(--s5) var(--s6) var(--s8); min-width: 0; }
.idetail .back { display: none; justify-self: start; }
.pad { padding: var(--s4); }
.id-head { display: grid; gap: 6px; }
.id-id { color: var(--text-3); }
.id-head h2 { font-size: var(--fs-lg); letter-spacing: -.01em; line-height: 1.25; max-width: 40ch; }
.id-st { display: flex; align-items: center; gap: 9px; }
.id-st strong { font-weight: 500; font-size: var(--fs); }

.tl { display: grid; position: relative; margin-left: 4px; }
.tl li { position: relative; display: grid; grid-template-columns: 136px 1fr; gap: 2px 16px; padding: 0 0 18px 20px; border-left: 1px solid var(--line-2); }
.tl li:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl li::before { content: ""; position: absolute; left: -4px; top: 6px; width: 7px; height: 7px; background: var(--bg); border: 1px solid var(--text-3); border-radius: 50%; }
.tl li:first-child::before { background: var(--text); border-color: var(--text); }
.tl time { color: var(--text-3); grid-row: span 2; padding-top: 1px; }
.tl strong { font-weight: 500; }
.tl p { color: var(--text-2); max-width: 68ch; }

.uform { display: grid; gap: var(--s3); padding: var(--s4); border: 1px solid var(--line-2); border-radius: var(--r-lg); }
.uform .sh-h { margin-top: 0; color: var(--text); }
.uf-row { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s3) var(--s5); }
.uf-row .field { width: 200px; }

.pm { display: grid; gap: var(--s3); padding-top: var(--s5); border-top: 1px solid var(--line); }
.pm-h { font-size: var(--fs-md); }
.pm h4 { font-size: var(--fs); font-weight: 500; margin-top: var(--s3); }
.pm-p { color: var(--text-2); max-width: 70ch; }
.pm-impact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.pm-impact > div { padding: 9px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pm-impact dt { color: var(--text-3); font-size: var(--fs-sm); }
.pm-impact dd { color: var(--text); }
.pm-tl li { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line); color: var(--text-2); }
.pm-tl time { color: var(--text-3); }
.pm-act td { white-space: normal; vertical-align: top; }
.pm-act td:first-child { min-width: 220px; }
.pm-none { padding-top: var(--s3); border-top: 1px solid var(--line); }

/* ---------- 9. Maintenance ---------- */
.strip { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px 12px; }
.strip-days { display: grid; grid-template-columns: repeat(16, 1fr); }
.strip-days span { display: grid; justify-items: center; font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-3); padding-bottom: 6px; line-height: 1.4; }
.strip-days b { font-weight: 400; color: var(--text-3); opacity: .85; }
.strip-days .is-today { color: var(--text); }
.strip-track {
  position: relative; height: 34px; border-top: 1px solid var(--line-2);
  background: linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / calc(100% / 16) 100%;
}
.win { position: absolute; top: 7px; height: 14px; min-width: 6px; border: 1px solid var(--text-2); background: rgba(232, 236, 228, .35); border-radius: 1px; }
.win-past { border-color: var(--text-3); opacity: .7; }
.sinc { position: absolute; bottom: 2px; width: 3px; height: 6px; transform: translateX(-1px); }
.sinc-down { background: var(--down); }
.sinc-deg { background: var(--deg); }
.now-mk { position: absolute; top: -1px; bottom: 0; width: 1px; background: var(--up); }
.now-mk span { position: absolute; bottom: -2px; left: 5px; color: var(--up); font-size: var(--fs-xs); background: var(--bg); padding: 0 2px; }

.wlist { display: grid; border-top: 1px solid var(--line); margin-top: var(--s3); }
.wrow { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: var(--s5); padding: var(--s4) 2px; border-bottom: 1px solid var(--line); }
.w-when { display: grid; color: var(--text-2); align-content: start; }
.w-when span:last-child { color: var(--text-3); }
.w-what { display: grid; gap: 4px; }
.w-what h3 { font-size: var(--fs-md); }
.w-what h3 .mono { font-size: var(--fs-xs); margin-left: 6px; }
.w-what > p { color: var(--text-2); max-width: 72ch; }
.w-meta { display: flex; flex-wrap: wrap; gap: 4px 0; color: var(--text-3) !important; font-size: var(--fs-sm); }
.w-meta span + span::before { content: ""; display: inline-block; width: 1px; height: 10px; margin: 0 10px; background: var(--line-3); }
.w-act { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* ---------- 10. Alert rules ---------- */
.rtable { width: 100%; border-collapse: collapse; }
.rtable thead th { height: 36px; padding: 0 12px; text-align: left; font-weight: 500; font-size: var(--fs-sm); color: var(--text-3); border-bottom: 1px solid var(--line); }
.rtable td, .rtable tbody th { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-weight: 400; }
.rtable tbody tr:last-child > * { border-bottom: 0; }
.rtable .is-off .rname, .rtable .is-off .rcond, .rtable .is-off .rch { color: var(--text-3); }
.c-sw { width: 58px; }
.c-sw .switch { margin-top: 1px; }
.rname { font-weight: 500; text-decoration-color: transparent; text-align: left; }
.rname:hover { text-decoration-color: var(--line-3); }
.rt { display: block; font-size: var(--fs-sm); }
.rcond { color: var(--text-2); }
.rch { display: flex; flex-direction: column; gap: 2px; color: var(--text-2); font-size: var(--fs-sm); }
.rch .mono { font-size: var(--fs-xs); }
.rlast { color: var(--text-3); white-space: nowrap; }
.fired { display: grid; border-top: 1px solid var(--line); margin-top: var(--s3); }
.fired li { display: grid; grid-template-columns: 150px 8px 1fr auto; align-items: center; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.fired time { color: var(--text-3); }

.kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.kind { position: relative; }
.kind input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.kind span { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r); color: var(--text-2); }
.kind input:checked + span { border-color: var(--text); color: var(--text); background: var(--bg-3); }
.kind input:focus-visible + span { outline: 1.5px solid var(--text); outline-offset: 2px; }
.params { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); }
.field-n { width: auto; }
.r-preview { padding: 10px 12px; border: 1px dashed var(--line-3); border-radius: var(--r); color: var(--text-2); line-height: 1.6; }

/* ---------- 11. Status page ---------- */
.sp { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); gap: var(--s6); align-items: start; }
.sp-set { display: grid; gap: var(--s4); position: sticky; top: calc(var(--top-h) + var(--s5)); }
.sp-g { display: grid; gap: 0; }
.sp-gn { color: var(--text-3); font-size: var(--fs-xs); margin: 6px 0 2px; font-family: var(--mono); }
.sp-note { font-size: var(--fs-sm); }
.dirty { color: var(--deg); }

.browser { border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden; min-width: 0; }
.br-bar { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 12px; border-bottom: 1px solid var(--line-2); background: var(--bg-1); }
.br-dots { display: flex; gap: 6px; }
.br-dots i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--line-3); }
.br-url { flex: 1; max-width: 360px; margin: 0 auto; padding: 3px 10px; border: 1px solid var(--line); border-radius: var(--r); color: var(--text-2); text-align: center; font-size: var(--fs-xs); }

/* The public page itself: the same ground, quieter, wider spacing */
.pub { display: grid; gap: var(--s6); padding: var(--s8) clamp(16px, 5%, 56px) var(--s8); max-width: 820px; margin: 0 auto; }
.pub-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.pub-brand { font-size: var(--fs-lg); font-weight: 500; letter-spacing: -.01em; }
.pub-sub { color: var(--text-3); font-size: var(--fs-sm); }
.pub-state { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: var(--r-lg); font-size: var(--fs-md); }
.pub-state strong { font-weight: 500; }
.pub-deg { border-color: rgba(240, 180, 60, .45); background: var(--deg-soft); }
.pub-down { border-color: rgba(244, 97, 90, .5); background: var(--down-soft); }
.pub-up { border-color: rgba(83, 209, 124, .35); }
.pub-inc { display: grid; gap: 6px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: var(--r-lg); }
.pub-inc h3 { font-size: var(--fs-md); }
.pub-inc p { color: var(--text-2); max-width: 70ch; }
.pub-g { display: grid; gap: 2px; }
.pub-g > h3 { font-size: var(--fs); font-weight: 500; color: var(--text-2); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pub-c { display: grid; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.pub-cn { display: flex; justify-content: space-between; gap: 12px; }
.pub-cm { display: flex; justify-content: space-between; gap: 8px; color: var(--text-3); font-size: var(--fs-xs); }
.pub-cm span:nth-child(2) { color: var(--text-2); }
.pub-w { display: grid; gap: 3px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pub-w > p:last-child { color: var(--text-2); max-width: 70ch; }
.pub-foot { font-size: var(--fs-sm); text-align: center; }

/* ---------- 12. Loading, empty, error, tooltip, toasts ---------- */
.sk-wrap { display: grid; gap: var(--s3); }
.sk { display: block; border-radius: 2px; background: linear-gradient(90deg, var(--bg-2) 0%, var(--bg-3) 50%, var(--bg-2) 100%) 0 0 / 300% 100%; }
.sk-line { height: 14px; width: min(640px, 80%); }
.sk-short { width: min(420px, 55%); margin-bottom: var(--s4); }
.sk-frame { padding: 4px 0; }
.sk-row { display: grid; grid-template-columns: 26% 1fr 70px 70px; gap: 24px; align-items: center; padding: 14px 12px; border-bottom: 1px solid var(--line); }
.sk-row:last-child { border-bottom: 0; }
.sk-a { height: 26px; }
.sk-bars { height: 24px; }
.sk-n { height: 12px; }
.sk-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s4); }
.sk-block { height: 200px; }
.sk-note { color: var(--text-3); }

.panel-msg { display: grid; justify-items: start; gap: var(--s3); max-width: 560px; margin: var(--s8) auto; padding: var(--s8); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-msg h2 { font-size: var(--fs-lg); }
.panel-msg p { color: var(--text-2); }
.pm-art { width: 120px; height: 64px; margin-bottom: var(--s2); }
.pm-line { stroke: var(--text-2); stroke-width: 1.2; fill: none; }
.pm-bob { fill: var(--up); }
.pm-bob-down { fill: var(--down); }
.pm-ground { stroke: var(--line-3); stroke-width: 1; fill: none; }
.pm-code { color: var(--text-3); padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: var(--r); }

.tip {
  position: fixed; z-index: 60; pointer-events: none; white-space: pre; max-width: 280px;
  padding: 7px 10px; background: var(--bg-1); border: 1px solid var(--line-3); border-radius: var(--r);
  color: var(--text); font-size: var(--fs-xs); line-height: 1.6; box-shadow: var(--sh);
}
.toasts { position: fixed; right: var(--s6); bottom: var(--s6); z-index: 70; display: grid; gap: 8px; justify-items: end; }
.toast { max-width: 380px; padding: 10px 14px; background: var(--bg-1); border: 1px solid var(--line-3); border-radius: var(--r); box-shadow: var(--sh); }
.toast.out { opacity: 0; transition: opacity 400ms; }

/* ---------- 13. Motion ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
@keyframes line-in { from { background: rgba(232, 236, 228, .07); } to { background: transparent; } }
@keyframes sweep { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: no-preference) {
  .sk { animation: shimmer 1.6s linear infinite; }
  .ll-new { animation: line-in 1.4s var(--ease); }
  /* Signature moment: the bars draw left to right, oldest day first, like a probe filling its log */
  .js .mtable .bars { animation: sweep 900ms var(--ease) both; }
  .js .mtable tbody tr:nth-child(2) .bars { animation-delay: 40ms; }
  .js .mtable tbody tr:nth-child(3) .bars { animation-delay: 80ms; }
  .js .mtable tbody tr:nth-child(4) .bars { animation-delay: 120ms; }
  .js .mtable tbody tr:nth-child(n+5) .bars { animation-delay: 160ms; }
  .sheet[open] .sheet-in { animation: sheet-in 260ms var(--ease); }
  .modal[open] .modal-in { animation: modal-in 220ms var(--ease); }
  .toast { animation: modal-in 220ms var(--ease); }
}
@keyframes sheet-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes modal-in { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 14. Narrow screens ---------- */
@media (max-width: 1240px) {
  .search { width: 180px; }
  .c-name { width: 27%; }
  .c-chk { display: none; }
  .ll { grid-template-columns: 68px 36px 72px minmax(0, 1fr) 54px 74px; gap: 10px; }
}
@media (max-width: 1100px) {
  :root { --side-w: 64px; }
  .side { padding: var(--s4) 10px; align-items: center; }
  .brand { padding: 0; }
  .brand-name, .brand-org, .nav-l, .nav-n, .nav-a .kbd, .probes, .keys, .who > span:last-child { display: none; }
  .mark { grid-row: auto; }
  .nav-a { grid-template-columns: 16px; justify-content: center; width: 42px; min-height: 40px; padding: 0; }
  .side-foot { padding: var(--s3) 0 0; border-top: 0; }
  .top, .content, .foot { padding-left: var(--s6); padding-right: var(--s6); }
  .banner { margin-left: var(--s6); margin-right: var(--s6); }
  .sp { grid-template-columns: 1fr; }
  .sp-set { position: static; }
  .facts-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
  .clock { display: none; }
}

@media (max-width: 900px) {
  :root { --top-h: 52px; }
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .mark-sm { display: block; }
  .clock { display: inline; font-size: var(--fs-xs); }
  .top { flex-wrap: wrap; gap: 8px 12px; padding: 10px var(--s4); }
  .top-l { gap: 10px; align-items: center; }
  .top-r { flex: 1 1 100%; justify-content: space-between; }
  .search { flex: 1; width: auto; }
  .content { padding: var(--s5) var(--s4) calc(var(--tab-h) + var(--s8)); }
  .banner { margin: var(--s3) var(--s4) 0; align-items: flex-start; flex-wrap: wrap; }
  .foot { padding: var(--s4) var(--s4) calc(var(--tab-h) + var(--s5)); }

  /* Bottom bar */
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(6, 1fr);
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg); border-top: 1px solid var(--line-2);
  }
  .tabbar a { position: relative; display: grid; justify-items: center; align-content: center; gap: 4px; color: var(--text-3); text-decoration: none; font-size: var(--fs-xs); }
  .tabbar a[aria-current="page"] { color: var(--text); }
  .tabbar a[aria-current="page"] .i { color: var(--up); }
  .tabbar .tab-dot { position: absolute; top: 9px; left: calc(50% + 7px); width: 6px; height: 6px; border-radius: 50%; background: var(--deg); }
  .toasts { left: var(--s4); right: var(--s4); bottom: calc(var(--tab-h) + var(--s3)); justify-items: stretch; }
  .toast { max-width: none; }

  /* Monitor table becomes stacked cards */
  .mtable, .mtable tbody, .mtable tr { display: block; }
  .mtable thead { display: none; }
  .mtable tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name state" "bars bars" "n1 n2"; gap: 10px 12px; padding: 14px 14px; border-bottom: 1px solid var(--line); }
  .mtable tbody tr:last-child { border-bottom: 0; }
  .mtable td, .mtable tbody th { display: block; padding: 0; border: 0; width: auto; }
  .mtable .c-name { grid-area: name; min-width: 0; }
  .mtable .c-state { grid-area: state; align-self: center; justify-self: end; text-align: right; }
  .mtable .c-bars { grid-area: bars; }
  .mtable .c-num { text-align: left !important; display: flex; gap: 8px; align-items: baseline; }
  .mtable .c-up { grid-area: n1; }
  .mtable .c-p50 { grid-area: n2; justify-content: flex-end; }
  .mtable .lab { display: inline; font-family: var(--sans); color: var(--text-3); font-size: var(--fs-sm); }
  .mtable .c-chk { display: none; }
  .mtable .none-row { display: block; }
  .bars { height: 28px; gap: 1px; }
  .bars-wide { gap: 4px; }

  .ll { grid-template-columns: 62px 34px minmax(0, 1fr) 70px; gap: 10px; }
  .ll-v, .ll-c { display: none; }

  .rgrid { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; min-height: 0; }
  .ilist { border-right: 0; }
  .split.has-sel .ilist { display: none; }
  .split:not(.has-sel) .idetail { display: none; }
  .idetail { padding: var(--s4); }
  .idetail .back { display: inline-flex; }
  .wrow { grid-template-columns: 1fr; gap: var(--s2); }
  .w-meta { gap: 2px 14px; }
  .w-meta span + span::before { display: none; }
  .w-act { flex-direction: row; align-items: center; justify-content: space-between; }

  /* Alert rules: rows become cards */
  .rtable, .rtable tbody, .rtable tr { display: block; }
  .rtable thead { display: none; }
  .rtable tbody tr { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 6px 4px; padding: 14px 12px; border-bottom: 1px solid var(--line); }
  .rtable tbody tr:last-child { border-bottom: 0; }
  .rtable td, .rtable tbody th { display: block; padding: 0; border: 0; }
  .rtable .c-sw { grid-row: span 4; }
  .rtable .rlast::before { content: "Last fired "; font-family: var(--sans); }
  .fired li { grid-template-columns: 8px 1fr auto; }
  .fired time { grid-column: 1 / -1; }

  .sheet { width: 100vw; }
  .sheet-in { padding: var(--s4) var(--s4) var(--s8); border-left: 0; }
  .modal-in { padding: var(--s4); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .f-3 { grid-template-columns: 1fr 1fr; }
  .f-3 .field:first-child { grid-column: 1 / -1; }
  .tl li { grid-template-columns: 1fr; padding-left: 16px; }
  .tl time { grid-row: auto; }
  .pm-impact { grid-template-columns: 1fr; }
  .panel-msg { margin: var(--s4) 0; padding: var(--s5); }
}

@media (max-width: 480px) {
  .view-title { font-size: 18px; }
  .sum-line { font-size: var(--fs); }
  .sum-facts { padding-left: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
  .sum-facts span + span::before { display: none; }
  .toolbar { align-items: stretch; }
  .tool-r { width: 100%; justify-content: space-between; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s4) 2px; scrollbar-width: none; }
  .chip { flex: none; }
  .cgrid { grid-template-columns: 1fr; }
  .sel-big { width: 100%; }
  .sel-big select { flex: 1; min-width: 0; }
  .seg button { padding: 0 8px; }
  .pub { padding: var(--s5) var(--s4); }
  .pub-cm span:first-child, .pub-cm span:last-child { display: none; }
  .pub-cm { justify-content: flex-start; }
  .facts-4, .facts { grid-template-columns: 1fr 1fr; }
  .rc-sum { gap: 10px; }
  .city { display: none; }
  .dtable th, .dtable td { padding: 7px 9px; }
}

/* Gallery badge (641-900px): a strip below the bottom tabs so the badge never covers one */
@media (min-width: 641px) and (max-width: 900px) {
  .tabbar { height: calc(var(--tab-h) + 44px + env(safe-area-inset-bottom)); padding-bottom: calc(44px + env(safe-area-inset-bottom)); }
  .content { padding-bottom: calc(var(--tab-h) + 44px + var(--s8)); }
  .foot { padding-bottom: calc(var(--tab-h) + 44px + var(--s5)); }
  .toasts { bottom: calc(var(--tab-h) + 44px + var(--s3)); }
}
