/* Monx design system.
   Colour carries state only: up, down, failing, recovering, idle. Actions and
   navigation stay neutral. Every colour is a token; dark and light define the
   same token set (guarded by tests/test_templates_shell.py). */

/* ---------- reset ----------
   Browser defaults removed once, for every page. It sits in a cascade layer, so every rule
   below outranks it whatever its specificity. */
@layer reset {
    *, ::before, ::after, ::backdrop, ::file-selector-button { box-sizing: border-box; border: 0 solid; margin: 0; padding: 0; }
    html {
        -webkit-text-size-adjust: 100%; tab-size: 4; line-height: 1.5;
        -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
    }
    hr { height: 0; color: inherit; border-top-width: 1px; }
    abbr:where([title]) { text-decoration: underline dotted; }
    h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }
    a { color: inherit; text-decoration: inherit; }
    b, strong { font-weight: bolder; }
    code, kbd, samp, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 1em; }
    small { font-size: 80%; }
    sub, sup { vertical-align: baseline; font-size: 75%; line-height: 0; position: relative; }
    sub { bottom: -0.25em; }
    sup { top: -0.5em; }
    table { text-indent: 0; border-color: inherit; border-collapse: collapse; }
    progress { vertical-align: baseline; }
    summary { display: list-item; }
    ol, ul, menu { list-style: none; }
    img, svg, video, canvas, audio, iframe, embed, object { vertical-align: middle; display: block; }
    img, video { max-width: 100%; height: auto; }
    button, input, select, optgroup, textarea, ::file-selector-button {
        font: inherit; font-feature-settings: inherit; font-variation-settings: inherit; letter-spacing: inherit;
        color: inherit; opacity: 1; background-color: transparent; border-radius: 0;
    }
    ::placeholder { opacity: 1; color: color-mix(in oklab, currentColor 50%, transparent); }
    textarea { resize: vertical; }
    ::-webkit-search-decoration { -webkit-appearance: none; }
    ::-webkit-date-and-time-value { min-height: 1lh; text-align: inherit; }
    ::-webkit-datetime-edit { display: inline-flex; padding-block: 0; }
    ::-webkit-datetime-edit-fields-wrapper { padding: 0; }
    ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field,
    ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field,
    ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field { padding-block: 0; }
    ::file-selector-button { margin-inline-end: 4px; }
    :-moz-focusring { outline: auto; }
    :-moz-ui-invalid { box-shadow: none; }
    button, input:where([type="button"], [type="reset"], [type="submit"]), ::file-selector-button { appearance: button; }
    ::-webkit-inner-spin-button, ::-webkit-outer-spin-button { height: auto; }
    button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; }
}

/* ---------- tokens ---------- */
:root, [data-theme="dark"] {
    --mx-bg: #0e1417;
    --mx-side: #0e1417;
    --mx-surface: #141c20;
    --mx-raised: #1b252a;
    --mx-line: #25323a;
    --mx-line-soft: #1c272d;
    --mx-text: #e6eceb;
    --mx-text-2: #9aa9ad;
    --mx-text-3: #6a7a80;
    --mx-action-bg: #e6eceb;
    --mx-action-text: #0e1417;
    --mx-up: #3dbe7b;
    --mx-down: #f0565b;
    --mx-warn: #e5a93b;
    --mx-recovering: #5aa9e6;
    --mx-idle: #4a5960;
    --mx-down-wash: #1d1a1e;
    --mx-focus: #8fc7ff;
    --mx-chip: #1b252a;
    --mx-chip-shadow: none;
    --mx-card-shadow: none;
    --mx-strip-up: #1f6a48;
    --mx-strip-idle: #2b383e;
    --mx-scrim: rgba(0, 0, 0, 0.6);
    --mx-heat-1: #33454d;
    --mx-heat-2: #4f646d;
    --mx-heat-3: #7a8f97;
    --mx-heat-4: #b4c2c6;
    color-scheme: dark;
    --mx-chart-1: #2b383e;
    --mx-chart-2: #3d4d55;
    --mx-chart-3: #5a6b73;
    --mx-chart-4: #8fa0a6;
    --mx-series: #7a8b92;
}

[data-theme="light"] {
    --mx-bg: #f7f8f7;
    --mx-side: #eceeed;
    --mx-surface: #ffffff;
    --mx-raised: #f4f6f5;
    --mx-line: #d5dcd9;
    --mx-line-soft: #e6eae8;
    --mx-text: #11181b;
    --mx-text-2: #4a595e;
    --mx-text-3: #6b7a80;
    --mx-action-bg: #11181b;
    --mx-action-text: #ffffff;
    --mx-up: #18874f;
    --mx-down: #cb2f36;
    --mx-warn: #a86f08;
    --mx-recovering: #2473b8;
    --mx-idle: #a9b5b8;
    --mx-down-wash: #fdf2f2;
    --mx-focus: #1f6fc4;
    --mx-chip: #ffffff;
    --mx-chip-shadow: 0 0 0 1px #d5dcd9, 0 1px 2px rgba(17, 24, 27, 0.06);
    --mx-card-shadow: 0 1px 2px rgba(17, 24, 27, 0.04), 0 8px 24px -12px rgba(17, 24, 27, 0.10);
    --mx-strip-up: #86cfa8;
    --mx-strip-idle: #d3dadb;
    --mx-scrim: rgba(17, 24, 27, 0.4);
    --mx-heat-1: #c9d3d2;
    --mx-heat-2: #a3b2b3;
    --mx-heat-3: #7b8c91;
    --mx-heat-4: #4f5f64;
    color-scheme: light;
    --mx-chart-1: #dfe5e4;
    --mx-chart-2: #c3cdcc;
    --mx-chart-3: #9aa9ad;
    --mx-chart-4: #6b7a80;
    --mx-series: #74848a;
}

/* ---------- fonts ----------
   Served from static/fonts, never from another host. One variable file per subset, cut with
   pyftsubset from the upstream variable TTF (Schibsted Grotesk 1.100, JetBrains Mono 2.211;
   github.com/google/fonts, ofl/). The browser fetches a file only when the page shows a
   character in its unicode-range. A file that changes gets a new name: url() here carries no
   content version. Licence: OFL.txt in each folder. */
@font-face {
    font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400 900; font-display: swap;
    src: url('fonts/schibsted-grotesk/schibsted-grotesk-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400 900; font-display: swap;
    src: url('fonts/schibsted-grotesk/schibsted-grotesk-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'JetBrains Mono'; font-style: normal; font-weight: 100 800; font-display: swap;
    src: url('fonts/jetbrains-mono/jetbrains-mono-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'JetBrains Mono'; font-style: normal; font-weight: 100 800; font-display: swap;
    src: url('fonts/jetbrains-mono/jetbrains-mono-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- base ---------- */
html { background: var(--mx-bg); }
html, body { min-height: 100%; margin: 0; }
body {
    background: var(--mx-bg);
    color: var(--mx-text);
    font-family: 'Schibsted Grotesk', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--mx-focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.mx-app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.mx-main { min-width: 0; }

.mx-side {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column;
    padding: 22px 14px 14px;
    background: var(--mx-side);
    border-right: 1px solid var(--mx-line-soft);
}
.mx-brand {
    display: flex; align-items: center; gap: 10px; padding: 0 10px 22px;
    font-size: 19px; font-weight: 700; letter-spacing: -0.02em; color: var(--mx-text);
}
.mx-brand img { width: 22px; height: 22px; }

.mx-nav-group { margin-bottom: 18px; }
.mx-nav-label { padding: 0 10px 6px; font-size: 12px; color: var(--mx-text-3); }
.mx-nav-link {
    display: flex; align-items: center; justify-content: space-between;
    height: 34px; padding: 0 10px; border-radius: 7px;
    color: var(--mx-text-2); font-weight: 500;
}
.mx-nav-link:hover { color: var(--mx-text); }
.mx-nav-link[aria-current="page"] { background: var(--mx-chip); box-shadow: var(--mx-chip-shadow); color: var(--mx-text); }
.mx-nav-link--sub { height: 30px; padding-left: 22px; font-size: 13px; }

.mx-side-foot {
    margin-top: auto; display: flex; align-items: center; gap: 6px;
    padding: 12px 6px 0; border-top: 1px solid var(--mx-line-soft);
}
.mx-account { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; color: var(--mx-text-2); font-size: 13px; }
.mx-account:hover { color: var(--mx-text); }
.mx-account span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-avatar {
    flex: none; width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--mx-chip); box-shadow: var(--mx-chip-shadow);
    color: var(--mx-text); font-size: 12px; font-weight: 600;
}
.mx-icon-btn {
    width: 30px; height: 30px; border-radius: 7px; flex: none;
    display: grid; place-items: center;
    color: var(--mx-text-3); background: none; border: 0; cursor: pointer;
}
.mx-icon-btn:hover { background: var(--mx-chip); color: var(--mx-text); }
.mx-icon-btn svg { width: 16px; height: 16px; }
.mx-icon-btn:disabled { opacity: 0.4; cursor: default; }

/* theme switch shows the icon for the theme it switches to */
.mx-when-light { display: none; }
[data-theme="light"] .mx-when-light { display: revert; }
[data-theme="light"] .mx-when-dark { display: none; }

/* ---------- page ---------- */
.mx-page { padding: 34px 40px 80px; max-width: 1180px; width: 100%; }
.mx-page-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.mx-page-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--mx-text-2); }

.mx-btn {
    display: inline-flex; align-items: center; gap: 7px;
    height: 36px; padding: 0 14px; border-radius: 8px; border: 0; cursor: pointer;
    font: inherit; font-weight: 600;
    background: var(--mx-action-bg); color: var(--mx-action-text);
}
.mx-btn:hover { opacity: 0.9; }
.mx-btn--quiet { background: none; color: var(--mx-text-2); box-shadow: inset 0 0 0 1px var(--mx-line); }
.mx-btn--quiet:hover { color: var(--mx-text); opacity: 1; }

/* the watch line: page state as one sentence */
.mx-watch { margin: 0 0 6px; font-size: 34px; line-height: 1.15; font-weight: 600; letter-spacing: -0.025em; }
.mx-watch-sub { margin: 0 0 30px; color: var(--mx-text-2); font-size: 15px; }

.mx-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.mx-tabs { display: flex; gap: 2px; }
.mx-tab {
    display: inline-flex; align-items: center; height: 32px; padding: 0 11px; border-radius: 7px;
    color: var(--mx-text-2); font-weight: 500;
}
.mx-tab:hover { color: var(--mx-text); }
.mx-tab[aria-current="true"] { background: var(--mx-chip); box-shadow: var(--mx-chip-shadow); color: var(--mx-text); }
.mx-tab-count { margin-left: 5px; color: var(--mx-text-3); }

.mx-input {
    height: 34px; padding: 0 12px; border-radius: 8px; font: inherit;
    background: var(--mx-surface); border: 1px solid var(--mx-line); color: var(--mx-text);
}
.mx-input::placeholder { color: var(--mx-text-3); }
.mx-input--search { width: 240px; }

/* ---------- sentinel list ---------- */
.mx-list {
    background: var(--mx-surface); border: 1px solid var(--mx-line); border-radius: 12px;
    overflow: hidden; box-shadow: var(--mx-card-shadow);
}
.mx-list-cols, .mx-row {
    display: grid; align-items: center; column-gap: 20px;
    grid-template-columns: minmax(0, 1fr) 300px 84px 96px 32px;
    padding: 0 18px 0 20px;
}
.mx-list-cols { height: 38px; font-size: 12px; color: var(--mx-text-3); border-bottom: 1px solid var(--mx-line); }
.mx-num { text-align: right; }
.mx-row { position: relative; min-height: 62px; border-bottom: 1px solid var(--mx-line-soft); color: var(--mx-text); }
.mx-row:last-child { border-bottom: 0; }
.mx-row:hover { background: var(--mx-raised); }
.mx-row[data-state="down"] { background: var(--mx-down-wash); }
.mx-row[data-state="down"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--mx-down); }
.mx-row[data-state="paused"] .mx-row-name, .mx-row[data-state="paused"] .mx-row-resp { color: var(--mx-text-3); }

.mx-row-ident { display: flex; align-items: center; gap: 13px; min-width: 0; padding: 11px 0; color: inherit; }
.mx-row-ident > span:last-child { min-width: 0; }
.mx-row-name, .mx-row-meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-row-name { font-weight: 600; }
.mx-row-meta { font-size: 13px; color: var(--mx-text-2); }
.mx-row[data-state="down"] .mx-row-meta { color: var(--mx-down); }
.mx-row[data-state="failing"] .mx-row-meta { color: var(--mx-warn); }
.mx-row-resp { font-weight: 500; }
.mx-row-ago { color: var(--mx-text-2); font-size: 13px; }

.mx-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--mx-idle); }
[data-state="up"] > .mx-row-ident .mx-dot { background: var(--mx-up); }
[data-state="down"] > .mx-row-ident .mx-dot { background: var(--mx-down); }
[data-state="failing"] > .mx-row-ident .mx-dot { background: var(--mx-warn); }
[data-state="recovering"] > .mx-row-ident .mx-dot { background: var(--mx-recovering); }

.mx-strip { display: flex; gap: 2px; height: 22px; align-items: stretch; }
.mx-strip i { flex: 1; border-radius: 1.5px; background: var(--mx-strip-idle); }
.mx-strip i[data-s="up"] { background: var(--mx-strip-up); }
.mx-strip i[data-s="down"] { background: var(--mx-down); }
.mx-strip i[data-s="failing"] { background: var(--mx-warn); }

.mx-empty { padding: 56px 24px; text-align: center; color: var(--mx-text-2); }
.mx-empty h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; color: var(--mx-text); }
.mx-empty p { margin: 0 0 18px; }

.mx-pager { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 16px; color: var(--mx-text-2); font-size: 13px; }

/* ---------- toast ---------- */
.mx-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.mx-toast {
    display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 400px;
    padding: 11px 12px 11px 14px; border-radius: 10px; pointer-events: auto;
    background: var(--mx-raised); color: var(--mx-text);
    border: 1px solid var(--mx-line); border-left: 3px solid var(--mx-text-3);
    box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.5);
    font-size: 13px; font-weight: 500;
}
.mx-toast span { flex: 1; }
.mx-toast[data-type="success"] { border-left-color: var(--mx-up); }
.mx-toast[data-type="error"] { border-left-color: var(--mx-down); }
.mx-toast[data-type="warning"] { border-left-color: var(--mx-warn); }
.mx-toast[data-type="info"] { border-left-color: var(--mx-recovering); }

/* ---------- detail page ---------- */
.mx-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mx-btn:disabled { opacity: 0.5; cursor: default; }
.mx-btn--danger { background: var(--mx-down); color: #fff; }
.mx-muted { color: var(--mx-text-2); }
a.mx-page-title:hover { color: var(--mx-text); }

.mx-headline { display: flex; align-items: flex-start; gap: 14px; }
.mx-headline .mx-dot { width: 12px; height: 12px; margin-top: 14px; }
.mx-watch--long { max-width: 30ch; overflow-wrap: anywhere; }
[data-monitor-state="up"] .mx-dot, [data-state="up"] > .mx-dot { background: var(--mx-up); }
[data-monitor-state="down"] .mx-dot, [data-state="down"] > .mx-dot { background: var(--mx-down); }
[data-monitor-state="failing"] .mx-dot { background: var(--mx-warn); }
[data-monitor-state="recovering"] .mx-dot { background: var(--mx-recovering); }

.mx-notice {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    margin-bottom: 24px; padding: 14px 16px; border-radius: 10px;
    background: var(--mx-surface); border: 1px solid var(--mx-line); border-left: 3px solid var(--mx-text-3);
}
.mx-notice[data-kind="warn"] { border-left-color: var(--mx-warn); }
.mx-notice[data-kind="ok"] { border-left-color: var(--mx-up); }
.mx-notice p { margin: 2px 0 0; color: var(--mx-text-2); }

.mx-facts { display: flex; gap: 48px; flex-wrap: wrap; margin: 0 0 30px; }
.mx-facts dt { font-size: 13px; color: var(--mx-text-2); }
.mx-facts dd { margin: 2px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.mx-facts a, .mx-event a { color: inherit; text-decoration: underline; text-decoration-color: var(--mx-text-3); text-underline-offset: 3px; }

.mx-panel {
    margin-bottom: 20px; background: var(--mx-surface); border: 1px solid var(--mx-line);
    border-radius: 12px; overflow: hidden; box-shadow: var(--mx-card-shadow);
}
.mx-panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    min-height: 48px; padding: 7px 18px 7px 20px; border-bottom: 1px solid var(--mx-line);
}
.mx-panel-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.mx-panel-tools { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.mx-panel-tools .mx-icon-btn { font-size: 18px; }
.mx-panel-empty { margin: 0; padding: 32px 20px; text-align: center; color: var(--mx-text-2); }

.mx-seg { display: flex; padding: 2px; border-radius: 8px; background: var(--mx-raised); box-shadow: inset 0 0 0 1px var(--mx-line-soft); }
.mx-seg button {
    height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: none; cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 500; color: var(--mx-text-2);
}
.mx-seg button[aria-pressed="true"] { background: var(--mx-surface); color: var(--mx-text); box-shadow: var(--mx-chip-shadow); }

.mx-chart { height: 320px; padding: 18px 20px 6px; }
.mx-legend { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; padding: 6px 20px 18px; font-size: 13px; color: var(--mx-text-2); }
.mx-legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 2px; }
.mx-legend [data-series="1"]::before { background: var(--mx-chart-1); }
.mx-legend [data-series="2"]::before { background: var(--mx-chart-2); }
.mx-legend [data-series="3"]::before { background: var(--mx-chart-3); }
.mx-legend [data-series="4"]::before { background: var(--mx-chart-4); }
/* Same tint as the outage bands of the chart: OUTAGE_BAND_OPACITY in js/monx-charts.js. */
.mx-legend [data-series="outage"]::before { background: color-mix(in srgb, var(--mx-down) 24%, transparent); }

.mx-table-wrap { overflow-x: auto; }
.mx-table { width: 100%; border-collapse: collapse; background: none; }
.mx-table th, .mx-table td { padding: 12px 20px; text-align: left; white-space: nowrap; background: none; }
.mx-table th { font-size: 12px; font-weight: 400; color: var(--mx-text-3); border-bottom: 1px solid var(--mx-line); background: none; }
.mx-table td { border-top: 1px solid var(--mx-line-soft); }
.mx-table tbody tr:first-child td { border-top: 0; }
.mx-table .mx-num { text-align: right; }
.mx-result[data-state="up"] { color: var(--mx-up); }
.mx-result[data-state="down"] { color: var(--mx-down); }

.mx-event { display: flex; align-items: baseline; gap: 13px; padding: 12px 20px; border-top: 1px solid var(--mx-line-soft); }
.mx-panel-head + .mx-event { border-top: 0; }
.mx-event-body { flex: 1; min-width: 0; }
.mx-event-detail { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 13px; color: var(--mx-text-2); }
.mx-event-error { color: var(--mx-down); }
.mx-event time { font-size: 13px; white-space: nowrap; }

.mx-modal-scrim { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: var(--mx-scrim); }
.mx-modal { width: 100%; max-width: 440px; padding: 24px; border-radius: 14px; background: var(--mx-surface); border: 1px solid var(--mx-line); }
.mx-modal h3 { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.mx-modal p { margin: 0 0 22px; color: var(--mx-text-2); }

/* ---------- detail layout: main column and side rail ---------- */
.mx-page--detail { max-width: 1400px; }
.mx-detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.mx-detail-rail .mx-panel-head { min-height: 44px; }
.mx-detail-rail .mx-line { padding-left: 20px; padding-right: 18px; }
.mx-panel-note { margin: 0; padding: 14px 20px; font-size: 13px; color: var(--mx-text-2); }
.mx-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 16px; }
.mx-band > div { flex-basis: 0; }
.mx-panel-head a.mx-muted { font-size: 13px; }
.mx-panel-head a.mx-muted:hover { color: var(--mx-text); }

.mx-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.mx-card {
    margin: 0; padding: 20px 22px; min-width: 0;
    background: var(--mx-surface); border: 1px solid var(--mx-line); border-radius: 12px; box-shadow: var(--mx-card-shadow);
}
.mx-card dt, .mx-band dt, .mx-kv dt { font-size: 13px; color: var(--mx-text-2); }
.mx-card dd, .mx-band dd { margin: 6px 0 0; font-size: 22px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.mx-card dd.mx-strip { margin-top: 12px; height: 26px; }
.mx-card dd.mx-card-note, .mx-band dd.mx-card-note { margin-top: 8px; font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--mx-text-2); }
.mx-result[data-state="failing"] { color: var(--mx-warn); }
.mx-result[data-state="recovering"] { color: var(--mx-recovering); }
.mx-result[data-state="paused"], .mx-result[data-state="pending"] { color: var(--mx-text-2); }

/* figures side by side, split by hairlines */
.mx-band { display: flex; margin-top: 0; padding: 20px 0; }
.mx-band > div { flex: 1; min-width: 0; padding: 0 22px; border-left: 1px solid var(--mx-line-soft); }
.mx-band > div:first-child { border-left: 0; }
.mx-band--inset { margin: 0; padding: 16px 0 18px; border-top: 1px solid var(--mx-line-soft); }

.mx-kv { margin: 0; padding: 6px 20px 14px; }
.mx-kv > div { padding: 9px 0; border-top: 1px solid var(--mx-line-soft); }
.mx-kv > div:first-child { border-top: 0; }
.mx-kv dd { margin: 2px 0 0; overflow-wrap: anywhere; font-weight: 500; }
.mx-kv .mx-dot { display: inline-block; margin-right: 6px; }

/* ---------- dashboard ---------- */
/* minmax(0, 1fr): a chart canvas must not widen its grid track past the page */
.mx-grid-1, .mx-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.mx-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mx-panel--fill { height: 100%; margin-bottom: 0; }
.mx-facts--inset { margin: 0; padding: 16px 20px; }
.mx-facts small { font-size: 13px; font-weight: 400; color: var(--mx-text-2); }
.mx-empty-note { margin-top: 22px; font-size: 13px; }
.mx-empty-note a, .mx-table a { color: inherit; text-decoration: underline; text-decoration-color: var(--mx-text-3); text-underline-offset: 3px; }

/* status board: the state sentence, four counts and the region line in one panel */
.mx-board-main { display: flex; align-items: center; justify-content: space-between; gap: 24px 40px; flex-wrap: wrap; padding: 26px 28px; }
.mx-board-status { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.mx-board-status .mx-dot { width: 12px; height: 12px; margin-top: 10px; }
.mx-board-headline { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; }
.mx-board-detail { margin: 4px 0 0; font-size: 15px; color: var(--mx-text-2); }
.mx-counts { display: flex; margin: 0; }
.mx-counts > div { display: flex; flex-direction: column-reverse; padding: 2px 28px; border-left: 1px solid var(--mx-line); }
.mx-counts > div:last-child { padding-right: 0; }
.mx-counts dt { font-size: 13px; color: var(--mx-text-2); white-space: nowrap; }
.mx-counts dd { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; }
.mx-counts small { margin-left: 6px; font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--mx-text-2); }
.mx-board-regions { display: flex; align-items: center; gap: 8px 28px; flex-wrap: wrap; padding: 13px 28px; border-top: 1px solid var(--mx-line); font-size: 13px; }
.mx-region { display: inline-flex; align-items: center; gap: 8px; }
.mx-region strong { font-weight: 600; }
.mx-board .mx-skeleton { border: 0; background: none; height: 104px; }
/* Overview board: the sentence and the uptime counts load as two slots; the slots dissolve so both are items of one row */
.mx-board-slot { display: contents; }
.mx-board-slot .mx-skeleton { height: 57px; }

.mx-dot[data-state="up"] { background: var(--mx-up); }
.mx-dot[data-state="down"] { background: var(--mx-down); }
.mx-dot[data-state="failing"] { background: var(--mx-warn); }
.mx-dot[data-state=""] { visibility: hidden; }
dt .mx-dot, td .mx-dot { display: inline-block; margin-right: 6px; }

.mx-line { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 20px; border-top: 1px solid var(--mx-line-soft); color: var(--mx-text); }
.mx-panel-head + .mx-line { border-top: 0; }
a.mx-line:hover { background: var(--mx-raised); }
.mx-line-main { flex: 1; min-width: 0; }
.mx-line-title, .mx-line-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-line-sub { font-size: 13px; color: var(--mx-text-2); }
.mx-line-value { font-weight: 500; white-space: nowrap; }
.mx-line-value .mx-dot { display: inline-block; margin-right: 8px; }

.mx-chart--short { height: 260px; }
.mx-legend [data-series="ok"]::before { background: var(--mx-series); }
.mx-legend [data-series="fail"]::before { background: var(--mx-down); }
.mx-legend span:has(.mx-heat)::before { content: none; }
.mx-scroll { max-height: 280px; overflow-y: auto; }

.mx-table--heat { table-layout: fixed; }
.mx-table-wrap:has(.mx-table--heat) { overflow-x: hidden; }
/* dashboard heatmap only: keep the last column off the panel edge without shrinking its cell */
.mx-panel--fill .mx-table--heat { width: calc(100% - 12px); }
.mx-table--heat th, .mx-table--heat td { padding: 9px 2px; }
.mx-table--heat th:first-child { width: 150px; }
.mx-table--heat th:first-child, .mx-table--heat td:first-child { padding-left: 20px; overflow: hidden; text-overflow: ellipsis; }
.mx-table--heat th.mx-num { overflow: visible; }
.mx-table--heat .mx-num { text-align: center; }
.mx-heat { display: inline-block; width: 100%; max-width: 16px; aspect-ratio: 1; border-radius: 4px; vertical-align: middle; box-shadow: inset 0 0 0 1px var(--mx-line); }
.mx-heat[data-bin]:not([data-bin=""]) { box-shadow: none; }
.mx-legend .mx-heat { width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; }
.mx-heat[data-bin="1"] { background: var(--mx-heat-1); }
.mx-heat[data-bin="2"] { background: var(--mx-heat-2); }
.mx-heat[data-bin="3"] { background: var(--mx-heat-3); }
.mx-heat[data-bin="4"] { background: var(--mx-heat-4); }
.mx-heat[data-bin="5"] { background: var(--mx-warn); }

.mx-skeleton { border-radius: 12px; background: var(--mx-surface); border: 1px solid var(--mx-line-soft); }
.mx-skeleton--line { height: 64px; }
.mx-skeleton--panel { height: 240px; }

/* ---------- incidents ---------- */
.mx-list > .mx-line:first-child { border-top: 0; }
.mx-list .mx-line { min-height: 62px; }
.mx-list .mx-line-title { font-weight: 600; }
.mx-line-side { text-align: right; white-space: nowrap; font-weight: 500; }
.mx-line-side .mx-line-sub { font-weight: 400; }
.mx-dot[data-state="idle"] { background: var(--mx-idle); }
.mx-grid-2--top { align-items: start; }
.mx-code {
    margin: 0; padding: 16px 20px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere;
    font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; color: var(--mx-text-2);
    background: none; border: 0;
}
.mx-steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.mx-steps li { counter-increment: step; padding: 14px 20px 14px 56px; border-top: 1px solid var(--mx-line-soft); position: relative; }
.mx-steps li:first-child { border-top: 0; }
.mx-steps li::before {
    content: counter(step); position: absolute; left: 20px; top: 13px;
    width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
    font-size: 12px; font-weight: 600; color: var(--mx-text-2); box-shadow: inset 0 0 0 1px var(--mx-line);
}
.mx-steps header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; }
.mx-steps h3 { margin: 0; font-size: 14px; font-weight: 600; }
.mx-steps p { margin: 3px 0 0; font-size: 13px; color: var(--mx-text-2); overflow-wrap: anywhere; }
.mx-steps .mx-dot { display: inline-block; margin-right: 6px; }

/* ---------- forms ---------- */
.mx-page--form { max-width: 1040px; }
.mx-form { padding-bottom: 6px; }
.mx-form > .mx-panel-head { margin-bottom: 18px; }
.mx-field { margin: 0 20px 20px; padding: 0; border: 0; min-width: 0; }
.mx-field .mx-field, .mx-field-row > .mx-field { margin: 0; }
.mx-field > label:not(.mx-check):not(.mx-option), .mx-field > legend, .mx-label { display: block; margin-bottom: 6px; padding: 0; font-size: 13px; font-weight: 500; color: var(--mx-text); }
.mx-field label .mx-muted, .mx-label .mx-muted { font-weight: 400; margin-left: 4px; }
.mx-field .mx-input { width: 100%; height: 38px; }
.mx-field .mx-input--short { width: 120px; }
select.mx-input { padding-right: 32px; }
.mx-input:focus { outline: 2px solid var(--mx-focus); outline-offset: 1px; border-color: transparent; }
.mx-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0 20px 20px; }
.mx-field > .mx-field-row { margin: 12px 0 0; }
.mx-hint { display: block; margin: 6px 0 0; font-size: 13px; font-weight: 400; color: var(--mx-text-2); }
.mx-field-error { margin: 10px 0 0; font-size: 13px; color: var(--mx-down); }
.mx-form-ok { margin: 10px 0 0; font-size: 13px; color: var(--mx-up); }
.mx-line-actions .mx-field-error, .mx-line-actions .mx-form-ok { margin: 0; }
.mx-form-message:empty { display: none; }
.mx-input-row { display: flex; gap: 8px; margin-top: 8px; }
.mx-input-row > .mx-input, .mx-input-row > .mx-suggest { flex: 1; min-width: 0; }
.mx-input-row .mx-btn { height: 38px; white-space: nowrap; }

.mx-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; cursor: pointer; }
.mx-check-row { display: flex; flex-wrap: wrap; gap: 8px 22px; }
/* color-scheme: light keeps unchecked boxes white in the dark theme; the dark native box is too faint on panels */
.mx-check input, .mx-option input, .mx-page input[type="checkbox"], .mx-page input[type="radio"] { width: 16px; height: 16px; margin: 0; accent-color: var(--mx-action-bg); color-scheme: light; }

.mx-option {
    display: flex; align-items: center; gap: 12px; margin-bottom: 8px; padding: 11px 14px;
    border-radius: 9px; border: 1px solid var(--mx-line); cursor: pointer;
}
.mx-option:has(input:checked) { border-color: var(--mx-text-2); background: var(--mx-raised); }
.mx-option .mx-hint { margin: 0; }

.mx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mx-chips:not(:empty) { margin-bottom: 2px; }
.mx-chip {
    display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 10px;
    border-radius: 7px; background: var(--mx-raised); box-shadow: inset 0 0 0 1px var(--mx-line-soft);
    font-size: 13px; font-weight: 500;
}
.mx-chip button { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--mx-text-3); font-size: 15px; line-height: 1; cursor: pointer; }
.mx-chip button:hover { color: var(--mx-text); }

.mx-suggest { position: relative; }
.mx-suggestions {
    position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 4px); max-height: 180px; overflow-y: auto;
    border-radius: 9px; background: var(--mx-surface); border: 1px solid var(--mx-line);
    box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.5);
}
.mx-suggestion { padding: 8px 12px; font-size: 13px; cursor: pointer; }
.mx-suggestion:hover, .mx-suggestion[aria-selected="true"] { background: var(--mx-raised); }

.mx-disclosure > summary { cursor: pointer; list-style: none; }
.mx-disclosure:not([open]) > summary.mx-panel-head { margin-bottom: 0; border-bottom: 0; }
.mx-disclosure > summary::-webkit-details-marker { display: none; }
.mx-disclosure > summary::after { content: "Show"; font-size: 13px; color: var(--mx-text-2); }
.mx-disclosure[open] > summary::after { content: "Hide"; }
.mx-disclosure { padding-bottom: 0; }
.mx-disclosure[open] { padding-bottom: 6px; }

.mx-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ---------- alert channels ---------- */
.mx-page--narrow { max-width: 760px; }
.mx-line--tall { flex-wrap: wrap; row-gap: 10px; padding-top: 12px; padding-bottom: 12px; }
.mx-line-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.mx-line-actions .mx-btn { height: 32px; padding: 0 11px; font-size: 13px; }
.mx-inline-form { display: flex; gap: 6px; }
.mx-input--code { width: 118px; height: 32px; }
.mx-input--mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }
.mx-textarea { height: auto !important; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.mx-option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mx-option-grid .mx-option { margin-bottom: 0; }
.mx-steps-plain { padding-left: 18px; }
.mx-steps-plain li { margin-top: 4px; }
.mx-hint code, .mx-field code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; color: var(--mx-text); background: var(--mx-raised); padding: 1px 5px; border-radius: 4px; }
.mx-notice[data-kind="down"] { border-left-color: var(--mx-down); }
.mx-modal--wide { max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; }
.mx-form--bare { padding: 0; }
.mx-form--bare .mx-field { margin-left: 0; margin-right: 0; }
.mx-modal h3 + .mx-form { margin-top: 18px; }

/* ---------- patrol ---------- */
/* fold: a list row that opens a body below it. The toggle covers the whole row; links in the row stay clickable above it. */
.mx-fold { border-top: 1px solid var(--mx-line-soft); }
.mx-fold:first-child, .mx-panel-head + .mx-fold { border-top: 0; }
.mx-fold > .mx-line { border-top: 0; }
.mx-fold-row { position: relative; }
.mx-fold-row:hover { background: var(--mx-raised); }
.mx-fold-row:has(.mx-fold-toggle:focus-visible) { outline: 2px solid var(--mx-focus); outline-offset: -2px; }
.mx-fold-row::after {
    content: ""; flex: none; width: 7px; height: 7px; margin: 0 4px 3px 2px;
    border-right: 1.5px solid var(--mx-text-3); border-bottom: 1.5px solid var(--mx-text-3); transform: rotate(45deg);
}
.mx-fold-row:has(.mx-fold-toggle[aria-expanded="true"])::after { margin-bottom: -3px; transform: rotate(-135deg); }
.mx-fold-toggle {
    display: block; max-width: 100%; padding: 0; border: 0; background: none; cursor: pointer;
    font: inherit; font-weight: 600; color: inherit; text-align: left;
}
.mx-fold-toggle:focus-visible { outline: none; }
.mx-fold-toggle::after { content: ""; position: absolute; inset: 0; }
.mx-fold-row a { position: relative; z-index: 1; }
.mx-fold-body { margin-left: 24px; border-top: 1px solid var(--mx-line-soft); border-left: 1px solid var(--mx-line); }
.mx-fold-body > .mx-line:first-child { border-top: 0; }

.mx-line--wrap .mx-line-title, .mx-line--wrap .mx-line-sub { white-space: normal; overflow-wrap: anywhere; }
.mx-line-sub a, .mx-kv a, .mx-panel-note a {
    color: inherit; text-decoration: underline; text-decoration-color: var(--mx-text-3); text-underline-offset: 3px;
}
.mx-line-sub a:hover, .mx-kv a:hover, .mx-panel-note a:hover { color: var(--mx-text); }
.mx-panel-text { margin: 0; padding: 14px 20px 6px; overflow-wrap: anywhere; }
.mx-panel-sub { margin: 0; padding: 14px 20px 8px; border-top: 1px solid var(--mx-line-soft); font-size: 13px; font-weight: 500; color: var(--mx-text-2); }
.mx-panel > .mx-empty { padding: 32px 20px; }
.mx-panel > .mx-empty p { margin-bottom: 14px; }
.mx-band dd .mx-dot, .mx-card dd .mx-dot { display: inline-block; margin-right: 8px; vertical-align: middle; }

/* a table whose first column wraps so it never scrolls sideways */
.mx-table--fit td:first-child { white-space: normal; }

/* key and value side by side, for evidence and other longer lists */
.mx-kv--rows > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); column-gap: 16px; align-items: baseline; }
.mx-kv--rows dd { margin: 0; }

.mx-link-btn {
    padding: 0; border: 0; background: none; cursor: pointer; font: inherit; font-size: 13px; color: var(--mx-text-2);
    text-decoration: underline; text-decoration-color: var(--mx-text-3); text-underline-offset: 3px;
}
.mx-link-btn:hover { color: var(--mx-text); }
.mx-chip--plain { padding: 0 10px; }
.mx-chips--inset { align-items: center; padding: 14px 20px 16px; }
.mx-kv dd.mx-chips { font-weight: 400; }

.mx-code-block { border-top: 1px solid var(--mx-line-soft); }
.mx-code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px 0; font-size: 13px; color: var(--mx-text-2); }
.mx-code-block .mx-code { padding-top: 8px; }

.mx-panel-form { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 20px; }
.mx-panel-form .mx-input { flex: 1 1 180px; min-width: 0; height: 36px; }
.mx-panel-form--foot { border-top: 1px solid var(--mx-line-soft); }
/* A multi-field form at the foot of a panel: fields stacked, as in .mx-form. */
.mx-panel-fields { padding-top: 18px; border-top: 1px solid var(--mx-line-soft); }
.mx-filters { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.mx-filters .mx-input { max-width: 240px; }
.mx-field--inline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.mx-field.mx-field--inline > label:not(.mx-check):not(.mx-option) { margin-bottom: 0; }
.mx-field--inline .mx-input { width: 160px; }

/* fix guidance arrives as plain HTML from the mitigation route */
.mx-mitigation { padding: 14px 20px 16px; border-top: 1px solid var(--mx-line-soft); font-size: 13px; color: var(--mx-text-2); }
.mx-mitigation > .mx-panel-note { padding: 0; }
.mx-mitigation p { margin: 4px 0; }
.mx-mitigation ol { margin: 6px 0; padding-left: 18px; list-style: decimal; }
.mx-mitigation li { margin-top: 4px; }
.mx-mitigation strong { display: block; margin-top: 10px; color: var(--mx-text); font-weight: 600; }
.mx-mitigation > div > strong:first-child { margin-top: 0; }
.mx-mitigation code, .mx-mitigation pre { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; color: var(--mx-text); background: var(--mx-raised); }
.mx-mitigation code { padding: 1px 5px; border-radius: 4px; }
.mx-mitigation pre { margin: 6px 0 0; padding: 10px 12px; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 860px) {
    .mx-fold-body { margin-left: 12px; }
    .mx-table--fit th, .mx-table--fit td { padding-left: 10px; padding-right: 10px; }
    .mx-table--fit th:first-child, .mx-table--fit td:first-child { padding-left: 16px; }
    .mx-table--fit th:last-child, .mx-table--fit td:last-child { padding-right: 16px; }
    .mx-kv--rows > div { grid-template-columns: minmax(0, 1fr); }
    .mx-filters { width: 100%; }
    .mx-filters .mx-input { flex: 1 1 40%; min-width: 0; max-width: none; }
    .mx-fold-row .mx-line-title { white-space: normal; overflow-wrap: anywhere; }
}

/* ---------- account pages: events, status pages, billing, reporting, errors ---------- */
.mx-watch-sub { overflow-wrap: anywhere; }
.mx-actions--start { justify-content: flex-start; }
.mx-notice > div { min-width: 0; overflow-wrap: anywhere; }
a.mx-line-title:hover { text-decoration: underline; text-decoration-color: var(--mx-text-3); text-underline-offset: 3px; }
.mx-line-side time { display: block; }
.mx-filters { align-items: center; }
.mx-filters .mx-check { margin-left: 6px; font-size: 13px; color: var(--mx-text-2); }
.mx-filters .mx-btn { height: 34px; }
.mx-input--slug { width: 210px; height: 32px; }
.mx-panel-actions--note { align-items: center; gap: 8px 14px; padding-top: 4px; font-size: 13px; }

/* how much of a plan limit is used */
.mx-meter {
    display: block; width: 100%; height: 6px; margin-bottom: 8px; border: 0; border-radius: 3px; overflow: hidden;
    -webkit-appearance: none; appearance: none; background: var(--mx-chart-1);
}
.mx-meter::-webkit-progress-bar { background: var(--mx-chart-1); }
.mx-meter::-webkit-progress-value { background: var(--mx-series); }
.mx-meter::-moz-progress-bar { background: var(--mx-series); }
.mx-meter[data-state="failing"]::-webkit-progress-value { background: var(--mx-warn); }
.mx-meter[data-state="failing"]::-moz-progress-bar { background: var(--mx-warn); }

/* one dot per sentinel per day */
.mx-table--days th:first-child { width: 260px; }
.mx-table--days td { padding-top: 12px; padding-bottom: 12px; }
.mx-table--days th:last-child, .mx-table--days td:last-child { padding-right: 20px; }
.mx-table--days td .mx-dot { width: 12px; height: 12px; margin: 0; vertical-align: middle; }
.mx-table--days a.mx-dot:hover, .mx-table--days a.mx-dot:focus-visible { box-shadow: 0 0 0 3px var(--mx-line); border-radius: 50%; }
.mx-legend--dots { margin: 0; padding-top: 14px; border-top: 1px solid var(--mx-line-soft); }
.mx-legend--dots span::before { content: none; }
.mx-legend--dots .mx-dot { display: inline-block; margin-right: 7px; }

@media (max-width: 860px) {
    .mx-table--days th:first-child { width: 124px; }
    .mx-table--days th:last-child, .mx-table--days td:last-child { padding-right: 14px; }
    .mx-table--days .mx-line-title, .mx-table--days .mx-line-sub { white-space: normal; overflow-wrap: anywhere; }
    .mx-inline-form:has(.mx-input--slug) { flex: 1 1 100%; }
    .mx-input--slug { flex: 1; width: auto; min-width: 0; }
}

/* ---------- admin pages ---------- */
.mx-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }
.mx-table .mx-line-actions { justify-content: flex-end; flex-wrap: nowrap; }
.mx-table .mx-line-sub { white-space: normal; overflow-wrap: break-word; }
.mx-table a.mx-btn--quiet { color: var(--mx-text-2); text-decoration: none; }
.mx-table a.mx-btn--quiet:hover { color: var(--mx-text); }
.mx-table-clip { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.mx-form--bare .mx-field-row { margin-left: 0; margin-right: 0; }
.mx-modal .mx-kv { padding: 0 0 10px; }
.mx-modal .mx-notice { margin-bottom: 18px; }

@media (max-width: 860px) {
    .mx-table-clip { max-width: 120px; }
    .mx-table .mx-line-actions { flex-wrap: wrap; }
    /* fit tables give up nowrap on phones so the action buttons stay in view */
    .mx-table--fit td { white-space: normal; }
    .mx-table--fit td:first-child, .mx-table--fit td:first-child .mx-line-sub { overflow-wrap: anywhere; }
    .mx-table .mx-btn { white-space: nowrap; }
}

/* ---------- auth pages: log in, sign up, password reset ---------- */
.mx-auth { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 32px 16px 96px; }
.mx-auth-col { width: 100%; max-width: 400px; }
.mx-auth-brand { justify-content: center; padding: 0 0 26px; }
.mx-auth-panel { margin-bottom: 18px; padding: 28px 28px 8px; }
.mx-auth-title { margin: 0 0 6px; font-size: 22px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; }
.mx-auth-lead { margin: 0 0 22px; color: var(--mx-text-2); }
.mx-auth-title:last-child, .mx-auth-lead:last-child { margin-bottom: 20px; }
.mx-auth-panel .mx-field { margin: 0 0 18px; }
.mx-auth-panel .mx-field .mx-input { height: 40px; }
.mx-auth-panel .mx-btn { width: 100%; height: 40px; justify-content: center; margin-bottom: 20px; }
.mx-auth-or { display: flex; align-items: center; gap: 12px; margin: 0 0 20px; font-size: 13px; color: var(--mx-text-3); }
.mx-auth-or::before, .mx-auth-or::after { content: ""; flex: 1; height: 1px; background: var(--mx-line-soft); }
.mx-auth-terms { margin: 0 0 20px; }
.mx-auth .mx-notice { margin-bottom: 16px; }
.mx-auth-links { margin: 0; text-align: center; font-size: 13px; color: var(--mx-text-2); }
.mx-auth-links p { margin: 0 0 6px; }
.mx-auth-links a, .mx-auth .mx-hint a, .mx-auth-lead a {
    color: var(--mx-text); text-decoration: underline; text-decoration-color: var(--mx-text-3); text-underline-offset: 3px;
}
/* a field bots fill and people never see; display:none would tip bots off */
.mx-offscreen { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 860px) {
    .mx-auth { align-items: flex-start; padding: 40px 16px 32px; }
    .mx-auth-panel { padding: 24px 20px 4px; }
}

@media (max-width: 1180px) {
    .mx-detail { grid-template-columns: minmax(0, 1fr); }
    /* dashboard panel rows only: forms and detail pages keep two columns down to phone width */
    .mx-grid-2--fold { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- mobile ---------- */
.mx-bottom, .mx-sheet-scrim { display: none; }
@media (max-width: 860px) {
    .mx-app { grid-template-columns: minmax(0, 1fr); }
    .mx-side { display: none; }
    .mx-main { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
    .mx-page { padding: 22px 16px 32px; }
    .mx-watch { font-size: 26px; }
    .mx-tools form, .mx-input--search { width: 100%; }
    .mx-list-cols { display: none; }
    .mx-row { grid-template-columns: minmax(0, 1fr) auto; padding: 0 14px 0 16px; }
    .mx-row .mx-strip, .mx-row .mx-row-ago, .mx-row .mx-icon-btn { display: none; }
    .mx-toasts { bottom: calc(70px + env(safe-area-inset-bottom)); }
    .mx-page-top { flex-wrap: wrap; }
    .mx-actions { justify-content: flex-start; }
    .mx-facts { gap: 28px; }
    .mx-chart { height: 200px; padding: 12px 12px 4px; }
    .mx-wide-only { display: none; }
    .mx-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .mx-band { flex-wrap: wrap; row-gap: 18px; }
    .mx-band > div { flex: 1 1 40%; }
    .mx-band > div:nth-child(odd) { border-left: 0; }
    .mx-grid-2 { grid-template-columns: minmax(0, 1fr); }
    .mx-field-row { grid-template-columns: minmax(0, 1fr); }
    .mx-board-main, .mx-board-regions { padding-left: 16px; padding-right: 16px; }
    .mx-board-headline { font-size: 22px; }
    .mx-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; }
    .mx-counts > div { padding: 0; border: 0; }
    .mx-chart--short { height: 180px; }
    .mx-table th, .mx-table td { padding: 11px 14px; }
    .mx-table--heat th, .mx-table--heat td { padding: 9px 2px; }
    .mx-table--heat th:first-child { width: 110px; }
    .mx-table--heat th:first-child, .mx-table--heat td:first-child { padding-left: 14px; }
    /* detail page: title, sentence, then actions */
    .mx-page--detail { display: flex; flex-direction: column; }
    .mx-page--detail > * { order: 4; }
    .mx-page--detail > .mx-page-top { display: contents; }
    .mx-page--detail .mx-page-title { order: 0; margin-bottom: 14px; }
    .mx-page--detail > .mx-headline { order: 1; }
    .mx-page--detail > .mx-watch-sub { order: 2; margin-bottom: 16px; }
    .mx-page--detail .mx-actions { order: 3; margin-bottom: 24px; }

    .mx-bottom {
        display: grid; grid-template-columns: repeat(5, 1fr);
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
        height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
        background: var(--mx-surface); border-top: 1px solid var(--mx-line);
    }
    .mx-bottom-link {
        display: grid; place-items: center; background: none; border: 0; cursor: pointer;
        font: inherit; font-size: 12px; font-weight: 500; color: var(--mx-text-3);
    }
    .mx-bottom-link[aria-current="page"] { color: var(--mx-text); font-weight: 600; }

    .mx-sheet-scrim { display: block; position: fixed; inset: 0; z-index: 60; background: var(--mx-scrim); }
    .mx-sheet {
        position: absolute; left: 0; right: 0; bottom: 0;
        padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
        background: var(--mx-surface); border-radius: 16px 16px 0 0;
    }
    .mx-sheet .mx-nav-link { height: 44px; width: 100%; background: none; border: 0; font: inherit; font-weight: 500; cursor: pointer; }
}

/* whole row opens the sentinel; the check button stays clickable above the link */
.mx-row-ident::after { content: ""; position: absolute; inset: 0; }
.mx-row .mx-icon-btn { position: relative; z-index: 1; }

/* ---------- public status page ---------- */
/* Healthy is blue on the public page; inside the app up stays green and blue means recovering. */
.mx-public { --mx-up: #3b82f6; --mx-strip-up: #3b82f6; }
.mx-pub { max-width: 860px; margin: 0 auto; padding: 40px 20px 56px; }
.mx-pub-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.mx-pub-top nav { display: flex; gap: 20px; font-size: 13px; color: var(--mx-text-2); }
.mx-pub-top nav a:hover, .mx-pub-foot a:hover { color: var(--mx-text); }
.mx-pub-body { padding: 18px 20px 16px; }
.mx-pub-days { height: 34px; }
.mx-pub-days i { cursor: pointer; }
.mx-pub-days i:focus-visible { outline-offset: 1px; border-radius: 1.5px; }
.mx-pub-axis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--mx-text-3); }
.mx-pub-foot { margin-top: 28px; text-align: center; font-size: 12px; color: var(--mx-text-3); }
.mx-pub-foot a { text-decoration: underline; text-underline-offset: 3px; }

/* the tooltip may reach past the panel edge on narrow screens */
.mx-pub-panel--chart { overflow: visible; }
.mx-pub-chart { position: relative; padding-left: 48px; }
.mx-pub-plot { position: relative; height: 200px; touch-action: pan-y; }
.mx-pub-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mx-pub-grid { stroke: var(--mx-line-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.mx-pub-area { fill: var(--mx-series); fill-opacity: 0.2; }
.mx-pub-curve { fill: none; stroke: var(--mx-series); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.mx-pub-ytick { position: absolute; left: -48px; width: 40px; text-align: right; transform: translateY(-50%); font-size: 12px; color: var(--mx-text-3); }
.mx-pub-xaxis { position: relative; height: 18px; margin-top: 8px; }
.mx-pub-xaxis span { position: absolute; transform: translateX(-50%); font-size: 12px; color: var(--mx-text-3); white-space: nowrap; }
.mx-pub-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--mx-text-3); pointer-events: none; }
.mx-pub-point { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--mx-text); box-shadow: 0 0 0 2px var(--mx-surface); transform: translate(-50%, -50%); pointer-events: none; }
.mx-pub-tip, .mx-pub-pop {
    position: absolute; background: var(--mx-raised); border: 1px solid var(--mx-line); border-radius: 8px;
    font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.mx-pub-tip { z-index: 5; padding: 7px 10px; white-space: nowrap; pointer-events: none; transform: translate(-50%, calc(-100% - 12px)); }
.mx-pub-tip--below { transform: translate(-50%, 12px); }
.mx-pub-tip > span { margin-left: 8px; color: var(--mx-text-2); }
.mx-pub-phases { min-width: 170px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--mx-line); color: var(--mx-text-2); }
.mx-pub-phases div { display: flex; justify-content: space-between; gap: 16px; }
.mx-pub-phases b { font-weight: 500; color: var(--mx-text); }
.mx-pub-pop { z-index: 10; min-width: 240px; max-width: 320px; padding: 10px 12px; }
.mx-pub-pop-day { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; font-weight: 600; }
.mx-pub-pop ul { margin-top: 6px; }
.mx-pub-pop li { margin: 2px 0; }
.mx-pub-ok { font-weight: 700; color: var(--mx-up); }
.mx-pub-ko { font-weight: 700; color: var(--mx-down); }
@media (max-width: 520px) {
    .mx-pub { padding: 24px 12px 40px; }
    .mx-pub .mx-table th, .mx-pub .mx-table td { padding-left: 12px; padding-right: 12px; }
    .mx-pub-xaxis span:nth-child(even) { display: none; }
}
