/*
 * fleet-id — components that are genuinely this app's own: the fleet health
 * dashboard, per-app health cards, and the Jahresrückblick widget. Everything
 * general lives in shared/ui and theme.css. Reference tokens, never raw values.
 */

/* ── Small shared bits ─────────────────────────────────────────────────── */

.sub { color: var(--muted); font-size: 0.85rem; }
.muted { color: var(--muted); }

.section { margin-top: 1.75rem; }
.section:first-of-type { margin-top: 0; }
.section-title {
    margin: 0 0 0.9rem;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

/* Maps semantic meaning onto shared/ui's `.badge` --badge-accent hook. */
.badge-success { --badge-accent: var(--pos); }
.badge-danger { --badge-accent: var(--neg); }
.badge-warning { --badge-accent: var(--warn); }

/* A role is not a state: neutral, so green, amber and red stay for state. */
.chip {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.1rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.75rem; font-weight: 600;
    color: var(--text-2);
    white-space: nowrap;
}
.badge-muted { --badge-accent: var(--muted); }
.badge-sm { padding: 0.05rem 0.3rem; font-size: 0.7rem; min-width: 0; white-space: nowrap; }
.badge .ui-icon { font-size: 0.85em; margin-right: 0.15em; }

/* ── fleet dashboard: section head and roll-up tally ───────────────────── */

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}
.fleet-tally {
    display: flex;
    align-items: baseline;
    gap: 0.85rem;
    margin: 0;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}
.tally { color: var(--muted); }
.tally-up { color: var(--pos); font-weight: 600; }
.tally-down { color: var(--neg); font-weight: 600; }

/* ── fleet dashboard: needs-attention strip ────────────────────────────── */

/* Absent when the fleet is clean — an empty warning box reads as a problem of its own. */
.attention {
    margin-bottom: var(--gap-grid);
    padding: 0.9rem 1rem 1rem;
    background: var(--card);
    border: 1px solid var(--neg);
    border-left-width: 3px;
    border-radius: var(--r-m);
    box-shadow: var(--shadow-1);
}
.attention-title {
    margin: 0 0 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--neg);
}
.attention-list { margin: 0; padding: 0; list-style: none; }

.attention-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.7rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
}
.attention-row:first-child { border-top: 0; }
.attention-row .app-icon { margin-bottom: 0; }
.attention-name { font-weight: 600; min-width: 9rem; }
.attention-reason { color: var(--text-2); font-size: 0.85rem; overflow-wrap: anywhere; min-width: 0; }
.attention-facts { color: var(--muted); font-size: 0.78rem; }
.attention-link { margin-left: auto; font-size: 0.82rem; white-space: nowrap; }
.attention-link .ui-icon { margin-left: 0.3em; font-size: 0.85em; }

/* ── fleet dashboard: healthy app tiles ────────────────────────────────── */

.healthy-title {
    margin: 0 0 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}
.healthy-title .sub { font-weight: 400; letter-spacing: 0; }

/* Healthy apps are quiet rows: the dot and chips turn colour only when a check fails. */
.health-rows { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-m); }
.health-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    padding: 0.55rem 0.85rem;
}
.health-row + .health-row { border-top: 1px solid var(--border); }
.health-dot { flex: none; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--pos); }
.health-dot-warn { background: var(--warn); }
.health-name { flex: 1 1 9rem; min-width: 0; font-weight: 600; font-size: 0.9rem; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.health-name:hover { color: var(--primary); }

/* ── fleet dashboard: fleet-check findings ─────────────────────────────── */

.tally-warn { color: var(--warn); font-weight: 600; }
.checks-stale { color: var(--warn); font-size: 0.85rem; }
.check-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
}
.check-group:first-child { border-top: 0; }
.check-findings { margin: 0; padding: 0; list-style: none; font-size: 0.85rem; }
.check-findings li { padding: 0.1rem 0; }
.checks-healthy { margin-top: 0.75rem; font-size: 0.85rem; }
.checks-healthy summary { cursor: pointer; color: var(--text-2); }

/* ── fleet dashboard: fleet-id's own status, one line ──────────────────── */

/* Deliberately not a tile grid — fleet-id is one app among eight. */
.self-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    padding: 0.7rem 0.9rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-m);
    font-size: 0.85rem;
}
.self-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.self-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

/* ── admin: user rows, access page, API doc cards ──────────────────────── */

.user-rows { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-m); }
.user-rows .list-row-meta { display: flex; flex-wrap: wrap; gap: 0 0.75rem; white-space: normal; }
.user-factor { display: inline-flex; align-items: center; gap: 0.25rem; }
.user-factor-none { color: var(--text-2); font-weight: 600; }
.user-seen { min-width: 6.5rem; text-align: right; }
.user-apps { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 719px) {
    .user-rows .list-row-end { flex-wrap: wrap; justify-content: flex-end; max-width: 8rem; gap: 0.25rem 0.5rem; }
    .user-seen { min-width: 0; }
}
.access-list { margin-top: 0.9rem; }
.access-list .source-row { gap: 0.75rem; }
.access-list .app-mark { width: 1.8rem; height: 1.8rem; font-size: 0.95rem; flex: none; }
.access-summary { margin: 1rem 0 0; min-height: 1.3em; }
.doc-card { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; color: inherit; text-decoration: none; }
.doc-card h2 { margin: 0; }
a.doc-card:hover { border-color: var(--primary); }

/* An app with no base URL configured — present in the fleet but not on SSO. */
.card-muted { opacity: 0.62; }

/* ── Landing page: launcher ────────────────────────────────────────────── */

/* Each tile sets only --app-hue; its colours derive from the root tokens at
   that hue, as shared/ui's .palette-app does. Overriding --hue here would do
   nothing, because the tokens are computed at :root. */
.launcher {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    gap: var(--gap-tight);
    margin: 1.25rem 0 0;
    padding: 0;
    list-style: none;
}
.launcher > li { display: flex; min-width: 0; position: relative; }

.launcher-toolbar { display: flex; align-items: center; gap: .75rem; margin-top: 1.25rem; }
.launcher-toolbar + .launcher { margin-top: .75rem; }
.launcher-status { color: var(--muted); font-size: .875rem; }
.launcher-controls { display: none; position: absolute; top: .5rem; right: .5rem; gap: .25rem; z-index: 1; }
.launcher-controls .btn { padding: .25rem; line-height: 0; }
.launcher-layout[data-editing] .launcher-controls { display: flex; }
.launcher-layout[data-editing] .launcher > li[draggable="true"] { cursor: grab; }
.launcher-layout[data-editing] .launcher-tile { pointer-events: none; }
.launcher-hidden { margin-top: 1.25rem; }
.launcher-hidden > summary { cursor: pointer; color: var(--muted); }
.launcher-hidden[hidden] { display: none; }

.launcher-tile {
    --app-hue: var(--hue);
    --app-chroma: var(--mark-chroma);
    --tile-accent: oklch(from var(--primary) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue));
    container-type: inline-size;
    flex: 1 1 auto;
    min-width: 0;
    background:
        linear-gradient(160deg, oklch(from var(--primary-soft) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue)), transparent 70%),
        var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-l);
    box-shadow: var(--shadow-1);
    color: var(--text);
    text-decoration: none;
}
.launcher-tile-self { --app-chroma: var(--chroma); }
.launcher-tile:hover { border-color: var(--tile-accent); }
.launcher-tile:focus-visible { outline-color: var(--tile-accent); }

.launcher-tile-body {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "mark name here" "mark desc desc";
    align-items: center;
    align-content: center;
    gap: 0.1rem 0.9rem;
    height: 100%;
    padding: 0.85rem 1rem;
}

.launcher-mark {
    grid-area: mark;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: var(--r-m);
    background: var(--tile-accent);
    color: var(--on-primary);
    font-size: 1.3rem;
}

.launcher-name {
    grid-area: name;
    font-size: var(--step-1);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    overflow-wrap: break-word;
}
.launcher-desc b { color: var(--text); font-weight: 600; }
.launcher-desc {
    grid-area: desc;
    color: var(--muted);
    font-size: 0.875rem;
    line-height: 1.4;
}
.launcher-badges {
    grid-area: here;
    justify-self: end;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.3rem;
}
.launcher-badges:not(:has(*)) { display: none; }
.launcher-here {
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: oklch(from var(--primary-soft) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue));
    color: oklch(from var(--primary-ink) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue));
    font-size: 0.72rem;
    font-weight: 600;
}

/* An app the user holds no grant for: shown, but greyed out and not a link. */
.launcher-tile-locked {
    --tile-accent: var(--muted);
    background: var(--card);
    box-shadow: none;
    color: var(--muted);
}
.launcher-tile-locked:hover { border-color: var(--border); }
.launcher-tile-locked .launcher-mark {
    background: var(--card-2);
    color: var(--muted);
}
.launcher-no-access {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--card-2);
    color: var(--muted);
}

/* An app whose health check fails: muted, but still a link. */
.launcher-tile-degraded { --tile-accent: var(--muted); }
.launcher-tile-degraded .launcher-mark { filter: grayscale(0.8); opacity: 0.8; }
.launcher-degraded {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--warn-soft);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--warn-border);
}

/* Open attention items, counted on the tile and listed in the strip above the launcher. */
.launcher-count {
    min-width: 1.5rem;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: color-mix(in oklab, var(--warn) 22%, transparent);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.launcher-attention { margin-top: 1.25rem; }

/* The next dated things across the fleet; absent when nothing is coming. */
.upcoming { margin-top: var(--gap-grid); padding: 0.9rem 1rem; }
.upcoming-title {
    margin: 0 0 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}
.upcoming-list { margin: 0; padding: 0; list-style: none; }
.upcoming-list > li { --app-hue: var(--hue); }
.upcoming-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.4rem;
    border-radius: var(--r-s);
    color: var(--text);
    text-decoration: none;
}
.upcoming-row:hover { background: var(--card-2); }
.upcoming-date {
    flex: none;
    min-width: 6.5rem;
    color: var(--text-2);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}
.upcoming-mark {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: var(--r-s);
    background: oklch(from var(--primary) l calc(var(--mark-chroma) * c / var(--chroma)) var(--app-hue));
    color: var(--on-primary);
    font-size: 0.95rem;
}
.upcoming-summary { min-width: 0; overflow-wrap: anywhere; font-size: 0.9rem; }
.attention-group { --app-hue: var(--hue); --app-chroma: var(--mark-chroma); position: relative; }
.attention-wide { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-inline); }
.attention-apps { display: flex; flex-wrap: wrap; gap: var(--gap-inline); }
.attention-group > summary { cursor: pointer; list-style: none; }
.attention-group > summary::-webkit-details-marker { display: none; }
.attention-group[open] > summary { border-color: var(--primary); }
.attention-items {
    margin: 0.35rem 0 0;
    padding: 0.4rem;
    min-width: 14rem;
    list-style: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-m);
    box-shadow: var(--shadow-1);
}
.attention-wide .attention-items { position: absolute; z-index: 5; }
.attention-items a {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--r-s);
    color: var(--text);
    font-size: 0.85rem;
    text-decoration: none;
}
.attention-items a:hover { background: var(--card-2); }
.attention-items b { font-variant-numeric: tabular-nums; }
.attention-fold { display: none; }
.attention-fold > summary {
    padding: 0.6rem 0.9rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-m);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}
.attention-fold[open] > summary { border-color: var(--primary); }
.attention-fold .attention-apps { flex-direction: column; margin-top: 0.5rem; }
@media (width < 40rem) {
    .attention-fold { display: block; }
    .attention-wide { display: none; }
}
.attention-app {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: oklch(from var(--primary-ink) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue));
    font-weight: 600;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Each app's name in its own headline face; the font files load on this page only. */
.launcher-tile[data-face="archivo"] .launcher-name { font-family: "Archivo", var(--font-body); }
.launcher-tile[data-face="bricolage-grotesque"] .launcher-name { font-family: "Bricolage Grotesque", var(--font-body); }
.launcher-tile[data-face="geist"] .launcher-name { font-family: "Geist", var(--font-body); }
.launcher-tile[data-face="ibm-plex-sans"] .launcher-name { font-family: "IBM Plex Sans", var(--font-body); }
.launcher-tile[data-face="outfit"] .launcher-name { font-family: "Outfit", var(--font-body); }
.launcher-tile[data-face="sora"] .launcher-name { font-family: "Sora", var(--font-body); }
.launcher-tile[data-face="space-grotesk"] .launcher-name { font-family: "Space Grotesk", var(--font-body); }
.launcher-tile[data-face="zen-kaku-gothic-new"] .launcher-name { font-family: "Zen Kaku Gothic New", var(--font-body); }

.signed-in-note {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0 0;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--r-m);
    background: var(--card-2);
    color: var(--muted);
    font-size: 0.85rem;
}

/* ── Landing page: Jahresrückblick (year in review) ────────────────────── */

.card-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0 0 1.1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}
.card-head-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: var(--r-s);
    background: var(--primary-soft);
    color: var(--primary-ink);
    font-size: 1.05rem;
}

.jahresrueckblick {
    margin-top: 2rem;
    padding: var(--card-pad-y) var(--card-pad-x);
    border-top: 3px solid var(--primary);
}

.jrb-title { flex: 1; min-width: 0; }
.jrb-years { display: flex; gap: 0.3rem; }
.jrb-years a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid var(--border);
    border-radius: var(--r-s);
    color: var(--text-2);
    font-size: 0.95rem;
}
.jrb-years a:hover { border-color: var(--primary); color: var(--primary-ink); }

.jahresrueckblick { container-type: inline-size; }
.jahresrueckblick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: dense;
    grid-auto-rows: 1fr;
    gap: var(--gap-tight);
}
.jahresrueckblick-grid > :first-child,
.jahresrueckblick-grid > :first-child > .jrb-item { grid-column: span 2; }
@container (width >= 40rem) {
    .jahresrueckblick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.jrb-item {
    --app-hue: var(--hue);
    --app-chroma: var(--mark-chroma);
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.95rem 1rem;
    background:
        linear-gradient(160deg, oklch(from var(--primary-soft) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue)), transparent 75%),
        var(--card-2);
    border: 1px solid var(--border);
    border-radius: var(--r-m);
    color: inherit;
    text-decoration: none;
}
.jrb-item:hover { border-color: oklch(from var(--primary) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue)); }
.jrb-item:focus-visible { outline-color: oklch(from var(--primary) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue)); }

.jrb-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--r-m);
    background: oklch(from var(--primary) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue));
    color: var(--on-primary);
    font-size: 1.2rem;
}

.jrb-body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.jrb-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}
.jrb-value {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    overflow-wrap: break-word;
}
.jrb-meta { font-size: 0.82rem; color: var(--text-2); }

/* Each tile is a frame holding one tile or none. Once loaded it leaves the grid's
   layout to its tile, so an app with nothing that year leaves no gap. */
.jahresrueckblick-grid > .lazy-frame[complete] { display: contents; }
.jrb-loading { flex-direction: column; align-items: stretch; gap: 0; min-height: 4.6rem; }
.jrb-loading:hover, .jrb-no-answer:hover { border-color: var(--border); }
.jahresrueckblick-grid .jrb-item { flex-direction: column; gap: 0.6rem; }
.jahresrueckblick-grid > :first-child > .jrb-item { flex-direction: row; gap: 0.85rem; }
.jrb-no-answer .jrb-icon { background: var(--border-strong); color: var(--muted); }
.jrb-no-answer .jrb-meta { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); }
.jrb-empty { display: none; }
.jahresrueckblick-grid:not(:has(.jrb-item, .lazy-frame-failed)) { display: none; }
.jahresrueckblick-grid:not(:has(.jrb-item, .lazy-frame-failed)) + .jrb-empty { display: block; }

/* ── Calendar portal ────────────────────────────────────────────────────── */

/* Same feed-URL treatment as arbeitszeit's profile page: full-width,
   monospace, read-only. */
.ics-url-row { margin-bottom: 0.75rem; }
.ics-url-input {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-s);
    font: 0.83rem/1.4 monospace;
    background: var(--card-2);
    color: var(--text);
    cursor: text;
}

.card-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.card-actions:not(:first-child) { margin-top: 1rem; }
.card-actions + .card-actions { margin-top: 0.75rem; }
.login-card .form-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.login-card details { margin-top: 1.25rem; }
.login-card details + form { margin-top: 1.25rem; }
.btn-passkey-first { display: flex; width: 100%; justify-content: center; padding-block: 0.9rem; font-size: 1.1rem; }
.btn-passkey-first[hidden] { display: none; }
.login-card .login-password { margin-top: 1rem; }
.login-password > summary { cursor: pointer; color: var(--primary-ink); font-size: 0.9rem; }
.login-password[open] > summary { margin-bottom: 1rem; }

.source-list { display: flex; flex-direction: column; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.source-row { display: flex; align-items: center; gap: 0.5rem; }
.source-list .source-row { display: flex; margin: 0; font-size: inherit; font-weight: 400; }
.source-list .source-row-app { font-weight: 600; }
.source-list .source-row input[type="checkbox"] { width: 1.25rem; height: 1.25rem; min-width: 1.25rem; min-height: 1.25rem; flex: none; margin: 0; accent-color: var(--primary); }
.form-card.form-card-wide { max-width: none; }
@media (max-width: 719px) {
    .source-list .source-row { min-height: var(--tap-min); }
    .source-list .source-link { display: inline-flex; align-items: center; min-height: var(--tap-min); }
    .jrb-years a { width: var(--tap-min); height: var(--tap-min); }
    .tap-link { display: inline-flex; align-items: center; padding: calc((var(--tap-min) - 1.5em) / 2) 1.1rem; margin: calc((var(--tap-min) - 1.5em) / -2) -1.1rem; line-height: 1.5; }
}
.source-label { display: inline-flex; align-items: center; gap: 0.4rem; }

/* The individual-feeds list has no checkbox: the label grows and the
   manage-link sits flush right instead. */
li.source-row .source-label { flex: 1 1 auto; }

/* ── Two-factor ─────────────────────────────────────────────────────────── */

/* Stays black on white in the dark theme too: scanners need the contrast. */
.totp-qr svg { display: block; background: #fff; border-radius: var(--r-s); }
/* One unbreakable base32 string, wider than a phone. */
.totp-secret { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; overflow-wrap: anywhere; }
.totp-secret-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.setup-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: var(--gap); }
.setup-steps > li { counter-increment: step; display: grid; gap: 0.6rem; }
.setup-steps h2 { display: flex; align-items: center; gap: 0.6rem; font-size: var(--step-0); margin: 0; }
.setup-steps h2::before {
    content: counter(step);
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.6rem; height: 1.6rem; border-radius: 999px;
    background: var(--primary-soft); color: var(--primary-ink); font-size: 0.85rem;
}
.recovery-codes { columns: 2; margin: 0 0 1rem; padding: 0 0 0 1.75rem; line-height: 1.9; }
.recovery-codes li::marker { color: var(--muted); font-size: 0.8em; }

/* ── Sign-in moments ────────────────────────────────────────────────────── */

/* The app marks sit on a shallow arc; --i is the index, the middle one rides highest. */
.login-marks { display: flex; justify-content: center; gap: 0.5rem; margin: 3rem auto 0; padding-bottom: 0.9rem; }
.login-marks-item { display: inline-flex; translate: 0 calc(pow(var(--i) - 3, 2) * 0.18rem); }
.login-marks + .login-card { margin-top: 1rem; }

.app-mark {
    --app-chroma: var(--mark-chroma);
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.2rem; height: 2.2rem; border-radius: var(--r-m);
    background: oklch(from var(--primary) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue, var(--hue)));
    color: var(--on-primary); font-size: 1.1rem;
}
.login-brand .app-mark { width: 3.4rem; height: 3.4rem; font-size: 1.7rem; }
.app-face h1 { font-family: var(--app-face, inherit); }
.app-face[data-face="archivo"] { --app-face: "Archivo", var(--font-body); }
.app-face[data-face="bricolage-grotesque"] { --app-face: "Bricolage Grotesque", var(--font-body); }
.app-face[data-face="geist"] { --app-face: "Geist", var(--font-body); }
.app-face[data-face="ibm-plex-sans"] { --app-face: "IBM Plex Sans", var(--font-body); }
.app-face[data-face="outfit"] { --app-face: "Outfit", var(--font-body); }
.app-face[data-face="sora"] { --app-face: "Sora", var(--font-body); }
.app-face[data-face="space-grotesk"] { --app-face: "Space Grotesk", var(--font-body); }
.app-face[data-face="zen-kaku-gothic-new"] { --app-face: "Zen Kaku Gothic New", var(--font-body); }

.code-boxes { position: relative; }
.code-boxes-cells { display: none; }
.code-boxes.is-enhanced .code-boxes-cells { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.45rem; pointer-events: none; }
.code-boxes.is-enhanced .code-boxes-input {
    position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0;
    opacity: 0; cursor: text;
}
.code-boxes-cell {
    display: flex; align-items: center; justify-content: center;
    height: 3.2rem; border: 1px solid var(--border-strong); border-radius: var(--r-s);
    background: var(--card-2); font: 600 1.4rem var(--font-mono, monospace);
}
.code-boxes-cell.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.login-divider { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0 0; }
.recovery-toggle summary { cursor: pointer; color: var(--primary-ink); font-size: 0.9rem; }
.recovery-toggle summary:hover { text-decoration: underline; }
.login-cancel { margin-top: 1rem; text-align: center; }
.btn-quiet { background: none; border: 0; padding: 0.25rem 0.5rem; color: var(--muted); font: inherit; font-size: 0.875rem; cursor: pointer; }
.btn-quiet:hover { color: var(--text); text-decoration: underline; }

/* ── fleet dashboard: /health checks as chips ─────────────────────────── */

.checks { display: inline-flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; }
.check {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
}
.check::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--pos);
}
.check-warn { color: var(--text-2); }
.check-warn::before { background: var(--warn); }
.check-fail { color: var(--neg); }
.check-fail::before { background: var(--neg); }

/* ── Notifications ──────────────────────────────────────────────────────── */

/* A kind sits under its app's switch. */
.source-row-nested { padding-left: 1.6rem; }

/* ── fleet automation page ─────────────────────────────────────────────── */

.automation-bar { width: 8rem; height: 0.5rem; accent-color: var(--accent, currentColor); }
.automation-queues { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.automation-timeline { display: grid; gap: 0.25rem; }
.automation-lane-row { display: grid; grid-template-columns: minmax(6rem, 10rem) 1fr; align-items: center; gap: 0.75rem; }
.automation-lane-name { font-size: 0.85rem; overflow-wrap: anywhere; }
.automation-lane-chart { display: block; width: 100%; height: 28px; }
.automation-lane-empty .automation-lane-name { color: var(--muted); }
.automation-lane-empty .automation-lane { opacity: 0.6; }
.automation-lane { fill: var(--card); stroke: var(--border); stroke-width: 1px; }
.automation-run { fill: var(--pos); stroke: var(--pos); stroke-width: 3px; }
.automation-run-timeout,
.automation-run-no-result { fill: var(--card); stroke: var(--warn); }
.automation-run-session-limit { fill: url(#automation-hatch); stroke: var(--warn); }
.automation-run-error { fill: var(--neg); stroke: var(--neg); }
.automation-defs { position: absolute; }
.automation-hatch-bg { fill: var(--card); }
.automation-hatch-line { stroke: var(--warn); stroke-width: 1.5px; }
.automation-run-slit { stroke: var(--card); stroke-width: 3px; pointer-events: none; }
.automation-run-cross-box { overflow: visible; pointer-events: none; }
.automation-run-cross-halo { fill: none; stroke: var(--neg); stroke-width: 4px; }
.automation-run-cross { fill: none; stroke: var(--card); stroke-width: 2px; }
.outcome-glyph { font-size: 0.85em; }
.automation-run:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.automation-run-detail { margin: 0.5rem 0 0; font-size: 0.85rem; overflow-wrap: anywhere; }
.automation-axis-row { margin-bottom: -0.25rem; }
.automation-axis { display: block; width: 100%; height: 16px; overflow: visible; }
.automation-axis-label { fill: var(--muted); font-size: 0.7rem; font-variant-numeric: tabular-nums; }
.automation-lane-chart { overflow: visible; }
.automation-tick { stroke: var(--border); stroke-width: 1px; opacity: 0.5; pointer-events: none; }
.automation-tick-major { opacity: 1; }
.automation-now { stroke: var(--primary); stroke-width: 2px; pointer-events: none; }
.automation-run-live { fill: var(--card); stroke: var(--pos); stroke-dasharray: 5 3; }
.automation-outliers { display: grid; gap: 0.25rem; margin-bottom: 1rem; }
.automation-outlier-rail { stroke: var(--border); stroke-width: 1px; }
.automation-outlier-dot { fill: var(--pos); fill-opacity: 0.6; stroke: var(--card); stroke-width: 1px; }
.automation-outlier-dot.is-outlier { fill: var(--warn); fill-opacity: 1; stroke: var(--warn); }
.automation-outlier-median { stroke: var(--primary); stroke-width: 2px; }
.automation-runs tr.is-highlighted td { background: var(--primary-soft); }
.automation-runs tbody tr[data-key] { cursor: pointer; }
.automation-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 100; width: min(24rem, 100vw); overflow-y: auto; padding: 1rem; background: var(--card); border-left: 1px solid var(--border); box-shadow: -4px 0 16px rgb(0 0 0 / 0.15); }
.automation-drawer[hidden] { display: none; }
.automation-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin: 0 0 0.75rem; }
.automation-drawer-head h3 { margin: 0; overflow-wrap: anywhere; }
.automation-drawer-body { display: block; margin: 0; }
.automation-drawer-body dt { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 0.75rem; }
.automation-drawer-body dd { display: block; text-align: left; margin: 0.15rem 0 0; overflow-wrap: anywhere; }
.automation-flow { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0 0 1rem; padding: 0; }
.automation-flow-stage { flex: 1 1 8rem; position: relative; }
.automation-flow-stage a { display: grid; gap: 0.1rem; padding: 0.6rem 0.9rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--card); color: inherit; text-decoration: none; }
.automation-flow-stage + .automation-flow-stage a::before { content: "\2192"; position: absolute; left: -0.85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.automation-flow-count { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.automation-flow-name { color: var(--muted); font-size: 0.85rem; }
.automation-flow-stage.is-zero a { color: var(--muted); }
.automation-flow-stage.is-peak a { border-color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
.automation-attention { color: var(--neg); font-weight: 600; }
.automation-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 0.75rem 0 0.25rem; }
.automation-filter-group { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.automation-filter {
    display: inline-flex; align-items: center; gap: 0.3rem;
    min-height: var(--tap-min, 2rem); padding: 0 0.7rem;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--card); color: var(--text-2);
    font: inherit; font-size: 0.8rem; cursor: pointer;
}
.automation-filter[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.automation-filter-count { font-variant-numeric: tabular-nums; color: var(--muted); }
.automation-more { margin-top: 0.75rem; }
.automation-runs tbody tr[hidden] { display: none; }
.automation-queue { margin: 0; padding: 0; list-style: none; }
.automation-queue a { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 44px; padding: 0 0.5rem; border-radius: var(--radius, 0.375rem); }
.automation-queue-count { font-variant-numeric: tabular-nums; font-weight: 600; }
.automation-queue-oldest { color: var(--muted); font-size: 0.8125rem; font-weight: 400; }
.automation-held { list-style: none; margin: 0.5rem 0 0; padding: 0; font-size: 0.8125rem; }
.automation-held li { padding: 0.125rem 0; overflow-wrap: anywhere; }
.automation-held-reason { color: var(--muted); }
.automation-queue-zero { color: var(--muted); }
.automation-queue-zero .automation-queue-count { font-weight: 400; }
.automation-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; margin: 0 0 0.5rem; }
.automation-cell { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-m); padding: 0.75rem 1rem; }
.automation-cell dt { color: var(--muted); font-size: 0.85rem; }
.automation-cell dd { margin: 0.25rem 0 0; font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.automation-cell dd a { color: inherit; }
.automation-baseline { display: block; margin: 0.25rem 0 0; color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.automation-cost { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.5rem; margin-bottom: 0.5rem; }
.automation-cost-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.75rem; }
.automation-cost-list li { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 0.75rem; }
.automation-cost-name { overflow-wrap: anywhere; }
.automation-cost-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.automation-cost-list .automation-bar { grid-column: 1 / -1; width: 100%; }
.automation-banner { display: flex; align-items: flex-start; gap: 0.6rem; margin: 0 0 0.75rem; padding: 0.75rem 1rem; background: var(--warn-soft); border: 1px solid var(--warn-border); border-radius: var(--r-m); }
.automation-banner > svg { flex: none; margin-top: 0.15rem; color: var(--warn); }
.automation-banner p { margin: 0; }
.automation-cell-warm { background: var(--warn-soft); border-color: var(--warn-border); }
.automation-cell-warn dd { color: var(--warn); }
.automation-cell-bad dd { color: var(--neg); }
.automation-queue-your-turn { padding: 0.5rem; border-radius: var(--r-m); background: var(--warn-soft); }
.automation-steps { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.85rem; }
.automation-step.is-done { text-decoration: line-through; }
.automation-step.is-current { color: inherit; font-weight: 600; }
.automation-pulse { display: inline-block; width: 0.5rem; height: 0.5rem; margin-right: 0.4rem; border-radius: 50%; background: var(--pos); }
@media (prefers-reduced-motion: no-preference) {
    .automation-pulse { animation: automation-pulse 2s ease-in-out infinite; }
    @keyframes automation-pulse { 50% { opacity: 0.25; } }
    .automation-figure { display: inline-block; }
    .automation-figure.is-changed { animation: automation-figure 0.45s ease-out; }
    @keyframes automation-figure { from { opacity: 0; transform: translateY(0.4em); } }
    .automation-runs tbody tr.is-new { animation: automation-row-in 0.4s ease-out; }
    @keyframes automation-row-in { from { opacity: 0; transform: translateY(-0.6rem); } }
    .automation-run.is-new { transform-box: fill-box; transform-origin: 0 50%; animation: automation-draw 0.6s ease-out; }
    @keyframes automation-draw { from { transform: scaleX(0); } }
}

/* ── sign-in pulse ─────────────────────────────────────────────────────── */

.pulse-grid { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1rem; }
.pulse-name { font-size: 0.9rem; margin: 0 0 0.25rem; display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.pulse-chart { display: block; width: 100%; height: auto; }
.pulse-own { max-width: 28rem; }
.pulse-axis { stroke: var(--border); stroke-width: 0.6; }
.pulse-issued { fill: var(--pos); }
.pulse-denied { fill: var(--neg); }
.pulse-flag { fill: var(--warn); }
.pulse-flagged { margin: 0.25rem 0 0; font-size: 0.8rem; color: var(--neg); }
.pulse-line { fill: none; stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; }
.pulse-line-0 { stroke: var(--pos); }
.pulse-line-1 { stroke: var(--warn); }
.pulse-line-2 { stroke: var(--text-2); }
.pulse-line-3 { stroke: var(--neg); }
.pulse-line-4 { stroke: var(--muted); }
.pulse-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.pulse-key::before { content: ""; display: inline-block; width: 0.7rem; height: 0.2rem; margin-right: 0.35rem; vertical-align: middle; background: currentColor; }
.pulse-key-0::before { background: var(--pos); }
.pulse-key-1::before { background: var(--warn); }
.pulse-key-2::before { background: var(--text-2); }
.pulse-key-3::before { background: var(--neg); }
.pulse-key-4::before { background: var(--muted); }
.pulse-row-flagged td { color: var(--neg); }

/* ── danger button, sign-out rows, app icon ────────────────────────────── */

.btn-danger { color: var(--neg); border-color: var(--neg); }
.btn-danger:hover {
    color: var(--neg);
    border-color: var(--neg);
    background: color-mix(in srgb, var(--neg) 12%, var(--card));
}

.signout-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.6rem 0;
}
.signout-row .btn { flex: none; }

.source-link { font-size: 0.85rem; }

.app-icon {
    --app-hue: var(--hue);
    --app-chroma: var(--chroma);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin-bottom: 0.5rem;
    border-radius: var(--r-s);
    background: oklch(from var(--primary-soft) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue));
    color: oklch(from var(--primary-ink) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue));
    font-size: 1.05rem;
}

/* ── Account security rows ─────────────────────────────────────────────── */

.security-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.security-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.75rem 0; border-top: 1px solid var(--border); }
.security-row:first-child { border-top: 0; }
.security-state { display: inline-flex; flex: none; font-size: 1.25rem; color: var(--muted); }
.security-row.is-off .security-state { color: var(--muted); }
.security-row.is-ok .security-state { color: var(--pos); }
.security-row.is-warn .security-state { color: var(--warn); }
.security-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.security-row .btn { flex: none; }
.security-actions { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }

/* The ring: --ring-done of three safeguards, drawn clockwise. */
.security-ring {
    --ring-size: 3rem;
    flex: none;
    display: inline-grid;
    place-items: center;
    width: var(--ring-size);
    height: var(--ring-size);
    border-radius: 50%;
    background: conic-gradient(var(--pos) calc(var(--ring-done) / 3 * 100%), var(--border) 0);
}
.security-ring-n {
    display: grid;
    place-items: center;
    width: calc(var(--ring-size) - 0.7rem);
    height: calc(var(--ring-size) - 0.7rem);
    border-radius: 50%;
    background: var(--card);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.security-summary { display: flex; align-items: center; gap: 0.85rem; margin: 0.75rem 0 0.25rem; }
.launcher-ring { grid-area: here; justify-self: end; }
.launcher-ring .security-ring { --ring-size: 2.4rem; }

/* ── Notifications by app ──────────────────────────────────────────────── */

.app-blocks { display: flex; flex-direction: column; gap: 1rem; }
.app-block { display: flex; flex-direction: column; gap: 0.5rem; margin: 0; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: var(--r-s); min-width: 0; }
.app-block-head { display: flex; align-items: center; gap: 0.6rem; margin: 0; font-weight: 600; }
.app-block-head .source-label { flex: 1 1 auto; }
.app-block .source-row-nested { font-weight: 400; margin: 0; padding-left: 2.4rem; }

.switch {
    appearance: none;
    flex: none;
    width: 2.5rem;
    min-width: 2.5rem;
    height: 1.5rem;
    min-height: 1.5rem;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--card-2);
    position: relative;
    cursor: pointer;
}
.switch::after {
    content: "";
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: var(--muted);
    transition: transform 0.15s;
}
.switch:checked { background: var(--primary); border-color: var(--primary); }
.switch:checked::after { transform: translateX(1rem); background: var(--card); }
.switch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .switch::after { transition: none; } }

.quiet-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; }
.quiet-row label { margin: 0; }
.quiet-row input[type="time"] { width: auto; }

/* ── Calendar ──────────────────────────────────────────────────────────── */

.ics-url-row { display: flex; gap: 0.5rem; align-items: center; }
.ics-url-row .ics-url-input { flex: 1 1 auto; min-width: 0; width: auto; }
.ics-url-row .btn { flex: none; }
.source-link { display: inline-flex; align-items: center; gap: 0.3rem; }
.danger-zone { border-color: var(--neg); }

.launcher-request { margin-top: 0.5rem; }
.launcher-requested { background: var(--card-2); color: var(--muted); }

/* ── Year story: /rueckblick/{year} ────────────────────────────────────── */

.story {
    --app-hue: var(--hue);
    --app-chroma: var(--mark-chroma);
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    overflow-y: auto;
}
.story-bar, .story-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem clamp(1rem, 4vw, 2rem);
}
.story-title { font-family: var(--font-display); font-weight: 700; }
.story-progress { display: flex; flex: 1; gap: 0.3rem; margin: 0; padding: 0; list-style: none; }
.story-progress li { flex: 1; height: 3px; border-radius: 2px; background: var(--border-strong); }
.story-progress li.is-done { background: var(--primary); }
.story-close, .story-nav .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--tap-min);
    min-height: var(--tap-min);
}
.story-nav { justify-content: space-between; position: sticky; bottom: 0; background: var(--bg); }
.story-position { color: var(--muted); font-size: 0.85rem; }

.story-stage { flex: 1; display: flex; flex-direction: column; }
.story-slide {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 2rem max(clamp(1.25rem, 6vw, 3rem), calc((100% - 52rem) / 2));
    background: linear-gradient(160deg, oklch(from var(--primary-soft) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue)), transparent 65%);
}
.story-slide[hidden] { display: none; }
.story-slide p { margin: 0; }
.story-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: var(--r-m);
    background: oklch(from var(--primary) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue));
    color: var(--on-primary);
    font-size: 1.7rem;
}
.story-app {
    color: oklch(from var(--primary-ink) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue));
    font-weight: 600;
}
.story-label { color: var(--muted); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.story-figure { display: flex; flex-direction: column; gap: 0.5rem; }
.story-figure .jrb-value { font-size: clamp(2.4rem, 9vw, 5rem); line-height: 1.05; }
.story-figure .jrb-meta { font-size: clamp(1rem, 2.5vw, 1.3rem); }
.story-open {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1.25rem;
    color: oklch(from var(--primary-ink) l calc(var(--app-chroma) * c / var(--chroma)) var(--app-hue));
    font-weight: 600;
}
.story-end { --app-chroma: var(--chroma); align-items: stretch; }
.story-end-title { font-family: var(--font-display); font-size: clamp(1.8rem, 6vw, 3rem); margin: 0 0 0.75rem; }
.story-empty { color: var(--text-2); font-size: 1.1rem; }
.story-all { display: grid; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.story-all a {
    display: grid;
    gap: 0.1rem 0.85rem;
    grid-template-columns: auto 1fr;
    padding: 0.8rem 1rem;
    background: var(--card-2);
    border: 1px solid var(--border);
    border-left: 4px solid oklch(from var(--primary) l calc(var(--mark-chroma) * c / var(--chroma)) var(--app-hue));
    border-radius: var(--r-m);
    color: inherit;
    text-decoration: none;
}
.story-all-icon { grid-row: span 3; align-self: center; font-size: 1.3rem; }
.story-all-label { color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }

.story-slide[data-face="archivo"] .jrb-value, .story-all [data-face="archivo"] .jrb-value { font-family: "Archivo", var(--font-body); }
.story-slide[data-face="bricolage-grotesque"] .jrb-value, .story-all [data-face="bricolage-grotesque"] .jrb-value { font-family: "Bricolage Grotesque", var(--font-body); }
.story-slide[data-face="geist"] .jrb-value, .story-all [data-face="geist"] .jrb-value { font-family: "Geist", var(--font-body); }
.story-slide[data-face="ibm-plex-sans"] .jrb-value, .story-all [data-face="ibm-plex-sans"] .jrb-value { font-family: "IBM Plex Sans", var(--font-body); }
.story-slide[data-face="outfit"] .jrb-value, .story-all [data-face="outfit"] .jrb-value { font-family: "Outfit", var(--font-body); }
.story-slide[data-face="sora"] .jrb-value, .story-all [data-face="sora"] .jrb-value { font-family: "Sora", var(--font-body); }
.story-slide[data-face="space-grotesk"] .jrb-value, .story-all [data-face="space-grotesk"] .jrb-value { font-family: "Space Grotesk", var(--font-body); }
.story-slide[data-face="zen-kaku-gothic-new"] .jrb-value, .story-all [data-face="zen-kaku-gothic-new"] .jrb-value { font-family: "Zen Kaku Gothic New", var(--font-body); }

@media (prefers-reduced-motion: no-preference) {
    .story.is-paged .story-slide:not([hidden]) { animation: story-in 0.35s ease-out; }
    @keyframes story-in { from { opacity: 0; transform: translateX(1.5rem); } }
}

/* Without the paging controller the slides stack and the buttons have nothing to do. */
.story:not(.is-paged) .story-nav { display: none; }

.jrb-story-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0 0.6rem;
    height: 2.1rem;
    border: 1px solid var(--border);
    border-radius: var(--r-s);
    color: var(--text-2);
    font-size: 0.85rem;
}
.jrb-story-link:hover { border-color: var(--primary); color: var(--primary-ink); }
@media (max-width: 719px) {
    .jrb-story-link { height: var(--tap-min); }
}
.story-nav .btn[aria-disabled="true"] { opacity: 0.4; cursor: default; }

@media (max-width: 639.98px) {
    .automation-runs thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .automation-runs, .automation-runs tbody { display: block; }
    .automation-runs tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.25rem 0.75rem;
        padding: 0.65rem 0.75rem;
        border-bottom: 1px solid var(--border);
    }
    .automation-runs tr::after { content: ""; order: 1; flex-basis: 100%; height: 0; }
    .automation-runs tbody tr:last-child { border-bottom: none; }
    .automation-runs td { padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
    .automation-runs .run-target { order: 0; flex: 1 1 0; font-weight: 600; }
    .automation-runs .run-outcome { order: 0; }
    .automation-runs .run-script, .automation-runs .run-kind, .automation-runs .run-model,
    .automation-runs .run-duration, .automation-runs .run-started { order: 2; color: var(--muted, inherit); font-size: 0.85em; }
}

.automation-since { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

.automation-heat { border-collapse: separate; border-spacing: 2px; width: 100%; table-layout: fixed; font-size: 0.7rem; }
.automation-heat th { font-weight: 400; color: var(--muted); text-align: left; white-space: nowrap; }
.automation-heat thead th { text-align: center; }
.automation-heat tbody th { width: 5.5rem; }
.automation-heat-cell { height: 1.1rem; border-radius: 2px; background: var(--card); box-shadow: inset 0 0 0 1px var(--border); }
.automation-heat-cell[data-level="1"] { background: color-mix(in srgb, var(--pos) 25%, var(--card)); }
.automation-heat-cell[data-level="2"] { background: color-mix(in srgb, var(--pos) 50%, var(--card)); }
.automation-heat-cell[data-level="3"] { background: color-mix(in srgb, var(--pos) 75%, var(--card)); }
.automation-heat-cell[data-level="4"] { background: var(--pos); }
.automation-heat-cell.is-failed { box-shadow: inset 0 0 0 2px var(--neg); }
.automation-heat-cell.is-limit { box-shadow: inset 0 0 0 2px var(--warn); }
@media (max-width: 40rem) { .automation-heat-quiet { visibility: hidden; } .automation-heat tbody th { width: 4rem; } }
