/* ============================================
   Snake CSS Framework
   ============================================

   Requires snake-theme.css to be loaded first (variables and fonts).

   Mobile first, one breakpoint at 640px, nested in the component it belongs
   to. The type scale has none: heading steps are clamp()ed in the theme.

   1. Reset
   2. Base Elements
   3. Typography
   4. Generic Classes
   5. Layout
   6. Navbar
   7. Form Elements
   8. Buttons
   9. Notifications
   10. Tabbed Sections
   11. Toggle
   12. Breadcrumb
   13. Tables
   14. Utility Components
   15. Modifiers
*/

/* --- Reset --- */

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

/* 62.5% of the 16px browser default makes 1rem = 10px, so every rem value
   in this file can be read directly as a tenth of its pixel equivalent */
html {
    -webkit-text-size-adjust: 100%;
    font-size: 62.5%;
    text-size-adjust: 100%;
}

/* Sticky footer. dvh, not a percentage: min-height: 100% would resolve against
   html's auto height and collapse. Needs <main> as a direct child of <body> */
body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    line-height: var(--line-height);
    background: var(--wh);
    color: var(--n1);
    font-family: var(--font-sans);
    font-size: var(--base);
    font-weight: var(--regular);
    font-style: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

main {
    flex: 1 0 auto;
}

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

img,
picture,
svg,
video,
canvas {
    max-width: 100%;
}

img,
picture,
video,
canvas {
    display: block;
    height: auto;
}

/* Author display rules (.msg, .modal...) must not win over the hidden attribute */
[hidden] {
    display: none !important;
}

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

button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: none;
    cursor: pointer;
    display: inline-block;
    line-height: 1;
    padding: 0;
}

/* Two queries, not one: they test opposite values. Motion is granted rather
   than revoked, so it stays off where the feature is unsupported */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

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

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

figcaption {
    font-size: var(--small);
    color: var(--n2);
    padding-top: 0.5em;
}

/* A timestamp is one token: breaking it mid-date reads as two values */
time {
    text-transform: lowercase;
    white-space: nowrap;
}

ul,
ol {
    padding-left: 1.5em;
}

blockquote {
    border-left: 3px solid var(--border-color);
    color: var(--n2);
    padding-left: var(--space-md);
}

hr {
    border: none;
    border-top: 1px solid var(--n4);
    margin: var(--space-lg) 0;
}

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

pre code {
    font-size: 1em;
}

:not(pre) > code,
kbd,
pre {
    background-color: color-mix(in srgb, var(--n3) 15%, transparent);
    border-radius: var(--radius);
}

:not(pre) > code,
kbd {
    padding: 0.1em 0.4em;
}

pre {
    overflow-x: auto;
    padding: var(--space-md);
}

sub,
sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

sub {
    bottom: -0.25em;
}

sup {
    top: -0.5em;
}

small {
    font-size: 0.875em;
}

mark {
    background-color: color-mix(in srgb, var(--warning) 30%, transparent);
    color: inherit;
}

/* The global margin reset would remove the auto margin that centers a modal dialog */
dialog {
    color: inherit;
    margin: auto;
}

/* --- Typography --- */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-serif);
    font-weight: var(--bold);
    line-height: 1.1;
    margin-bottom: 0.5em;
}

/* --hd0 is reserved for an optional future display/hero style, not used by default headings */
h1 {
    font-size: var(--hd1);
}

h2 {
    font-size: var(--hd2);
}

h3 {
    font-size: var(--hd3);
}

h4 {
    font-size: var(--hd4);
}

h5 {
    font-size: var(--hd5);
}

h6 {
    font-size: var(--hd6);
}

p + p {
    margin-top: var(--space-md);
}

strong,
b {
    font-weight: var(--bold);
}

/* --- Generic Classes --- */

/* Icon */
/* Stroke-drawn icons: fill: none only makes sense with the stroke properties
   beside it. They have to be CSS, not attributes on a sprite's <symbol>: a
   <use> clone inherits from the <use> element, not from the sprite wrapper */
.icon {
    width: 1em;
    height: 1em;
    min-width: 1em;
    min-height: 1em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Status classes (generic, can be applied to any element) */
.success {
    border: 1px solid var(--success);
    color: var(--success);
    background-color: color-mix(in srgb, var(--success) 10%, transparent);
}

.warning {
    border: 1px solid var(--warning);
    color: var(--warning);
    background-color: color-mix(in srgb, var(--warning) 10%, transparent);
}

.error {
    border: 1px solid var(--error);
    color: var(--error);
    background-color: color-mix(in srgb, var(--error) 10%, transparent);
}

.info {
    border: var(--border-width) solid var(--border-color);
    color: var(--n1);
    background-color: color-mix(in srgb, var(--n3) 10%, transparent);
}

/* --- Layout --- */

/* Gap-managed container. With no column modifier this is a vertical stack,
   which is grid's own default and also the mobile layout of every modifier
   below: the column counts only come in at the 640px breakpoint */
.grid {
    display: grid;
    gap: var(--grid-gap);
}

/* The gap owns the spacing, so inherited block margins must not add to it */
.grid > * {
    margin: 0;
}

/* As many columns as fit, none ever narrower than --grid-min */
.grid-auto {
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(var(--grid-min), 100%), 1fr)
    );
}

/* Column counts start at the breakpoint; below it the .grid stack is right.
   minmax(0, 1fr): plain 1fr keeps a minimum, so one long word widens the grid */
@media (min-width: 640px) {
    .grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

/* Horizontal row that wraps. Flex rather than grid: grid columns never wrap,
   and would force every item onto a track of the same width. Alignment along
   the main axis is left to the caller */
.cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--grid-gap);
}

.cluster > * {
    margin: 0;
}

/* On the element, not a wrapper, so a full-bleed background can sit on it.
   min() keeps a gutter below --boxed-w, so no padded wrapper is needed */
.boxed {
    width: min(100% - 2 * var(--space-md), var(--boxed-w));
    margin-inline: auto;

    /* Roomier gutter once there is width to spare */
    @media (min-width: 640px) {
        width: min(100% - 2 * var(--space-lg), var(--boxed-w));
    }
}

.card {
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--wh);
    padding: var(--space-lg);
}

.card-full {
    width: 100%;
}

/* --- Navbar --- */

.navbar {
    align-items: center;
    display: flex;
    height: var(--navbar-height);
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--wh);
    border-top: var(--border-width) solid var(--border-color);
    padding: var(--space-sm) 0;
    z-index: 100;

    /* Thumb reach puts the bar at the bottom on phones; from the breakpoint up
       it becomes a conventional top bar */
    @media (min-width: 640px) {
        top: 0;
        bottom: auto;
        border-top: none;
        border-bottom: var(--border-width) solid var(--border-color);
    }
}

.navbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    color: inherit;
    text-transform: uppercase;
    font-size: var(--xsmall);
    padding: var(--space-sm) var(--space-md);

    /* Icon over label while vertical space is cheap and width is not, side by
       side once the bar is at the top */
    @media (min-width: 640px) {
        flex-direction: row;
        gap: var(--space-sm);
    }
}

.navbar-item:hover,
.navbar-item.active {
    color: var(--primary);
}

.navbar-item .icon {
    font-size: var(--hd4);
}

/* No room under a trigger while the bar is at the bottom. A page needing the
   destination on a phone should use a plain .navbar-item link */
.navbar .dropdown {
    display: none;

    @media (min-width: 640px) {
        display: inline-block;
    }
}

/* The navbar is fixed: reserve its space so it never covers the content, on
   the side the bar is actually on */
body:has(.navbar) {
    padding-bottom: var(--navbar-height);

    @media (min-width: 640px) {
        padding-bottom: 0;
        padding-top: var(--navbar-height);
    }
}

/* Keep an in-page anchor from landing under the top bar */
@media (min-width: 640px) {
    html:has(.navbar) {
        scroll-padding-top: var(--navbar-height);
    }
}

/* --- Form Elements --- */

/* Labels and legend */
label {
    display: inline-flex;
    align-items: center;
    gap: 0.333em;
    font-weight: var(--bold);
    cursor: default;
}

legend {
    font-weight: var(--bold);
    padding: 0;
    margin-bottom: var(--space-sm);
}

/* Fieldset reset */
fieldset {
    border: none;
    padding: 0;
    margin: var(--space-md) 0;
}

fieldset label,
.input-checkbox label,
.input-radio label {
    font-weight: var(--regular);
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.333em;
    cursor: pointer;
}

/* Field group: label, control and any .note or .error below it move as one
   unit. The gap spaces them inside the group, the margin one group from the
   next, so a plain <form> gets its vertical rhythm with no extra class */
.input,
.input-checkbox,
.input-radio {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

/* Inside a fieldset, checkboxes and radios read as a single list rather than
   as separate groups: the fieldset's own margin already separates the list */
fieldset .input-checkbox,
fieldset .input-radio {
    margin-bottom: var(--space-xs);
}

/* Inputs: checkbox, radio, file, range, color and button types keep their native look */
input:where(
    :not(
        [type="checkbox"],
        [type="radio"],
        [type="range"],
        [type="file"],
        [type="submit"],
        [type="button"],
        [type="reset"],
        [type="color"],
        [type="image"],
        [type="hidden"]
    )
),
select,
textarea {
    background-color: var(--wh);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius);
    color: var(--n1);
    display: block;
    line-height: 1;
    padding: 0.5em;
    width: 100%;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--primary);
}

textarea {
    line-height: var(--line-height);
    resize: vertical;
}

::placeholder {
    color: var(--n2);
    opacity: 1;
}

/* Soft neutral glow, like Safari's. The transparent outline is what keeps a
   ring in forced-colors mode, where shadows are not painted */
:is(input, select, textarea):focus-visible {
    border-color: var(--primary);
    outline: 2px solid transparent;
    box-shadow: 0 0 4px 2px color-mix(in srgb, var(--n1) 15%, transparent);
}

/* The types that keep their native look keep the native focus ring too */
input:is(
    [type="checkbox"],
    [type="radio"],
    [type="range"],
    [type="file"],
    [type="color"]
):focus-visible {
    box-shadow: none;
    outline: revert;
}

input:disabled,
select:disabled,
textarea:disabled {
    background-color: color-mix(in srgb, var(--n3) 10%, var(--wh));
    color: var(--n2);
    cursor: not-allowed;
}

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

:is(input, select, textarea):user-invalid {
    border-color: var(--error);
}

/* Select reset for Safari. A native option list cannot be styled: where that
   matters, see .dropdown */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23202021' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-position: right 0.6em center;
    background-repeat: no-repeat;
    padding-right: 2.4em;
}

/* File Upload */
.upload-area {
    border: var(--border-width) dotted var(--border-color);
    border-radius: var(--radius);
    padding: var(--space-lg);
    text-align: center;
    cursor: pointer;
    position: relative;
    transition:
        border-color var(--transition),
        background-color var(--transition);
}

/* Stretch the label over the whole area so a click anywhere opens the file picker */
.upload-area label::after {
    content: "";
    inset: 0;
    position: absolute;
}

.upload-area:has(input:focus-visible) {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.upload-area:hover {
    border-color: var(--primary);
    background-color: color-mix(in srgb, var(--primary) 5%, transparent);
}

/* Visually hidden instead of display: none, so the input stays reachable by keyboard */
.input-upload input[type="file"] {
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

.upload-preview {
    margin-top: var(--space-md);
    text-align: left;
}

/* --- Buttons --- */

/* An inline-flex box takes its baseline from its first child, so an icon
   button would sit lower than a plain one. Middle alignment evens them out */
.btn {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    gap: 0.5em;
    font-family: var(--font-sans);
    font-size: var(--small);
    text-transform: uppercase;
    padding: 0 1.2em;
    height: 2.6em;
    border: none;
    border-radius: var(--radius);
    background-color: var(--n3);
    color: var(--wh);
    cursor: pointer;
    line-height: 1;
    text-box: trim-both cap alphabetic;
    transition: background-color var(--transition);
}

.btn:hover:not(:disabled, .is-disabled) {
    background-color: color-mix(in srgb, var(--n3) 85%, black);
}

/* Opacity dims any variant (.btn-alt, .btn-accent...) without a dedicated
   disabled style per variant. .is-disabled covers elements that cannot use
   the disabled attribute, like a <label> or <a> styled as a button */
.btn:disabled,
.btn.is-disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Links have no disabled attribute: block clicks. Kept separate because
   pointer-events: none also hides the not-allowed cursor */
a.btn.is-disabled {
    pointer-events: none;
}

.btn.btn-alt {
    background-color: var(--n4);
    color: var(--n1);
}

.btn.btn-alt:hover:not(:disabled, .is-disabled) {
    background-color: color-mix(in srgb, var(--n4) 85%, black);
}

.btn-accent {
    background-color: var(--primary);
    color: var(--wh);
    border-color: var(--primary);
}

.btn-accent:hover:not(:disabled, .is-disabled) {
    background-color: var(--accent);
}

/* Size, not colour, so it combines with any variant above. Every length in
   .btn is an em: the font-size shrinks padding, height and gap along with it */
.btn-sm {
    font-size: var(--xsmall);
}

/* --- Notifications --- */

.msg {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    padding: var(--space-md);
    border-radius: var(--radius);
    background-color: var(--wh);
    gap: var(--space-md);
}

.msg p {
    margin: 0;
    font-size: var(--small);
}

.msg .dismiss {
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: currentColor;
}

/* Secondary line: a caption under a field, a url under a name, a timestamp
   under a value. Absorbs what a project would otherwise call .meta */
.note {
    display: block;
    color: var(--n2);
    font-size: var(--small);
    padding-top: 0.5em;
}

/* --- Tabbed Sections --- */

.tabbed {
    position: relative;
    margin-bottom: var(--space-lg);
}

/* Tabs follow the ARIA tablist pattern: state lives in aria-selected, not in a class */
.tab-title {
    display: flex;
    overflow-x: auto;
    border-bottom: var(--border-width) solid var(--border-color);
    margin-bottom: var(--space-md);
}

.tab-title [role="tab"] {
    flex-shrink: 0;
    display: block;
    padding: var(--space-sm) var(--space-md);
    color: var(--n2);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font: inherit;
    font-weight: var(--bold);
    cursor: pointer;
}

.tab-title [role="tab"]:hover,
.tab-title [role="tab"][aria-selected="true"] {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* --- Toggle --- */
/* Built on <details>/<summary>: no JS needed to open or close */

.toggle {
    margin-bottom: var(--space-md);
}

.toggle > summary {
    display: flex;
    list-style: none;
    cursor: pointer;
    color: var(--primary);
}

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

.toggle-content {
    padding: var(--space-md);
}

/* --- Breadcrumb --- */

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    padding: var(--space-sm) 0;
    margin-bottom: var(--space-md);
    font-size: var(--small);
}

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

.breadcrumb .active,
.breadcrumb [aria-current] {
    color: var(--n2);
}

.breadcrumb a::after {
    content: "/";
    margin: 0 var(--space-xs);
    color: var(--n3);
}

.breadcrumb a:last-child::after {
    content: none;
}

/* --- Tables --- */

table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
}

th,
td {
    border-bottom: var(--border-width) solid var(--n4);
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    vertical-align: top;
}

th {
    font-weight: var(--bold);
}

thead th {
    border-bottom: 2px solid var(--border-color);
    font-size: var(--xsmall);
    text-transform: uppercase;
}

/* Body rows carry more text than anything else on a page: a step down keeps a
   wide table readable without shrinking its headings */
tbody {
    font-size: var(--small);
}

/* tbody is already --small, so a .note inside one needs another step down to
   keep reading as secondary */
tbody .note {
    font-size: var(--xsmall);
}

/* Row hover helps the eye track one record across a wide table. Body rows
   only: a header is not a target. Mixed with transparent rather than a solid
   step, so it stays faint over whatever surface the table sits on */
tbody tr:hover {
    background-color: color-mix(in srgb, var(--n4) 40%, transparent);
}

/* Wrapper for a table wider than its container: without it the table pushes
   the whole page into horizontal scroll. Needs tabindex="0" and a label in the
   markup, or the scroll area is unreachable by keyboard */
.table-scroll {
    overflow-x: auto;
}

/* Column alignment modifiers */
.col-left {
    text-align: left;
}

.col-right {
    text-align: right;
}

/* Column width modifiers: apply to <col> inside a <colgroup>, or directly to th/td.
   Content-heavy tables may need table-layout: fixed on the table for predictable results. */
.col-min {
    width: 1%;
    white-space: nowrap;
}

.col-medium {
    width: 30%;
}

.col-max {
    width: 100%;
}

/* --- Utility Components --- */

/* Modal: built on the native <dialog> element, which handles the top layer,
   the Esc key and focus trapping without any JavaScript */
.modal {
    margin: auto;
    border: none;
    border-radius: var(--radius);
    background-color: var(--wh);
    padding: var(--space-lg);
    max-width: min(90vw, 40rem);
    max-height: 90dvh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-header {
    margin-bottom: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    margin-bottom: var(--space-md);
}

.modal-footer {
    margin-top: var(--space-md);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--hd4);
    cursor: pointer;
    color: var(--n2);
    padding: 0;
    line-height: 1;
}

/* Dropdown: <details> for open/close, panel absolutely positioned in the
   wrapper. No JS, no top layer, so it goes wherever a block goes.
   Not built yet: radio inputs in <label>s inside the panel would make this a
   styleable <select> that still submits. See the select note */
.dropdown {
    display: inline-block;
    position: relative;
}

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

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

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10;
    min-width: 100%;
    background-color: var(--wh);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--space-xs) 0;
}

/* :not() because a switcher .option is often a link, and this rule's extra
   specificity would otherwise override its own display */
.dropdown-menu a:not(.option) {
    display: block;
    padding: var(--space-sm) var(--space-md);
    color: var(--n1);
    text-decoration: none;
}

.dropdown-menu a:hover {
    background-color: var(--n4);
}

/* Switcher: rows are mutually exclusive options, not destinations.
   aria-current like the breadcrumb, not role="menu", which would promise
   arrow keys. .switcher sits on the <details>, so the trigger, the name and
   the secondary line need no classes of their own */
.switcher > summary {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    max-width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--wh);
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.switcher .chevron {
    transition: transform var(--transition);
}

.switcher[open] .chevron {
    transform: rotate(180deg);
}

.switcher .label {
    padding: var(--space-sm) var(--space-md) var(--space-xs);
    color: var(--n2);
    font-size: var(--xsmall);
    text-transform: uppercase;
}

.switcher .option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 var(--space-sm);
    align-items: center;
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.switcher .option:hover {
    background-color: var(--n4);
}

.switcher .option > :not(.icon) {
    grid-column: 2;
}

/* A name is a label, not prose: breaking it mid-word reads as an error */
.switcher .option strong {
    white-space: nowrap;
}

/* No padding: here the two lines are one label, not a caption under a block */
.switcher .option .note {
    padding-top: 0;
}

/* visibility, not display: unchecked rows keep the column width, so no spacer
   element is needed. The row span centres the tick against the two lines */
.switcher .option .icon {
    grid-row: 1 / -1;
    visibility: hidden;
}

/* Attribute presence, not ="true": a link marks itself aria-current="page",
   the same form the breadcrumb matches */
.switcher .option[aria-current] .icon {
    visibility: visible;
}

/* The page-level hr margin is far too generous inside a panel */
.switcher hr {
    margin: var(--space-xs) 0;
}

/* Pills */
.pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3em;
    align-items: center;
    list-style: none;
    padding: 0;
}

/* Badge: a standalone .pill, or a bare <a>/<li> inside a .pills row. Neutral
   by default; border: none because a status class below carries one of its own
   and a pill reads better without it */
.pill,
.pills > a,
.pills > li {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.5em 1em;
    background-color: var(--n4);
    border: none;
    border-radius: 999px;
    color: var(--n1);
    font-size: var(--xsmall);
    font-weight: var(--bold);
    line-height: 1;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
    text-box: trim-both cap alphabetic;
}

.pill .icon {
    width: 0.9em;
    height: 0.9em;
}

/* Status variants. Two classes each, so they win over both the neutral pill
   and the generic .success/.warning/.error without any specificity tricks.
   The text keeps the status colour at full strength: a deliberate choice for
   a private dashboard, where the hue matters more than the ratio. Measured at
   a 10% tint it is 3.5:1 (success), 3.2:1 (warning) and 4.6:1 (error) — only
   error clears the 4.5:1 of WCAG AA. Meaning never rests on colour alone: each
   badge carries an icon and a word, so 1.4.1 holds; it is 1.4.3 that is traded
   away. Darkening the text towards --n1 fixes the ratio but turns warning
   muddy, which is why it is not done here */
.pill.accent {
    background-color: var(--primary);
    color: var(--wh);
}

.pill.success {
    background-color: color-mix(in srgb, var(--success) 10%, var(--wh));
    color: var(--success);
}

.pill.warning {
    background-color: color-mix(in srgb, var(--warning) 10%, var(--wh));
    color: var(--warning);
}

.pill.error {
    background-color: color-mix(in srgb, var(--error) 10%, var(--wh));
    color: var(--error);
}

/* Counters */
.counters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
    align-items: center;
}

.counter {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    color: var(--n1);
    font-size: var(--base);
}

.counter span {
    font-size: var(--small);
    text-box: trim-both cap alphabetic;
}

/* Meter: one ratio against a limit, which is not a two-slice pie chart. The
   empty track is a lighter step of the fill's own colour, so the state reads
   across the whole bar. --meter-color carries severity: set it per instance */
.meter {
    height: 0.8rem;
    border-radius: 999px;
    background-color: color-mix(in srgb, var(--meter-color, var(--primary)) 18%, var(--wh));
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    border-radius: 999px;
    background-color: var(--meter-color, var(--primary));
}

/* --- Modifiers --- */

.negative {
    background-color: var(--n1);
    color: var(--wh);
}
