/* The shipped components. Load tokens.css first. Every measure here is
   twitchlive's, the reference page: change one and twitchlive changes. */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--slate);
    color: var(--ink);
    font-weight: 400;
}

/* Colour says it is a link; no underline, on hover either. */
a {
    color: var(--blue);
    text-decoration: none;
}

/* Components set display, which outranks the UA rule for [hidden]. */
[hidden] {
    display: none !important;
}

code,
kbd,
pre,
.mono {
    font-family: var(--mono);
}

code,
kbd {
    font-size: 0.9em;
}

/* Inline only: a code block's own fill is on the block. */
:not(pre) > code {
    padding: 0.1em 0.35em;
    background: var(--slate);
    border-radius: 3px;
    overflow-wrap: anywhere;
}

.nowrap {
    white-space: nowrap;
}

/* One line ending in an ellipsis: a long name or prompt in a list. A table
   cell ignores max-width, so a truncated cell takes the table's spare width
   (width 100%, max-width 0) and ends its line there instead of growing the
   column to the whole text. */
.truncate {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td.truncate {
    width: 100%;
    max-width: 0;
}

/* A figure that re-renders in place, a clock or a counter: its width holds. */
.tabular {
    font-variant-numeric: tabular-nums;
}

/* Read aloud, never drawn: clipping keeps the element in the accessibility
   tree, which display:none does not. */
.vh {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip {
    position: fixed;
    top: -100px;
    left: 1.5rem;
    z-index: 200;
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--blue);
    border-radius: var(--r-control);
}

.skip:focus {
    top: 0.5rem;
}

/* The "leaves the app" mark after an external link: an inline SVG at the
   text's size, stroked in the link's colour. */
.external-icon {
    flex: 0 0 auto;
    width: 0.82em;
    height: 0.82em;
    margin-left: 0.28em;
    vertical-align: -0.09em;
    opacity: 0.75;
}

/* Bar */

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--surface);
    box-shadow: var(--shadow-bar);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 0.5rem 1.5rem;
}

.nav-logo {
    flex: 0 0 auto;
}

.nav-logo a {
    color: var(--blue);
    font-size: 1.25rem;
    font-weight: 500;
    white-space: nowrap;
}

/* The link row is the item that gives: on a phone it scrolls sideways under
   its own edge rather than wrapping below the logo. */
.nav-links {
    display: flex;
    gap: 1.5rem;
    min-width: 0;
    overflow-x: auto;
    list-style: none;
    scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
    display: none;
}

.nav-link {
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color var(--fade);
}

.nav-link:hover,
.nav-link[aria-current="page"] {
    color: var(--blue);
}

/* A POST that sits in a line of links or a table cell: signing out, ending a
   session. The form takes no box of its own. */
.nav-form,
.inline-form {
    display: inline;
}

.nav-link-button {
    background: none;
    border: none;
    line-height: inherit;
    cursor: pointer;
}

/* Page */

.container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--page-max);
    margin: 0.75rem auto;
    padding: 0 1.5rem;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.login-card {
    width: 100%;
    max-width: var(--login-max);
    padding: 3rem;
    background: var(--surface);
    border: var(--edge);
    border-radius: var(--r-tile);
    text-align: center;
}

.profile-card {
    width: 100%;
    margin-bottom: 0.85rem;
    padding: 0.9rem 1.1rem;
    background: var(--surface);
    border: var(--edge);
    border-radius: var(--r-card);
}

h1 {
    margin-bottom: 0.6rem;
    color: var(--ink);
    font-size: 19px;
    font-weight: 500;
}

h2 {
    margin: 0 0 0.55rem;
    color: var(--ink);
    font-size: 16px;
    font-weight: 500;
}

h3 {
    margin: 0.85rem 0 0.25rem;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
}

/* How many a heading's list holds, after its words: muted, smaller, light. */
:is(h1, h2, h3) .count {
    margin-left: 0.6rem;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 400;
}

/* A note inside a heading, after its words: "· last checked 12:04". Muted,
   a step smaller and regular weight, so the heading still reads first. Any
   heading, in a card or the page column; .count is the same for a number. */
:is(h1, h2, h3) .heading-note {
    margin-left: 0.4rem;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 400;
}

.profile-card > h3:first-child {
    margin-top: 0;
}

/* The card's padding is its foot: the last block keeps no margin of its own
   below it, so a card that ends in a message, a form row or a fold has as much
   room at the bottom as at the top. */
.profile-card > :last-child {
    margin-bottom: 0;
}

/* A document card, a walkthrough or an API page, runs several sections down
   one card: each block after the first keeps a gap, and a later h2 opens a
   new section with room above it. The page column does the same where a
   second section runs down it outside any card. gen's and magpie's rules. */
.profile-card > :not(h1, h2, h3) + :is(p, pre, .table-container, .profile-info) {
    margin-top: 0.6rem;
}

:is(.profile-card, .container) > h2:not(:first-child) {
    margin-top: 1.25rem;
}

/* A plain list in a card keeps its markers inside the card's edge, as a list
   in a fold does, and the block gap above it that a paragraph keeps. A list
   with a class is a component, a log or a timeline, and spaces itself. */
.profile-card > :is(ul, ol):not([class]) {
    padding-left: 1.25rem;
}

.profile-card > :not(h1, h2, h3) + :is(ul, ol):not([class]) {
    margin-top: 0.6rem;
}

.text-muted {
    color: var(--muted);
    font-style: italic;
}

/* A line of facts under a title or a row, a film's year and runtime: muted
   and upright, the ramp's Caption step. Not .text-muted, whose italic is for
   a sentence. */
.caption {
    color: var(--muted);
    font-size: 0.75rem;
}

.disabled {
    opacity: 0.7;
}

.margin-top-1 {
    margin-top: 1rem;
}

.margin-top-2 {
    margin-top: 2rem;
}

/* A card heading with a control at its right, on one baseline. */
.card-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

/* A page's title row: the h1, an optional muted note, and the page's controls
   at the far end, wrapping under on a phone. It takes the h1's place in the
   column, so it keeps the h1's margin below and the h1 drops its own. More
   than one control sits in one wrapper, which is the row's last item. */
.page-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.6rem;
}

.page-heading > h1 {
    margin-bottom: 0;
}

.page-heading-note {
    color: var(--muted);
    font-size: 0.875rem;
}

/* A note that reports a fault rather than an aside: red-deep, which holds
   4.5:1 on the page background where red does only just. */
.page-heading-note-danger {
    color: var(--red-deep);
}

/* A note that warns, a backup running late: amber-ink, the one amber that
   holds 4.5:1 on the page background. */
.page-heading-note-warn {
    color: var(--amber-ink);
}

.page-heading > :last-child:not(h1, .page-heading-note) {
    margin-left: auto;
}

/* More than one range switch beside a heading: they wrap as a unit. */
.card-heading-switches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Two cards read as one comparison. Subgrid puts both cards' heading, intro
   and body on the same three rows, so the two tables start at one height.
   Each card holds exactly those three children. */
.card-pair {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    grid-template-rows: auto auto auto;
    align-items: start;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.card-pair > .profile-card {
    display: grid;
    grid-row: span 3;
    grid-template-rows: subgrid;
    margin-bottom: 0;
}

/* Forms */

.input-group {
    margin-bottom: 0.55rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
}

input,
select {
    width: 100%;
    padding: 0.4rem 0.55rem;
    border: var(--edge);
    border-radius: var(--r-control);
    outline: none;
    font-size: 0.875rem;
    font-weight: 400;
    transition: border var(--fade);
}

/* A box to tick keeps its own size wherever it sits, not a field's width. */
input:is([type="checkbox"], [type="radio"]) {
    width: auto;
    padding: 0;
}

textarea {
    width: 100%;
    min-height: 5em;
    padding: 0.4rem 0.55rem;
    border: var(--edge);
    border-radius: var(--r-control);
    outline: none;
    font-size: 0.875rem;
    resize: vertical;
}

/* A select sits on the field's white, as input and textarea do. Firefox
   otherwise draws it on its button grey, and it reads as disabled. */
select {
    background-color: var(--surface);
}

/* Focus draws the edge at 2px in blue, on every field a keyboard reaches. */
:is(input, select, textarea):focus {
    border: 2px solid var(--blue);
}

:is(input, select, textarea)[aria-invalid="true"] {
    background: var(--red-tint);
    border-color: var(--red);
}

/* The error under its field: location is the field, so the line is cause and
   fix. */
.input-error {
    display: block;
    margin-top: 0.2rem;
    color: var(--red-deep);
    font-size: 0.78rem;
}

.input-group small {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.78rem;
    font-style: normal;
}

.password-input {
    width: 320px;
    max-width: 100%;
}

/* A checkbox or radio with its label on one line. */
.check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.check input {
    width: auto;
    margin: 0;
}

/* A group of controls under one legend, the checkboxes of a routing choice.
   On the page it is a light box with the legend in its notch; spaced as one
   more group in the form. min-width lets it shrink inside a phone's column. */
fieldset {
    min-width: 0;
    margin-bottom: 0.55rem;
    padding: 0.5rem 0.75rem 0.6rem;
    border: var(--edge);
    border-radius: var(--r-control);
}

legend {
    padding: 0 0.3rem;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
}

/* Boxes to tick, one under the next, each its own line to hit. */
fieldset > .check + .check {
    margin-top: 0.3rem;
}

/* In a card the card is the box: the group drops its edge and the legend reads
   as a field's label, set over its controls. */
.profile-card fieldset {
    padding: 0;
    border: none;
}

.profile-card legend {
    padding: 0 0 0.2rem;
}

/* A filter above a list: a wrapping row of fields, labels above. */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.85rem;
}

.filter-form .input-group {
    margin-bottom: 0;
}

/* A filter on one line: labels inline, fields as wide as their content. */
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    font-size: 0.875rem;
}

.filters label {
    display: inline;
    margin: 0;
}

.filters :is(input, select) {
    width: auto;
}

/* A box to tick in the filter keeps its own row: box, gap, words. */
.filters label.check {
    display: flex;
}

/* The filter the page is narrowed by, with its clear control. */
.active-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    padding: 0.25rem 0.7rem;
    border: var(--edge);
    border-radius: var(--r-pill);
    color: var(--muted);
    font-size: 0.8125rem;
}

.active-filter-clear {
    color: var(--muted);
    font-weight: 600;
    line-height: 1;
}

.active-filter-clear:hover {
    color: var(--red);
}

/* Buttons */

.btn {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    background: var(--green);
    border: none;
    border-radius: var(--r-control);
    color: var(--surface);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--fade);
}

.btn:hover {
    background: var(--green-deep);
}

/* A link takes the button's white over the link blue. A quiet button keeps its
   own text colour: its fill is surface, so white on it is an empty box. */
a.btn:not(.btn-quiet),
a.btn:not(.btn-quiet):hover {
    color: var(--surface);
}

.btn:disabled,
.btn[aria-disabled="true"],
.btn-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
}

.btn-danger,
.logout-btn {
    background: var(--red);
}

.logout-btn {
    margin-top: 1.5rem;
}

.btn-danger:hover,
.logout-btn:hover {
    background: var(--red-hover);
}

/* The quiet action beside a green one, or a row of them where a badge
   already carries the state: surface fill, line edge, muted text. */
.btn-quiet {
    background: var(--surface);
    border: var(--edge);
    color: var(--muted);
}

.btn-quiet:hover {
    background: var(--slate);
    color: var(--ink);
}

.btn-quiet-danger {
    color: var(--red);
}

/* On the tint the text steps to red-deep: plain red on it is 4.1:1. */
.btn-quiet-danger:hover {
    background: var(--red-tint);
    color: var(--red-deep);
}

/* A toggle that is on, a filter or a mode: lit in blue, as the range switch's
   current choice, on its tint. The text is the deep blue; the plain blue on
   the tint measures 3.9:1. */
.btn-quiet[aria-pressed="true"] {
    background: var(--blue-tint);
    border-color: var(--blue);
    color: var(--blue-deep);
}

/* A form that is one row: fields side by side, labels above, the button on
   the fields' baseline. A field grows from 12rem; .input-group-compact
   holds the lone always-visible field to 20rem; .input-group-full takes a
   row of its own. */
.form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.4rem 0.75rem;
    margin-bottom: 0.85rem;
}

.form-row .input-group {
    flex: 1 1 12rem;
    min-width: 9rem;
    margin-bottom: 0;
}

.form-row .btn {
    flex: 0 0 auto;
}

.form-row .input-group-full {
    flex: 1 1 100%;
}

.form-row .input-group-compact {
    flex: 0 1 20rem;
}

/* Optional fields folded under the row: a muted summary, a narrow stack. */
.form-more {
    flex: 1 1 100%;
}

.form-more summary {
    width: fit-content;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.form-more-fields {
    display: grid;
    gap: 0.6rem;
    max-width: 26rem;
    margin-top: 0.6rem;
}

.links {
    margin-top: 1.5rem;
    font-size: 0.875rem;
}

.links a {
    color: var(--blue);
    font-weight: 500;
}

.forgot-password-link {
    margin-bottom: 1em;
    text-align: right;
}

.forgot-password-link a {
    color: var(--blue);
    font-size: 0.95em;
    transition: color var(--fade);
}

.admin-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* A wrapping run of plain links under a fact or a card: Mod Organizer 2 ·
   Load order. Closer than .admin-links, which spaces buttons. */
.link-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}

/* A card after a row keeps the card-to-card gap above it. Only the rows that
   set no margin of their own: a heading, a message, a filter or a form already
   spaces what follows, and the page column is flex, so margins add up rather
   than collapse. */
:is(.link-row, .admin-links) + .profile-card {
    margin-top: 0.85rem;
}

/* The same after a page's muted intro, a bare paragraph in the column. Only a
   muted one: a consumer's own intro classes carry their own margin. */
.container > p.text-muted + .profile-card {
    margin-top: 0.85rem;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.85rem;
}

/* Messages */

/* A message is its hue's tint on an edge of the hue. The text is the deep
   step, which holds 4.5:1 on the tint where the plain hue does not: error
   4.1 to 5.5, info 3.9 to 6.1, warning 4.4 to 5.2 in amber ink. Green holds
   4.6 as it is. */

.error-message,
.warning-message,
.info-message,
.success-message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border: 1px solid;
    border-radius: var(--r-control);
    font-size: 0.875rem;
}

.error-message {
    background-color: var(--red-tint);
    border-color: var(--red);
    color: var(--red-deep);
    text-align: center;
}

.info-message {
    background-color: var(--blue-tint);
    border-color: var(--blue);
    color: var(--blue-deep);
}

.success-message {
    background-color: var(--green-tint);
    border-color: var(--green);
    color: var(--green);
}

.warning-message {
    background-color: var(--amber-tint);
    border-color: var(--amber);
    color: var(--amber-ink);
}

/* Facts */

/* minmax(0, 1fr), not 1fr: 1fr's floor is the longest word, so a URL, a SHA
   or a path in a value would push the page sideways on a phone. */
.facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.3rem 1.5rem;
}

.facts dt {
    color: var(--muted);
    font-weight: 600;
}

.facts dd {
    overflow-wrap: anywhere;
}

.profile-info {
    margin: 1rem 0;
    font-size: 0.875rem;
    text-align: left;
}

.profile-info p {
    margin: 0.75rem 0;
    color: var(--muted);
}

/* Last in a card, the last line would carry its margin out through the block
   to the card's foot, which the card's last block gives up. */
.profile-card > .profile-info:last-child > p:last-child {
    margin-bottom: 0;
}

.profile-info strong {
    display: inline-block;
    width: var(--label-col);
    color: var(--ink);
}

.change-password {
    padding-top: 1.5rem;
    border-top: var(--edge);
    text-align: left;
}

/* Events */

.events-list {
    margin-top: 0.5rem;
    list-style: none;
}

.event-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.45rem 0;
    border-bottom: var(--edge);
}

.event-item:last-child {
    border-bottom: none;
}

.event-time {
    color: var(--muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.event-content {
    flex: 1;
}

.event-action {
    margin-bottom: 0.25rem;
    color: var(--ink);
    font-weight: 500;
}

.event-details {
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 400;
}

/* A timeline: one thing's events in order, a time right-aligned in its
   column, a dot on a thread, the event. The dot's hue is the event's state;
   an unmarked dot is an event with no state to report. */
.timeline {
    margin: 0.4rem 0 0;
    list-style: none;
}

.timeline-event {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.12rem 0;
    font-size: 0.875rem;
}

.timeline-time {
    flex: 0 0 8.5rem;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.35;
    text-align: right;
    white-space: nowrap;
    opacity: 0.85;
}

.timeline-mark {
    position: relative;
    flex: 0 0 auto;
    align-self: flex-start;
    width: 0.5rem;
    height: 0.5rem;
    margin-top: 0.3rem;
    background: var(--line);
    border-radius: 50%;
}

/* The thread from each dot down to the next. */
.timeline-mark::before {
    content: "";
    position: absolute;
    top: 0.5rem;
    bottom: -0.44rem;
    left: 50%;
    width: 1px;
    background: var(--line);
    transform: translateX(-50%);
}

.timeline-event:last-child .timeline-mark::before {
    display: none;
}

.timeline-body {
    flex: 1;
    color: var(--ink);
    line-height: 1.35;
}

.timeline-ok .timeline-mark {
    background: var(--green);
}

.timeline-info .timeline-mark {
    background: var(--blue);
}

.timeline-data .timeline-mark {
    background: var(--data);
}

.timeline-end .timeline-mark {
    background: var(--muted);
}

/* Still going: a hollow dot, the line muted and italic. */
.timeline-ongoing .timeline-mark {
    background: transparent;
    border: 2px solid var(--data);
}

.timeline-ongoing .timeline-body {
    color: var(--muted);
    font-style: italic;
}

/* Tables */

.table-container {
    margin-top: 0.5rem;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    background-color: var(--surface);
    border-collapse: collapse;
    border-radius: var(--r-control);
    box-shadow: var(--shadow-lift);
    font-size: 0.8rem;
}

/* Fixed layout: a column keeps its width across filters and pages instead
   of following the longest cell on the page. Set the fixed columns' widths
   on the th; the unsized columns share the rest. */
.data-table-fixed {
    table-layout: fixed;
}

/* A name and a few short figures: the lead column takes the spare width and
   every other column shrinks to its content, so the figures sit together at
   the right edge instead of spreading across the row. The lead is the first
   column, or the one whose cells carry .lead when a rank comes first. */

/* :where() holds these at zero specificity, so the phone reflow below undoes
   them without a heavier selector. */
:where(.data-table-lead:not(:has(.lead)) :is(th, td):not(:first-child)),
:where(.data-table-lead:has(.lead) :is(th, td):not(.lead)) {
    width: 1%;
    white-space: nowrap;
}

.data-table-lead :is(th, td):not(:first-child, .lead) {
    padding-left: 1.5rem;
}

.data-table tr:hover {
    background-color: rgb(0 0 0 / 2%);
}

/* Ten columns of small numbers: the band keeps the eye on one row across the
   width. nth-child follows DOM order, so a script that sorts by moving the
   rows keeps the bands alternating; it counts only the rows still shown, so a
   filter that sets hidden on some leaves the rest alternating too. */
.data-table-zebra tbody tr:nth-child(even of :where(:not([hidden]))) {
    background: rgb(0 0 0 / 3%);
}

/* One line per row whatever the widths work out to. Top alignment keeps a
   row menu's button on that line while its panel is open in flow. */
.data-table-compact td {
    white-space: nowrap;
    vertical-align: top;
}

.data-table th,
.data-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: var(--edge);
    text-align: left;
}

.data-table th {
    background-color: var(--slate);
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
}

/* A fixed layout holds each column to its set width, so a heading wider than
   its column wraps rather than spill into the next one. */
.data-table-fixed th {
    white-space: normal;
}

/* A sortable column: aria-sort carries the direction, the arrow draws it. */
.data-table th[data-sort] {
    cursor: pointer;
    user-select: none;
}

.data-table th[data-sort]:hover {
    color: var(--ink);
}

.data-table th[aria-sort="ascending"]::after {
    content: " ▲";
    font-size: 0.6rem;
}

.data-table th[aria-sort="descending"]::after {
    content: " ▼";
    font-size: 0.6rem;
}

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

/* A row's detail, a fold of what was sent: <tr class="row-detail"> right
   under it, one cell spanning the columns. No line between the two, and they
   light together under the pointer, so they read as one row. */
.data-table tr:has(+ tr.row-detail) > td {
    border-bottom: none;
}

.data-table tr:hover + tr.row-detail,
.data-table tr:has(+ tr.row-detail:hover) {
    background-color: rgb(0 0 0 / 2%);
}

/* A row that is a link: tabindex="0" and the script follows its data-href. */
.data-table tr[role="link"] {
    cursor: pointer;
}

.data-table tr[role="link"]:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: -2px;
}

.data-table :is(td, th).num {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.data-table td.row-actions {
    text-align: right;
}

.row-actions form {
    display: block;
    margin: 0;
}

/* A badge and the figure it qualifies, on one baseline. The flex box is this
   span, not the cell: a flex td stops giving its width to the column. */
.status-line {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    white-space: nowrap;
}

/* A row's actions behind one ⋯: <details class="row-menu">. It opens in
   flow and pushes the row taller; a script that adds .row-menu-floating
   floats it over the table instead, out of the scrolling box's clip. */
.row-menu > summary {
    list-style: none;
}

.row-menu > summary::-webkit-details-marker {
    display: none;
}

.row-menu-items {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: fit-content;
    margin-top: 0.3rem;
    margin-left: auto;
}

.row-menu-floating[open] > .row-menu-items {
    position: fixed;
    z-index: 30;
    margin: 0;
    padding: 0.3rem;
    background: var(--surface);
    border: var(--edge);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-menu);
}

.row-menu-items .btn {
    width: 100%;
    text-align: left;
    white-space: nowrap;
}

/* A card that folds: <details class="profile-card card-fold">, its h2 in the
   summary. display stays on the summary, since flex on it drops the
   browser's disclosure marker and the row reads as dead text. */
.card-fold > summary {
    cursor: pointer;
    user-select: none;
}

/* Inside a summary, so never the card's own later h2 that the section gap
   above spaces. */
/* stylelint-disable-next-line no-descending-specificity */
.card-fold > summary h2 {
    display: inline;
    margin: 0;
}

.card-fold > summary .text-muted {
    margin-left: 0.4rem;
}

.card-fold[open] > summary {
    margin-bottom: 0.55rem;
}

/* A detail folded away inside a card, a changelog or a list of followed
   lists: the summary a muted line that says what opens, the body under it.
   A card fold is a card, not a .fold, so the check's pairing with it never
   meets on one summary. */
/* stylelint-disable-next-line no-descending-specificity */
.fold > summary {
    width: fit-content;
    color: var(--muted);
    cursor: pointer;
}

.fold > summary:hover {
    color: var(--ink);
}

.fold {
    margin-block: 0.5rem;
}

.fold[open] > summary {
    margin-bottom: 0.4rem;
}

/* Slate zeroes every padding; a list in a fold keeps its bullets inside. */
.fold :is(ul, ol) {
    padding-left: 1.25rem;
}

/* A fold in a table cell is cell content: no block margin, so its row is as
   tall as the next. In a truncating cell the closed summary ends its one line
   in an ellipsis; the open body under it wraps as a code block does. */
.data-table td > .fold {
    margin-block: 0;
}

.truncate > .fold > summary {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Two or three links that pick a window, 7d or All time. The current one is
   aria-current and filled; each reloads the page, so no script. */
.range-switch {
    display: inline-flex;
    overflow: hidden;
    border: var(--edge);
    border-radius: var(--r-pill);
    font-size: 0.8125rem;
}

.range-switch a {
    padding: 0.15rem 0.7rem;
    color: var(--muted);
}

.range-switch a:hover {
    background: var(--slate);
}

.range-switch a[aria-current] {
    background: var(--blue);
    color: var(--surface);
}

/* Straight in the page column, a switch keeps its own width: the column is a
   flex column and would stretch it. Only there, since in a heading, a filter or
   a pagination row the row's own alignment places it. */
.container > .range-switch {
    align-self: flex-start;
}

/* A switch with more options than a phone is wide: it wraps, and a wrapped
   pill is a blob, so it is a box. */
.range-switch-wrap {
    flex-wrap: wrap;
    border-radius: var(--r-control);
}

/* Several quiet buttons as one control, Hide / Show / Only: shared edges,
   rounded only at the ends, the pressed one drawn over its neighbours. */
.segmented {
    display: inline-flex;
}

.segmented > .btn {
    border-radius: 0;
}

.segmented > .btn + .btn {
    margin-left: -1px;
}

.segmented > .btn:first-child {
    border-radius: var(--r-control) 0 0 var(--r-control);
}

.segmented > .btn:last-child {
    border-radius: 0 var(--r-control) var(--r-control) 0;
}

.segmented > .btn[aria-pressed="true"] {
    position: relative;
}

.forgot-password-link a:hover {
    color: var(--blue-deep);
}

/* Sibling pages of one section, Events / Handshakes: above the h1, muted
   links over a hairline, the current page blue on a 2px rule. Navigation, not
   a filter, so it takes no box. A row wider than a phone scrolls sideways
   with its scrollbar shown, so the pages past the edge stay findable. */
.tabs {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 0.85rem;
    overflow-x: auto;
    border-bottom: var(--edge);
    font-size: 0.875rem;
}

/* :any-link, not a bare a: the same weight as the hover rules around it. */
.tabs a:any-link {
    margin-bottom: -1px;
    padding: 0.4rem 0 0.45rem;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
}

.tabs a:hover {
    color: var(--ink);
}

.tabs a[aria-current="page"] {
    border-bottom-color: var(--blue);
    color: var(--blue);
}

/* Numbered pages for a list too long to step through: the first and last few
   pages and the ones around the current, a .pagination-gap between runs. The
   current page is an aria-current span, filled as a range switch's current
   window is. A Prev or Next .btn at either end keeps its button shape. */
.pagination-numbers {
    gap: 0.25rem;
    font-size: 0.875rem;
}

.pagination-numbers :is(a, [aria-current]):not(.btn) {
    min-width: 2rem;
    padding: 0.2rem 0.45rem;
    border-radius: var(--r-control);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.pagination-numbers a:not(.btn):hover {
    background: var(--slate);
}

.pagination-numbers [aria-current] {
    background: var(--blue);
    color: var(--surface);
}

.pagination-gap {
    color: var(--muted);
}

/* Badges */

/* The state a row is in: offline, idle. nowrap: a pill is sized by its
   text, and a wrapped one is a blob. */

/* A badge is one unit: it moves to the next line whole, and a flex row does not
   squeeze it. Only a badge wider than its container, an error sentence on a
   phone, breaks inside. */
.badge {
    display: inline-block;
    flex-shrink: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 0.15rem 0.6rem;
    background: var(--slate);
    border: var(--edge);
    border-radius: var(--r-pill);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* In a table a badge holds one line: a cell is as narrow as its narrowest
   content, so a badge free to wrap would split "dirty tree" into two words
   the moment the column is squeezed. A wide table scrolls instead. */
.data-table .badge {
    white-space: nowrap;
}

/* The one state a page is watching for, "live": solid, so it reads first. */
.badge-solid {
    background: var(--data);
    border: none;
    color: var(--surface);
}

/* A note on a row rather than its state: a size down, closer tracking. The
   tinted and quiet badges are notes too. */
.badge-sm,
.badge-ok,
.badge-info,
.badge-warn,
.badge-danger,
.badge-data,
.badge-quiet {
    font-size: 0.7rem;
    letter-spacing: 0.02em;
}

/* A neutral note reads lighter than a state, so a row of them does not
   shout: twitchlive's channel flags. A tinted note keeps its weight, which
   its colour already carries. */
.badge-sm {
    font-weight: 500;
}

.badge-ok {
    background: rgb(from var(--green) r g b / 12%);
    border-color: rgb(from var(--green) r g b / 30%);
    color: var(--green-deep);
}

.badge-info {
    background: rgb(from var(--blue) r g b / 12%);
    border-color: rgb(from var(--blue) r g b / 30%);
    color: var(--blue-deep);
}

.badge-warn {
    background: rgb(from var(--amber) r g b / 12%);
    border-color: rgb(from var(--amber) r g b / 32%);
    color: var(--amber-ink);
}

.badge-danger {
    background: rgb(from var(--red) r g b / 12%);
    border-color: rgb(from var(--red) r g b / 30%);
    color: var(--red-deep);
}

.badge-data {
    background: rgb(from var(--data) r g b / 16%);
    border-color: rgb(from var(--data) r g b / 35%);
    color: var(--data-deep);
}

/* Present but set aside by hand: the quietest mark there is. */
.badge-quiet {
    border-style: dashed;
}

/* A one-letter mark: D, N, @. Square, since a one-letter pill reads as a
   bullet; the word it stands for is its title. */
.badge-initial {
    min-width: 1.35rem;
    padding: 0.1rem 0.25rem;
    border-radius: var(--r-control);
    font-size: 0.68rem;
    letter-spacing: 0;
    text-align: center;
}

/* Deep blue, as a tag under the pointer: plain blue on slate is 4.3:1. */
a.badge:hover {
    border-color: var(--blue);
    color: var(--blue-deep);
}

/* Free-form tags: a wrapping row of small neutral pills. */
.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.35rem;
    margin: 0.3rem 0;
}

.tag-chip {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    background: var(--slate);
    border: var(--edge);
    border-radius: var(--r-pill);
    color: var(--muted);
    font-size: 0.7rem;
}

/* A tag that opens its list: ink until the pointer, then a blue edge and
   deep-blue text (plain blue on slate is under 4.5:1). */
a.tag-chip {
    color: var(--ink);
}

a.tag-chip:hover {
    border-color: var(--blue);
    color: var(--blue-deep);
}

/* The same chips as a page's main filter row, where each is a tap target: a
   step up in type and padding, about 32px tall, still the tag's pill. */
.tag-chips-large {
    gap: 0.4rem 0.5rem;
}

.tag-chips-large > .tag-chip {
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
}

/* The value a facet row is narrowed to, Kind: app: aria-current, filled blue
   as a range switch's current window is. White on blue holds 4.51:1. Only in
   the large row: a small tag chip a consumer already marks current keeps its
   own look. In a .filters row a .filter-label names the facet. */
.tag-chips-large > a.tag-chip[aria-current],
.tag-chips-large > a.tag-chip[aria-current]:hover {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--surface);
}

.filters > .tag-chips {
    margin: 0;
}

/* The facet's name before its chips, Kind or Host: muted and upright, not
   the italic of .text-muted, which is for a sentence. */
.filter-label {
    color: var(--muted);
    font-weight: 500;
}

/* Stats: a figure over its label over a muted line, on a slate tile. */
.stats,
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--tile-min), 1fr));
    gap: 0.7rem;
    margin-top: 0.7rem;
}

.stat,
.stat-tile {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.7rem 0.8rem;
    background: var(--slate);
    border: var(--edge);
    border-radius: var(--r-card);
}

/* The figure leads whatever order the markup gives it. */
.stat-value {
    order: -1;
    color: var(--ink);
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.15;
}

.stat-label {
    color: var(--ink);
    font-size: 0.8rem;
    font-weight: 500;
}

.stat-sub {
    color: var(--muted);
    font-size: 0.72rem;
    font-style: italic;
}

/* Many tiles read as two calm rows of four, not one crowded strip. */
@media (width >= 768px) {
    .stat-grid-hero {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Charts: every mark is the data hue on the track, and every distinction a
   chart draws has a key under it. */

/* A bar chart: label, proportional track, value; every track starts at one x. */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(7rem, 12rem) 1fr auto;
    align-items: center;
    gap: 0.6rem;
}

.bar-label {
    overflow: hidden;
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    height: 14px;
    overflow: hidden;
    background: var(--track);
    border-radius: var(--r-bar);
}

.bar-fill {
    display: block;
    min-width: 2px;
    height: 100%;
    background: var(--data);
    border-radius: var(--r-bar);
}

.bar-value {
    color: var(--muted);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* A share: proportional segments in one track, each keyed in the legend. A
   segment names its step, so leaving out an empty one moves no colour; the
   track is what is left. */
.segment-bar {
    display: flex;
    max-width: 480px;
    height: 16px;
    overflow: hidden;
    background: var(--track);
    border-radius: var(--r-bar);
}

.segment {
    height: 100%;
    background: var(--data);
}

/* The key under a share bar: a swatch, then its name and count. */
.legend {
    display: flex;
    gap: 1rem;
    margin-top: 0.45rem;
    font-size: 0.75rem;
}

.swatch {
    display: inline-block;
    width: 11px;
    height: 11px;
    margin-right: 0.15rem;
    background: var(--data);
    border-radius: var(--r-mark);
    vertical-align: -0.05em;
}

.segment-2,
.swatch-2 {
    background: var(--data-2);
}

.segment-3,
.swatch-3 {
    background: var(--data-1);
}

.swatch-track {
    background: var(--track);
}

/* A sparkline: one series, no axes, no label; the line of text beside it
   states the figure. A link, so the hit area hugs the drawing, and the ring
   clears the stroke the SVG lets overflow. */
.sparkline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    margin: 0.3rem 0;
    outline-offset: 3px;
}

.sparkline svg {
    width: 120px;
    height: 28px;
    overflow: visible;
}

.sparkline polyline {
    fill: none;
    stroke: var(--data);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

/* A 1.5px line has no room for an underline; hover thickens the stroke. */
.sparkline:is(:hover, :focus-visible) polyline {
    stroke: var(--data-deep);
    stroke-width: 2.5;
}

/* A chart: an SVG on a fixed viewBox that scales to the card. The labels are
   in viewBox units, so they scale with the drawing; strokes do not. */
.chart {
    margin: 1rem 0 0;
}

.chart svg {
    width: 100%;
    height: auto;
}

.chart-grid,
.chart-axis {
    stroke: var(--line);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.chart-area {
    fill: var(--data);
    fill-opacity: 0.12;
    stroke: none;
}

.chart-line {
    fill: none;
    stroke: var(--data);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

/* Reference lines, each keyed in the legend: the peak solid red, the average
   dashed muted. */
.chart-peak {
    stroke: var(--red);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.chart-average {
    stroke: var(--muted);
    stroke-width: 1;
    stroke-dasharray: 4 3;
    vector-effect: non-scaling-stroke;
}

/* A point's hover target: invisible until pointed at, so a dense series
   reads as a curve rather than a string of beads. */
.chart-point {
    fill: var(--data);
    fill-opacity: 0;
}

.chart-point:hover {
    fill-opacity: 1;
}

/* An off-scale stream: a solid marker at the top edge, since the clipped line
   alone would read as a peak that happened to touch the ceiling. */
.chart-clipped {
    fill: var(--red);
}

.chart-key-clipped {
    color: var(--red);
}

/* An axis label: text-anchor on the element places it. */
.chart-label {
    fill: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.4rem;
    font-size: 0.85rem;
}

.chart-key {
    display: inline-block;
    width: 14px;
    height: 0;
    border-top: 2px solid var(--red);
}

.chart-key-average {
    border-top-style: dashed;
    border-top-color: var(--muted);
}

/* A heatmap: a day by hour grid, each cell a step of the data hue. */
.heatmap-scroll {
    padding-bottom: 0.25rem;
    overflow-x: auto;
}

.heatmap {
    display: grid;
    grid-template-columns: auto repeat(24, 16px);
    align-items: center;
    gap: 3px;
    width: max-content;
}

.heatmap-hour {
    color: var(--muted);
    font-size: 0.62rem;
    line-height: 1;
    text-align: left;
}

.heatmap-day {
    padding-right: 0.4rem;
    color: var(--muted);
    font-size: 0.68rem;
    text-align: right;
    white-space: nowrap;
}

.heatmap-cell {
    width: 16px;
    height: 16px;
    background: var(--track);
    border-radius: var(--r-mark);
}

.heatmap-l1 {
    background: var(--data-1);
}

.heatmap-l2 {
    background: var(--data-2);
}

.heatmap-l3 {
    background: var(--data-3);
}

.heatmap-l4 {
    background: var(--data);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 0.6rem;
    font-size: 0.7rem;
}

.heatmap-legend .heatmap-cell {
    width: 13px;
    height: 13px;
}

/* Cards in a grid: one entry each, a thumbnail over a body whose foot is
   pinned, so every card's last line sits at one height. */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
    gap: 1rem;
    margin-block: 0.85rem;
}

.card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    border: var(--edge);
    border-radius: var(--r-tile);
    transition:
        box-shadow 0.15s,
        transform 0.15s;
}

/* Only a card that goes somewhere lifts: the card itself is the link, or its
   cover is. A card of several links keeps still, since no one place opens. */
a.card:hover,
.card:has(> a.card-media):hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* 16:9, with the data hue behind it for the moment an image is missing. */
.card-media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--data);
}

.card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* A photo of any shape, a user's upload: the box is 4:3 on the page's slate,
   and the image fits inside it at no more than its own size, never cropped
   and never scaled up. The box is fixed, so the grid holds its shape while
   lazy images load. The 16:9 crop is for uniform art, a stream's frame. */
.card-media-fit {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    background: var(--slate);
    border-bottom: var(--edge);
}

/* A thumbnail that fails to load is drawn as its alt text, which takes the
   img's own type: set as .card-media-label, so an alt of "PNG" reads as the
   kind on a card with no preview. A loaded image draws no text. */
.card-media-fit img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-align: center;
}

/* A media box with no image, a PDF or a video with no frame: its kind
   centred, muted on slate, so the card reads as "no preview" rather than as
   a missing picture. The label covers the box, so it reads the same over the
   crop's data hue as in a fitted box. */
.card-media-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: var(--slate);
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-align: center;
}

/* A figure over the thumbnail's corner: a duration, a count. */
.card-overlay {
    position: absolute;
    right: 0.5rem;
    bottom: 0.5rem;
    padding: 0.1rem 0.45rem;
    background: var(--scrim);
    border-radius: var(--r-control);
    color: var(--surface);
    font-size: 0.72rem;
    font-weight: 600;
}

.card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.7rem 0.8rem 0.85rem;
}

/* The title takes the room left beside the avatar and ellipsises there; it
   never drives a wrap. Badges after it wrap under once the title is down to
   8rem, rather than crushing it to nothing. */
.card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.card-head > :not(.avatar, .badge) {
    flex: 1 1 0;
    min-width: min(8rem, 100%);
}

.avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: 50%;
}

.card-title {
    overflow: hidden;
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-title:hover {
    color: var(--blue);
}

.card-sub {
    font-size: 0.78rem;
}

/* Two lines, clamped and held open, so every card's rows line up. */
.card-text {
    display: -webkit-box;
    min-height: 2.6em;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.card-foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.4rem;
}

/* Code block: scrolls at 30rem rather than stretching the page. */
.code-block {
    max-height: 30rem;
    padding: 0.75rem;
    overflow: auto;
    background: var(--slate);
    border: var(--edge);
    border-radius: var(--r-control);
    font-size: 0.8rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* API docs: one section per topic, one block per endpoint under an edge, the
   method badge and the route on the endpoint's heading line, field tables
   with the name and the type kept whole. kantine's, gen's and wabbajackview's
   /docs pages, word for word. The table and fold rules the specificity check
   pairs them with never land on the same element (an API table is not the
   last-row case it styles, an example is not a card fold), so their order
   changes nothing. */
/* stylelint-disable no-descending-specificity */
.api-section {
    margin-top: 2rem;
    scroll-margin-top: 1rem;
}

.api-endpoint {
    padding-top: 1.5rem;
    border-top: var(--edge);
}

.api-endpoint h2 {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.api-route {
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.api-index td:first-child,
.api-fields td:nth-child(2) {
    white-space: nowrap;
}

.api-fields td:nth-child(2) {
    color: var(--muted);
    font-family: var(--mono);
}

.api-fields td:first-child {
    width: 14rem;
}

.api-example {
    margin-top: 1rem;
}

.api-example summary {
    margin-bottom: 0.5rem;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}
/* stylelint-enable no-descending-specificity */

@media (width <= 768px) {
    .nav-container {
        gap: 0.75rem;
        padding: 0.5rem 0.9rem;
    }

    .nav-logo a {
        font-size: 1.05rem;
    }

    .nav-links {
        gap: 0.9rem;
    }

    .nav-link {
        font-size: 0.8rem;
    }

    .container {
        padding: 0 0.7rem;
    }

    .profile-card {
        padding: 0.8rem 0.75rem;
    }

    .profile-info strong {
        display: block;
        width: auto;
    }

    /* A table whose cells carry data-mobile-label becomes a list of small
       cards: the first cell is the card's title, full width over a line, and
       each labelled cell is a label/value pair. A head with sortable columns
       stays as a row of sort chips; any other head is clipped from view but
       read aloud. A table without the attribute keeps its shape and scrolls
       sideways. Every rule steps down by child combinators, so a table
       nested in a cell, a fold's headers, keeps its own shape. */
    .data-table:has(td[data-mobile-label]) {
        display: block;
        background: transparent;
        box-shadow: none;
    }

    .data-table:has(td[data-mobile-label]) > thead {
        display: block;
    }

    .data-table:has(td[data-mobile-label]) > thead:not(:has(th[data-sort])) {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    .data-table:has(td[data-mobile-label]) > thead > tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.3rem;
        margin-bottom: 0.55rem;
    }

    .data-table:has(td[data-mobile-label]) > thead > tr::before {
        content: "Sort by";
        color: var(--muted);
        font-size: 0.7rem;
    }

    /* Roomier than the desktop head: these are the only tap targets that
       replace clicking a column heading. */
    .data-table:has(td[data-mobile-label]) > thead > tr > th {
        padding: 0.4rem 0.7rem;
        background: var(--surface);
        border: var(--edge);
        border-radius: var(--r-pill);
        font-size: 0.72rem;
    }

    .data-table:has(td[data-mobile-label]) > thead > tr > th:not([data-sort]) {
        display: none;
    }

    .data-table:has(td[data-mobile-label]) > thead > tr > th[aria-sort] {
        background: var(--slate);
        border-color: var(--muted);
        color: var(--ink);
    }

    .data-table:has(td[data-mobile-label]) > tbody,
    .data-table:has(td[data-mobile-label]) > tbody > tr,
    .data-table:has(td[data-mobile-label]) > tbody > tr > td {
        display: block;
    }

    .data-table:has(td[data-mobile-label]) > tbody > tr {
        margin-bottom: 0.5rem;
        padding: 0.55rem 0.7rem;
        background: var(--surface);
        border: var(--edge);
        border-radius: var(--r-card);
    }

    .data-table-zebra:has(td[data-mobile-label])
        > tbody
        > tr:nth-child(even of :where(:not([hidden]))) {
        background: var(--surface);
    }

    .data-table:has(td[data-mobile-label]) > tbody > tr:last-child {
        margin-bottom: 0;
    }

    .data-table:has(td[data-mobile-label]) > tbody > tr > td {
        padding: 0.12rem 0;
        border-bottom: none;
    }

    .data-table:has(td[data-mobile-label]) > tbody > tr > td:first-child {
        margin-bottom: 0.3rem;
        padding-bottom: 0.4rem;
        border-bottom: var(--edge);
        font-size: 0.9rem;
    }

    /* A detail row joins the card above it: the parent gives up its foot and
       its lower corners, the detail its head and upper corners, so the two
       read as one card. Its one cell is not a title. A card does not light
       under the pointer, so neither half does. */
    .data-table:has(td[data-mobile-label]) > tbody > tr:has(+ tr.row-detail) {
        margin-bottom: 0;
        background: var(--surface);
        border-bottom: none;
        border-radius: var(--r-card) var(--r-card) 0 0;
    }

    .data-table:has(td[data-mobile-label]) > tbody > tr.row-detail {
        padding-top: 0;
        background: var(--surface);
        border-top: none;
        border-radius: 0 0 var(--r-card) var(--r-card);
    }

    .data-table:has(td[data-mobile-label]) > tbody > tr.row-detail > td {
        margin: 0;
        padding: 0;
        border-bottom: none;
        font-size: inherit;
    }

    /* A reflowed cell is a flex row, which draws no ellipsis: a truncated
       value wraps instead. */
    .data-table td.truncate {
        max-width: none;
        white-space: normal;
    }

    /* The label's auto margin pushes everything after it to the right edge as
       one group: two badges, or a code and its note, sit together rather than
       spread across the line. A value that wraps, an error line, keeps to
       the right edge like the one-line values beside it. The label's own
       padding and the gap keep 0.75rem between label and value. The label
       sets its own face and size, so a cell's class, .text-muted or .mono,
       styles the value alone, and a card title's larger type leaves its label
       the size of the others. */
    .data-table:has(td[data-mobile-label]) > tbody > tr > td[data-mobile-label] {
        display: flex;
        align-items: baseline;
        gap: 0.35rem;
        text-align: right;
    }

    .data-table:has(td[data-mobile-label]) > tbody > tr > td[data-mobile-label]::before {
        content: attr(data-mobile-label);
        flex: 0 0 auto;
        margin-right: auto;
        padding-right: 0.4rem;
        color: var(--muted);
        font-family: var(--sans);
        font-size: 0.8rem;
        font-style: normal;
        font-variant-numeric: normal;
        font-weight: 500;
    }

    /* An open fold is read as a block, not a value: it takes its own line
       under the label and any text beside it, the cell's full width, and its
       body and a wrapped summary run from the left. Closed, its summary keeps
       to the right. A long word beside a fold, a session id, breaks rather
       than push the cell wider; the fold's own summary does not. */
    .data-table:has(td[data-mobile-label]) > tbody > tr > td[data-mobile-label] > .fold[open] {
        flex-basis: 100%;
        text-align: left;
    }

    .data-table:has(td[data-mobile-label]) > tbody > tr > td[data-mobile-label]:has(> .fold) {
        overflow-wrap: anywhere;
    }

    .data-table:has(td[data-mobile-label]) > tbody > tr > td[data-mobile-label] > .fold {
        overflow-wrap: normal;
    }

    .data-table:has(td[data-mobile-label]) > tbody > tr > td[data-mobile-label]:has(> .fold[open]) {
        flex-wrap: wrap;
    }

    /* A cell with nothing in it and no label, an actions cell with no
       action, takes no line in the card. */
    .data-table:has(td[data-mobile-label]) > tbody > tr > td:empty:not([data-mobile-label]) {
        display: none;
    }

    .data-table:has(td[data-mobile-label]) > tbody > tr > td.row-actions {
        margin-top: 0.55rem;
        text-align: left;
    }

    .data-table:has(td[data-mobile-label]) .row-menu-items {
        margin-left: 0;
    }

    /* A lead table's 1% columns are for a desktop row. As cards they would
       squash the sort chips and pin each figure against its label. */
    .data-table-lead:has(td[data-mobile-label]) :is(th, td) {
        width: auto;
        white-space: normal;
    }

    /* A rank before the lead: the lead cell is the card's title, over the
       line, and the first cell steps down to a label/value pair. */
    .data-table-lead:has(td.lead):has(td[data-mobile-label]) > tbody > tr {
        display: flex;
        flex-direction: column;
    }

    .data-table-lead:has(td.lead):has(td[data-mobile-label]) > tbody > tr > td.lead {
        order: -1;
        margin-bottom: 0.3rem;
        padding-bottom: 0.4rem;
        border-bottom: var(--edge);
        font-size: 0.9rem;
    }

    .data-table-lead:has(td.lead):has(td[data-mobile-label]) > tbody > tr > td:first-child {
        margin-bottom: 0;
        padding-bottom: 0.12rem;
        border-bottom: none;
        font-size: inherit;
    }
}

/* The heatmap's fixed columns need about 490px. Below 560px they go fluid
   and the cells stay square, so all 24 hours stay on screen: iOS draws no
   resting scrollbar, and a clipped grid reads as broken. minmax(0, 16px),
   not 1fr, so a column never grows past the desktop cell. */
@media (width <= 560px) {
    .heatmap {
        grid-template-columns: auto repeat(24, minmax(0, 16px));
        gap: 2px;
        width: 100%;
    }

    .heatmap .heatmap-cell {
        width: auto;
        height: auto;
        aspect-ratio: 1;
    }

    .heatmap-hour {
        font-size: 0.55rem;
    }

    .heatmap-day {
        padding-right: 0.3rem;
        font-size: 0.62rem;
    }
}
