/*
 * simdash styles. Colour, type, spacing, radius and elevation follow the Simunix brand tokens
 * (.claude/docs/design-tokens.md). One file, no build step, no external resources (CSP default-src 'self').
 * The CSP forbids inline style, so every colour, size and bar width lives here or in SVG presentation attributes.
 * Rules this file keeps:
 *  - every colour in a component comes from a token (hex appears only in the token block below);
 *  - Light Blue (--accent) is never text, a link or a meaningful border on light surfaces;
 *  - the brand gradient appears only on the sign-in screen and the application header bar, with white text;
 *  - status is never colour alone: icon + word + colour (stale and pending also change the outline style).
 */

/* Satoshi is licence-restricted and its file is not shipped, so only an installed copy is used and no request is made
   for a missing file (it used to 404 on every page). After adding public/assets/fonts/Satoshi-Variable.woff2, append
   , url("../fonts/Satoshi-Variable.woff2") format("woff2") to the src below. Until then the system stack renders. */
@font-face {
    font-family: "Satoshi";
    src: local("Satoshi");
    font-weight: 300 900;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light dark;

    /* Height of the sticky site header (44 px control + 2 x 8 px padding + 1 px border): the scroll offset for anchor targets and sticky table heads. */
    --header-h: 61px;

    /* Brand primitives: never used directly in components, not theme-overridden */
    --brand-blue-light: #4FB1E5;
    --brand-blue-dark:  #1F3681;
    --brand-grey-dark:  #202023;
    --brand-grey-light: #F3F6F9;
    --brand-grey-text:  #808080;
    --brand-white:      #FFFFFF;
    --brand-gradient: linear-gradient(135deg, #4FB1E5 0%, #1F3681 100%);

    /* Surfaces */
    --surface-page:     light-dark(#FFFFFF, #202023);
    --surface-raised:   light-dark(#F3F6F9, #2A2A2E);
    --surface-sunken:   light-dark(#E9EEF4, #17171A);
    --surface-overlay:  light-dark(#FFFFFF, #2A2A2E);
    --border-subtle:    light-dark(#E2E8F0, #3A3A40);
    --border-strong:    light-dark(#CBD5E1, #4C4C54);

    /* Text */
    --text-primary:     light-dark(#202023, #F3F6F9);
    --text-secondary:   light-dark(#6E6E6E, #A8A8B0);
    --text-muted:       #808080;
    --text-inverse:     light-dark(#FFFFFF, #202023);
    --text-link:        light-dark(#1F3681, #4FB1E5);

    /* Interactive */
    --interactive-default: light-dark(#1F3681, #4FB1E5);
    --interactive-hover:   light-dark(#182B67, #6FC0EA);
    --interactive-active:  light-dark(#122050, #8ACFF0);
    --interactive-subtle:  light-dark(#EAEFF9, #24313C);
    --focus-ring:          light-dark(#1F3681, #4FB1E5);

    /* Accent: decorative only on light surfaces; same value in both themes */
    --accent:           #4FB1E5;
    --accent-subtle:    light-dark(#E8F4FC, #22313B);

    /* Semantic */
    --success:          light-dark(#1B7F4B, #58C48C);
    --success-subtle:   light-dark(#E6F4EC, #1B2C23);
    --warning:          light-dark(#8A5A00, #E0A83C);
    --warning-subtle:   light-dark(#FDF3E2, #302614);
    --danger:           light-dark(#B3261E, #F2837B);
    --danger-subtle:    light-dark(#FCEBEA, #33191A);
    --info:             light-dark(#1F3681, #4FB1E5);
    --info-subtle:      light-dark(#EAEFF9, #22313B);

    /* Type */
    --font-sans: "Satoshi", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --text-xs:   0.75rem;
    --text-sm:   0.875rem;
    --text-base: 1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-3xl:  1.875rem;
    --weight-regular:  400;
    --weight-medium:   500;
    --weight-semibold: 600;
    --weight-bold:     700;
    --leading-tight:  1.25;
    --leading-normal: 1.5;

    /* Spacing, radius, elevation */
    --space-1: 0.25rem;  --space-2: 0.5rem;   --space-3: 0.75rem;
    --space-4: 1rem;     --space-6: 1.5rem;   --space-8: 2rem;
    --header-h: 61px;
    --space-12: 3rem;    --space-16: 4rem;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px rgba(32, 32, 35, 0.06);
    --shadow-md: 0 4px 12px rgba(32, 32, 35, 0.08);
    --shadow-lg: 0 12px 32px rgba(32, 32, 35, 0.12);

    /* Page-level aliases built from the tokens: grey page, white cards in light; the reverse depth in dark. */
    --page:  light-dark(var(--surface-raised), var(--surface-sunken));
    --card:  light-dark(var(--surface-page), var(--surface-raised));
    --inset: light-dark(var(--surface-raised), var(--surface-page));
    --elev-1: var(--shadow-sm);
    --elev-2: var(--shadow-md);
    --elev-3: var(--shadow-lg);
    --scrim: color-mix(in srgb, var(--brand-grey-dark) 45%, transparent);
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* In dark mode surfaces are separated by borders, not shadows. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --elev-1: none; --elev-2: none; --elev-3: none; }
}
:root[data-theme="dark"] { --elev-1: none; --elev-2: none; --elev-3: none; }

/* ---- Status token sets: --c outline/stripe fill, --c-fg text, --c-bg tinted background ---- */
.chip--up, .tile--up, .row--up, .summary--up, .due--up { --c: var(--success); --c-fg: var(--success); --c-bg: var(--success-subtle); }
.chip--degraded, .tile--degraded, .row--degraded, .summary--degraded, .due--degraded { --c: var(--warning); --c-fg: var(--warning); --c-bg: var(--warning-subtle); }
.chip--down, .tile--down, .row--down, .summary--down, .due--down { --c: var(--danger); --c-fg: var(--danger); --c-bg: var(--danger-subtle); }
/* Intermittent: info blue with a double outline and a zig-zag icon; distinct from degraded (amber) and checking (accent, solid). */
.chip--intermittent, .tile--intermittent, .row--intermittent, .summary--intermittent, .due--intermittent { --c: var(--info); --c-fg: var(--info); --c-bg: var(--info-subtle); }
/* Checking: accent is decorative, so the text stays primary. */
.chip--checking, .tile--checking, .row--checking, .summary--checking, .due--checking { --c: light-dark(var(--text-secondary), var(--accent)); --c-fg: var(--text-primary); --c-bg: var(--accent-subtle); }
.chip--unknown, .tile--unknown, .row--unknown, .summary--unknown, .due--unknown { --c: var(--text-secondary); --c-fg: var(--text-secondary); --c-bg: var(--inset); }
.chip--stale, .tile--stale, .row--stale, .summary--stale, .due--stale { --c: var(--text-secondary); --c-fg: var(--text-secondary); --c-bg: var(--inset); }
.chip--pending, .tile--pending, .row--pending, .summary--pending, .due--pending { --c: var(--text-secondary); --c-fg: var(--text-secondary); --c-bg: var(--inset); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--page);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    line-height: var(--leading-normal);
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--text-link); text-underline-offset: 3px; }
a:hover { color: var(--interactive-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
h1, h2, h3 { line-height: var(--leading-tight); margin: 0; font-weight: var(--weight-bold); }
p { margin: .4em 0; }
code { background: var(--inset); border: 1px solid var(--border-subtle); padding: 0 .35em; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: .92em; }
.muted { color: var(--text-secondary); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--card); color: var(--text-primary); padding: var(--space-2) var(--space-4); z-index: 20; border-radius: 0 0 var(--radius-md) 0; }
.skip-link:focus { left: 0; }
.icon { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Wordmark: two segments, theme-aware tokens; white on the gradient header ---- */
.wordmark { display: inline-flex; font-weight: var(--weight-bold); letter-spacing: .18em; line-height: 1; margin: 0; }
.wordmark__sim { color: var(--text-primary); }
.wordmark__dash { color: var(--interactive-default); }
.wordmark--lg { font-size: var(--text-2xl); margin-bottom: var(--space-4); }

/* ---- Header bar (brand gradient with a scrim so white text keeps AA contrast on the light-blue end) ---- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-6);
    padding: var(--space-2) var(--space-6);
    background: linear-gradient(var(--scrim), var(--scrim)), var(--brand-gradient);
    color: var(--brand-white);
    border-bottom: 1px solid var(--border-subtle);
}
.site-header :focus-visible { outline-color: var(--brand-white); }
.brand { display: inline-flex; align-items: center; color: var(--brand-white); text-decoration: none; font-size: var(--text-lg); min-height: 44px; }
.brand:hover { color: var(--brand-white); }
.site-header .wordmark__sim, .site-header .wordmark__dash, .wall-title .wordmark__sim, .wall-title .wordmark__dash { color: var(--brand-white); }
.nav { display: flex; gap: var(--space-1); flex: 1; flex-wrap: wrap; }
.nav a {
    color: var(--brand-white);
    text-decoration: none;
    font-weight: var(--weight-semibold);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    transition: background-color .15s;
}
.nav a:hover { background: color-mix(in srgb, var(--brand-white) 16%, transparent); color: var(--brand-white); }
.nav a[aria-current="page"] { background: color-mix(in srgb, var(--brand-white) 24%, transparent); box-shadow: inset 0 -3px 0 var(--brand-white); }
.header-tools { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.signout { display: flex; align-items: center; gap: var(--space-3); margin: 0; }
.who { display: inline-flex; align-items: center; gap: var(--space-2); }
.who__name { font-weight: var(--weight-semibold); }
.who__role { text-transform: capitalize; font-size: var(--text-xs); font-weight: var(--weight-semibold); padding: 1px var(--space-2); border-radius: var(--radius-full); border: 1px solid color-mix(in srgb, var(--brand-white) 70%, transparent); }

main { max-width: 1320px; margin: 0 auto; padding: var(--space-6); }

/* ---- Buttons, forms, cards ---- */
.card { background: var(--card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--elev-1); }
.card h1 { font-size: var(--text-2xl); }
.auth-card { max-width: 420px; margin: 0 auto; padding: var(--space-8); box-shadow: var(--elev-3); background: var(--surface-overlay); }
.auth-card h1 { margin-bottom: var(--space-1); }

/* Sign-in: the brand gradient fills the page behind the card; there is no header bar to repeat it. */
body:has(.auth-card) { background: linear-gradient(var(--scrim), var(--scrim)), var(--brand-gradient); background-attachment: fixed; min-height: 100vh; }
body:has(.auth-card) .site-header { display: none; }
body:has(.auth-card) main { padding-top: 12vh; }

label { display: block; margin-top: var(--space-4); margin-bottom: var(--space-1); font-weight: var(--weight-semibold); font-size: var(--text-sm); }
label.check { font-weight: var(--weight-regular); display: flex; gap: var(--space-2); align-items: center; min-height: 44px; font-size: var(--text-base); }

input[type="email"], input[type="password"] {
    width: 100%;
    min-height: 44px;
    padding: var(--space-3);
    font: inherit;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--inset);
    color: var(--text-primary);
    transition: border-color .15s;
}
input[type="email"]:focus, input[type="password"]:focus { border-color: var(--focus-ring); }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--interactive-default); }

button, .btn {
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-4);
    min-height: 44px;
    font: inherit;
    font-weight: var(--weight-semibold);
    color: var(--text-inverse);
    background: var(--interactive-default);
    border: 1px solid var(--interactive-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
button:hover, .btn:hover { background: var(--interactive-hover); border-color: var(--interactive-hover); }
button:active, .btn:active { background: var(--interactive-active); border-color: var(--interactive-active); }
.auth-card button[type="submit"] { width: 100%; margin-top: var(--space-6); }
.btn--ghost { margin-top: 0; background: transparent; color: var(--text-primary); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--interactive-subtle); color: var(--text-primary); border-color: var(--border-strong); }
.site-header button { margin-top: 0; padding: var(--space-2) var(--space-4); font-size: var(--text-sm); background: transparent; color: var(--brand-white); border-color: color-mix(in srgb, var(--brand-white) 70%, transparent); }
.site-header button:hover { background: color-mix(in srgb, var(--brand-white) 18%, transparent); border-color: var(--brand-white); }
.btn[aria-pressed="true"] { border-style: dashed; }
.form-error { color: var(--danger); font-weight: var(--weight-semibold); }
.notice { background: var(--card); border: 1px solid var(--border-subtle); border-left: 4px solid var(--interactive-default); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); }
.crumb { margin: 0 0 var(--space-4); }
.crumb a { text-decoration: none; font-weight: var(--weight-semibold); display: inline-flex; align-items: center; min-height: 44px; }
.crumb a:hover { text-decoration: underline; }

/* ---- Watchdog banners (client-generated, outside the refreshed board) ---- */
.watchdog__msg { margin: 0; padding: var(--space-3) var(--space-6); display: flex; align-items: center; gap: var(--space-3); font-weight: var(--weight-bold); }
.watchdog__msg--lost { background: var(--warning-subtle); color: var(--warning); border-bottom: 2px solid var(--warning); }
.watchdog__msg--signedout { background: var(--danger-subtle); color: var(--danger); border-bottom: 2px solid var(--danger); }
.watchdog__msg--held { background: var(--card); color: var(--text-primary); border-bottom: 2px dashed var(--warning); }
.watchdog__msg--paused { background: var(--card); color: var(--text-primary); border-bottom: 2px dashed var(--border-strong); }
.watchdog__msg a { color: inherit; }
body.is-offline #board { filter: grayscale(1); opacity: .75; transition: opacity .3s; }

/* ---- Status chips ---- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .4em;
    padding: .12em .75em .12em .55em;
    border: 1.5px solid var(--c, var(--text-secondary));
    border-radius: var(--radius-full);
    background: var(--c-bg, var(--inset));
    color: var(--c-fg, var(--text-secondary));
    font-weight: var(--weight-semibold);
    line-height: 1.35;
    white-space: nowrap;
    vertical-align: middle;
}
.chip--down { background: var(--danger); color: var(--text-inverse); }
.chip--intermittent { border-style: double; border-width: 4px; padding-block: 0; }
.chip--stale { border-style: dashed; }
.chip--pending { border-style: dotted; border-width: 2px; }
.chip--sm { font-size: var(--text-sm); }
.chip--md { font-size: var(--text-base); }
.chip--lg { font-size: var(--text-base); }
.chip--xl { font-size: var(--text-2xl); padding: .25em .9em .25em .7em; border-width: 2px; }
.chip--xl.chip--intermittent { border-width: 6px; padding-block: .1em; }
.chip--xl .icon { width: 1.25em; height: 1.25em; }
.chip--tag { margin-left: var(--space-2); font-size: var(--text-xs); }

.tag {
    display: inline-flex;
    align-items: center;
    gap: .3em;
    padding: 0 .65em;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    margin-left: var(--space-1);
    white-space: nowrap;
    background: var(--inset);
}
.tag--ack { border-color: var(--success); color: var(--success); background: var(--success-subtle); }
.tag--open { border-color: var(--warning); color: var(--warning); background: var(--warning-subtle); }
.tag--bad { border-color: var(--danger); color: var(--danger); background: var(--danger-subtle); }

.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--text-secondary);
    margin: var(--space-8) 0 var(--space-3);
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border-subtle); }

/* ---- Summary hero ---- */
.summary {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3) var(--space-8);
    padding: var(--space-8) var(--space-8) var(--space-8) calc(var(--space-8) + 8px);
    border-radius: var(--radius-lg);
    background: linear-gradient(100deg, var(--c-bg) 0%, var(--card) 75%);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--elev-2);
}
.summary::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: var(--c); }
.summary--stale::before { background: repeating-linear-gradient(180deg, var(--c) 0 10px, transparent 10px 16px); }
.summary__main { display: flex; align-items: center; gap: var(--space-6); flex-wrap: wrap; }
.summary__headline { font-size: 2.5rem; font-weight: var(--weight-bold); line-height: 1.1; }
.summary__sentence { margin: var(--space-2) 0 0; color: var(--text-secondary); font-size: var(--text-lg); }
.stamp { margin: 0; color: var(--text-secondary); text-align: right; font-size: var(--text-sm); }
.stamp time { font-weight: var(--weight-bold); color: var(--text-primary); font-size: var(--text-lg); }
.stamp__sub { display: block; font-size: var(--text-sm); }

.banner { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); margin: var(--space-4) 0; font-weight: var(--weight-semibold); }
.banner--stale { background: var(--card); border: 2px dashed var(--border-strong); }
.banner--paused { background: var(--card); border: 2px solid var(--border-strong); flex-wrap: wrap; }
.banner__action { margin: 0 0 0 auto; }
.monitor-control { margin: var(--space-4) 0; }
.monitor-control summary { display: inline-block; cursor: pointer; list-style: none; }
.monitor-control summary::-webkit-details-marker { display: none; }
.monitor-control__form { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin-top: var(--space-3); }
.monitor-control__form p { flex-basis: 100%; margin: 0; }

/* ---- Incidents ---- */
.incident-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); }
.incident {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-md);
    background: var(--danger-subtle);
    border: 1px solid var(--danger);
    border-left-width: 6px;
    box-shadow: var(--elev-1);
}
.incident .icon { color: var(--danger); margin-top: .2em; width: 1.4em; height: 1.4em; }
.incident--recovering { background: var(--warning-subtle); border-color: var(--warning); }
.incident--recovering .icon { color: var(--warning); }
.incident--more { border-style: dashed; background: transparent; font-weight: var(--weight-bold); box-shadow: none; }
.incident__text { line-height: 1.8; }
.incident__text a { color: var(--text-primary); }

.attention__list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.attention__list li { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); background: var(--card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.attention__name { font-weight: var(--weight-bold); }

/* ---- Product tiles ---- */
.product-grid { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); align-items: start; }
.tile {
    position: relative;
    overflow: hidden;
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: var(--space-6) var(--space-6) var(--space-4);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--elev-1);
    min-width: 0;
    transition: box-shadow .2s, border-color .2s;
}
.tile::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--c); }
.tile:hover { box-shadow: var(--elev-2); border-color: var(--border-strong); }
.tile--down, .tile--degraded, .tile--intermittent, .tile--checking { background: linear-gradient(180deg, var(--c-bg), var(--card) 60%); }
.tile--down { border-color: var(--danger); }
.tile--degraded { border-color: var(--warning); }
.tile--stale { border-style: dashed; border-color: var(--text-secondary); }
.tile--stale::before { background: repeating-linear-gradient(90deg, var(--c) 0 12px, transparent 12px 18px); }
.tile--pending { border-style: dotted; border-width: 2px; border-color: var(--text-secondary); }
.tile__head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.tile__name { font-size: var(--text-xl); }
.tile__cause { font-weight: var(--weight-semibold); margin: var(--space-3) 0 0; }
.tile__note { color: var(--text-secondary); margin: var(--space-2) 0 0; }
.tile__advisory { display: flex; gap: var(--space-2); align-items: center; color: var(--warning); font-weight: var(--weight-semibold); margin: var(--space-2) 0 0; }
.tile__details { margin-top: var(--space-4); }
.tile__details summary, .group summary {
    cursor: pointer;
    font-weight: var(--weight-semibold);
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    list-style: none;
    color: var(--text-secondary);
    font-size: var(--text-sm);
}
.tile__details summary::-webkit-details-marker, .group summary::-webkit-details-marker { display: none; }
.tile__details summary::before, .group summary::before {
    content: "";
    width: 7px; height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform .15s;
    flex: none;
}
.tile__details[open] > summary::before, .group[open] > summary::before { transform: rotate(45deg); }
.tile__details summary:hover, .group summary:hover { color: var(--text-primary); }

/* ---- Entity rows ---- */
.rows { list-style: none; padding: 0; margin: var(--space-2) 0 0; display: grid; gap: var(--space-2); }
.row {
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--inset);
    border: 1px solid var(--border-subtle);
    border-left: 4px solid var(--c, var(--border-strong));
    min-width: 0;
}
.row--down { background: var(--danger-subtle); border-color: var(--danger); }
.row--degraded, .row--checking { background: var(--warning-subtle); border-color: var(--warning); }
.row--checking { border-color: var(--c); background: var(--accent-subtle); }
.row--intermittent { background: var(--info-subtle); border-color: var(--info); border-left-style: double; border-left-width: 6px; }
.row--stale { border-style: dashed; border-color: var(--text-secondary); }
.row--pending { border-style: dotted; border-color: var(--text-secondary); }
.row__main { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); }
.row__name { font-weight: var(--weight-bold); }
.row__facts { font-size: var(--text-sm); flex-basis: 100%; }
.row__reason { margin: var(--space-2) 0 0; font-size: var(--text-sm); overflow-wrap: anywhere; }

/* ---- Uptime and metrics bars (SVG, presentation attributes only) ---- */
.uptime { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2) var(--space-4); margin-top: var(--space-3); }
.uptime__item { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 3px var(--space-2); font-size: var(--text-sm); min-width: 0; }
.uptime__label { white-space: nowrap; color: var(--text-secondary); font-weight: var(--weight-medium); font-size: var(--text-xs); }
.uptime__pct { font-weight: var(--weight-bold); font-size: var(--text-sm); text-align: right; }
.uptime__bar, .metric__bar { grid-column: 1 / -1; grid-row: 2; width: 100%; height: 8px; border-radius: var(--radius-full); overflow: hidden; display: block; }
.uptime__track { fill: var(--border-subtle); }
.uptime__fill--up { fill: var(--success); }
.uptime__fill--degraded { fill: var(--warning); }
.uptime__fill--down { fill: var(--danger); }
.uptime__note { grid-column: 1 / -1; grid-row: 3; font-size: var(--text-xs); }

.metrics {
    margin-top: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: grid;
    gap: var(--space-2);
}
.metrics--stale { border-style: dashed; border-color: var(--text-secondary); opacity: .85; }
.metrics__stale { margin: 0; display: flex; gap: var(--space-2); align-items: center; color: var(--text-secondary); font-weight: var(--weight-bold); font-size: var(--text-sm); }
.metrics__asof { margin: 0; font-size: var(--text-xs); font-weight: var(--weight-medium); }
.metric { display: grid; grid-template-columns: 4.4em 1fr 3.8em; align-items: center; gap: var(--space-3); font-size: var(--text-sm); }
.metric__label { color: var(--text-secondary); font-weight: var(--weight-medium); }
.metric__bar { grid-column: 2; grid-row: auto; height: 10px; }
.metric__value { font-weight: var(--weight-bold); text-align: right; }
.metric__na { grid-column: 2 / -1; color: var(--text-secondary); font-style: italic; font-size: var(--text-sm); line-height: 1.3; }

/* ---- Shared groups (Uptime) ---- */
.shared__groups { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: start; }
.group { background: var(--card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: var(--space-1) var(--space-4) var(--space-3); box-shadow: var(--elev-1); }
.group summary.group__title { color: var(--text-primary); font-size: var(--text-base); }
.group--problem { border: 2px solid var(--warning); }

/* ---- Domain table ---- */
.count-line { margin: 0 0 var(--space-4); font-size: var(--text-lg); }
.count-line__flag { display: inline-flex; align-items: center; gap: var(--space-1); font-weight: var(--weight-semibold); color: var(--warning); }
.domain-table { table-layout: auto; width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--elev-1); }
/* No overflow clipping here: overflow hidden would make the table a scroll container and the sticky head would stick to it, not the viewport (UAT-R-01). Corners are rounded on the corner cells instead. */
.domain-table thead th:first-child { border-top-left-radius: calc(var(--radius-lg) - 1px); }
.domain-table thead th:last-child { border-top-right-radius: calc(var(--radius-lg) - 1px); }
.domain-table tbody tr:last-child > :first-child { border-bottom-left-radius: calc(var(--radius-lg) - 1px); }
.domain-table tbody tr:last-child > :last-child { border-bottom-right-radius: calc(var(--radius-lg) - 1px); }
.domain-table th, .domain-table td { text-align: left; vertical-align: top; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle); }
.domain-table tbody tr:last-child > * { border-bottom: 0; }
.domain-table tbody tr:hover { background: var(--interactive-subtle); }
.domain-table thead th { position: sticky; top: var(--header-h); background: var(--inset); color: var(--text-secondary); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.domain__name { font-weight: var(--weight-bold); overflow-wrap: anywhere; }
.domain__owner { display: block; font-weight: var(--weight-regular); font-size: var(--text-sm); }
.domain__registrar { color: var(--text-secondary); font-size: var(--text-sm); }
.domain__registrar-inline { display: none; font-size: var(--text-sm); }
/* Four columns from 1100 px; hints only, cells wrap rather than overflow. */
@media (min-width: 800px) {
    .domain-table th.col-domain { width: 22%; }
    .domain-table .col-ssl, .domain-table .col-registration { width: 30%; }
    .domain-table th.col-registrar { width: 18%; }
}
/* Fold: 800 to 1099 px the Registrar column hides and its text shows as a muted line in the Domain cell. */
@media (min-width: 800px) and (max-width: 1099px) {
    .domain-table .col-registrar { display: none; }
    .domain__registrar-inline { display: block; }
    .domain-table th.col-domain { width: 28%; }
    .domain-table .col-ssl, .domain-table .col-registration { width: 36%; }
}

.xcell { display: block; --c-fg: var(--success); }
.xcell__line1 { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-bold); color: var(--c-fg); }
.xcell__line2 { display: block; font-size: var(--text-sm); margin-top: 2px; overflow-wrap: anywhere; }
.xcell__level { font-size: var(--text-xs); border: 1px solid currentColor; border-radius: var(--radius-full); padding: 0 .6em; margin-left: var(--space-1); }
.xcell--degraded { --c-fg: var(--warning); }
.xcell--down { --c-fg: var(--danger); }
.xcell--pending, .xcell--unknown, .xcell--stale { --c-fg: var(--text-secondary); }

/* ---- Detail pages ---- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0 var(--space-6); margin: var(--space-3) 0; }
.facts dt, .facts dd { padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); }
.facts dt { color: var(--text-secondary); }
.facts dd { margin: 0; font-weight: var(--weight-medium); }
.detail-grid { display: grid; gap: var(--space-2) var(--space-8); }
.plain { padding-left: var(--space-6); }
.incident-card h1 { font-size: var(--text-3xl); }
.incident-card { --c: var(--border-strong); border-left: 8px solid var(--c); }
.incident-card--open { --c: var(--danger); }
.incident-card--recovering { --c: var(--warning); }
.incident-card--resolved { --c: var(--success); }
.incident-card__lead { font-size: var(--text-lg); color: var(--text-secondary); margin-top: var(--space-3); }
.alert-list { list-style: none; padding: 0; margin: var(--space-4) 0 0; display: grid; gap: var(--space-3); }
.alert-item { background: var(--inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-1) var(--space-4); transition: border-color .15s; }
.alert-item:hover { border-color: var(--border-strong); }
.alert-item summary { cursor: pointer; min-height: 44px; padding: var(--space-3) 0; line-height: 1.9; }
.alert-item summary > * { margin-left: var(--space-2); }
.alert-item[open] { background: var(--card); }
.plain-table { width: 100%; border-collapse: collapse; margin: var(--space-2) 0 var(--space-3); }
.plain-table th, .plain-table td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border-subtle); }
.plain-table thead th { color: var(--text-secondary); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.plain-table tbody tr:last-child td { border-bottom: 0; }
.inventory-counts { color: var(--text-secondary); font-size: var(--text-sm); text-align: center; margin: var(--space-8) 0 0; }

/* ---- Overview: tools row, section heads, renewals due, property tiles, board foot ---- */
a.btn { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; }
.btn--sm { min-height: 44px; padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
.page-tools { display: flex; justify-content: flex-end; margin: 0 0 var(--space-3); }
.section-head { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-8) 0 var(--space-3); }
.section-head .section-title { flex: 1; margin: 0; }
.section-link { font-weight: var(--weight-semibold); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.due-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.due {
    display: grid;
    grid-template-columns: minmax(11rem, 1fr) minmax(0, 2fr) minmax(0, 1fr);
    gap: var(--space-1) var(--space-4);
    align-items: start;
    padding: var(--space-3) var(--space-4);
    background: var(--card);
    border: 1px solid var(--border-subtle);
    border-left: 4px solid var(--c, var(--border-strong));
    border-radius: var(--radius-md);
}
.due--down { background: var(--danger-subtle); border-color: var(--danger); }
.due--degraded { background: var(--warning-subtle); border-color: var(--warning); }
.due__what { display: flex; flex-direction: column; min-width: 0; }
.due__domain { font-weight: var(--weight-bold); overflow-wrap: anywhere; }
.due__kind, .due__who { font-size: var(--text-sm); }
.due__date { display: none; }
.due-more { padding: var(--space-2) var(--space-4); border: 1px dashed var(--border-strong); border-radius: var(--radius-md); font-weight: var(--weight-bold); }
.xcell__qualifier { font-size: var(--text-xs); border: 1px dashed currentColor; border-radius: var(--radius-full); padding: 0 .6em; margin-left: var(--space-1); }
.due-empty, .due-note { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-weight: var(--weight-semibold); }
.due-empty { background: var(--success-subtle); border: 1px solid var(--success); }
.due-empty .icon { color: var(--success); }
.due-empty--none { background: var(--inset); border-color: var(--border-strong); }
.due-empty--none .icon { color: var(--text-secondary); }
.due-note { margin-top: var(--space-2); background: var(--inset); border: 1px dashed var(--text-secondary); }
.due-note .icon { color: var(--text-secondary); }
.due-next { margin: var(--space-1) 0 0 var(--space-4); }
.product-grid--property { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: var(--space-4); }
.tile--property { padding: var(--space-4); }
.tile--property .tile__name { font-size: var(--text-lg); }
.tile--property .tile__cause, .tile--property .tile__note, .tile--property .tile__advisory { font-size: var(--text-sm); margin-top: var(--space-2); }
.tile--link { cursor: pointer; }
.tile__link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: var(--space-1); }
.tile__link::after { content: ""; position: absolute; inset: 0; }
.tile__link:focus-visible { outline: none; }
.tile--property:focus-within { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.tile__go { width: 1em; height: 1em; opacity: .6; }
/* The chevron and chip count towards the title row's width even though they look light. At the narrowest tile width a
   name like "ukphonebook" plus both overflowed by a few pixels, so the chip dropped to its own row with room to spare.
   A smaller chip and chevron and slightly tighter side padding keep typical names on one row (long names still wrap). */
.tile--property.tile--link { padding-inline: var(--space-3); }
.tile--property.tile--link .tile__head .chip { font-size: var(--text-sm); }
.tile--property.tile--link .tile__link { gap: 2px; }
.tile--property.tile--link .tile__go { width: .7em; height: .7em; }
.board-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-6); }
.board-foot .monitor-control { margin: 0; }
.board-foot .monitor-state { margin: 0; align-self: center; }

/* ---- Header tools and tiers: icon + short label from 1280 px, icon only below (the label stays as the accessible name) ---- */
.site-header .tool { display: inline-flex; align-items: center; gap: var(--space-2); }
.site-header .tool[hidden] { display: none; }
@media (max-width: 1279px) {
    .site-header { gap: var(--space-2) var(--space-4); }
    .nav a { padding: var(--space-2) var(--space-3); }
    .site-header .tool { width: 44px; min-width: 44px; padding: 0; justify-content: center; }
    .tool__label, .who__role { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .who__name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 1023px) {
    .who__name { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---- Uptime: page head, anchor targets ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-6); margin: 0 0 var(--space-4); }
.page-head h1 { font-size: var(--text-3xl); }
.shared { margin-top: var(--space-8); }
.tile[id], .shared[id] { scroll-margin-top: calc(var(--header-h) + var(--space-3)); }
.tile.is-target { outline: 3px solid var(--focus-ring); outline-offset: 3px; }

/* ---- Tablet and phone ---- */
@media (max-width: 799px) {
    .site-header { position: static; padding: var(--space-2) var(--space-4); }
    main { padding: var(--space-4); }
    .card { padding: var(--space-4); }
    .summary { padding: var(--space-6) var(--space-4) var(--space-6) calc(var(--space-4) + 8px); }
    .summary__main { gap: var(--space-4); }
    .summary__headline { font-size: var(--text-3xl); }
    .chip--xl { font-size: var(--text-xl); }
    .stamp { text-align: left; }
    /* Two rows: brand + user/sign-out, then the nav; the device toggles sit in the first row's spare space or wrap below. */
    .site-header { gap: 0 var(--space-3); }
    .header-tools { display: contents; }
    .brand { order: 0; margin-right: auto; }
    .header-tools > .tool { order: 1; }
    .signout { order: 2; }
    .nav { order: 3; flex-basis: 100%; flex-wrap: wrap; }
    .nav a { white-space: nowrap; padding: var(--space-2) var(--space-3); }
    .tile[id], .shared[id] { scroll-margin-top: var(--space-3); } /* the header is static here */
    .tag { white-space: normal; border-radius: var(--radius-md); }
    .site-header button { padding: var(--space-2) var(--space-3); }
    .header-tools { gap: var(--space-2) var(--space-2); }
    .incident, .incident__text { min-width: 0; }
    .incident__text { overflow-wrap: anywhere; }
    .domain-table { background: transparent; border: 0; box-shadow: none; overflow: visible; }
    .domain-table thead { display: none; }
    .domain-table thead th { position: static; top: auto; }
    .domain__registrar-inline { display: none; }
    .domain-table, .domain-table tbody, .domain-table tr, .domain-table th, .domain-table td { display: block; width: 100%; }
    .domain-table tr { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-2) var(--space-4); margin-bottom: var(--space-3); background: var(--card); box-shadow: var(--elev-1); }
    .domain-table th, .domain-table td { border: 0; padding: var(--space-1) 0; }
    .domain-table td::before { content: attr(data-label); display: block; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-secondary); }
    .plain-table thead { display: none; }
    .plain-table, .plain-table tbody, .plain-table tr, .plain-table td { display: block; }
    .plain-table tr { padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); }
    .plain-table td { border: 0; padding: 2px 0; }
    .plain-table td::before { content: attr(data-label) ": "; color: var(--text-secondary); }
    .facts { grid-template-columns: 1fr; }
    .facts dt { border-bottom: 0; padding-bottom: 0; }
    .tile { padding: var(--space-6) var(--space-4) var(--space-3); }
    .due { grid-template-columns: 1fr; }
    .page-tools { justify-content: stretch; }
    .page-tools .btn { width: 100%; justify-content: center; }
    .auth-card { padding: var(--space-6); }
}

/* ---- Desktop member board ---- */
@media (min-width: 1024px) {
    .detail-grid { grid-template-columns: 1fr 1fr; }
}

/* ================= Wall (display account, and /wall): always the dark theme ================= */
html.wall { font-size: max(12px, min(calc(100vh / 54), calc(100vw / 96))); }

.layout-display {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    user-select: none;
    font-size: 1rem;
}
/* A pointer is only hidden on the unattended display account; a member who put the wall on a screen keeps it to click Exit. */
.layout-display[data-kiosk] { cursor: none; }
.layout-display .wall-header { display: flex; align-items: center; gap: 1rem; padding: .4rem 1rem 0; }
.layout-display .wall-title { display: inline-flex; align-items: center; font-size: 1.05rem; }
.layout-display .wall-title .wordmark__sim { color: var(--text-primary); }
.layout-display .wall-title .wordmark__dash { color: var(--interactive-default); }
.layout-display .wall-clock { margin-left: auto; color: var(--text-secondary); font-size: 1rem; }
.layout-display .wall-clock time { color: var(--text-primary); font-weight: var(--weight-bold); font-size: 1.15rem; }
.wall-exit {
    color: var(--text-secondary);
    font-size: 1rem;
    text-decoration: underline;
    min-height: 2rem;
    display: inline-flex;
    align-items: center;
    padding: 0 .6rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
}
.layout-display main {
    flex: 1;
    min-height: 0;
    max-width: none;
    margin: 0;
    padding: .3rem 1rem .6rem;
    display: flex;
    flex-direction: column;
    animation: pixel-shift 2400s steps(1) infinite;
}
.layout-display #board { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .5rem; }
/* Nothing visible is smaller than 1rem (about 19-20 px at 1080p; the 18 px floor with margin for rounding). */
.layout-display .section-title { font-size: 1rem; margin: 0 0 .25rem; }
.layout-display .xcell__level, .layout-display .xcell__qualifier, .layout-display .tag, .layout-display .tag--ack,
.layout-display .stamp, .layout-display .stamp__sub, .layout-display .xcell__line2, .layout-display .inventory-counts { font-size: 1rem; }
.layout-display .section-head { margin: 0 0 .25rem; }
.layout-display .summary { padding: .5rem 1.2rem .5rem 1.6rem; box-shadow: none; }
.layout-display .summary::before { width: .45rem; }
.layout-display .summary__headline { font-size: 2.4rem; text-transform: uppercase; }
.layout-display .summary__sentence { font-size: 1.1rem; margin-top: 0; }
.layout-display .banner { margin: 0; font-size: 1.2rem; padding: .3rem .8rem; }
.layout-display .chip { text-transform: uppercase; }
.layout-display .chip--xl { font-size: 1.6rem; }
.layout-display .stamp time { font-size: 1.2rem; }
.layout-display .incident { padding: .3rem .8rem; font-size: 1.2rem; box-shadow: none; }
.layout-display .incident__text { line-height: 1.3; }
.layout-display .incident--more { font-size: 1.1rem; padding: .2rem .8rem; }
.layout-display .incident-list { gap: .3rem; }
/* Renewals are the compressible region: if the budget is ever exceeded they lose their tail, never the product tiles. */
.layout-display .renewals { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.layout-display .due-list { gap: .2rem; }
.layout-display .due { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 14rem; align-items: center; font-size: 1.35rem; line-height: 1.25; padding: .25rem .8rem; }
.layout-display .due__what { flex-direction: row; align-items: baseline; gap: 1rem; }
.layout-display .due__kind, .layout-display .due__date { font-size: 1rem; display: block; }
.layout-display .due .xcell__line2 { display: none; }
.layout-display .due-more { font-size: 1.1rem; padding: .2rem .8rem; }
.layout-display .due-empty, .layout-display .due-note { font-size: 1.1rem; padding: .3rem .8rem; }
.layout-display .due-next { font-size: 1rem; }
.layout-display .products { flex: none; }
.layout-display .product-grid { display: flex; flex-wrap: wrap; gap: .6rem; align-items: stretch; }
.layout-display .tile { flex: 1 1 0; min-width: 12rem; padding: .6rem .8rem .5rem; box-shadow: none; }
.layout-display .tile::before { height: .3rem; }
.layout-display .tile__name { font-size: 1.6rem; line-height: 1.1; overflow-wrap: anywhere; }
.layout-display .tile__cause, .layout-display .tile__note, .layout-display .tile__advisory { font-size: 1rem; margin-top: .3rem; }
.layout-display .inventory-counts, .layout-display .notice { display: none; }

@keyframes pixel-shift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(.15rem, .1rem); }
    50% { transform: translate(.3rem, 0); }
    75% { transform: translate(.1rem, .3rem); }
}

@media (prefers-reduced-motion: reduce) {
    .layout-display main { animation: none; }
    * { transition: none !important; }
}
