/* Marsolen styles.
 *
 * Hand-written: there is no CSS build step, no framework and no npm, matching the
 * vendored-asset rule for HTMX. Everything here is one file served same-origin.
 *
 * The rules up to MARKETING PAGES are the original generic ones - .panel, .field, .notice,
 * table.checks - which the channels, billing and settings pages are still written in. Their
 * blue palette below is the fallback; inside the signed-in shell (`.app`, see DASHBOARD at
 * the end of the file) the same variables are re-pointed at the brand.
 */

:root {
    --ink: #16181d;
    --ink-soft: #5b6270;
    --line: #dfe3ea;
    --page: #fbfcfd;
    --panel: #ffffff;
    --accent: #1f5fd6;
    --accent-ink: #ffffff;
    --danger: #b3261e;
    --danger-bg: #fdecea;
    --ok: #1a7f4b;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a {
    color: var(--accent);
}

/* --- page ------------------------------------------------------------------- */

main {
    max-width: 62rem;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}

main.narrow {
    max-width: 26rem;
}

h1 {
    font-size: 1.4rem;
    letter-spacing: -0.01em;
    margin: 0 0 1.25rem;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.muted {
    color: var(--ink-soft);
}

/* --- forms ------------------------------------------------------------------- */

.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.field input {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    background: #fff;
}

.field input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.field .hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: var(--ink-soft);
}

.field .error {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.82rem;
    color: var(--danger);
}

button {
    font: inherit;
    font-weight: 600;
    padding: 0.55rem 1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--accent);
    color: var(--accent-ink);
    cursor: pointer;
}

button.link {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 400;
    padding: 0;
    text-decoration: underline;
    cursor: pointer;
}

/* --- notices ------------------------------------------------------------------ */

.notice {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.7rem 0.85rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.notice.ok {
    border-color: #b8e0c8;
    background: #f0faf4;
    color: var(--ok);
}

.notice.bad {
    border-color: #f2c4c0;
    background: var(--danger-bg);
    color: var(--danger);
}

/* --- dashboard ----------------------------------------------------------------- */

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-head h1 {
    margin: 0;
}

button.danger {
    background: var(--danger);
}

button.link.danger {
    background: none;
    color: var(--danger);
}

/* --- state badges -------------------------------------------------------------- */

.badge {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.01em;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #f3f5f8;
    color: var(--ink-soft);
    white-space: nowrap;
}

.badge.up {
    border-color: #b8e0c8;
    background: #f0faf4;
    color: var(--ok);
}

.badge.grace {
    border-color: #f2ddb4;
    background: #fdf6e8;
    color: #8a6116;
}

/* --- checks table -------------------------------------------------------------- */

table.checks {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

table.checks th {
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--line);
}

table.checks td {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

table.checks tr:last-child td {
    border-bottom: none;
}

table.checks .sub {
    font-size: 0.82rem;
    color: var(--ink-soft);
}

.actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
}

/* --- detail -------------------------------------------------------------------- */

.panel h2 {
    font-size: 0.95rem;
    margin: 0 0 0.9rem;
}

.panel + .panel {
    margin-top: 1.25rem;
}

dl.facts {
    display: grid;
    grid-template-columns: 10rem 1fr;
    gap: 0.4rem 1rem;
    margin: 0 0 1.25rem;
}

dl.facts dt {
    color: var(--ink-soft);
    font-size: 0.9rem;
}

dl.facts dd {
    margin: 0;
}

.code-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.code-row code {
    display: block;
    flex: 1;
    overflow-x: auto;
    background: #f5f7fa;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
}

/* --- forms ---------------------------------------------------------------------- */

fieldset {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 0 0 1.25rem;
}

fieldset legend {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0 0.4rem;
}


.field select {
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    background: #fff;
}

.field input[type="radio"],
.field input[type="checkbox"] {
    width: auto;
    margin-right: 0.4rem;
}

ul.history {
    list-style: none;
    margin: 0;
    padding: 0;
}

ul.history li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--line);
}

ul.history li:last-child {
    border-bottom: none;
}

ul.history time {
    color: var(--ink-soft);
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

/* =============================================================================
   MARKETING PAGES
   =============================================================================
   Everything below is scoped to `.marketing` on <body>, which fragments/marketing.html
   sets. The dashboard theme above - --ink, --accent: #1f5fd6 - is the old blue palette
   and does not apply here; scoping rather than replacing lets the two coexist while the
   app pages are still on it.

   Design source: direction 1a of the Marsolen design system. No CSS build step, in
   keeping with the rest of this file, and no utility framework.
   ------------------------------------------------------------------------- */

/* --- vendored webfonts ------------------------------------------------------
   Google Fonts serves these, but `default-src 'self'` forbids the stylesheet and the
   font files coming from fonts.googleapis.com / fonts.gstatic.com, so the woff2 files
   are committed under static/fonts/ like htmx. See docs/VENDORED_ASSETS.md for the
   version, the SHA-256 of each file and the licence.

   Space Grotesk ships as one variable file per subset covering 300-700, so 400, 500 and
   600 are all real weights off one download. Space Mono is not variable and Google
   publishes only 400 and 700; the design's mono 500 and 600 therefore resolve to 400 and
   700 through normal CSS weight matching - which is exactly what the design reference
   rendered, since it loaded the same two files. */

@font-face {
    font-family: 'Space Grotesk';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('/fonts/space-grotesk-v22-latin-variable.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: 'Space Grotesk';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('/fonts/space-grotesk-v22-latin-ext-variable.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: 'Space Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/space-mono-v17-latin-400.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: 'Space Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/space-mono-v17-latin-ext-400.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: 'Space Mono';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/space-mono-v17-latin-700.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: 'Space Mono';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/space-mono-v17-latin-ext-700.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;
}

/* --- tokens ----------------------------------------------------------------- */

.marketing {
    /* sand - warm neutrals, from the cream page to the ink */
    --sand-0: #ffffff;
    --sand-50: #f9f4ed;
    --sand-100: #f5ead8;
    --sand-200: #e9dfce;
    --sand-300: #d9ccb6;
    --sand-400: #b3a68f;
    --sand-500: #8c8070;
    --sand-600: #645c50;
    --sand-800: #33302a;
    --sand-900: #201e1d;
    --sand-950: #141312;

    /* olive - the primary, and the trace colour */
    --olive-50: #eef7d8;
    --olive-200: #c7dc92;
    --olive-300: #a8c464;
    --olive-500: #4c6a0f;
    --olive-600: #3f580c;
    --olive-700: #31450a;

    /* monitor states. `up` is a true green held clear of the olive-lime primary, so
       "healthy" never reads as "interactive". */
    --state-up: #256b3c;
    --state-late: #b57c0d;
    --state-down: #a52d17;
    --state-down-soft: #fbeee8;
    --state-down-border: #e9b8a1;
    --clay-700: #6c1c0e;

    /* the rest of each state's badge - tint, edge and text - from design-system/tokens/colors.css,
       light theme, which is the only one these pages have */
    --state-up-soft: #e6f2e8;
    --state-up-border: #9ccdaa;
    --state-up-fg: #164226;
    --state-late-soft: #fbf1dd;
    --state-late-border: #eac98a;
    --state-late-fg: #754e08;
    --state-down-fg: var(--clay-700);
    --state-paused-soft: var(--sand-50);
    --state-paused-border: var(--sand-300);
    --state-paused-fg: var(--sand-600);
    --state-new-soft: #eaf0f3;
    --state-new-border: #c3d3da;
    --state-new-fg: #3f5a67;

    /* surfaces, text, borders */
    --surface-page: var(--sand-100);
    --surface-card: var(--sand-50);
    --surface-hover: var(--sand-100);
    --surface-active: var(--sand-200);
    --surface-code: #1c1e16;
    --code-chrome: #171911;
    --code-edge: #2c2f22;

    --text-body: var(--sand-800);
    --text-strong: var(--sand-900);
    --text-muted: var(--sand-600);
    --text-subtle: var(--sand-500);

    --border-subtle: var(--sand-200);
    --border-default: #ded2bd;
    --border-strong: var(--sand-500);

    --m-accent: var(--olive-500);
    --m-accent-hover: var(--olive-600);
    --m-accent-press: var(--olive-700);
    --accent-soft: var(--olive-50);
    --accent-soft-border: var(--olive-200);

    --font-sans: 'Space Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --radius-xs: 3px;
    --radius-sm: 5px;
    --radius-md: 7px;
    --radius-lg: 10px;

    /* sober, tight, warm-tinted. Borders do more work than shadows here. */
    --shadow-xs: 0 1px 1px rgba(32, 30, 29, .04);
    --shadow-sm: 0 1px 2px rgba(32, 30, 29, .06), 0 1px 1px rgba(32, 30, 29, .04);
    --shadow-md: 0 2px 6px rgba(32, 30, 29, .08), 0 1px 2px rgba(32, 30, 29, .05);
    --ring: 0 0 0 3px color-mix(in oklab, var(--olive-500) 26%, transparent);

    --ease-standard: cubic-bezier(.2, .6, .25, 1);
    --dur-fast: 120ms;
    --transition-control: background-color var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard);

    --gutter: 32px;
}

@media (prefers-reduced-motion: reduce) {
    .marketing {
        --dur-fast: 0ms;
    }
}

.marketing {
    margin: 0;
    background: var(--surface-card);
    color: var(--text-body);
    font: 400 15px/1.65 var(--font-sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.marketing :focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

/* The dashboard's `main` is a 62rem centred column with its own padding, which is right
   for a page of forms and tables and wrong here: a marketing band is a full-bleed strip
   of colour that caps its *contents* at 1180px, not a column with a background. Without
   this the dark stat band and the channels band render as floating panels with cream
   down both sides. */
.marketing main {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* --- layout ----------------------------------------------------------------- */

.marketing .m-band {
    padding: 56px var(--gutter);
}

/* Every band but the last is closed by a hairline. */
.marketing .m-band-card,
.marketing .m-band-page {
    border-bottom: 1px solid var(--border-default);
}

.marketing .m-band-card {
    background: var(--surface-card);
}

.marketing .m-band-page {
    background: var(--surface-page);
}

.marketing .m-band-dark {
    background: var(--sand-900);
    padding: 36px var(--gutter);
}

.marketing .m-pricing {
    border-bottom: none;
}

.marketing .m-wrap {
    max-width: 1180px;
    margin: 0 auto;
}

.marketing .m-wrap-narrow {
    max-width: 1000px;
}

/* --- type ------------------------------------------------------------------- */

.marketing .m-eyebrow {
    display: block;
    font: 600 11px/1.2 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--olive-600);
}

.marketing .m-h1 {
    margin: 14px 0 0;
    font: 600 38px/1.1 var(--font-sans);
    letter-spacing: -0.022em;
    color: var(--sand-900);
    text-wrap: balance;
}

.marketing .m-h2 {
    margin: 0;
    font: 600 30px/1.15 var(--font-sans);
    letter-spacing: -0.022em;
    color: var(--sand-900);
}

.marketing .m-h3 {
    margin: 0;
    font: 600 17px/1.3 var(--font-sans);
    letter-spacing: -0.012em;
    color: var(--text-strong);
}

.marketing .m-sub {
    margin: 10px 0 0;
    font: 400 17px/1.6 var(--font-sans);
    color: var(--text-muted);
    max-width: 60ch;
}

.marketing .m-body {
    margin: 7px 0 0;
    font: 400 14px/1.6 var(--font-sans);
    color: var(--text-muted);
}

.marketing .m-fine {
    margin: 14px 0 0;
    font: 400 12px/1.5 var(--font-mono);
    color: var(--text-subtle);
}

/* --- header ----------------------------------------------------------------- */

.marketing .m-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 26px;
    height: 58px;
    padding: 0 var(--gutter);
    background: rgba(249, 244, 237, .88);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-default);
}

.marketing .m-lockup {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
}

.marketing .m-lockup span {
    font: 600 17px/1 var(--font-sans);
    letter-spacing: -0.03em;
    color: var(--sand-900);
}

.marketing .m-nav {
    display: flex;
    gap: 20px;
}

.marketing .m-nav a {
    font: 500 14px/1.4 var(--font-sans);
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-control);
}

.marketing .m-nav a:hover {
    color: var(--text-strong);
    text-decoration: none;
}

.marketing .m-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- buttons ---------------------------------------------------------------- */
/* Three heights, three variants. Focus is never removed. */

.marketing .m-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    letter-spacing: 0;
    border: 1px solid transparent;
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-control);
}

.marketing .m-btn:hover {
    text-decoration: none;
}

.marketing .m-btn-sm {
    height: 26px;
    padding: 0 8px;
    gap: 5px;
    font: 500 12px/1 var(--font-sans);
    border-radius: var(--radius-sm);
}

.marketing .m-btn-md {
    height: 32px;
    padding: 0 12px;
    gap: 6px;
    font: 500 14px/1 var(--font-sans);
    border-radius: var(--radius-md);
}

.marketing .m-btn-lg {
    height: 38px;
    padding: 0 16px;
    gap: 8px;
    font: 500 15px/1 var(--font-sans);
    border-radius: var(--radius-md);
}

.marketing .m-btn-block {
    width: 100%;
}

.marketing .m-btn-primary {
    background: var(--m-accent);
    border-color: var(--m-accent);
    color: #fff;
}

.marketing .m-btn-primary:hover {
    background: var(--m-accent-hover);
    border-color: var(--m-accent-hover);
    color: #fff;
}

.marketing .m-btn-primary:active {
    background: var(--m-accent-press);
    border-color: var(--m-accent-press);
}

.marketing .m-btn-secondary {
    background: var(--surface-card);
    border-color: var(--border-default);
    color: var(--text-strong);
}

.marketing .m-btn-secondary:hover {
    background: var(--surface-hover);
    color: var(--text-strong);
}

.marketing .m-btn-secondary:active {
    background: var(--surface-active);
}

.marketing .m-btn-ghost {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--text-muted);
}

.marketing .m-btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--text-muted);
}

.marketing .m-btn-ghost:active {
    background: var(--surface-active);
}

.marketing .m-btn svg {
    flex: none;
}

/* --- card ------------------------------------------------------------------- */

.marketing .m-card {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    padding: 16px;
}

.marketing .m-card-sm {
    padding: 12px;
}

/* --- hero ------------------------------------------------------------------- */

.marketing .m-hero {
    padding: 72px var(--gutter) 56px;
}

.marketing .m-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 470px);
    gap: 56px;
    align-items: center;
}

.marketing .m-trace {
    display: block;
    margin-top: 22px;
    stroke: var(--olive-500);
    max-width: 100%;
}

.marketing .m-lede {
    margin: 16px 0 0;
    font: 400 17px/1.6 var(--font-sans);
    color: var(--text-muted);
    max-width: 52ch;
}

.marketing .m-lede code {
    font: 400 13px/1.5 var(--font-mono);
    color: var(--text-strong);
}

.marketing .m-hero-actions {
    display: flex;
    gap: 10px;
    margin-top: 26px;
    flex-wrap: wrap;
}

.marketing .m-hero-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

/* --- code block ------------------------------------------------------------- */

.marketing .m-code {
    background: var(--surface-code);
    border: 1px solid var(--code-edge);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.marketing .m-code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 6px 12px;
    border-bottom: 1px solid var(--code-edge);
    background: var(--code-chrome);
}

.marketing .m-code-name {
    font: 400 12px/1.5 var(--font-mono);
    letter-spacing: 0.02em;
    color: var(--sand-300);
}

.marketing .m-code-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: none;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--sand-400);
    cursor: pointer;
    transition: var(--transition-control);
}

/* The hover fill is a step of the code chrome rather than --surface-hover: this control
   sits on near-black, where the cream hover of the light surfaces would flash. */
.marketing .m-code-copy:hover {
    background: var(--code-edge);
    color: var(--sand-300);
}

/* marsolen.js sets data-copied for 1.5s after a successful copy. */
.marketing .m-code-copy .m-copy-done,
.marketing .m-code-copy[data-copied] .m-copy-idle {
    display: none;
}

.marketing .m-code-copy[data-copied] .m-copy-done {
    display: inline-flex;
    color: var(--olive-300);
}

.marketing .m-code-copy span {
    display: inline-flex;
}

.marketing .m-code-body {
    margin: 0;
    padding: 12px 14px;
    overflow-x: auto;
    font: 400 13px/1.5 var(--font-mono);
    color: #eae2d2;
}

/* No syntax highlighting anywhere: code is rendered verbatim in one colour.
   min-height holds a blank line open: an empty flex line has no content to give it a
   height, and the snippet then loses the gap the author put there. The numbered blocks
   do not need it - the line number keeps the row open - but they share the rule. */
.marketing .m-code-line {
    display: flex;
    gap: 14px;
    white-space: pre;
    min-height: 1.5em;
}

.marketing .m-code-no {
    width: 18px;
    flex: none;
    text-align: right;
    color: var(--sand-500);
    user-select: none;
}

/* --- monitor card ----------------------------------------------------------- */

.marketing .m-monitor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.marketing .m-monitor-name {
    font: 400 13px/1.5 var(--font-mono);
    color: var(--text-strong);
}

.marketing .m-monitor-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 7px;
    font: 400 12px/1.5 var(--font-mono);
    color: var(--text-subtle);
}

/* State is never colour alone - the badge always carries the word and a glyph. */
.marketing .m-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 20px;
    padding: 0 7px;
    border-radius: var(--radius-sm);
    font: 600 11px/1 var(--font-sans);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.marketing .m-status-down {
    background: var(--state-down-soft);
    border: 1px solid var(--state-down-border);
    color: var(--clay-700);
}

/* --- ping timeline ---------------------------------------------------------- */
/* One bar per run, oldest on the left. No axes, no gridlines, no legend. */

.marketing .m-timeline {
    display: flex;
    align-items: flex-end;
    gap: 1.5px;
    height: 26px;
    width: 100%;
    margin-top: 10px;
}

.marketing .m-ping {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    min-width: 3px;
}

.marketing .m-ping i {
    display: block;
    width: 100%;
    min-width: 3px;
    border-radius: 1.5px;
}

.marketing .m-ping-up {
    background: var(--state-up);
}

.marketing .m-ping-late {
    background: var(--state-late);
}

.marketing .m-ping-down {
    background: var(--state-down);
}

.m-ping-h32{height:32%} .m-ping-h33{height:33%} .m-ping-h34{height:34%} .m-ping-h37{height:37%} .m-ping-h38{height:38%} .m-ping-h39{height:39%} .m-ping-h41{height:41%} .m-ping-h42{height:42%}
.m-ping-h43{height:43%} .m-ping-h45{height:45%} .m-ping-h46{height:46%} .m-ping-h47{height:47%} .m-ping-h49{height:49%} .m-ping-h50{height:50%} .m-ping-h51{height:51%} .m-ping-h53{height:53%}
.m-ping-h54{height:54%} .m-ping-h55{height:55%} .m-ping-h57{height:57%} .m-ping-h58{height:58%} .m-ping-h59{height:59%} .m-ping-h61{height:61%} .m-ping-h62{height:62%} .m-ping-h63{height:63%}
.m-ping-h66{height:66%} .m-ping-h67{height:67%} .m-ping-h70{height:70%} .m-ping-h71{height:71%} .m-ping-h72{height:72%} .m-ping-h74{height:74%} .m-ping-h75{height:75%} .m-ping-h76{height:76%}
.m-ping-h78{height:78%} .m-ping-h79{height:79%} .m-ping-h80{height:80%} .m-ping-h82{height:82%} .m-ping-h83{height:83%} .m-ping-h84{height:84%} .m-ping-h86{height:86%} .m-ping-h87{height:87%}
.m-ping-h88{height:88%} .m-ping-h90{height:90%} .m-ping-h91{height:91%} .m-ping-h92{height:92%}

/* --- stat band -------------------------------------------------------------- */

.marketing .m-stats-row {
    display: flex;
    gap: 56px;
    flex-wrap: wrap;
}

.marketing .m-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.marketing .m-stat-label {
    font: 600 11px/1.2 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sand-500);
}

.marketing .m-stat-value {
    display: flex;
    align-items: baseline;
    gap: 3px;
}

/* Mono carries every machine value on this page: figures, prices, monitor names,
   cron expressions, timestamps. Sentences are sans. */
.marketing .m-stat-figure {
    font: 600 30px/1 var(--font-mono);
    letter-spacing: -0.012em;
    color: #fff;
}

.marketing .m-stat-unit {
    font: 500 14px/1 var(--font-mono);
    color: var(--sand-400);
}

/* --- integration ------------------------------------------------------------ */

.marketing .m-integration-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    margin-top: 26px;
    align-items: start;
}

.marketing .m-tabbed {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

/* The radios drive the tab strip and the panels. Kept in the layout but invisible and
   zero-sized, rather than display:none, so they stay focusable and the strip keeps the
   arrow-key behaviour a radio group has for free. */
.marketing .m-tab-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.marketing .m-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border-default);
}

.marketing .m-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 10px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    font: 500 14px/1 var(--font-sans);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-control);
}

.marketing .m-tab:hover {
    background: var(--surface-hover);
}

.marketing .m-snippet {
    display: none;
}

/* Sibling selectors rather than :has() - the radios precede the panels for exactly
   this reason. */
.marketing #snippet-spring:checked ~ .m-tabs .m-tab[for="snippet-spring"],
.marketing #snippet-quartz:checked ~ .m-tabs .m-tab[for="snippet-quartz"],
.marketing #snippet-maven:checked ~ .m-tabs .m-tab[for="snippet-maven"],
.marketing #snippet-props:checked ~ .m-tabs .m-tab[for="snippet-props"] {
    font-weight: 600;
    color: var(--text-strong);
    border-bottom-color: var(--m-accent);
}

.marketing #snippet-spring:checked ~ .m-snippets .m-snippet-spring,
.marketing #snippet-quartz:checked ~ .m-snippets .m-snippet-quartz,
.marketing #snippet-maven:checked ~ .m-snippets .m-snippet-maven,
.marketing #snippet-props:checked ~ .m-snippets .m-snippet-props {
    display: block;
}

/* Keyboard focus lands on the input, which is invisible; show the ring on its label. */
.marketing #snippet-spring:focus-visible ~ .m-tabs .m-tab[for="snippet-spring"],
.marketing #snippet-quartz:focus-visible ~ .m-tabs .m-tab[for="snippet-quartz"],
.marketing #snippet-maven:focus-visible ~ .m-tabs .m-tab[for="snippet-maven"],
.marketing #snippet-props:focus-visible ~ .m-tabs .m-tab[for="snippet-props"] {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    box-shadow: var(--ring);
}

.marketing .m-facts {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.marketing .m-fact {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-page);
}

.marketing .m-fact-icon {
    display: inline-flex;
    flex: none;
    color: var(--text-subtle);
}

.marketing .m-fact-label {
    font: 500 14px/1.3 var(--font-sans);
    color: var(--text-strong);
}

/* --- channels --------------------------------------------------------------- */

.marketing .m-channel-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.marketing .m-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    border: 1px solid var(--accent-soft-border);
    color: var(--olive-600);
}

.marketing .m-channel-grid .m-h3 {
    margin-top: 13px;
}

/* --- pricing ---------------------------------------------------------------- */

.marketing .m-price-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.marketing .m-plan-featured {
    border-color: var(--olive-300);
    box-shadow: var(--shadow-md);
}

.marketing .m-plan-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.marketing .m-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    padding: 0 7px;
    border-radius: var(--radius-xs);
    background: var(--accent-soft);
    border: 1px solid var(--accent-soft-border);
    color: var(--olive-700);
    font: 500 11px/1 var(--font-sans);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.marketing .m-price {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-top: 12px;
}

.marketing .m-price-figure {
    font: 600 38px/1 var(--font-mono);
    letter-spacing: -0.012em;
    color: var(--sand-900);
}

.marketing .m-price-per {
    font: 400 12px/1.5 var(--font-mono);
    color: var(--text-subtle);
}

.marketing .m-blurb {
    margin: 8px 0 0;
    font: 400 14px/1.5 var(--font-sans);
    color: var(--text-muted);
}

.marketing .m-features {
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.marketing .m-features li {
    display: flex;
    gap: 8px;
    font: 400 14px/1.45 var(--font-sans);
    color: var(--text-body);
}

.marketing .m-check {
    display: inline-flex;
    flex: none;
    margin-top: 1px;
    color: var(--state-up);
}

/* In flow, 20px under the feature list, as drawn. Not pushed to the card's bottom edge:
   the three cards stretch to a common height, so bottom-aligning the buttons would line
   them up with each other and pull Free's and Scale's away from their own lists. */
.marketing .m-plan-action {
    margin-top: 20px;
}

/* --- footer ----------------------------------------------------------------- */

.marketing .m-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: var(--gutter);
    background: var(--sand-950);
}

.marketing .m-footer-word {
    font: 600 17px/1 var(--font-sans);
    letter-spacing: -0.03em;
    color: #fff;
}

.marketing .m-footer-links {
    margin-left: auto;
    font: 400 12px/1.5 var(--font-mono);
    color: var(--sand-500);
}

/* --- responsive -------------------------------------------------------------
   The design is drawn at 1240px. Below ~900px the two-column grids become one
   column with the code under the copy, and the stat band wraps to 2x2. */

@media (max-width: 900px) {
    .marketing .m-hero-grid,
    .marketing .m-integration-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 32px;
    }

    .marketing .m-hero {
        padding-top: 48px;
    }

    .marketing .m-stats-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px 32px;
    }

    .marketing .m-channel-grid,
    .marketing .m-price-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .marketing .m-h1 {
        font-size: 32px;
    }

    .marketing .m-h2 {
        font-size: 26px;
    }
}

@media (max-width: 700px) {
    .marketing .m-header {
        gap: 16px;
    }

    /* The nav is four in-page anchors; below this width the two account actions are
       what the header is for. */
    .marketing .m-nav {
        display: none;
    }
}

@media (max-width: 600px) {
    .marketing {
        --gutter: 20px;
    }
}

/* =============================================================================
   PUBLIC STATUS PAGE
   =============================================================================
   templates/status/, at /status/<slug>. <body> carries both `marketing`, for the brand
   tokens and webfonts above, and `status`, which scopes everything here. Drawn from
   design-system/ui_kits/status/: a 760px column on the cream page, one card of published
   checks, light only like the marketing site.
   ------------------------------------------------------------------------- */

.status {
    background: var(--surface-page);
}

.status .s-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 760px;
    margin: 0 auto;
    padding: 40px 16px 56px;
}

.status .s-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.status .s-eyebrow {
    font: 600 11px/1.2 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-subtle);
}

.status .s-title {
    margin: 0;
    font: 600 30px/1.15 var(--font-sans);
    letter-spacing: -0.022em;
    color: var(--text-strong);
    overflow-wrap: anywhere;
}

.status .s-desc {
    margin: 0;
    max-width: 68ch;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.status .s-card {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.status .s-checks {
    margin: 0;
    padding: 0;
    list-style: none;
}

.status .s-check {
    padding: 16px 16px 14px;
}

.status .s-check + .s-check {
    border-top: 1px solid var(--border-subtle);
}

.status .s-check-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

/* A public display name is prose, in sans - never an identifier in mono. */
.status .s-check-name {
    flex: 1 1 12rem;
    min-width: 0;
    font: 500 15px/1.3 var(--font-sans);
    color: var(--text-strong);
    overflow-wrap: anywhere;
}

.status .s-figure {
    font: 400 12px/1.5 var(--font-mono);
    color: var(--text-muted);
    white-space: nowrap;
}

/* The state never rides on colour alone: a glyph and the word, as design-system StatusBadge. */
.status .s-state {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 20px;
    padding: 0 7px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    font: 600 11px/1 var(--font-sans);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.status .s-state-up { background: var(--state-up-soft); border-color: var(--state-up-border); color: var(--state-up-fg); }
.status .s-state-late { background: var(--state-late-soft); border-color: var(--state-late-border); color: var(--state-late-fg); }
.status .s-state-down { background: var(--state-down-soft); border-color: var(--state-down-border); color: var(--state-down-fg); }
.status .s-state-paused { background: var(--state-paused-soft); border-color: var(--state-paused-border); color: var(--state-paused-fg); }
.status .s-state-new { background: var(--state-new-soft); border-color: var(--state-new-border); color: var(--state-new-fg); }

/* 90 days, one column each, oldest on the left. The SVG's view box is 34 units tall and drawn
   34px tall, so a vertical unit is a pixel; status.UptimeBar computes the geometry. */
.status .s-bar {
    display: block;
    width: 100%;
    height: 34px;
    margin-top: 8px;
}

.status .s-day-up { fill: var(--state-up); }
.status .s-day-down { fill: var(--state-down); }
.status .s-day-none { fill: var(--border-strong); }

/* The whole column carries the day's tooltip, so a 3px no-data stub is as easy to point at as a
   full bar. Painted transparent rather than `none`, which would take it out of hit-testing. */
.status .s-day-slot { fill: transparent; }

.status .s-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font: 400 12px/1.5 var(--font-mono);
    color: var(--text-subtle);
}

.status .s-note {
    margin: 0;
    max-width: 68ch;
    font: 400 12px/1.5 var(--font-sans);
    color: var(--text-subtle);
}

.status .s-empty {
    margin: 0;
    padding: 16px;
    color: var(--text-muted);
}

.status .s-foot {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.status .s-by {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: 500 12px/1 var(--font-sans);
    color: var(--text-muted);
    text-decoration: none;
}

.status .s-by:hover {
    color: var(--text-strong);
}

/* --- auth ------------------------------------------------------------------- */

/* The sign-in, signup and password pages (fragments/auth.html): the lockup and one card on the
   cream page, nothing else. Scoped under .auth, beside .marketing, so the brand tokens apply and
   the dashboard's own .field/.panel rules never do. */

.auth {
    background: var(--surface-page);
}

/* design-system/readme.md: focus is an outline, never a box-shadow, so no rule can remove it.
   The marketing pages use the older ring; these pages hold the rule. */
.auth :focus-visible {
    outline: 2px solid var(--olive-500);
    outline-offset: 2px;
    box-shadow: none;
}

.auth a {
    color: var(--m-accent);
    text-underline-offset: 2px;
}

.auth a:hover {
    color: var(--m-accent-hover);
}

.auth .a-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    padding: 112px 24px 64px;
}

.auth .a-lockup {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
}

.auth .a-lockup span {
    font: 600 24px/1 var(--font-sans);
    letter-spacing: -0.022em;
    color: var(--text-strong);
}

.auth main.a-column {
    width: 100%;
    max-width: 400px;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth .a-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 28px;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.auth .a-card h1 {
    margin: 0;
    font: 600 22px/1.25 var(--font-sans);
    letter-spacing: -0.012em;
    color: var(--text-strong);
}

.auth .a-card p {
    margin: 0;
}

.auth .a-card .a-aside {
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
}

.auth .a-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin: 0;
}

.auth .a-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth .a-field label {
    font: 500 14px/1.4 var(--font-sans);
    color: var(--text-strong);
}

.auth .a-field input {
    height: 38px;
    padding: 0 12px;
    background: var(--surface-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    font: 400 15px/1.4 var(--font-sans);
    color: var(--text-strong);
}

.auth .a-field input.a-invalid {
    border-color: var(--state-down);
}

.auth .a-hint,
.auth .a-error {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}

.auth .a-error {
    color: var(--state-down-fg);
}

.auth .a-submit {
    height: 38px;
    width: 100%;
    background: var(--m-accent);
    border: 1px solid var(--m-accent);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    color: #fff;
    font: 500 15px/1 var(--font-sans);
    cursor: pointer;
    transition: var(--transition-control);
}

.auth .a-submit:hover {
    background: var(--m-accent-hover);
    border-color: var(--m-accent-hover);
}

.auth .a-submit:active {
    background: var(--m-accent-press);
    border-color: var(--m-accent-press);
}

/* A glyph and words, never colour alone. */
.auth .a-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.5;
}

.auth .a-notice svg,
.auth .a-confirm svg {
    flex: none;
    margin-top: 2px;
}

.auth .a-notice-ok {
    background: var(--state-up-soft);
    border-color: var(--state-up-border);
    color: var(--state-up-fg);
}

.auth .a-notice-bad {
    background: var(--state-down-soft);
    border-color: var(--state-down-border);
    color: var(--state-down-fg);
}

.auth .a-card .a-confirm {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--state-up-fg);
}

.auth .a-footer {
    margin: 0;
    text-align: center;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-muted);
}

@media (max-width: 480px) {
    .auth .a-page {
        padding: 64px 16px 48px;
    }
}

/* =============================================================================
   DASHBOARD
   =============================================================================
   Every signed-in page, through fragments/layout.html, which sets `app` on <body>.
   Translated from design-system/: the tokens are tokens/colors.css and friends, light theme,
   and each `d-` class below is one of its components - Button, IconButton, Card, MetricStat,
   StatusBadge, StateBanner, ProbeOutcome, Tabs, Field and its controls, ChoiceCard, CodeBlock -
   drawn as classes because the CSP forbids the inline styles the React reference uses. The
   chrome is ui_kits/app's AppShell.

   The pages not yet redrawn (channels, billing, settings) keep the classes at the top of this
   file. Their palette variables are re-pointed at the brand below, so inside the new chrome
   they read as the same product rather than as the old blue one.
   ------------------------------------------------------------------------- */

/* --- tokens ----------------------------------------------------------------- */

.app {
    --sand-0: #ffffff;
    --sand-50: #f9f4ed;
    --sand-100: #f5ead8;
    --sand-200: #e9dfce;
    --sand-300: #d9ccb6;
    --sand-400: #b3a68f;
    --sand-450: #a39785;
    --sand-500: #887e6d;
    --sand-550: #6b6256;
    --sand-600: #645c50;
    --sand-800: #33302a;
    --sand-900: #201e1d;
    --olive-300: #a8c464;
    --olive-500: #4c6a0f;
    --olive-600: #3f580c;
    --olive-700: #31450a;

    --state-up: #256b3c;
    --state-up-soft: #e6f2e8;
    --state-up-border: #9ccdaa;
    --state-up-fg: #164226;
    --state-late: #b57c0d;
    --state-late-soft: #fbf1dd;
    --state-late-border: #eac98a;
    --state-late-fg: #754e08;
    --state-down: #a52d17;
    --state-down-soft: #fbeee8;
    --state-down-border: #e9b8a1;
    --state-down-fg: #6c1c0e;
    --state-paused: var(--sand-500);
    --state-paused-soft: var(--sand-50);
    --state-paused-border: var(--sand-300);
    --state-paused-fg: var(--sand-600);
    --state-new: #5c7b8a;
    --state-new-soft: #eaf0f3;
    --state-new-border: #c3d3da;
    --state-new-fg: #3f5a67;

    --surface-page: var(--sand-100);
    --surface-card: var(--sand-50);
    --surface-sunken: var(--sand-200);
    --surface-raised: var(--sand-0);
    --surface-hover: var(--sand-100);
    --surface-active: var(--sand-200);
    --surface-code: #1c1e16;

    --text-body: var(--sand-800);
    --text-strong: var(--sand-900);
    --text-muted: var(--sand-600);
    --text-subtle: var(--sand-550);
    --text-link: var(--olive-600);
    --text-link-hover: var(--olive-700);
    --text-on-accent: #ffffff;

    --border-subtle: var(--sand-200);
    --border-default: #ded2bd;
    --border-strong: var(--sand-500);
    --border-focus: var(--olive-500);

    --accent: var(--olive-500);
    --accent-hover: var(--olive-600);
    --accent-press: var(--olive-700);
    --danger: #a52d17;
    --danger-hover: #8a2412;
    --danger-press: #6c1c0e;

    --font-sans: 'Space Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --radius-xs: 3px;
    --radius-sm: 5px;
    --radius-md: 7px;
    --radius-lg: 10px;
    --radius-xl: 14px;

    --shadow-xs: 0 1px 1px rgba(32, 30, 29, .04);
    --shadow-sm: 0 1px 2px rgba(32, 30, 29, .06), 0 1px 1px rgba(32, 30, 29, .04);
    --shadow-lg: 0 12px 28px rgba(32, 30, 29, .14), 0 2px 6px rgba(32, 30, 29, .07);

    --ease-standard: cubic-bezier(.2, .6, .25, 1);
    --dur-fast: 120ms;
    --transition-control: background-color var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard);

    /* The old dashboard palette at the top of this file, re-pointed at the brand. */
    --ink: var(--sand-900);
    --ink-soft: var(--sand-600);
    --line: var(--border-default);
    --page: var(--surface-page);
    --panel: var(--surface-card);
    --accent-ink: var(--text-on-accent);
    --danger-bg: var(--state-down-soft);
    --ok: var(--state-up);
    --radius: var(--radius-lg);
}

@media (prefers-reduced-motion: reduce) {
    .app {
        --dur-fast: 0ms;
    }
}

.app {
    margin: 0;
    background: var(--surface-page);
    color: var(--text-body);
    font: 400 15px/1.65 var(--font-sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* design-system/readme.md: focus is a 2px outline, never a box-shadow, so no rule can remove it. */
.app :focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

/* Zero specificity, so every component class below that styles a link wins over it. */
.app :where(a) {
    color: var(--text-link);
}

.app :where(a):hover {
    color: var(--text-link-hover);
}

.app code {
    font-family: var(--font-mono);
    font-size: .92em;
}

/* --- chrome: design-system/ui_kits/app AppShell ----------------------------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Always dark, in both themes, so it pins the dark theme's focus colour. The rail runs the full
   height of the page; what is on it stays in view as the page scrolls. */
.app-side {
    --border-focus: var(--olive-300);
    flex: none;
    width: 236px;
    background: var(--sand-900);
    border-right: 1px solid #282520;
    color: var(--sand-400);
}

.app-side-inner {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-lockup {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    padding: 0 14px;
    border-bottom: 1px solid #282520;
    color: #ffffff;
    font: 600 17px/1 var(--font-sans);
    letter-spacing: -0.03em;
    text-decoration: none;
}

.app-lockup:hover {
    color: #ffffff;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 10px 8px;
    list-style: none;
}

.app-nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 32px;
    padding: 0 9px;
    border-radius: var(--radius-sm);
    color: var(--sand-400);
    font: 400 14px/1 var(--font-sans);
    text-decoration: none;
    transition: var(--transition-control);
}

.app-nav a:hover {
    background: #272420;
    color: var(--sand-300);
}

.app-nav a[aria-current="page"] {
    background: #302c26;
    color: #ffffff;
    font-weight: 500;
}

.app-account {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
    padding: 12px 14px 14px;
    border-top: 1px solid #282520;
}

.app-account form {
    margin: 0;
}

.app-eyebrow {
    font: 600 11px/1.2 var(--font-mono);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--sand-450);
}

.app-who {
    font: 400 12px/1.5 var(--font-mono);
    color: var(--sand-300);
    overflow-wrap: anywhere;
}

.app-signout {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 26px;
    margin-top: 4px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    color: var(--sand-400);
    font: 500 13px/1 var(--font-sans);
    cursor: pointer;
}

.app-signout:hover {
    color: #ffffff;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* The column's auto margins would otherwise shrink a page to its content, and a wide table then
   widens the page instead of wrapping inside it. */
.app-main > main {
    width: 100%;
}

.app-flash {
    max-width: 1180px;
    padding: 12px 24px 0;
}

/* A redrawn page brings its own top bar and body; the old 62rem column is for the others. */
.app main.d-page {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* The brand's type sets wider than the system font these pages were sized for, and billing's plan
   table has five columns: 26rem no longer holds it. */
.app main.narrow {
    max-width: 36rem;
}

/* --- page: top bar and body -------------------------------------------------- */

.d-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 52px;
    padding: 0 24px 0 16px;
    background: var(--surface-card);
    border-bottom: 1px solid var(--border-default);
}

.d-title {
    margin: 0;
    font: 600 17px/1.2 var(--font-sans);
    letter-spacing: -0.012em;
    color: var(--text-strong);
}

/* A check's name is an identifier, and identifiers are mono. */
.d-title-mono {
    font-family: var(--font-mono);
    letter-spacing: 0;
}

.d-crumb {
    font: 400 12px/1.5 var(--font-mono);
    color: var(--text-subtle);
}

.d-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.d-head-actions form {
    margin: 0;
}

.d-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 1180px;
    padding: 20px 24px 28px;
}

.d-body-center {
    align-items: center;
    max-width: none;
    padding-top: 56px;
}

.d-column {
    width: 100%;
    max-width: 760px;
}

.d-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.d-stack-sm {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.d-stack-xs {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.d-with-aside {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 16px;
    align-items: start;
}

.d-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    align-items: start;
}

/* --- type --------------------------------------------------------------------- */

.d-h1 {
    margin: 0;
    font: 600 30px/1.15 var(--font-sans);
    letter-spacing: -0.022em;
    color: var(--text-strong);
}

.d-h2 {
    margin: 0;
    font: 600 20px/1.3 var(--font-sans);
    letter-spacing: -0.012em;
    color: var(--text-strong);
}

.d-eyebrow {
    margin: 0;
    font: 600 11px/1.2 var(--font-mono);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-subtle);
}

.d-lede {
    margin: 0;
    font: 400 15px/1.65 var(--font-sans);
    color: var(--text-muted);
}

.d-prose {
    max-width: 68ch;
}

.d-copy {
    font: 400 14px/1.6 var(--font-sans);
    color: var(--text-body);
}

.d-copy p,
p.d-copy {
    margin: 0;
}

.d-copy p + p {
    margin-top: 10px;
}

.d-fine {
    margin: 0;
    font: 400 13px/1.5 var(--font-sans);
    color: var(--text-subtle);
}

.d-rule-above {
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.d-mono {
    font-family: var(--font-mono);
    font-size: 13px;
}

.d-subtle {
    color: var(--text-subtle);
}

.d-wrap {
    overflow-wrap: anywhere;
}

.d-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.d-link {
    display: inline;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    color: var(--text-link);
    font: 500 13px/1.4 var(--font-sans);
    text-decoration: none;
    cursor: pointer;
}

.d-link:hover {
    color: var(--text-link-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* --- Button and IconButton ----------------------------------------------------- */
/* Three heights, a hairline, no lift. Hover darkens a step and press another; never opacity. */

.d-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-card);
    color: var(--text-strong);
    font: 500 14px/1 var(--font-sans);
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: var(--transition-control);
}

.d-btn:hover {
    background: var(--surface-hover);
    color: var(--text-strong);
    text-decoration: none;
}

.d-btn:active {
    background: var(--surface-active);
}

.d-btn svg {
    flex: none;
}

.d-btn-sm {
    gap: 5px;
    height: 26px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.d-btn-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--text-on-accent);
}

.d-btn-primary:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
    color: var(--text-on-accent);
}

.d-btn-primary:active {
    background: var(--accent-press);
}

.d-btn-danger {
    border-color: var(--danger);
    background: var(--danger);
    color: #ffffff;
}

.d-btn-danger:hover {
    border-color: var(--danger-hover);
    background: var(--danger-hover);
    color: #ffffff;
}

.d-btn-danger:active {
    background: var(--danger-press);
}

.d-btn-danger-quiet {
    border-color: var(--state-down-border);
    color: var(--state-down-fg);
}

.d-btn-danger-quiet:hover {
    background: var(--state-down-soft);
    color: var(--state-down-fg);
}

.d-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-control);
}

.d-icon-btn:hover {
    background: var(--surface-hover);
    color: var(--text-strong);
}

.d-icon-btn-sm {
    width: 26px;
    height: 26px;
}

.d-icon-btn-outline {
    border-color: var(--border-default);
    background: var(--surface-card);
}

.d-icon-btn-danger:hover {
    background: var(--state-down-soft);
    color: var(--state-down-fg);
}

/* --- notices --------------------------------------------------------------------- */

.d-notice {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 4px 10px;
    padding: 10px 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-card);
    color: var(--text-body);
    font: 400 14px/1.5 var(--font-sans);
}

.d-notice > svg {
    flex: none;
    margin-top: 2px;
}

.d-notice form {
    display: inline;
    margin: 0;
}

.d-notice .d-link {
    color: inherit;
    font-size: 14px;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.d-notice-ok {
    border-color: var(--state-up-border);
    background: var(--state-up-soft);
    color: var(--state-up-fg);
}

.d-notice-bad {
    border-color: var(--state-down-border);
    background: var(--state-down-soft);
    color: var(--state-down-fg);
}

/* --- Card -------------------------------------------------------------------------- */

/* Positioned so the visually hidden labels and inputs inside it are clipped with everything else:
   an absolute element takes its box from the nearest positioned ancestor, and without this one a
   table's hidden column heading sits at the table's far edge and widens the whole page on a phone. */
.d-card {
    position: relative;
    overflow: hidden;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.d-card-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 3px 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.d-card-title {
    margin: 0;
    font: 600 17px/1.3 var(--font-sans);
    letter-spacing: -0.012em;
    color: var(--text-strong);
}

.d-card-sub {
    width: 100%;
    margin: 0;
    font: 400 13px/1.4 var(--font-sans);
    color: var(--text-muted);
}

.d-card-note {
    font: 400 12px/1.5 var(--font-mono);
    color: var(--text-subtle);
}

.d-card-aside {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    font: 400 12px/1.5 var(--font-mono);
    color: var(--text-subtle);
}

.d-card-body,
.d-card-pad {
    padding: 16px;
}

.d-card-pad-sm {
    padding: 12px;
}

.d-card-pad-lg {
    padding: 24px;
}

/* Only for a tile whose number is that state and is not zero: an incident is the loudest tile. */
.d-card-down {
    border-color: var(--state-down-border);
    background: var(--state-down-soft);
}

.d-card-late {
    border-color: var(--state-late-border);
    background: var(--state-late-soft);
}

.d-empty {
    margin: 0;
    padding: 28px 16px;
    text-align: center;
    font: 400 14px/1.5 var(--font-sans);
    color: var(--text-subtle);
}

/* --- MetricStat ---------------------------------------------------------------------- */

.d-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.d-metric {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.d-metric-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font: 600 11px/1.2 var(--font-mono);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-subtle);
}

.d-metric-figure {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px;
}

.d-metric-value {
    font: 600 24px/1 var(--font-mono);
    letter-spacing: -0.012em;
    color: var(--text-strong);
}

.d-metric-unit {
    font: 500 13px/1 var(--font-mono);
    color: var(--text-subtle);
}

.d-metric-sub {
    font: 400 12px/1.5 var(--font-mono);
    color: var(--text-subtle);
}

.d-metric-down .d-metric-label,
.d-metric-down .d-metric-value,
.d-metric-down .d-metric-sub {
    color: var(--state-down-fg);
}

.d-metric-late .d-metric-label,
.d-metric-late .d-metric-value,
.d-metric-late .d-metric-sub {
    color: var(--state-late-fg);
}

/* --- StatusBadge, Badge and the dot ----------------------------------------------------- */
/* The state is never colour alone: a glyph and the word, in the state's -fg at 4.5:1. */

.d-state {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 9px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    font: 600 12px/1 var(--font-sans);
    letter-spacing: .02em;
    white-space: nowrap;
}

.d-state-sm {
    height: 20px;
    padding: 0 7px;
    font-size: 11px;
}

.d-state-up { background: var(--state-up-soft); border-color: var(--state-up-border); color: var(--state-up-fg); }
.d-state-late { background: var(--state-late-soft); border-color: var(--state-late-border); color: var(--state-late-fg); }
.d-state-down { background: var(--state-down-soft); border-color: var(--state-down-border); color: var(--state-down-fg); }
.d-state-paused { background: var(--state-paused-soft); border-color: var(--state-paused-border); color: var(--state-paused-fg); }
.d-state-new { background: var(--state-new-soft); border-color: var(--state-new-border); color: var(--state-new-fg); }

.d-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    padding: 0 7px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xs);
    background: var(--surface-card);
    color: var(--text-muted);
    font: 500 11px/1 var(--font-sans);
    letter-spacing: .02em;
    white-space: nowrap;
}

/* A certificate near expiry is a warning, never an alert. */
.d-badge-late {
    border-color: var(--state-late-border);
    background: var(--state-late-soft);
    color: var(--state-late-fg);
}

.d-dot {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: 500 14px/1.3 var(--font-sans);
    color: var(--text-strong);
    white-space: nowrap;
}

.d-dot::before {
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--state-paused);
}

.d-dot-up::before { background: var(--state-up); }
.d-dot-down::before { background: var(--state-down); }

/* --- StateBanner --------------------------------------------------------------------------- */

/* Written without whitespace inside, so with no banner the slot is :empty and takes no room. */
.d-banner-slot:empty {
    display: none;
}

.d-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px 12px 16px;
    border: 1px solid;
    border-radius: var(--radius-lg);
}

.d-banner > svg {
    flex: none;
    margin-top: 2px;
}

.d-banner-title {
    margin: 0;
    font: 600 17px/1.3 var(--font-sans);
    letter-spacing: -0.012em;
}

.d-banner-detail {
    margin: 3px 0 0;
    font: 400 14px/1.5 var(--font-sans);
    color: var(--text-body);
}

.d-banner-late { background: var(--state-late-soft); border-color: var(--state-late-border); color: var(--state-late-fg); }
.d-banner-down { background: var(--state-down-soft); border-color: var(--state-down-border); color: var(--state-down-fg); }
.d-banner-paused { background: var(--state-paused-soft); border-color: var(--state-paused-border); color: var(--state-paused-fg); }
.d-banner-new { background: var(--state-new-soft); border-color: var(--state-new-border); color: var(--state-new-fg); }

/* --- a check's status card: Right now | Setup ----------------------------------------------- */

.d-status {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
}

.d-now {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    padding: 18px 24px 20px;
}

/* The owner's choices, drawn quieter than the state on purpose: the page colour, small rows, and
   nothing in here ever turns red. */
.d-setup {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 20px 20px;
    border-left: 1px solid var(--border-subtle);
    background: var(--surface-page);
}

.d-moments {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 24px;
}

.d-moments-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px 20px;
}

/* Under the second and third figures - the deadline and the alert - the interval it measures. */
.d-grace {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: calc((100% - 48px) / 3 + 24px);
    font: 400 12px/1.5 var(--font-mono);
    color: var(--state-late-fg);
    white-space: nowrap;
}

.d-meter {
    flex: 1;
    min-width: 60px;
    height: 8px;
    border: 1px solid var(--state-late-border);
    border-radius: 4px;
    background: var(--state-late-soft);
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
}

.d-meter::-webkit-progress-bar {
    background: var(--state-late-soft);
}

.d-meter::-webkit-progress-value {
    background: var(--state-late);
}

.d-meter::-moz-progress-bar {
    background: var(--state-late);
}

/* The failed probes in a row, as PingTimeline draws them: a failure is always full height. */
.d-streak {
    display: flex;
    align-items: flex-end;
    gap: 14px;
}

.d-strip {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 34px;
}

.d-bar {
    width: 10px;
    border-radius: 1.5px;
}

.d-bar-up {
    height: 28%;
    background: var(--state-up);
}

.d-bar-down {
    height: 100%;
    background: var(--state-down);
}

.d-streak-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font: 400 12px/1.5 var(--font-mono);
    color: var(--text-subtle);
}

.d-streak-count {
    color: var(--state-down-fg);
}

.d-cert {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-body);
}

.d-facts {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 9px 12px;
    margin: 0;
}

.d-facts-wide {
    grid-template-columns: 110px minmax(0, 1fr);
}

.d-facts dt {
    padding-top: 2px;
    font: 500 12px/1.3 var(--font-sans);
    letter-spacing: .02em;
    color: var(--text-subtle);
}

.d-facts dd {
    min-width: 0;
    margin: 0;
    font: 400 14px/1.45 var(--font-sans);
    color: var(--text-body);
}

.d-facts dd.d-mono {
    font: 400 13px/1.5 var(--font-mono);
}

.d-facts .d-link {
    margin-left: 8px;
}

.d-plain {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.d-attention {
    color: var(--state-late-fg);
}

/* --- Tabs --------------------------------------------------------------------------------------- */
/* Radios and sibling selectors, as the marketing page's snippet tabs: they switch with JavaScript
   off, and the CSP has nothing to object to. Four at most, matched by position. */

.d-tabbed {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.d-tab-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.d-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    border-bottom: 1px solid var(--border-default);
}

.d-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    margin-bottom: -1px;
    padding: 0 10px;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font: 500 14px/1 var(--font-sans);
    cursor: pointer;
    transition: var(--transition-control);
}

.d-tab:hover {
    border-bottom-color: var(--border-strong);
    color: var(--text-strong);
}

.d-tab-count {
    display: inline-flex;
    align-items: center;
    height: 16px;
    padding: 0 5px;
    border-radius: var(--radius-xs);
    background: var(--surface-sunken);
    color: var(--text-muted);
    font: 500 11px/1 var(--font-mono);
}

.d-panel {
    display: none;
}

.d-tab-input:nth-of-type(1):checked ~ .d-tabs .d-tab:nth-of-type(1),
.d-tab-input:nth-of-type(2):checked ~ .d-tabs .d-tab:nth-of-type(2),
.d-tab-input:nth-of-type(3):checked ~ .d-tabs .d-tab:nth-of-type(3),
.d-tab-input:nth-of-type(4):checked ~ .d-tabs .d-tab:nth-of-type(4) {
    border-bottom-color: var(--accent);
    color: var(--text-strong);
    font-weight: 600;
}

.d-tab-input:nth-of-type(1):checked ~ .d-panels .d-panel:nth-of-type(1),
.d-tab-input:nth-of-type(2):checked ~ .d-panels .d-panel:nth-of-type(2),
.d-tab-input:nth-of-type(3):checked ~ .d-panels .d-panel:nth-of-type(3),
.d-tab-input:nth-of-type(4):checked ~ .d-panels .d-panel:nth-of-type(4) {
    display: block;
}

/* Keyboard focus lands on the radio, which is invisible; the outline goes on its tab. */
.d-tab-input:nth-of-type(1):focus-visible ~ .d-tabs .d-tab:nth-of-type(1),
.d-tab-input:nth-of-type(2):focus-visible ~ .d-tabs .d-tab:nth-of-type(2),
.d-tab-input:nth-of-type(3):focus-visible ~ .d-tabs .d-tab:nth-of-type(3),
.d-tab-input:nth-of-type(4):focus-visible ~ .d-tabs .d-tab:nth-of-type(4) {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

/* --- tables, ProbeOutcome and history ------------------------------------------------------------- */

.d-table {
    width: 100%;
    border-collapse: collapse;
}

.d-table th {
    height: 32px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border-default);
    background: var(--surface-sunken);
    color: var(--text-subtle);
    font: 600 11px/1.2 var(--font-mono);
    letter-spacing: .08em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.d-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-body);
    font: 400 14px/1.4 var(--font-sans);
    vertical-align: middle;
}

.d-table th:first-child,
.d-table td:first-child {
    padding-left: 16px;
}

.d-table th:last-child,
.d-table td:last-child {
    padding-right: 16px;
}

.d-table tbody tr:last-child td {
    border-bottom: none;
}

.d-table tbody tr:hover td {
    background: var(--surface-hover);
}

.d-table .d-cell-mono {
    color: var(--text-muted);
    font: 400 13px/1.5 var(--font-mono);
    white-space: nowrap;
}

.d-table .d-strong {
    color: var(--text-strong);
}

.d-table .d-overdue {
    color: var(--state-late-fg);
}

.d-table .d-cell-actions {
    text-align: right;
    white-space: nowrap;
}

.d-cell-actions form {
    display: inline-flex;
    margin: 0;
}

.d-col-state {
    width: 200px;
}

.d-col-time {
    width: 150px;
}

.d-col-actions {
    width: 110px;
}

.d-col-narrow {
    width: 90px;
}

.d-row-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.d-check-link {
    color: var(--text-strong);
    font: 500 14px/1.3 var(--font-mono);
    text-decoration: none;
}

.d-check-link:hover {
    color: var(--text-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.d-row-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    color: var(--text-subtle);
    font: 400 12px/1.5 var(--font-mono);
}

.d-outcome {
    display: inline-flex;
    align-items: flex-start;
    gap: 7px;
    min-width: 0;
}

.d-outcome > svg {
    flex: none;
    margin-top: 2px;
    color: var(--text-muted);
}

.d-outcome-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 7px;
}

.d-outcome-label {
    color: var(--text-strong);
    font: 500 14px/1.35 var(--font-sans);
}

/* "response" or "connection": the one-glance answer to "my application, or the way to it?" */
.d-outcome-side {
    color: var(--text-subtle);
    font: 400 12px/1.5 var(--font-mono);
}

.d-outcome-detail {
    display: block;
    margin-top: 1px;
    color: var(--text-muted);
    font: 400 12px/1.45 var(--font-sans);
}

.d-history {
    margin: 0;
    padding: 0;
    list-style: none;
}

.d-history li {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) auto;
    align-items: start;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.d-history li:last-child {
    border-bottom: none;
}

.d-history-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: var(--text-body);
    font: 400 14px/1.45 var(--font-sans);
}

.d-history-delivery {
    color: var(--text-subtle);
    font: 400 12px/1.5 var(--font-mono);
}

.d-history-time {
    color: var(--text-muted);
    font: 400 12px/1.5 var(--font-mono);
    white-space: nowrap;
}

/* --- CodeBlock and the URL box -------------------------------------------------------------------- */
/* Code is the one surface that never inverts, and has no syntax highlighting anywhere. */

.d-code {
    --border-focus: var(--olive-300);
    overflow: hidden;
    border: 1px solid #2c2f22;
    border-radius: var(--radius-md);
    background: var(--surface-code);
}

.d-code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
    padding: 3px 6px 3px 12px;
    border-bottom: 1px solid #2c2f22;
    background: #171911;
    color: var(--sand-300);
    font: 400 12px/1.5 var(--font-mono);
    letter-spacing: .02em;
}

.d-code-body {
    margin: 0;
    padding: 12px 14px;
    overflow-x: auto;
    color: #eae2d2;
    font: 400 13px/1.5 var(--font-mono);
    white-space: pre;
}

.d-code-body code {
    font: inherit;
}

.d-code-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--sand-400);
    cursor: pointer;
}

.d-code-copy:hover {
    background: #2a2d20;
    color: var(--sand-300);
}

.d-code-copy span {
    display: inline-flex;
}

/* marsolen.js sets data-copied for 1.5s after a successful copy. */
.d-code-copy .d-copy-done,
.d-code-copy[data-copied] .d-copy-idle {
    display: none;
}

.d-code-copy[data-copied] .d-copy-done {
    display: inline-flex;
    color: var(--olive-300);
}

.d-url {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Plain text rather than a read-only input, which would clip a URL longer than itself. */
.d-url-box {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 8px;
    min-width: 0;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    color: var(--text-subtle);
}

.d-url-box > svg {
    flex: none;
}

.d-url-box code {
    color: var(--text-strong);
    font: 400 13px/1.5 var(--font-mono);
    overflow-wrap: anywhere;
    user-select: all;
}

.d-url-method {
    flex: none;
    color: var(--text-subtle);
    font: 600 11px/1.2 var(--font-mono);
    letter-spacing: .08em;
}

.d-url-foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.d-url-foot .d-fine {
    flex: 1;
}

/* --- confirmations, as disclosures ----------------------------------------------------------------- */

.d-confirm {
    position: relative;
}

.d-confirm > summary {
    list-style: none;
}

.d-confirm > summary::-webkit-details-marker {
    display: none;
}

.d-confirm[open] > summary.d-icon-btn {
    background: var(--surface-active);
    color: var(--text-strong);
}

.d-confirm-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 340px;
    padding: 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    background: var(--surface-card);
    box-shadow: var(--shadow-lg);
}

.d-confirm-title {
    margin: 0;
    color: var(--text-strong);
    font: 600 17px/1.3 var(--font-sans);
    letter-spacing: -0.012em;
}

.d-confirm-text {
    margin: 0;
    color: var(--text-muted);
    font: 400 14px/1.5 var(--font-sans);
}

.d-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
}

.d-confirm-actions form {
    margin: 0;
}

/* Inside a card, which clips: the confirmation opens in the flow instead of over it. */
.d-confirm-inline[open] {
    flex-basis: 100%;
}

.d-confirm-inline .d-confirm-panel {
    position: static;
    width: auto;
    margin-top: 10px;
    border-radius: var(--radius-md);
    background: var(--surface-page);
    box-shadow: none;
}

/* --- forms: Field, Input, Select, Radio, Checkbox --------------------------------------------------- */

.d-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin: 0;
}

.d-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.d-label {
    padding: 0;
    color: var(--text-strong);
    font: 500 12px/1.3 var(--font-sans);
    letter-spacing: .02em;
}

.d-req {
    margin-left: 3px;
    color: var(--state-down-fg);
}

.d-hint {
    display: block;
    color: var(--text-subtle);
    font: 400 12px/1.45 var(--font-sans);
}

.d-hint code,
.d-copy code,
.d-lede code {
    padding: 1px 4px;
    border-radius: var(--radius-xs);
    background: var(--surface-sunken);
    color: var(--text-strong);
}

.d-error {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--state-down-fg);
    font: 400 12px/1.4 var(--font-sans);
}

.d-error > svg {
    flex: none;
}

.d-input,
.d-select {
    display: flex;
    align-items: center;
    max-width: 100%;
    height: 32px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface-card);
    box-shadow: var(--shadow-xs);
    color: var(--text-subtle);
    transition: var(--transition-control);
}

.d-input {
    gap: 7px;
    padding: 0 10px;
}

.d-input > svg {
    flex: none;
}

.d-input:focus-within,
.d-select:focus-within {
    border-color: var(--border-focus);
    outline: 2px solid var(--border-focus);
    outline-offset: 1px;
}

/* The wrapper draws the focus; the control inside it would draw a second one. */
.d-input input:focus-visible,
.d-select select:focus-visible {
    outline: none;
}

.d-input input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-strong);
    font: 400 14px/1.4 var(--font-sans);
}

.d-input-mono input {
    font: 400 13px/1.5 var(--font-mono);
}

.d-input input::placeholder {
    color: var(--text-subtle);
    opacity: 1;
}

.d-suffix {
    flex: none;
    color: var(--text-subtle);
    font: 400 12px/1.5 var(--font-mono);
}

.d-select {
    position: relative;
}

.d-select select {
    width: 100%;
    height: 100%;
    padding: 0 30px 0 10px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-strong);
    font: 400 14px/1.4 var(--font-sans);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.d-select > svg {
    position: absolute;
    right: 9px;
    pointer-events: none;
}

.d-invalid {
    border-color: var(--state-down);
}

.d-w-90 { width: 90px; }
.d-w-150 { width: 150px; }
.d-w-160 { width: 160px; }
.d-w-200 { width: 200px; }
.d-w-230 { width: 230px; }
.d-w-360 { width: 360px; }

.d-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.d-indent {
    padding-left: 26px;
}

/* A set of controls under one label is a fieldset with a legend, so a screen reader finds it. */
.d-group {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: none;
}

.d-group > legend {
    float: left;
    width: 100%;
    margin: 0 0 10px;
    padding: 0;
}

.d-group > legend + * {
    clear: both;
}

.d-group > :not(legend) + :not(legend) {
    margin-top: 10px;
}

.d-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 16px;
}

.d-span-2 {
    grid-column: span 2;
}

/* Radio and Checkbox keep the native input in the tab order - hidden from sight, never shrunk to
   nothing - and draw the outline on the visible control. */
.d-radio,
.d-check {
    position: relative;
    display: inline-flex;
    gap: 8px;
    cursor: pointer;
}

.d-radio {
    align-items: center;
}

.d-check {
    align-items: flex-start;
}

.d-radio-input,
.d-check-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.d-radio-dot,
.d-check-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-strong);
    background: var(--surface-card);
    box-shadow: var(--shadow-xs);
    transition: var(--transition-control);
}

.d-radio-dot {
    border-radius: 50%;
}

.d-radio-dot::after {
    content: "";
    display: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.d-radio-input:checked ~ .d-radio-dot {
    border-color: var(--accent);
}

.d-radio-input:checked ~ .d-radio-dot::after {
    display: block;
}

.d-check-box {
    margin-top: 1px;
    border-radius: var(--radius-xs);
    color: var(--text-on-accent);
}

.d-check-box svg {
    visibility: hidden;
}

.d-check-input:checked ~ .d-check-box {
    border-color: var(--accent);
    background: var(--accent);
}

.d-check-input:checked ~ .d-check-box svg {
    visibility: visible;
}

.d-radio-input:focus-visible ~ .d-radio-dot,
.d-check-input:focus-visible ~ .d-check-box {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.d-radio-label,
.d-check-label {
    color: var(--text-strong);
    font: 400 14px/1.35 var(--font-sans);
}

.d-check-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.d-check-desc {
    color: var(--text-subtle);
    font: 400 12px/1.45 var(--font-sans);
}

.d-note,
.d-kind {
    display: flex;
    gap: 10px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    color: var(--text-muted);
}

.d-note {
    align-items: flex-start;
    padding: 12px 14px;
}

.d-note > svg {
    flex: none;
    margin-top: 2px;
}

.d-note p {
    margin: 0;
    color: var(--text-body);
    font: 400 14px/1.55 var(--font-sans);
}

.d-kind {
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 12px;
}

.d-kind-name {
    color: var(--text-strong);
    font: 500 14px/1.4 var(--font-sans);
}

.d-kind-note {
    color: var(--text-subtle);
    font: 400 13px/1.4 var(--font-sans);
}

.d-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 18px;
    border-top: 1px solid var(--border-subtle);
}

.d-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    color: var(--text-body);
    font: 400 14px/1.55 var(--font-sans);
    list-style: none;
    counter-reset: step;
}

.d-steps li {
    display: flex;
    gap: 10px;
    counter-increment: step;
}

.d-steps li::before {
    content: counter(step, decimal-leading-zero);
    flex: none;
    width: 22px;
    padding-top: 3px;
    color: var(--text-subtle);
    font: 600 11px/1.2 var(--font-mono);
    letter-spacing: .08em;
}

/* --- ChoiceCard --------------------------------------------------------------------------------------- */

.d-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.d-choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 16px 16px 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
    box-shadow: var(--shadow-sm);
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-control);
}

.d-choice:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    color: var(--text-muted);
    text-decoration: none;
}

.d-choice > svg {
    margin-bottom: 2px;
}

.d-choice-title {
    color: var(--text-strong);
    font: 600 17px/1.3 var(--font-sans);
    letter-spacing: -0.012em;
}

.d-choice-desc {
    color: var(--text-muted);
    font: 400 14px/1.5 var(--font-sans);
}

.d-choice-cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    color: var(--text-link);
    font: 500 14px/1 var(--font-sans);
}

.d-choices-hint p {
    margin: 0;
    padding: 0 4px;
    color: var(--text-subtle);
    font: 400 13px/1.55 var(--font-sans);
}

/* --- narrower screens ------------------------------------------------------------------------------------ */

@media (max-width: 1100px) {
    .d-with-aside,
    .d-status {
        grid-template-columns: minmax(0, 1fr);
    }

    .d-setup {
        border-top: 1px solid var(--border-subtle);
        border-left: none;
    }
}

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }

    .app-side {
        width: auto;
        border-right: none;
        border-bottom: 1px solid #282520;
    }

    .app-side-inner {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        height: auto;
    }

    .app-lockup {
        border-bottom: none;
    }

    .app-nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 6px 8px;
    }

    .app-account {
        flex-direction: row;
        align-items: center;
        margin: 0 0 0 auto;
        padding: 6px 14px;
        border-top: none;
    }

    .app-account .app-eyebrow,
    .app-account .app-who {
        display: none;
    }

    .app-flash {
        padding: 12px 16px 0;
    }

    .d-head {
        padding: 10px 16px;
    }

    .d-body {
        padding: 16px;
    }

    .d-body-center {
        padding-top: 32px;
    }

    .d-card {
        overflow-x: auto;
    }

    .d-stats,
    .d-moments-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .d-split,
    .d-choices,
    .d-grid-2 {
        grid-template-columns: minmax(0, 1fr);
    }

    .d-span-2 {
        grid-column: auto;
    }

    .d-grace {
        padding-left: 0;
    }
}

@media (max-width: 600px) {
    .d-moments {
        grid-template-columns: minmax(0, 1fr);
    }

    .d-history li {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }

    .d-head-actions {
        width: 100%;
        margin-left: 0;
    }

    .d-confirm-panel {
        right: auto;
        left: 0;
        width: min(340px, calc(100vw - 32px));
    }
}
