/* Design tokens. Every color, size and radius comes from here. */
:root {
    --color-bg: #f7f7f8;
    --color-surface: #ffffff;
    --color-text: #1d1d1f;
    --color-muted: #6b6b73;
    --color-border: #e2e2e6;
    --color-accent: #2f6fde;
    --color-on-accent: #ffffff;
    --color-danger: #c62828;
    /* The local network badge: green, so it stands out on black and white icons */
    --color-local: #2e7d32;
    --color-local-bg: #dcf2dd;

    /* Soft color patches behind every page (body::before) */
    --mesh-1: rgb(255 190 180 / 0.55);
    --mesh-2: rgb(180 210 255 / 0.6);
    --mesh-3: rgb(225 190 255 / 0.5);
    --mesh-4: rgb(175 235 220 / 0.55);
    --mesh-5: rgb(255 240 215 / 0.5);

    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-size-base: 1rem;
    --font-size-small: 0.85rem;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2.5rem;

    --radius: 8px;
    --content-width: 72rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #151517;
        --color-surface: #1f1f23;
        --color-text: #ececf0;
        --color-muted: #9a9aa3;
        --color-border: #2e2e34;
        --color-accent: #6b9cf0;
        --color-on-accent: #10131a;
        --color-danger: #ef6b6b;
        --color-local: #8fd694;
        --color-local-bg: #1d3a20;

        --mesh-1: rgb(120 60 80 / 0.35);
        --mesh-2: rgb(40 70 130 / 0.4);
        --mesh-3: rgb(80 50 120 / 0.35);
        --mesh-4: rgb(30 90 80 / 0.35);
        --mesh-5: rgb(90 70 40 / 0.25);
    }
}

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

/* The search hides cards and links with the hidden attribute: it must win over any display rule */
[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: 1.5;
}

/* Fixed to the screen rather than painted on body, so a long board neither stretches nor scrolls it.
   Still on purpose: animating it would repaint it and every blurred card on each frame. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        radial-gradient(ellipse at 15% 20%, var(--mesh-1), transparent 45%),
        radial-gradient(ellipse at 85% 15%, var(--mesh-2), transparent 45%),
        radial-gradient(ellipse at 80% 80%, var(--mesh-3), transparent 45%),
        radial-gradient(ellipse at 15% 85%, var(--mesh-4), transparent 45%),
        radial-gradient(ellipse at 50% 50%, var(--mesh-5), transparent 50%);
}

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

/* The public entry page (login.html): the same patches as every page, in vivid colors and slowly drifting */
.landing {
    --mesh-1: rgb(255 80 120 / 0.85);
    --mesh-2: rgb(70 130 255 / 0.85);
    --mesh-3: rgb(170 80 255 / 0.8);
    --mesh-4: rgb(20 200 170 / 0.8);
    --mesh-5: rgb(255 160 50 / 0.7);
}

@media (prefers-color-scheme: dark) {
    .landing {
        --mesh-1: rgb(220 40 110 / 0.65);
        --mesh-2: rgb(60 90 240 / 0.7);
        --mesh-3: rgb(140 50 230 / 0.65);
        --mesh-4: rgb(10 170 145 / 0.6);
        --mesh-5: rgb(220 120 20 / 0.5);
    }
}

/* Larger than the screen (180%) so it can wander without showing an edge, along the path of the
   design idea. Moved with transform, which needs no repaint; no blurred cards here except the hero */
.landing::before {
    inset: -40%;
    animation: landing-drift 16s ease-in-out infinite alternate;
}

@keyframes landing-drift {
    0% {
        transform: translate(20%, 20%);
    }
    25% {
        transform: translate(-20%, 12%);
    }
    50% {
        transform: translate(-12%, -20%);
    }
    75% {
        transform: translate(12%, -12%);
    }
    100% {
        transform: translate(20%, 12%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .landing::before {
        animation: none;
    }
}

.landing-hero {
    margin-top: var(--space-5);
    padding: var(--space-5) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--color-surface) 72%, transparent);
    backdrop-filter: blur(10px);
    text-align: center;
}

.landing-hero h1 {
    margin: var(--space-3) 0;
    font-size: clamp(1.8rem, 6vw, 2.6rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.landing-lead {
    max-width: 30rem;
    margin: 0 auto var(--space-4);
    font-size: 1.1rem;
}

.landing-hero .notice {
    margin: 0 0 var(--space-4);
    text-align: left;
}

.button-large {
    padding: var(--space-3) var(--space-5);
    font-size: 1.05rem;
}

.site-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    /* See-through, more than the collection cards */
    background: color-mix(in srgb, var(--color-surface) 55%, transparent);
    backdrop-filter: blur(6px);
    /* The blur gives the header its own stacking context: it must sit above the cards
       (an open card menu is at 1) so the user menu is not hidden behind them */
    position: relative;
    z-index: 2;
}

.brand {
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}

.container {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--space-4) var(--space-3);
}

.tagline {
    color: var(--color-muted);
}

.site-header .session {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.container.narrow {
    max-width: 40rem;
}

.prose h2 {
    margin-top: var(--space-5);
    font-size: 1.15rem;
}

.button {
    display: inline-block;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    background: var(--color-accent);
    color: var(--color-on-accent);
    font-weight: 600;
    text-decoration: none;
}

.button-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-accent);
    font: inherit;
    font-size: var(--font-size-small);
    cursor: pointer;
}

.notice {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}

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

/* A message that floats over the page for a few seconds (app.js) */
.toast {
    position: fixed;
    left: 50%;
    bottom: var(--space-4);
    transform: translateX(-50%);
    z-index: 10;
    width: max-content;
    max-width: calc(100vw - 2 * var(--space-4));
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.2);
}

.toast[hidden] {
    display: none;
}

.fine-print {
    margin-top: var(--space-4);
    color: var(--color-muted);
    font-size: var(--font-size-small);
}

.site-footer {
    padding: var(--space-4) var(--space-3);
    text-align: center;
    font-size: var(--font-size-small);
}

.board {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.collection input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
}

.form-actions .button {
    border: 0;
    font: inherit;
    cursor: pointer;
}

/* One column on phones, a grid on wider screens */
/* "New collection": a square "+" under the last card, on the left */
.add-collection {
    align-self: flex-start;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid var(--color-accent);
    background: var(--color-surface);
    color: var(--color-accent);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}

.collections {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
    gap: var(--space-3);
    /* Each card as tall as its content, not as the tallest card in its row */
    align-items: start;
}

/* Masonry (set up by app.js): thin rows, each card spans what its height needs */
.collections.masonry {
    grid-auto-rows: 4px;
    row-gap: 0;
}

.collection {
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    /* Partly see-through: only the background, so text and icons stay solid */
    background: color-mix(in srgb, var(--color-surface) 75%, transparent);
    backdrop-filter: blur(6px);
}

/* The blur gives each card its own stacking context, so a menu can only rise
   above the other cards if its whole card does */
.collection:has(.menu[open]) {
    z-index: 1;
}

.collection-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
}

.collection-name {
    margin: 0;
    font-size: 1.05rem;
    overflow-wrap: anywhere;
}


.links {
    margin: var(--space-2) 0 0;
    padding: 0;
    list-style: none;
}

.links li {
    padding: var(--space-1) 0;
    overflow-wrap: anywhere;
}

.links a {
    text-decoration: none;
}

.links a:hover {
    text-decoration: underline;
}

.collection label {
    display: block;
    margin-bottom: var(--space-1);
    font-size: var(--font-size-small);
    color: var(--color-muted);
}

.collection.editing input[type="text"] {
    width: 100%;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-2);
}

.empty {
    color: var(--color-muted);
    font-size: var(--font-size-small);
}

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

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

.link {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
}

.favicon {
    flex: none;
    margin-top: 0.2rem;
    /* Icons come in any shape; keep theirs inside the square */
    object-fit: contain;
}

/* Border and padding inside the 32px, so identicons line up with favicons */
.favicon.identicon {
    box-sizing: border-box;
    padding: 2px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
}

/* Lucide icons are strokes in the color of the text, light or dark, with a little air inside the 32px */
svg.favicon.lucide {
    box-sizing: border-box;
    padding: 3px;
    color: var(--color-text);
}

/* App logos come in their brand colour; one too pale or too dark for the page takes the colour of the text */
svg.favicon.brand {
    box-sizing: border-box;
    padding: 3px;
}

@media not (prefers-color-scheme: dark) {
    svg.favicon.brand-light {
        fill: var(--color-text);
    }
}

@media (prefers-color-scheme: dark) {
    svg.favicon.brand-dark {
        fill: var(--color-text);
    }
}

/* A link on the user's own network: Lucide's "network" on a light green disc on the icon's lower right
   corner, with a ring in the card's colour so it looks cut out of the icon */
.local-icon {
    position: relative;
    flex: none;
    display: flex;
    margin-top: 0.2rem;
}

.local-icon .favicon {
    margin-top: 0;
}

.local-badge {
    position: absolute;
    right: -5px;
    bottom: -5px;
    box-sizing: border-box;
    padding: 2px;
    border-radius: 50%;
    background: var(--color-local-bg);
    color: var(--color-local);
    box-shadow: 0 0 0 1.5px var(--color-surface);
}

.link-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.link-title {
    overflow-wrap: anywhere;
}

.link-meta {
    color: var(--color-muted);
    font-size: var(--font-size-small);
}

/* Link edit form, in its modal: header, a body that scrolls, actions always in sight */
.modal.modal-form {
    width: min(34rem, calc(100% - 2 * var(--space-3)));
    max-height: calc(100dvh - 2 * var(--space-3));
    padding: 0;
}

.modal-form[open] {
    display: flex;
}

/* With the icon picker (local links), a fixed height: searching changes what is inside, not the window's size */
.modal.modal-form:has(.icon-picker) {
    height: min(44rem, calc(100dvh - 2 * var(--space-3)));
}

.link-edit {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.modal .modal-header h2 {
    margin: 0;
}

.modal-close {
    padding: var(--space-1) var(--space-2);
    border: 0;
    border-radius: var(--radius);
    background: none;
    color: var(--color-muted);
    font: inherit;
    cursor: pointer;
}

.modal-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-3) var(--space-4);
}

.modal-body input[type="text"] {
    margin-bottom: var(--space-3);
}

.modal .form-actions.modal-footer {
    margin-top: 0;
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-border);
}

/* On a phone the edit form takes the whole screen */
@media (max-width: 40rem) {
    .modal.modal-form,
    .modal.modal-form:has(.icon-picker) {
        width: 100%;
        max-width: none;
        height: 100dvh;
        max-height: none;
        margin: 0;
        border: 0;
        border-radius: 0;
    }
}

/* Icon picker in the link edit form (local links) */
.icon-field {
    min-width: 0;
    margin: 0 0 var(--space-2);
    padding: 0;
    border: 0;
}

.icon-field legend {
    margin-bottom: var(--space-1);
}

.icon-current-line {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
}

.icon-current {
    display: flex;
}

.icon-current .favicon {
    margin-top: 0;
}

.icon-search {
    width: 100%;
    margin: var(--space-2) 0;
}

.icon-grid {
    display: grid;
    /* Finger-sized squares on a phone, as many per row as fit */
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: var(--space-1);
    max-height: 15rem;
    overflow-y: auto;
}

.icon-choice {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
}

.icon-choice[hidden] {
    display: none;
}

.icon-choice .favicon {
    margin-top: 0;
}

/* The radio stays for the keyboard and screen readers; the square shows the choice */
.icon-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.icon-choice:hover {
    border-color: var(--color-border);
}

.icon-choice:has(input:checked) {
    border-color: var(--color-accent);
    box-shadow: inset 0 0 0 1px var(--color-accent);
}

.icon-choice:has(input:focus-visible) {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

.icon-automatic {
    justify-content: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    padding: 0 var(--space-2);
}

.icon-heading {
    margin: var(--space-2) 0 var(--space-1);
    color: var(--color-muted);
    font-size: var(--font-size-small);
}

/* A handful of matches: no scroll of its own */
.brand-grid {
    max-height: none;
}

.icon-message {
    grid-column: 1 / -1;
    margin: var(--space-2) 0;
    color: var(--color-muted);
    font-size: var(--font-size-small);
}

.add-link {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.add-link input {
    flex: 1;
    min-width: 0;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    font: inherit;
}

.add-link .button {
    padding: var(--space-1) var(--space-3);
    border: 0;
    font: inherit;
    cursor: pointer;
}

.notice.duplicate {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: baseline;
    margin-top: var(--space-2);
}



.members {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

.members-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.members h3 {
    margin: 0 0 var(--space-2);
    font-size: var(--font-size-base);
}

.member-list {
    margin: 0 0 var(--space-3);
    padding: 0;
    list-style: none;
}

.member {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1) var(--space-2);
    padding: var(--space-1) 0;
}

.member-who {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-wrap: anywhere;
}

.member-email,
.member-role {
    color: var(--color-muted);
    font-size: var(--font-size-small);
}

.member-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.inline-form {
    margin: 0;
}

.members select,
.share-form input {
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    font: inherit;
}

.share-form {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.share-form input {
    flex: 1 1 12rem;
    min-width: 0;
}

.share-form .button {
    padding: var(--space-1) var(--space-3);
    border: 0;
    font: inherit;
    cursor: pointer;
}

/* Shown while htmx waits for the server, which visits the link (up to 5 s) */
.add-link .busy {
    display: none;
    align-self: center;
    color: var(--color-muted);
    font-size: var(--font-size-small);
}

.add-link.htmx-request .busy {
    display: inline;
}

.search {
    margin-bottom: var(--space-3);
}

.search input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
}

.search .empty {
    margin: var(--space-2) 0 0;
}

/* Ordering is for mouse users only: drag a collection by its name, a link by its title */
@media (hover: hover) and (pointer: fine) {
    [data-sortable="board"] .collection-name {
        cursor: grab;
    }

    .board.searching [data-sortable="board"] .collection-name {
        cursor: auto;
    }
}

.sortable-ghost {
    opacity: 0.4;
}

.sortable-chosen .collection-name {
    cursor: grabbing;
}

/* Header: brand, search, then "New collection" and the session on the right */
.site-header {
    flex-wrap: wrap;
}

.header-search {
    width: 16rem;
    max-width: 100%;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    font: inherit;
    font-size: var(--font-size-small);
}

.button-small {
    padding: var(--space-1) var(--space-3);
    border: 0;
    font: inherit;
    font-size: var(--font-size-small);
    cursor: pointer;
}

/* Phones: the search takes its own row under the brand and buttons */
@media (max-width: 40rem) {
    .header-search {
        order: 3;
        width: 100%;
    }
}

#search-empty {
    margin: 0 0 var(--space-3);
}

.modal {
    width: min(26rem, calc(100% - 2 * var(--space-3)));
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
}

.modal::backdrop {
    background: rgb(0 0 0 / 0.4);
}

.modal h2 {
    margin: 0 0 var(--space-3);
    font-size: 1.1rem;
}

.modal label:not(.icon-choice),
.modal legend {
    display: block;
    padding: 0;
    margin-bottom: var(--space-1);
    color: var(--color-muted);
    font-size: var(--font-size-small);
}

.modal input[type="text"],
.modal input[type="search"] {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    font: inherit;
}

.modal .notice {
    margin: var(--space-2) 0 0;
}

.modal .form-actions {
    margin-top: var(--space-3);
}

.site-footer .version {
    color: var(--color-muted);
}

/* Computer-only features (PRD): hidden on touch screens */
@media not ((hover: hover) and (pointer: fine)) {
    .desktop-only {
        display: none;
    }
}

.account-delete .decision {
    margin: 0 0 var(--space-3);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.account-delete .decision.missing {
    border-color: var(--color-danger);
}

.account-delete legend {
    padding: 0 var(--space-1);
    font-weight: 600;
}

.decision-users {
    margin-left: var(--space-2);
    color: var(--color-muted);
    font-size: var(--font-size-small);
    font-weight: normal;
}

.account-delete .decision label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    margin-right: var(--space-4);
}

.account-delete #confirm-email {
    width: 100%;
    margin-top: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
}

/* Collection menu: the ⋮ button at the top right of each card */
.collection-name {
    flex: 1;
    min-width: 0;
}

.menu {
    position: relative;
    flex: none;
}

.menu-button {
    list-style: none;
    padding: 0 var(--space-2);
    border-radius: var(--radius);
    color: var(--color-muted);
    font-size: 1.2rem;
    line-height: 1.4;
    cursor: pointer;
    user-select: none;
}

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

.menu-button:hover,
.menu[open] .menu-button {
    background: var(--color-bg);
    color: var(--color-text);
}

.menu-items {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    min-width: 13rem;
    margin-top: var(--space-1);
    padding: var(--space-1) 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: 0 6px 18px rgb(0 0 0 / 0.15);
}

.menu-items form {
    margin: 0;
}

.menu-items button {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 0;
    background: none;
    color: var(--color-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.menu-items button:hover {
    background: var(--color-bg);
}

.menu-items button.danger {
    color: var(--color-danger);
}

.menu-info {
    margin: 0;
    padding: var(--space-1) var(--space-3) var(--space-2);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: var(--font-size-small);
}

/* Links: the menu sits quietly at the end of the row */
.link-menu .menu-button {
    font-size: 1rem;
}

.link:not(:hover) .link-menu:not([open]) .menu-button {
    opacity: 0.5;
}

@media not ((hover: hover) and (pointer: fine)) {
    .link:not(:hover) .link-menu:not([open]) .menu-button {
        opacity: 1;
    }
}

/* User menu: the name in the header opens it */
.user-button {
    list-style: none;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: var(--font-size-small);
    cursor: pointer;
    user-select: none;
}

.user-button::-webkit-details-marker {
    display: none;
}

.user-button::after {
    content: " \25BE";
    color: var(--color-muted);
}

.user-button:hover,
.user-menu[open] .user-button {
    background: var(--color-bg);
}

.menu-items a {
    display: block;
    padding: var(--space-2) var(--space-3);
    color: var(--color-text);
    text-decoration: none;
}

.menu-items a:hover {
    background: var(--color-bg);
}

/* On/off switch in the user menu: the track shows the state, aria-checked carries it */
.menu-items .switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.switch-track {
    position: relative;
    flex: none;
    width: 2.2rem;
    height: 1.25rem;
    border-radius: 999px;
    background: var(--color-border);
    transition: background-color 0.15s;
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(1.25rem - 4px);
    height: calc(1.25rem - 4px);
    border-radius: 50%;
    background: var(--color-surface);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
    transition: transform 0.15s;
}

.switch[aria-checked="true"] .switch-track {
    background: var(--color-accent);
}

.switch[aria-checked="true"] .switch-track::after {
    transform: translateX(0.95rem);
}

@media (prefers-reduced-motion: reduce) {
    .switch-track,
    .switch-track::after {
        transition: none;
    }
}

/* The outcome of an action on a site icon, inside its row */
.row-notice {
    display: block;
    margin-top: var(--space-1);
    color: var(--color-accent);
    font-size: var(--font-size-small);
}

.row-notice.row-error {
    color: var(--color-danger);
}

/* Account page */
.account-section {
    margin-top: var(--space-4);
}

.account-section h2 {
    font-size: 1.1rem;
}

.account-end {
    margin-top: var(--space-5);
}

.account-section label {
    display: block;
    margin: var(--space-3) 0 var(--space-1);
    color: var(--color-muted);
    font-size: var(--font-size-small);
}

.account-section input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
}

.account-section input[readonly] {
    background: var(--color-bg);
    color: var(--color-muted);
}

.account-section .fine-print {
    margin-top: var(--space-1);
}

.inline-field {
    display: flex;
    gap: var(--space-2);
}

.inline-field .button {
    border: 0;
    font: inherit;
    cursor: pointer;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: var(--space-3);
    margin: 0;
}

.stats div {
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}

.stats dt {
    color: var(--color-muted);
    font-size: var(--font-size-small);
}

.stats dd {
    margin: var(--space-1) 0 0;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Administration pages */
.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-2);
}

.admin-nav a {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius);
    color: var(--color-muted);
    text-decoration: none;
}

.admin-nav a.current {
    background: var(--color-surface);
    color: var(--color-text);
    font-weight: 600;
}

.admin-list {
    margin: var(--space-3) 0 0;
    padding: 0;
    list-style: none;
}

.admin-list li {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
}

.admin-list-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow-wrap: anywhere;
}

.icon-row {
    flex-wrap: wrap;
}

.icon-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}

.icon-actions form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.icon-actions input[type="file"] {
    max-width: 14rem;
    font-size: var(--font-size-small);
}

.pending {
    color: var(--color-danger);
}

.stats-table {
    width: 100%;
    margin-top: var(--space-3);
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.stats-table th,
.stats-table td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    text-align: right;
}

.stats-table th:first-child {
    text-align: left;
    font-weight: normal;
    color: var(--color-muted);
}

.stats-table thead th {
    color: var(--color-muted);
    font-size: var(--font-size-small);
    font-weight: 600;
}
