@charset "UTF-8";

/*
 * The dashboard of Malipo, in the manner of the administrators' console of
 * FoxShard Identity, whose values these are (its
 * static/css/admin.css): a pale bar and drawer around a canvas of white
 * cards, the current item of the drawer a band with a bar along its start, a
 * page opening with its icon in a round, a table's head a grey band, codes
 * on grey chips. Inter and JetBrains Mono are served from /assets/fonts
 * and the icons are drawn by script: nothing is loaded from another site.
 *
 * What FoxShard Identity's console does not have, and this one does:
 * a dark theme (the same roles in the brand's light red, over its ink),
 * sizes in rem so that the page follows the reader's text size, and a table
 * that turns into a list of cards on a phone rather than scrolling sideways.
 *
 * The checkout page and the simulator's card page are a customer's, not the
 * console's, and keep malipo.css with the shop's colour.
 *
 * Order: fonts, tokens (light, then dark), the base, the bar, the drawer and
 * the canvas, a page's head, then one block per component, then the pages'
 * own parts, the utilities and the narrow screens last. Nothing is inline in
 * a page: the Content Security Policy allows no inline style or script.
 */

/* ------------------------------------------------------------------ */
/* Fonts: Inter and JetBrains Mono, self-hosted                         */
/* ------------------------------------------------------------------ */

/* Inter, under the SIL Open Font License 1.1 (fonts/Inter/LICENSE-Inter-OFL.txt). One file holds every weight. */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/Inter/InterVariable.woff2") format("woff2");
}

/* JetBrains Mono for codes, under the SIL Open Font License 1.1 (fonts/JetBrainsMono/LICENSE-JetBrainsMono-OFL.txt).
   One file holds every weight. */
@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url("../fonts/JetBrainsMono/JetBrainsMono-Variable.woff2") format("woff2");
}

/* ------------------------------------------------------------------ */
/* Tokens                                                              */
/* ------------------------------------------------------------------ */

:root {
    color-scheme: light;

    --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
    --mono: "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --primary: #d42b21;
    --primary-hover: #b8221a;
    --primary-press: #9a1b14;
    --primary-tint: rgb(212 43 33 / 0.08);
    --on-primary: #ffffff;
    --avatar: #b8221a;
    --on-avatar: #ffffff;
    --chrome: #ffffff;
    --canvas: #f4f5f7;
    --canvas-edge: #eceef1;
    --surface: #ffffff;
    --search: #eceef1;
    --text: #0d1117;
    --text-nav: #0d1117;
    --text-muted: #4a5361;
    /* the console's own #7b8496 is 3.7:1 on white, and this is the colour of its smallest text */
    --text-subtle: #5f6978;
    --text-placeholder: #6b7585;
    --text-label: #161b22;
    --text-soft: #4a5361;
    --icon: #4a5361;
    --selected: #ffe4df;
    --on-selected: #8f1a13;
    --selected-bar: #b8221a;
    --fab: #ffe4df;
    --tint: #fff1ee;
    --tint-soft: #fff6f4;
    --info: #f4f5f7;
    --info-edge: #d5d9df;
    --line: #e6e8ec;
    --line-field: #d5d9df;
    --line-strong: #c4cad2;
    /* the edge of a field: the console's own line-strong is 1.4:1 on white, and a control's boundary has to be 3:1 */
    --line-control: #868d9c;
    --divider: #e6e8ec;
    --table-head: #f4f5f7;
    --table-head-line: #e6e8ec;
    --row-hover: #fafafb;
    --chip: #eceef1;
    --chip-text: #4a5361;
    --dot: #e5352b;
    --error: #b3261e;
    --on-error: #ffffff;
    --error-container: #f9dedc;
    --error-edge: #f2c4c0;
    --on-error-container: #410e0b;
    --good-container: #c4eed0;
    --on-good-container: #072711;
    --warn-container: #ffdf99;
    --warn-edge: #f0cf7e;
    --on-warn-container: #421f00;
    --live: #188038;
    --on-live: #ffffff;
    --inverse-surface: #161b22;
    --inverse-on-surface: #f4f5f7;
    --scrim: rgb(13 17 23 / 0.36);
    --state-hover: rgb(13 17 23 / 0.05);
    --state-press: rgb(13 17 23 / 0.09);

    /* what a count's icon stands in: its round and its stroke */
    --tint-blue: #e9ecf0;
    --on-tint-blue: #3a4558;
    --tint-violet: #ffe4df;
    --on-tint-violet: #8f1a13;
    --tint-green: #e3f3e7;
    --on-tint-green: #1c6b2a;
    --tint-amber: #fdf1dc;
    --on-tint-amber: #8a4b00;
    --tint-red: #fce8e6;
    --on-tint-red: #b3261e;

    /* Google's elevation: Material 3's levels 1 to 3, in the warm grey of Google's own sites */
    --elevation-1: 0 1px 2px 0 rgb(60 64 67 / 0.3), 0 1px 3px 1px rgb(60 64 67 / 0.15);
    --elevation-2: 0 1px 2px 0 rgb(60 64 67 / 0.3), 0 2px 6px 2px rgb(60 64 67 / 0.15);
    --elevation-3: 0 1px 3px 0 rgb(60 64 67 / 0.3), 0 4px 8px 3px rgb(60 64 67 / 0.15);
    /* a card's shadow: level 1 at a quarter of its strength; a card that is a link, under the pointer, level 2 at a quarter */
    --elevation-card: 0 1px 2px 0 rgb(60 64 67 / 0.075), 0 1px 3px 1px rgb(60 64 67 / 0.0375);
    --elevation-card-hover: 0 1px 2px 0 rgb(60 64 67 / 0.075), 0 2px 6px 2px rgb(60 64 67 / 0.0375);
    /* the corner of a card and of every box like one (a banner, a menu, a dialog): all but square */
    --corner-card: 0.125rem;
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23374151' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    /* what is outside a field, which its label stands on: the canvas, or a card */
    --field-outside: var(--canvas);

    --gutter: 1rem;
    --bar-h: 4.0625rem;
    --nav-w: 16.9375rem;
    --rail-w: 4.5rem;
    --content-max: 80rem;
}

@media (min-width: 48rem) {
    :root {
        --gutter: 1.5rem;
    }
}

/* The dark theme: the console's roles in the brand's light red, over its ink and slightly reduced white. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --primary: #ff7a66;
        --primary-hover: #ff9585;
        --primary-press: #ffb0a3;
        --primary-tint: rgb(255 122 102 / 0.12);
        --on-primary: #0d1117;
        --avatar: #b8221a;
        --chrome: #10151c;
        --canvas: #0d1117;
        --canvas-edge: #1d232b;
        --surface: #161b22;
        --search: #1d232b;
        --text: #f4f5f7;
        --text-nav: #e1e5ea;
        --text-muted: #9ba4b0;
        --text-subtle: #8e98a5;
        --text-placeholder: #7d8794;
        --text-label: #d0d5db;
        --text-soft: #adb5c0;
        --icon: #adb5c0;
        --selected: #3a1f1d;
        --on-selected: #ffd9d2;
        --selected-bar: #ff7a66;
        --fab: #4a2420;
        --tint: #2a1a19;
        --tint-soft: #241817;
        --info: #161b22;
        --info-edge: #30363d;
        --line: #262c34;
        --line-field: #30363d;
        --line-strong: #444c56;
        --line-control: #6b7280;
        --divider: #262c34;
        --table-head: #1a2028;
        --table-head-line: #2b323b;
        --row-hover: #1a2028;
        --chip: #232932;
        --chip-text: #c6ccd7;
        --dot: #ff7a66;
        --error: #f2b8b5;
        --on-error: #601410;
        --error-container: #5e1f1b;
        --error-edge: #7d2f2a;
        --on-error-container: #fbdad7;
        --good-container: #174a2c;
        --on-good-container: #c9f0d6;
        --warn-container: #5c3d05;
        --warn-edge: #7a5412;
        --on-warn-container: #ffe2a8;
        --live: #6dd58c;
        --on-live: #06210f;
        --inverse-surface: #e6e9f0;
        --inverse-on-surface: #1d2430;
        --scrim: rgb(0 0 0 / 0.6);
        --state-hover: rgb(244 245 247 / 0.08);
        --state-press: rgb(244 245 247 / 0.14);
        --tint-blue: #232a33;
        --on-tint-blue: #b6c0cc;
        --tint-violet: #3a1f1d;
        --on-tint-violet: #ff9d8d;
        --tint-green: #183626;
        --on-tint-green: #7fd69a;
        --tint-amber: #3b2e12;
        --on-tint-amber: #f3c26b;
        --tint-red: #3d2220;
        --on-tint-red: #f2b8b5;
        --elevation-1: 0 1px 2px 0 rgb(0 0 0 / 0.5), 0 1px 3px 1px rgb(0 0 0 / 0.3);
        --elevation-2: 0 1px 2px 0 rgb(0 0 0 / 0.5), 0 2px 6px 2px rgb(0 0 0 / 0.3);
        --elevation-3: 0 1px 3px 0 rgb(0 0 0 / 0.5), 0 4px 8px 3px rgb(0 0 0 / 0.3);
        --elevation-card: 0 1px 2px 0 rgb(0 0 0 / 0.4), 0 1px 3px 1px rgb(0 0 0 / 0.2);
        --elevation-card-hover: 0 1px 2px 0 rgb(0 0 0 / 0.4), 0 2px 6px 2px rgb(0 0 0 / 0.25);
        --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23c4c9d4' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --primary: #ff7a66;
    --primary-hover: #ff9585;
    --primary-press: #ffb0a3;
    --primary-tint: rgb(255 122 102 / 0.12);
    --on-primary: #0d1117;
    --avatar: #b8221a;
    --chrome: #10151c;
    --canvas: #0d1117;
    --canvas-edge: #1d232b;
    --surface: #161b22;
    --search: #1d232b;
    --text: #f4f5f7;
    --text-nav: #e1e5ea;
    --text-muted: #9ba4b0;
    --text-subtle: #8e98a5;
    --text-placeholder: #7d8794;
    --text-label: #d0d5db;
    --text-soft: #adb5c0;
    --icon: #adb5c0;
    --selected: #3a1f1d;
    --on-selected: #ffd9d2;
    --selected-bar: #ff7a66;
    --fab: #4a2420;
    --tint: #2a1a19;
    --tint-soft: #241817;
    --info: #161b22;
    --info-edge: #30363d;
    --line: #262c34;
    --line-field: #30363d;
    --line-strong: #444c56;
    --line-control: #6b7280;
    --divider: #262c34;
    --table-head: #1a2028;
    --table-head-line: #2b323b;
    --row-hover: #1a2028;
    --chip: #232932;
    --chip-text: #c6ccd7;
    --dot: #ff7a66;
    --error: #f2b8b5;
    --on-error: #601410;
    --error-container: #5e1f1b;
    --error-edge: #7d2f2a;
    --on-error-container: #fbdad7;
    --good-container: #174a2c;
    --on-good-container: #c9f0d6;
    --warn-container: #5c3d05;
    --warn-edge: #7a5412;
    --on-warn-container: #ffe2a8;
    --live: #6dd58c;
    --on-live: #06210f;
    --inverse-surface: #e6e9f0;
    --inverse-on-surface: #1d2430;
    --scrim: rgb(0 0 0 / 0.6);
    --state-hover: rgb(244 245 247 / 0.08);
    --state-press: rgb(244 245 247 / 0.14);
    --tint-blue: #232a33;
    --on-tint-blue: #b6c0cc;
    --tint-violet: #3a1f1d;
    --on-tint-violet: #ff9d8d;
    --tint-green: #183626;
    --on-tint-green: #7fd69a;
    --tint-amber: #3b2e12;
    --on-tint-amber: #f3c26b;
    --tint-red: #3d2220;
    --on-tint-red: #f2b8b5;
    --elevation-1: 0 1px 2px 0 rgb(0 0 0 / 0.5), 0 1px 3px 1px rgb(0 0 0 / 0.3);
    --elevation-2: 0 1px 2px 0 rgb(0 0 0 / 0.5), 0 2px 6px 2px rgb(0 0 0 / 0.3);
    --elevation-3: 0 1px 3px 0 rgb(0 0 0 / 0.5), 0 4px 8px 3px rgb(0 0 0 / 0.3);
    --elevation-card: 0 1px 2px 0 rgb(0 0 0 / 0.4), 0 1px 3px 1px rgb(0 0 0 / 0.2);
    --elevation-card-hover: 0 1px 2px 0 rgb(0 0 0 / 0.4), 0 2px 6px 2px rgb(0 0 0 / 0.25);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23c4c9d4' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

/* A touch screen has no pointer to hover with: what only a hover shows is not shown, and the press still is. */
@media (hover: none) {
    :root {
        --state-hover: transparent;
        --row-hover: transparent;
        --primary-tint: transparent;
        --primary-hover: var(--primary);
    }
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--bar-h) + 1rem);
}

body {
    margin: 0;
    min-height: 100dvh;
    background: var(--chrome);
    color: var(--text);
    font: 400 0.875rem/1.4286 var(--sans);
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
}

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
    text-wrap: balance;
}

h3 {
    font-size: 1rem;
}

h4 {
    font-size: 0.875rem;
}

p, ul, ol, dl, dd, figure {
    margin: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* A link in the middle of what a page says is underlined: a blue that is 2.9:1 against the text round it (1.5:1
   in the dark theme) is not a way to tell it from the text (WCAG 1.4.1). What is a control or a way about the page
   (a button, a card that is a link, the crumbs, the first name of a row, the drawer) is known by its shape and its
   place, and the console's plain look is kept for it. */
.content :where(a:not(.btn, .app-card, .segmented__item, .icon-btn, .nav__link, .nav__fab)) {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

.content .crumbs a,
.content .table td:first-child a {
    text-decoration: none;
}

.content .crumbs a:hover,
.content .table td:first-child a:hover {
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* A page's title and its main part take the focus from script, after a move to another page or the skip link,
   so that the keyboard and screen readers start there; they are not controls, and show no ring */
h1[tabindex="-1"]:focus,
main[tabindex="-1"]:focus {
    outline: none;
}

img, svg {
    display: block;
    max-width: 100%;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

strong {
    font-weight: 600;
}

code, kbd, samp, pre {
    font-family: var(--mono);
    font-size: 0.75rem;
}

code {
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    background: var(--chip);
    color: var(--chip-text);
    overflow-wrap: anywhere;
}

pre {
    max-height: 24rem;
    margin: 0;
    padding: 0.75rem 1rem;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--corner-card);
    background: var(--canvas);
    color: var(--text-nav);
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

::selection {
    background: var(--selected);
    color: var(--on-selected);
}

[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 100;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    background: var(--primary);
    color: var(--on-primary);
    font-weight: 500;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
    color: var(--on-primary);
}

/* ------------------------------------------------------------------ */
/* Icons                                                               */
/* ------------------------------------------------------------------ */

.icon {
    width: 1.5rem;
    height: 1.5rem;
    flex: none;
    fill: currentColor;
}

.icon--sm {
    width: 1.125rem;
    height: 1.125rem;
}

/* An icon inside a line of text, such as "opens in a new tab" after a link */
.icon--inline {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-left: 0.25em;
    vertical-align: -0.125em;
}

/* A spinner, in a button or alone */
.spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    flex: none;
    border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ------------------------------------------------------------------ */
/* The bar across the top                                              */
/* ------------------------------------------------------------------ */

.top-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--bar-h);
    padding: 0 0.9375rem 0.125rem 0.5rem;
    background: var(--chrome);
}

/* the start of the search field lines up with the start of the canvas below while the drawer is whole; it stays
   where it is when the drawer is drawn in to a rail, so that the name does not jump */
.top-bar__start {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: none;
    min-width: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
    border-radius: 0.5rem;
    color: var(--text);
    white-space: nowrap;
}

.brand:hover {
    color: var(--text);
    text-decoration: none;
}

.brand__mark {
    flex: none;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
}

.brand__name {
    overflow: hidden;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.75rem;
    letter-spacing: -0.0125rem;
    text-overflow: ellipsis;
}

.brand__by {
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 400;
}

.search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    max-width: 42.8125rem;
    height: 2.5rem;
    padding: 0 1rem 0 0.625rem;
    border-radius: 1.25rem;
    background: var(--search);
    color: var(--icon);
    transition: background-color 0.15s, box-shadow 0.15s;
}

.search:focus-within {
    background: var(--surface);
    box-shadow: var(--elevation-1);
}

.search input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.5rem;
    text-overflow: ellipsis;
}

.search input::placeholder {
    color: var(--text-soft);
    opacity: 1;
}

.search input::-webkit-search-cancel-button {
    display: none;
}

/* the ring of a field that has none of its own is the bar's whole box */
.search:has(input:focus-visible) {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.top-bar__actions {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-left: auto;
    padding-left: 1rem;
}

/* A round button of an icon alone: its hit area is wider than the icon, as it should be for a thumb */
.icon-btn {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--icon);
    transition: background-color 0.15s;
}

@media (pointer: coarse) {
    .icon-btn {
        width: 2.75rem;
        height: 2.75rem;
    }
}

.icon-btn:hover {
    background: var(--state-hover);
    color: var(--icon);
    text-decoration: none;
}

.icon-btn:active {
    background: var(--state-press);
}

.avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--avatar);
    color: var(--on-avatar);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1;
    text-transform: uppercase;
    user-select: none;
}

.avatar--large {
    width: 4.5rem;
    height: 4.5rem;
    font-size: 2rem;
    font-weight: 400;
}

/* ------------------------------------------------------------------ */
/* Menus: the account in the bar                                       */
/* ------------------------------------------------------------------ */

.menu {
    position: relative;
}

.menu > summary {
    list-style: none;
    cursor: pointer;
}

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

.account > summary {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
}

.account > summary:hover,
.account[open] > summary {
    background: var(--state-hover);
}

.menu__panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 40;
    width: 21.5rem;
    max-width: calc(100vw - 1.5rem);
    padding: 0.5rem 0;
    border-radius: var(--corner-card);
    background: var(--surface);
    box-shadow: var(--elevation-2);
    text-align: left;
}

.account__panel {
    display: grid;
    justify-items: center;
    gap: 0.25rem;
    width: 20rem;
    padding: 1.25rem 1rem 1rem;
    text-align: center;
}

.account__panel .avatar {
    margin: 0.25rem auto 0.625rem;
}

.account__name {
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.75rem;
    overflow-wrap: anywhere;
}

.account__id {
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.account__panel .cluster {
    justify-content: center;
    margin-top: 0.25rem;
}

.account__panel .btn {
    margin-top: 0.75rem;
}

/* ------------------------------------------------------------------ */
/* The drawer and the canvas                                           */
/* ------------------------------------------------------------------ */

.shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    min-height: calc(100dvh - var(--bar-h));
}

@media (min-width: 64rem) {
    .shell {
        grid-template-columns: var(--nav-w) minmax(0, 1fr);
    }

    .top-bar__start {
        width: calc(var(--nav-w) + 1.375rem);
    }

    /* the drawer drawn in to a rail of icons. Only the shell takes the narrower value: the bar is outside it, so
       its start keeps its width and the name does not jump */
    .is-rail .shell {
        --nav-w: var(--rail-w);
    }
}

.rail {
    display: none;
}

@media (min-width: 64rem) {
    .rail {
        position: sticky;
        top: var(--bar-h);
        display: block;
        max-height: calc(100dvh - var(--bar-h));
        padding: 0.5625rem 0.6875rem 1.5rem 0.75rem;
        overflow-y: auto;
    }
}

.nav {
    display: grid;
    gap: 0;
    align-content: start;
}

/* the button that signs an app up: outlined in the colour it is filled with on hover */
.nav__fab {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 0.9375rem;
    min-height: 3.1875rem;
    margin: 0 0 0.6875rem 0.25rem;
    padding: 0 1.9375rem 0 0.8125rem;
    border: 2px solid var(--fab);
    border-radius: 0.875rem;
    background: transparent;
    color: var(--on-selected);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s;
}

.nav__fab:hover:not(:disabled) {
    background: var(--fab);
    color: var(--on-selected);
    text-decoration: none;
}

.nav__fab:disabled {
    opacity: 0.55;
}

.nav__group {
    display: grid;
    gap: 0;
    padding-bottom: 0.5rem;
}

/* a section of the drawer runs across the whole of it, edge to edge; the one open has a bar along its start */
.nav__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1.0625rem;
    min-height: 3rem;
    margin: 0 -0.6875rem 0.25rem -0.75rem;
    padding: 0 1.9375rem 0 1.8125rem;
    border-radius: 0;
    color: var(--text-nav);
    font-size: 0.9375rem;
    white-space: nowrap;
}

.nav__link .icon {
    color: var(--icon);
}

.nav__link:hover {
    background: var(--state-hover);
    color: var(--text-nav);
    text-decoration: none;
}

.nav__link[aria-current="page"] {
    background: var(--selected);
    color: var(--on-selected);
    font-weight: 600;
}

.nav__link[aria-current="page"] .icon {
    color: var(--on-selected);
}

.nav__link[aria-current="page"]::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 0.1875rem;
    background: var(--selected-bar);
    content: "";
}

.nav__heading {
    margin: 0 -0.6875rem 0 -0.75rem;
    padding: 1rem 1.8125rem 0.375rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* which app: an outlined menu in the drawer, as tall as the button above it */
.nav__app {
    margin: 0 0.5rem 0.75rem 0.25rem;
}

.nav__app .field__control {
    min-height: 3rem;
    padding: 0.5rem 2.75rem 0.5rem 1rem;
    font-size: 0.9375rem;
}

/* the same on the rail: icons alone, their names still there for a screen reader and for a pointer's tooltip */
@media (min-width: 64rem) {
    .is-rail .rail {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .is-rail .rail .nav__fab {
        justify-content: center;
        width: 3.1875rem;
        margin-left: 0;
        padding: 0;
    }

    .is-rail .rail .nav__link {
        justify-content: center;
        margin: 0 -0.5rem 0.25rem;
        padding: 0 0.5rem;
    }

    .is-rail .rail .nav__fab span,
    .is-rail .rail .nav__link span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .is-rail .rail .nav__heading,
    .is-rail .rail .nav__app {
        display: none;
    }

    .is-rail .rail .nav__group + .nav__group {
        margin-top: 0.5rem;
        border-top: 1px solid var(--divider);
        padding-top: 0.5rem;
    }
}

/* below the width of a rail the drawer is a dialog the bar's button opens, whole or away */
dialog.drawer {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(17.5rem, calc(100vw - 3rem));
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 1rem 0.6875rem 1.5rem 0.75rem;
    border: 0;
    border-radius: 0;
    background: var(--chrome);
    color: var(--text);
    box-shadow: var(--elevation-1);
    overflow-y: auto;
}

dialog.drawer::backdrop {
    background: var(--scrim);
}

.drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* the canvas the cards stand on: a page, with its head and what it holds, one under the other */
.content {
    display: grid;
    grid-template-columns: minmax(0, var(--content-max));
    justify-content: center;
    align-content: start;
    gap: 1.25rem;
    min-width: 0;
    min-height: calc(100dvh - var(--bar-h));
    padding: 1.25rem var(--gutter) 2.5rem;
    border-top: 1px solid var(--canvas-edge);
    background: var(--canvas);
    --field-outside: var(--canvas);
}

@media (min-width: 64rem) {
    .content {
        padding: 1.4375rem 1.5rem 2.5rem 1.75rem;
        border-left: 1px solid var(--canvas-edge);
    }
}

/* ------------------------------------------------------------------ */
/* The head of a page                                                  */
/* ------------------------------------------------------------------ */

.page-head {
    display: grid;
    gap: 0.75rem;
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin: -0.25rem 0 0 -0.5rem;
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.25rem;
}

.crumbs a {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    color: var(--text-soft);
}

.crumbs a:hover {
    background: var(--state-hover);
    text-decoration: none;
}

.crumbs .icon {
    width: 1.125rem;
    height: 1.125rem;
    color: var(--text-subtle);
}

.page-head__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 1.5rem;
}

/* a page's icon in its round, and its name and purpose beside it */
.page-head__main {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    flex: 1 1 24rem;
    min-width: 0;
}

.page-head__icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: var(--tint);
    color: var(--primary);
}

.page-head__icon .icon {
    width: 2rem;
    height: 2rem;
}

.page-head__text {
    display: grid;
    gap: 0.5rem;
    min-width: 0;
}

.page-head h1 {
    margin-top: 0.125rem;
    color: var(--text);
    font-size: 2.125rem;
    font-weight: 700;
    line-height: 2.5rem;
    letter-spacing: -0.03125rem;
    overflow-wrap: anywhere;
}

/* a name alone beside its icon stands in the middle of it */
.page-head__text:has(> h1:only-child) {
    align-self: center;
}

.page-head__text:has(> h1:only-child) h1 {
    margin-top: 0;
}

.page-head__lead {
    max-width: 38rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.25rem;
}

.page-head__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.125rem;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.5625rem;
    padding: 0 1.5rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--primary);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.25rem;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s, box-shadow 0.15s;
}

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

.btn .icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-left: -0.25rem;
}

.btn:disabled,
.btn[aria-disabled="true"],
.btn[aria-busy="true"] {
    opacity: 0.55;
}

.btn[aria-busy="true"] {
    cursor: progress;
}

.btn--filled {
    background: var(--primary);
    color: var(--on-primary);
}

.btn--filled:hover:not(:disabled) {
    background: var(--primary-hover);
    color: var(--on-primary);
    box-shadow: var(--elevation-1);
}

.btn--filled:active:not(:disabled) {
    background: var(--primary-press);
}

.btn--tonal {
    background: var(--fab);
    color: var(--on-selected);
}

.btn--tonal:hover:not(:disabled) {
    color: var(--on-selected);
    box-shadow: var(--elevation-1);
}

.btn--outlined {
    border-color: var(--line-strong);
    background: var(--surface);
    color: var(--primary);
}

.btn--outlined:hover:not(:disabled),
.btn--text:hover:not(:disabled) {
    background: var(--primary-tint);
}

.btn--text {
    padding-inline: 0.75rem;
}

.btn--text .icon {
    margin-left: 0;
}

.btn--danger {
    background: var(--error);
    color: var(--on-error);
}

.btn--danger:hover:not(:disabled) {
    color: var(--on-error);
    box-shadow: var(--elevation-1);
    filter: brightness(0.92);
}

.btn--danger-outlined {
    border-color: var(--error-edge);
    background: var(--surface);
    color: var(--error);
}

.btn--danger-outlined:hover:not(:disabled) {
    background: color-mix(in srgb, var(--error) 8%, transparent);
}

.btn--sm {
    min-height: 2rem;
    padding: 0 0.625rem;
    font-size: 0.875rem;
}

.btn--sm .icon {
    width: 1.125rem;
    height: 1.125rem;
}

.btn--lg {
    min-height: 3rem;
    padding: 0 1.75rem;
    font-size: 1rem;
}

.btn--block {
    width: 100%;
    /* a button as wide as its column wraps its words on a narrow screen, rather than stick out of it */
    white-space: normal;
    text-align: center;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* ------------------------------------------------------------------ */
/* Chips                                                               */
/* ------------------------------------------------------------------ */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 1.75rem;
    padding: 0.125rem 0.6875rem;
    border: 1px solid var(--line-field);
    border-radius: 0.5rem;
    color: var(--text-nav);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1rem;
    white-space: nowrap;
}

.chip .icon {
    width: 0.875rem;
    height: 0.875rem;
    margin-left: -0.1875rem;
    color: inherit;
}

.chip--success,
.chip--pending,
.chip--warning,
.chip--danger,
.chip--neutral,
.chip--live,
.chip--test {
    border-color: transparent;
}

.chip--success {
    background: var(--good-container);
    color: var(--on-good-container);
}

.chip--pending {
    background: var(--tint);
    color: var(--on-selected);
}

.chip--warning,
.chip--test {
    background: var(--warn-container);
    color: var(--on-warn-container);
}

.chip--danger {
    background: var(--error-container);
    color: var(--on-error-container);
}

.chip--neutral {
    background: var(--chip);
    color: var(--text-label);
}

.chip--live {
    background: var(--live);
    color: var(--on-live);
}

.chip-set {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

/* the chips of a set hold names of any length: a long one wraps in its own box, not out of the card */
.chip-set .chip {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ */
/* Cards, counts, steps                                                */
/* ------------------------------------------------------------------ */

/* a card: white on the canvas with a faint shadow, a quarter of Google's level 1, and no edge; the transparent
   border keeps what is inside where it was when a card takes one. What floats over the page, a menu, a dialog
   or a tip, has the full shadow of its level */
.card {
    --field-outside: var(--surface);
    display: grid;
    gap: 1rem;
    align-content: start;
    min-width: 0;
    padding: 1.1875rem 1.25rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--corner-card);
    background: var(--surface);
    box-shadow: var(--elevation-card);
}

.card--tonal {
    border-color: var(--info-edge);
    background: var(--info);
    box-shadow: none;
}

.card--danger {
    border-color: var(--error-edge);
}

.card .card {
    border-color: var(--line);
    box-shadow: none;
}

.card .card--danger {
    border-color: var(--error-edge);
}

.card .card--tonal {
    border-color: var(--info-edge);
}

.card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.card__title,
.card__head > h2,
.card > h2 {
    color: var(--text);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.5rem;
}

.card__text {
    color: var(--text-muted);
}

.card h3 {
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 600;
}

.grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 40rem) {
    .grid--3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 64rem) {
    .grid--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.stack {
    display: grid;
    gap: 1rem;
    align-content: start;
    min-width: 0;
}

.stack--lg {
    gap: 1.5rem;
}

.stack--sm {
    gap: 0.5rem;
}

.cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

/* a count, with its icon in a round of its own colour. Three or fewer are wide tiles with the icon beside the words;
   one or two keep to the width of a tile; four or more stand the icon over the words, so that five fit a row of a
   laptop's width instead of four and one */
.stats {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.stats:not(:has(> .stat:nth-child(3))) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 22rem));
}

.stats:has(> .stat:nth-child(4)) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 11.5rem), 1fr));
}

.stats:has(> .stat:nth-child(4)) .stat {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    padding: 1.25rem;
    border-radius: var(--corner-card);
    background: var(--surface);
    box-shadow: var(--elevation-card);
    color: var(--text);
    /* the value's size follows the tile's width, so that an amount fits its tile whole */
    container-type: inline-size;
}

.stat__icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
}

.stat__icon .icon {
    width: 1.5rem;
    height: 1.5rem;
}

.stat__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat__label {
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.375rem;
}

.stat__value {
    margin-top: 0.125rem;
    font-size: clamp(1.125rem, 7cqi, 1.75rem);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.03125rem;
    font-variant-numeric: tabular-nums;
    /* KES 1,500.00 breaks at its space if it must, never inside the number */
    overflow-wrap: break-word;
}

.stat__hint {
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.125rem;
}

.tint--blue {
    background: var(--tint-blue);
    color: var(--on-tint-blue);
}

.tint--violet {
    background: var(--tint-violet);
    color: var(--on-tint-violet);
}

.tint--green {
    background: var(--tint-green);
    color: var(--on-tint-green);
}

.tint--amber {
    background: var(--tint-amber);
    color: var(--on-tint-amber);
}

.tint--red {
    background: var(--tint-red);
    color: var(--on-tint-red);
}

/* the steps from a new app to a live one, a line joining each number to the next */
.steps {
    display: grid;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.steps li {
    position: relative;
    min-height: 2.875rem;
    padding: 0.125rem 0 1.375rem 3.75rem;
    counter-increment: step;
}

.steps li:last-child {
    padding-bottom: 0;
}

.steps li::before {
    position: absolute;
    top: 0;
    left: 0;
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--tint);
    color: var(--primary);
    font-size: 1rem;
    font-weight: 600;
    content: counter(step);
}

.steps li:not(:last-child)::after {
    position: absolute;
    top: 2.75rem;
    bottom: 0.25rem;
    left: 1.1875rem;
    width: 2px;
    border-radius: 1px;
    background: var(--line);
    content: "";
}

.steps li.is-done::before {
    background: var(--good-container);
    color: var(--on-good-container);
    content: "\2713";
}

.steps__text {
    display: grid;
    gap: 0.25rem;
}

.steps__text strong {
    color: var(--text);
    font-size: 1rem;
    line-height: 1.375rem;
}

.steps__hint {
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.3125rem;
}

/* ------------------------------------------------------------------ */
/* Tables: a table on wide screens, a list of cards on narrow ones     */
/* ------------------------------------------------------------------ */

/* a table on its own stands on a card of its own; one in a card (a section) takes the card's */
.table-wrap {
    position: relative;
    min-width: 0;
    padding: 0.75rem 1.25rem;
    border-radius: var(--corner-card);
    background: var(--surface);
    box-shadow: var(--elevation-card);
}

.card .table-wrap {
    padding: 0;
    background: none;
    box-shadow: none;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--divider);
    text-align: left;
    vertical-align: middle;
}

.table th {
    height: 2.4375rem;
    padding-block: 0;
    border-bottom-color: var(--table-head-line);
    background: var(--table-head);
    color: var(--text-label);
    font-weight: 600;
    white-space: nowrap;
}

.table th:first-child {
    border-top-left-radius: var(--corner-card);
}

.table th:last-child {
    border-top-right-radius: var(--corner-card);
}

.table td {
    /* a row of one line is as tall as the console's: 38px; a cell is never shorter than its height, and grows with what it holds */
    height: 2.375rem;
    color: var(--text-nav);
}

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

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

.table tbody tr.is-link {
    cursor: pointer;
}

.table td:first-child a {
    color: var(--text);
    font-weight: 500;
}

.table td.num,
.table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* a second, quieter line under a value: in tables, definition lists and cards */
.sub {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1rem;
}

a.sub {
    color: var(--primary);
}

.table td.table__empty {
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    text-align: center;
}

.more {
    display: flex;
    justify-content: center;
    padding: 0.375rem 1rem;
    border-top: 1px solid var(--divider);
}

@media (min-width: 48rem) {
    .table-scroll {
        overflow-x: auto;
    }
}

/* Below md the rows are cards: the cell's heading is written before it */
@media (max-width: 47.99rem) {
    .table-wrap {
        padding: 0.25rem 0.75rem;
    }

    .table--stack thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .table--stack,
    .table--stack tbody,
    .table--stack tr,
    .table--stack td {
        display: block;
        width: 100%;
    }

    .table--stack tbody tr {
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--divider);
    }

    .table--stack tbody tr:last-child {
        border-bottom: 0;
    }

    .table--stack td,
    .table--stack tbody tr:last-child td {
        display: grid;
        /* a cell here is a grid, where a height is a hard one: it goes with what the cell holds */
        height: auto;
        grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr);
        gap: 0.75rem;
        padding: 0.375rem 0.25rem;
        border-bottom: 0;
        text-align: left;
    }

    .table--stack tbody tr:hover td {
        background: none;
    }

    .table--stack td.num {
        text-align: left;
    }

    .table--stack td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.8125rem;
        font-weight: 500;
    }

    .table--stack td[data-label=""]::before {
        content: none;
    }

    /* a cell with no heading has the row to itself, in the last row too, whose cells the rule above names
       more strongly: an empty table's message is there, the only row, and would be squeezed into the heading's column */
    .table--stack td[data-label=""],
    .table--stack tbody tr:last-child td[data-label=""] {
        grid-template-columns: minmax(0, 1fr);
    }

    /* and that message keeps the room and the centre it has on a wide screen */
    .table--stack tbody tr:last-child td.table__empty {
        padding: 2.5rem 1rem;
        text-align: center;
    }

    /* what a cell holds stays together beside its heading: a chip keeps its own width */
    .table--stack td > .cell {
        min-width: 0;
    }

    /* a button in a cell is no wider than the half of the row that is its own: its words wrap before it sticks out */
    .table--stack td .btn {
        max-width: 100%;
        white-space: normal;
        text-align: left;
    }
}

/* ------------------------------------------------------------------ */
/* Forms: outlined fields whose label stands on the edge once there is something in them */
/* ------------------------------------------------------------------ */

.form {
    display: grid;
    gap: 1.5rem;
    max-width: 42.5rem;
    min-width: 0;
}

.dialog .form {
    max-width: none;
}

.form__row {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 40rem) {
    .form__row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.field {
    --field-h: 3.125rem;
    --field-top: calc((var(--field-h) - 1.5rem) / 2);
    position: relative;
    display: grid;
    align-content: start;
    min-width: 0;
}

.field__control {
    grid-row: 1;
    width: 100%;
    min-height: var(--field-h);
    padding: 0.75rem 1.1875rem;
    border: 1px solid var(--line-control);
    border-radius: 0.4375rem;
    outline: 0;
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
    line-height: 1.5rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field__control::placeholder {
    color: var(--text-placeholder);
    opacity: 1;
}

.field__control:hover:not(:disabled) {
    border-color: var(--text-muted);
}

/* two pixels of blue when focused, without moving what is typed */
.field__control:focus {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.field__control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.field__control[readonly] {
    border-style: dashed;
    color: var(--text-muted);
}

textarea.field__control {
    min-height: 6.5rem;
    resize: vertical;
}

select.field__control {
    padding-right: 3rem;
    appearance: none;
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.5rem;
    cursor: pointer;
}

input[type="color"].field__control {
    width: 4rem;
    padding: 0.25rem;
    flex: none;
}

.field__control--mono {
    font-family: var(--mono);
}

.field__control[aria-invalid="true"] {
    border-color: var(--error);
    box-shadow: inset 0 0 0 1px var(--error);
}

/* the label stands inside the box until there is something in it, a placeholder to show, or a focus: then it
   moves onto the edge, its background cutting the line behind it. A text field has a placeholder of one space
   (field() in ui.js), so that "no placeholder showing" means "something typed"; a menu or a date is never empty */
.field__label {
    position: absolute;
    top: var(--field-top);
    left: 1.125rem;
    z-index: 1;
    max-width: calc(100% - 1.5rem);
    padding: 0 0.25rem;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    transform-origin: left top;
    transition: transform 0.15s, color 0.15s;
}

.field:focus-within .field__label,
.field:has(.field__control:not(:placeholder-shown)) .field__label,
.field:has(.field__control[placeholder]:not([placeholder=" "])) .field__label {
    background: linear-gradient(var(--field-outside) 50%, var(--surface) 50%);
    color: var(--text-label);
    font-weight: 500;
    transform: translateY(calc(-1 * var(--field-top) - 0.46875rem)) scale(0.78);
}

.field:focus-within .field__label {
    color: var(--primary);
}

.field:has(.field__control[aria-invalid="true"]) .field__label {
    color: var(--error);
}

.field__optional {
    font-weight: 400;
}

.field__hint {
    grid-row: 2;
    margin: 0.25rem 1rem 0;
    color: var(--text-subtle);
    font-size: 0.75rem;
    line-height: 1rem;
}

.field__error {
    grid-row: 3;
    margin: 0.25rem 1rem 0;
    color: var(--error);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1rem;
}

.field__inline {
    grid-row: 1;
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    min-width: 0;
}

.field__inline > .field__control {
    flex: 1 1 auto;
    min-width: 0;
}

/* a choice that is on or off: the browser's own box, in the colour of the page */
.check {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    min-height: 2.75rem;
    padding-block: 0.5rem;
    font-size: 0.9375rem;
    cursor: pointer;
}

.check input {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0.125rem 0 0;
    flex: none;
    accent-color: var(--primary);
}

.check__text {
    display: grid;
    gap: 0.125rem;
}

.check__hint {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Checkboxes of equal weight, such as an endpoint's events: two columns where there is room */
.check-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: 1rem;
}

@media (min-width: 40rem) {
    .check-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.check-grid .check {
    align-items: center;
}

.check-grid .check input {
    margin-top: 0;
}

fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

legend {
    padding: 0;
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

/* the filters of a list, on the canvas above it: their menus a little shorter than a form's */
.toolbar {
    --field-h: 2.875rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.toolbar .field {
    flex: 1 1 10rem;
    max-width: 18rem;
}

.toolbar .field--grow {
    flex: 3 1 14rem;
    max-width: none;
}

.toolbar .field__control {
    min-height: var(--field-h);
    padding-block: 0.6875rem;
    /* a date field is a little taller than a select by itself: the controls of a row line up */
    block-size: var(--field-h);
}

.toolbar .btn {
    min-height: var(--field-h);
}

/* Material 3's segmented buttons: the one chosen is filled */
.segmented {
    display: inline-flex;
    flex: none;
    border: 1px solid var(--line-strong);
    border-radius: 0.4375rem;
    background: var(--surface);
    overflow: hidden;
}

.segmented__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 2.5rem;
    padding: 0 1.25rem;
    border: 0;
    background: transparent;
    color: var(--text-label);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.segmented__item .icon {
    width: 1.125rem;
    height: 1.125rem;
}

.segmented__item + .segmented__item {
    border-left: 1px solid var(--line-strong);
}

.segmented__item:hover:not(:disabled):not([aria-pressed="true"]):not([aria-current="true"]) {
    background: var(--state-hover);
    color: var(--text-label);
    text-decoration: none;
}

.segmented__item:focus-visible {
    outline-offset: -2px;
}

.segmented__item[aria-pressed="true"],
.segmented__item[aria-current="true"] {
    background: var(--primary);
    color: var(--on-primary);
    font-weight: 600;
}

.segmented__item:disabled {
    opacity: 0.55;
}

/* ------------------------------------------------------------------ */
/* Alerts, empty places, loading                                       */
/* ------------------------------------------------------------------ */

/* the base is the informing one: alert--info needs no rule of its own */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.875rem 1rem;
    border: 1px solid var(--info-edge);
    border-radius: var(--corner-card);
    background: var(--info);
    color: var(--text);
    font-size: 0.875rem;
}

.alert > .icon {
    color: var(--primary);
}

.alert__body {
    display: grid;
    flex: 1 1 auto;
    gap: 0.25rem;
    min-width: 0;
}

.alert--success {
    border-color: color-mix(in srgb, var(--on-good-container) 20%, transparent);
    background: var(--good-container);
    color: var(--on-good-container);
}

.alert--warning {
    border-color: var(--warn-edge);
    background: var(--warn-container);
    color: var(--on-warn-container);
}

.alert--error {
    border-color: var(--error-edge);
    background: var(--error-container);
    color: var(--on-error-container);
}

.alert--success > .icon,
.alert--warning > .icon {
    color: inherit;
}

.alert--error > .icon {
    color: var(--error);
}

.alert a {
    color: inherit;
    font-weight: 500;
    text-decoration: underline;
}

/* nothing to show yet: the icon in a round, what it means, and what to do about it */
.empty {
    display: grid;
    justify-items: center;
    gap: 0.25rem;
    padding: 3rem 1.5rem 3.5rem;
    color: var(--text-muted);
    text-align: center;
}

.empty > .icon {
    box-sizing: content-box;
    width: 2.25rem;
    height: 2.25rem;
    padding: 1.375rem;
    margin-bottom: 1rem;
    border-radius: 50%;
    background: var(--tint);
    color: var(--primary);
}

.empty strong {
    color: var(--text);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.5rem;
}

.empty p {
    max-width: 27.5rem;
    margin-bottom: 0.75rem;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* ------------------------------------------------------------------ */
/* Dialogs and the snackbar                                            */
/* ------------------------------------------------------------------ */

dialog.dialog {
    --field-outside: var(--surface);
    width: min(32.5rem, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
    padding: 0;
    border: 0;
    border-radius: var(--corner-card);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--elevation-3);
    overflow: auto;
}

dialog.dialog--wide {
    width: min(48rem, calc(100vw - 2rem));
}

dialog.dialog::backdrop {
    background: var(--scrim);
}

.dialog__inner {
    display: grid;
    gap: 1.25rem;
    padding: 1.5rem;
}

.dialog__title {
    font-size: 1.375rem;
    font-weight: 600;
    line-height: 1.75rem;
}

.dialog__text {
    color: var(--text-muted);
}

.dialog__title + .dialog__text {
    margin-top: -0.5rem;
}

.dialog .btn-row {
    justify-content: flex-end;
    margin-top: 0.25rem;
}

/* a secret shown once: a warning, and the secret on a white box that is easy to copy whole */
.secret {
    display: grid;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid var(--warn-edge);
    border-radius: var(--corner-card);
    background: var(--warn-container);
    color: var(--on-warn-container);
}

.secret__value {
    display: block;
    padding: 0.75rem;
    border: 1px solid var(--line-field);
    border-radius: var(--corner-card);
    background: var(--surface);
    color: var(--text);
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
    user-select: all;
}

.snackbar-host {
    position: fixed;
    left: 1.5rem;
    bottom: calc(1.5rem + env(safe-area-inset-bottom));
    z-index: 80;
    display: grid;
    gap: 0.5rem;
    width: min(35.5rem, calc(100vw - 3rem));
    pointer-events: none;
}

.snackbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3rem;
    padding: 0.5rem 1rem;
    border-radius: var(--corner-card);
    background: var(--inverse-surface);
    color: var(--inverse-on-surface);
    box-shadow: var(--elevation-3);
    pointer-events: auto;
    animation: rise 0.2s ease-out;
}

.snackbar--error {
    background: var(--error-container);
    color: var(--on-error-container);
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(0.5rem);
    }
}

/* ------------------------------------------------------------------ */
/* What a page is made of: lists of facts, events, charts, apps         */
/* ------------------------------------------------------------------ */

/* Key and value lists: a name, and what it is of, a line across between one and the next */
.kv {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
}

.kv dt {
    padding: 0.75rem 0 0;
    color: var(--text-muted);
}

.kv dd {
    min-width: 0;
    padding: 0.125rem 0 0.75rem;
    border-bottom: 1px solid var(--divider);
    overflow-wrap: anywhere;
}

.kv dd:last-child {
    padding-bottom: 0.125rem;
    border-bottom: 0;
}

@media (min-width: 40rem) {
    .kv {
        grid-template-columns: minmax(8.75rem, 13.75rem) minmax(0, 1fr);
        column-gap: 1rem;
    }

    .kv dt,
    .kv dd {
        min-height: 3.25rem;
        padding: 0.875rem 0;
        border-bottom: 1px solid var(--divider);
    }

    .kv dt:nth-last-of-type(1),
    .kv dd:last-child {
        min-height: 2.75rem;
        padding-bottom: 0.25rem;
        border-bottom: 0;
    }
}

/* A timeline of events */
.timeline {
    display: grid;
    padding: 0;
    list-style: none;
}

.timeline li {
    position: relative;
    display: grid;
    gap: 0.125rem;
    margin-left: 0.4375rem;
    padding: 0 0 1rem 1.5rem;
    border-left: 2px solid var(--line);
}

.timeline li:last-child {
    padding-bottom: 0;
    border-left-color: transparent;
}

.timeline li::before {
    position: absolute;
    top: 0.25rem;
    left: -0.4375rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 3px var(--surface);
    content: "";
}

.timeline__time {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Collapsible blocks */
details.disclosure {
    border: 1px solid var(--line-strong);
    border-radius: 0.25rem;
    background: var(--surface);
}

details.disclosure > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-height: 3rem;
    padding: 0.625rem 1rem;
    font-weight: 500;
    list-style: none;
    cursor: pointer;
}

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

details.disclosure > summary::after {
    width: 0.5rem;
    height: 0.5rem;
    margin-left: auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.15s;
    content: "";
}

details.disclosure[open] > summary::after {
    transform: rotate(-135deg);
}

details.disclosure > .disclosure__body {
    display: grid;
    gap: 0.75rem;
    padding: 0 1rem 1rem;
}

/* In a table's cell a disclosure is a small toggle, whatever the width of the column */
.table details.disclosure > summary {
    flex-wrap: nowrap;
    min-height: 2.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

.table details.disclosure > .disclosure__body {
    padding: 0 0.75rem 0.75rem;
}

/* A small bar chart of amounts by day: bars of CSS, heights set from script */
.bars {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    align-items: end;
    gap: 0.1875rem;
    height: 8rem;
    padding-top: 0.5rem;
    border-bottom: 1px solid var(--line-strong);
}

.bars__bar {
    display: block;
    min-height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--primary);
}

.bars__bar--empty {
    background: var(--line);
}

.bars__axis {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* The apps on the person's first page: each card is one link */
.app-card {
    display: grid;
    gap: 1rem;
    align-content: start;
    min-width: 0;
    padding: 1.25rem;
    border-radius: var(--corner-card);
    background: var(--surface);
    box-shadow: var(--elevation-card);
    color: var(--text);
    text-decoration: none;
    transition: box-shadow 0.15s;
}

.app-card:hover {
    box-shadow: var(--elevation-card-hover);
    color: var(--text);
    text-decoration: none;
}

.app-card__head {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.app-card__title {
    display: grid;
    gap: 0.125rem;
    min-width: 0;
}

.app-card__name {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.5rem;
    overflow-wrap: anywhere;
}

.app-card__key {
    color: var(--text-muted);
}

/* An app's logo, or its initial on a round mark when it has none */
.app-mark {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--tint-soft);
    color: var(--primary);
    font-size: 1.125rem;
    font-weight: 500;
}

.app-mark--logo {
    object-fit: cover;
    background: var(--chip);
}

/* The signed-out page */
.welcome {
    --field-outside: var(--canvas);
    display: grid;
    place-items: center;
    min-height: calc(100dvh - var(--bar-h));
    padding: 2rem var(--gutter);
    border-top: 1px solid var(--canvas-edge);
    background: var(--canvas);
}

.welcome__card {
    display: grid;
    gap: 1.25rem;
    justify-items: center;
    width: min(28rem, 100%);
    padding: 2.5rem 2rem;
    border-radius: var(--corner-card);
    background: var(--surface);
    box-shadow: var(--elevation-card);
    text-align: center;
}

.welcome__card h1 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 2.125rem;
    letter-spacing: -0.03125rem;
}

.welcome__card .brand__mark {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.75rem;
}

.welcome__card p {
    color: var(--text-muted);
}

/* A figure in money: its digits all as wide as the others, so that a column of them lines up */
.amount {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.amount--in {
    color: var(--on-tint-green);
}

.amount--out {
    color: var(--error);
}

.copy {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 100%;
}

.copy .icon-btn {
    width: 2rem;
    height: 2rem;
}

.copy .icon {
    width: 1.25rem;
    height: 1.25rem;
}

.mono {
    font-family: var(--mono);
    font-size: 0.75rem;
    overflow-wrap: anywhere;
}

pre.json {
    max-height: 28rem;
    font-size: 0.8125rem;
}

/* ------------------------------------------------------------------ */
/* Utilities                                                           */
/* ------------------------------------------------------------------ */

.text-variant {
    color: var(--text-muted);
}

.text-small {
    font-size: 0.8125rem;
}

.nowrap {
    white-space: nowrap;
}

.w-full {
    width: 100%;
}

/* ------------------------------------------------------------------ */
/* Narrow screens                                                      */
/* ------------------------------------------------------------------ */

@media (max-width: 44.99rem) {
    .search {
        display: none;
    }

    /* counts in two columns of compact tiles, as FoxShard Identity's console draws them on a phone */
    .stats,
    .stats:has(> .stat:nth-child(4)),
    .stats:not(:has(> .stat:nth-child(3))) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .stats > .stat {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 1rem;
    }

    .stat__icon {
        width: 2.5rem;
        height: 2.5rem;
    }

    .stat__icon .icon {
        width: 1.25rem;
        height: 1.25rem;
    }

    .stat__value {
        font-size: clamp(1rem, 7cqi, 1.5rem);
    }

    .top-bar__actions {
        gap: 0.25rem;
        padding-left: 0;
    }

    /* the icon and the name stay on one row; what goes with them (the switch between test and live data, the role,
       the purpose) runs the width of the page under them, where a switch of four days' choices fits at 320px */
    .page-head__main {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 0.75rem 0.875rem;
    }

    .page-head__text {
        display: contents;
    }

    .page-head__text > h1 {
        grid-column: 2;
        margin-top: 0;
    }

    .page-head__text > :not(h1) {
        grid-column: 1 / -1;
    }

    .segmented {
        max-width: 100%;
    }

    .segmented__item {
        flex: 1 1 auto;
        min-width: 0;
        padding: 0 0.75rem;
    }

    .page-head h1 {
        font-size: 1.75rem;
        line-height: 2.125rem;
    }

    .page-head__icon {
        width: 3.25rem;
        height: 3.25rem;
    }

    .page-head__icon .icon {
        width: 1.625rem;
        height: 1.625rem;
    }

    .snackbar-host {
        left: 1rem;
        bottom: calc(1rem + env(safe-area-inset-bottom));
        width: calc(100vw - 2rem);
    }
}

/* on the narrowest phones the bar keeps room for its buttons */
@media (max-width: 29.99rem) {
    .brand__by {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
