/* Clipboardy shared UI. No external fonts or assets (§8.5: no third-party origins). */

:root {
    color-scheme: light dark;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #1b1f24;
    --muted: #5d6673;
    --border: #d8dde3;
    --accent: #2357c6;
    --accent-text: #ffffff;
    --ok: #1f7a3f;
    --warn: #9a6200;
    --danger: #b3261e;
    /* Text on a danger fill (button.danger): white on the dark red here, dark on the light red of the dark scheme. */
    --danger-text: #ffffff;
    --radius: 8px;
    --radius-lg: 12px;
    /* Type scale and spacing: every size and gap below comes from these. */
    --fs-sm: 0.875rem;
    --fs-base: 1rem;
    --fs-lg: 1.125rem;
    --fs-xl: 1.375rem;
    --fs-2xl: 1.75rem;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --shadow-1: 0 1px 2px rgb(16 24 40 / 0.06), 0 1px 3px rgb(16 24 40 / 0.1);
    --shadow-2: 0 4px 8px rgb(16 24 40 / 0.08), 0 12px 24px rgb(16 24 40 / 0.14);
    /* The platform's own UI faces only: no font is downloaded (§8.5). */
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: var(--fs-base);
    line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14171b;
        --surface: #1d2127;
        --text: #e6e9ed;
        --muted: #9aa4b1;
        --border: #343a42;
        --accent: #7aa2ff;
        --accent-text: #0d1424;
        --ok: #6cc98d;
        --warn: #e0b04f;
        --danger: #ff8a80;
        --danger-text: #2a0b09;
        --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4), 0 1px 3px rgb(0 0 0 / 0.3);
        --shadow-2: 0 4px 8px rgb(0 0 0 / 0.45), 0 12px 24px rgb(0 0 0 / 0.5);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

.page {
    max-width: 760px;
    margin: 0 auto;
    /* Room at the bottom for the toasts, so they never cover the last control for long. */
    padding: var(--space-5) var(--space-4) calc(var(--space-6) * 3);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

h1, h2 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.02em; }

/* The router focuses each page's heading for screen readers (FocusOnNavigate): no focus box around it. */
h1:focus { outline: none; }

/* Interactive elements keep a clear ring when focused from the keyboard. */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
summary:focus-visible, [tabindex]:not([tabindex="-1"]):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Hints for a mouse or trackpad (keys, drag and drop), and for touch screens (tap, long-press). */
.touch-only { display: none; }

@media (hover: none) and (pointer: coarse) {
    .pointer-only { display: none !important; }
    .touch-only { display: revert; }
}
h2 { font-size: var(--fs-lg); font-weight: 650; }
h2 .icon { color: var(--muted); }

a { color: var(--accent); }

.lead, .hint, .meta { color: var(--muted); }
.lead { font-size: var(--fs-lg); margin: 0; }
.hint { font-size: var(--fs-sm); margin: 0; }
.meta { font-size: var(--fs-sm); }

/* The inline SVG icons (Icon.razor): sized by the text around them, drawn in its colour. */
.icon {
    width: 1.25em;
    height: 1.25em;
    flex: none;
    vertical-align: -0.25em;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* A modal dialog and its title take the focus when it opens (ModalDialog), without a ring: the ring is for controls. */
.dialog:focus,
.dialog h2:focus {
    outline: none;
}

button {
    font: inherit;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--accent-text);
    cursor: pointer;
    min-height: 44px;
}

button.secondary {
    background: transparent;
    color: var(--accent);
}

button.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--danger-text);
}

button:disabled { opacity: 0.55; cursor: default; }
button .icon { width: 1.125em; height: 1.125em; }

input[type=text], input[type=password], input[type=datetime-local], textarea, select {
    font: inherit;
    min-height: 44px;
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

textarea { resize: vertical; }

label { font-weight: 600; }
label.check { font-weight: normal; display: inline-flex; gap: 8px; align-items: center; min-height: 44px; }

.error { color: var(--danger); }
.notice { color: var(--muted); margin: 0; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.75rem;
    padding: 1px var(--space-2);
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    white-space: nowrap;
}

.badge.verified { color: var(--ok); border-color: var(--ok); }
.badge.unverified { color: var(--warn); border-color: var(--warn); }
.badge.authority { color: var(--accent); border-color: var(--accent); }
.badge .icon { width: 1.1em; height: 1.1em; }

.fingerprint {
    font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
    font-size: var(--fs-sm);
    word-spacing: 0.2em;
}

.join-form, .text-form, .inline-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invite-host { margin: 0 0 4px; color: var(--muted); }
.invite-host .host {
    display: block;
    font-size: 1.6rem;
    line-height: 1.2;
    color: var(--text);
    overflow-wrap: anywhere;
}

.open-in-app-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin: 0; }

.admin-servers { margin: 0; padding-left: 1.2em; }
.admin-servers a { overflow-wrap: anywhere; }

.inline-form { flex-direction: row; }
.inline-form input { flex: 1; }

/* A secret's field with its Show/Hide toggle. */
.secret-field { display: flex; flex: 1; gap: 8px; min-width: 0; }
.secret-field input { flex: 1; min-width: 0; }

.scanner {
    width: 100%;
    max-height: 320px;
    border-radius: var(--radius);
    background: #000;
}

/* The room's header: its name, the connection, and the Info button that opens the room info. */
.room-head { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.room-head h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-id { font-family: ui-monospace, Menlo, Consolas, monospace; }

.connection { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.connection .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.connection.connected .dot { background: var(--ok); }
.connection.reconnecting .dot, .connection.pending .dot { background: var(--warn); }
.connection.offline .dot { background: var(--danger); }

/* On a phone the dot speaks for itself: its words stay for screen readers (role=status) and as its title. */
@media (max-width: 480px) {
    .connection-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

.banner {
    margin: 0;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left-width: 4px;
}

.banner.warning { border-color: var(--warn); }
.banner.warning > .icon { color: var(--warn); }
.banner.error { border-color: var(--danger); }

/* Sections as cards. */
.home > section, .join .pending, .invite-result, .share-area, .approval-banner, .page > .help-panel, .item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    padding: var(--space-4);
}

.home > section { display: flex; flex-direction: column; gap: var(--space-3); }

/* The version of the running client, the last line of the start page. No card; selectable, to copy it into a report. */
.app-version { color: var(--muted); font-size: var(--fs-sm); text-align: center; margin: var(--space-4) 0 0; user-select: text; }

/* The composer (ShareArea): Paste & send first, then the text box with Send, the file button and the options chip. */
.share-area { display: flex; flex-direction: column; gap: var(--space-3); }
.share-area.dragging { outline: 2px dashed var(--accent); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

.primary-action { min-height: 52px; font-size: var(--fs-lg); }
.paste.primary-action { width: 100%; }

.share-area textarea {
    min-height: calc(2lh + 18px);
    max-height: 40vh;
    resize: none;
    field-sizing: content;
}

/* Without a Paste button (Firefox, Safari) the text box is where to paste: it stands out as the primary action would. */
.share-area textarea.prominent {
    border: 2px solid var(--accent);
    min-height: calc(3lh + 18px);
}

/* Where it is the composer's only prompt: the accent at full strength (4.5:1 needs it; browsers dim placeholders otherwise). */
.share-area textarea.prominent::placeholder { color: var(--accent); opacity: 1; }

.composer-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.composer-row .send.primary-action { flex: 1 1 100%; }

.file-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    border: 1px solid var(--accent);
    color: var(--accent);
    cursor: pointer;
}

.file-button:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-button .icon { width: 1.125em; height: 1.125em; }

/* Popovers: the options chip's under the chip (always at the composer's right edge), the trust mark's across its card under
   the head line, so neither leaves the page on a phone. */
.options { position: relative; display: inline-flex; margin-left: auto; }
.trust { display: inline-flex; }

.popover {
    position: absolute;
    top: calc(100% + var(--space-1));
    z-index: 5;
    width: max-content;
    max-width: min(320px, calc(100vw - 2 * var(--space-4)));
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    font-weight: normal;
    font-size: var(--fs-sm);
}

.options-popover { right: 0; }
.options-popover select { width: 100%; }
.trust-popover {
    top: calc(var(--space-4) + 44px + var(--space-1));
    left: var(--space-3);
    right: var(--space-3);
    width: auto;
    max-width: none;
}
.trust-sentence { display: block; }

.options-chip { white-space: nowrap; }

progress { width: 100%; }

.approval-banner { border-color: var(--accent); display: flex; flex-direction: column; gap: var(--space-3); }
.approval-banner .request > p:first-child > .icon { color: var(--accent); margin-right: var(--space-1); }
.approval-banner p { margin: 0; }
.approval-banner .label { unicode-bidi: isolate; }
.request { display: flex; flex-direction: column; gap: 6px; }

/* The history: compact cards, the newest one larger. */
.item-list { display: flex; flex-direction: column; gap: var(--space-3); }
.item { position: relative; display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.item.is-unverified { border-color: var(--warn); }
.item.failed { opacity: 0.75; }
.item-head { display: flex; gap: var(--space-1) var(--space-2); align-items: center; min-width: 0; }
.item-head > * { flex: none; }
.kind-icon { color: var(--muted); }
.item-head .read-once { color: var(--accent); }
.item-meta { margin: 0; }
.signature-warning > .icon { color: var(--danger); }
.sealed-text > .icon { color: var(--muted); }

/* A sender's label is another device's claim: isolated (<bdi>), on one line, cut with an ellipsis. */
.item-head > .sender {
    flex: 0 1 auto;
    min-width: 0;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    unicode-bidi: isolate;
}

.trust-mark {
    min-width: 44px;
    padding: 0 var(--space-2);
    gap: var(--space-1);
    background: transparent;
    border-color: transparent;
    color: var(--muted);
    font-size: var(--fs-sm);
}

.trust-mark.verified { color: var(--ok); }
.trust-mark.unverified, .trust-mark.former, .trust-mark.late-epoch { color: var(--warn); }
.trust-mark.signature-invalid { color: var(--danger); }
.trust-mark.signature-pending .trust-words { border-bottom: 1px dashed currentColor; }
.trust-mark[aria-expanded=true] { border-color: currentColor; }

.item.latest { border-color: var(--accent); box-shadow: var(--shadow-2); }
.item.latest .preview { font-size: var(--fs-base); max-height: 18em; }
.item.latest .actions .copy { flex: 1 1 100%; min-height: 52px; font-size: var(--fs-lg); }

/* An item that came in while the page was open lights up for 2 s. */
.item.arrived { animation: item-arrived 2s ease-out; }

@keyframes item-arrived {
    from { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
    to { background: var(--surface); }
}

@media (prefers-reduced-motion: reduce) {
    .item.arrived { animation: none; }
}

.preview {
    margin: 0;
    max-height: 12em;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: var(--fs-sm);
}

/* Its own size at most, never stretched by the card's column: a flex item would otherwise fill the width and, held at the
   maximum height, lose its aspect ratio. */
.preview-image { align-self: flex-start; width: auto; height: auto; max-width: 100%; max-height: 320px; object-fit: contain; border-radius: 4px; }
.file { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; align-items: baseline; }
.file-name { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.sealed-text { margin: 0; font-style: italic; }

.member-list ul, .room-list, .recipients { list-style: none; margin: 0; padding: 0; }
.member-list li, .recipients li {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: baseline;
    padding: 8px 0;
    border-top: 1px solid var(--border);
}

.member-list li.unverified .label { opacity: 0.7; }
.member-list .label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    unicode-bidi: isolate;
}
.member-list .fingerprint { flex-basis: 100%; overflow-wrap: anywhere; }
.member-list ul { margin-top: var(--space-2); }

.room-list li {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) 0;
    border-top: 1px solid var(--border);
}

.room-list li:first-child { border-top: none; }
.room-list a { display: flex; flex: 1; min-width: 0; gap: var(--space-3); align-items: center; text-decoration: none; min-height: 44px; }
.room-list .room-icon { color: var(--accent); width: 1.5em; height: 1.5em; }
.room-text { display: flex; flex-direction: column; min-width: 0; }
.room-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-text .room-title { font-weight: 600; }

/* The room's name (§5.3): text from the room's authorities, isolated in a <bdi>; a long one ends in an ellipsis. */
.room-name { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* The share page ("Share to Clipboardy"): what is shared, then the remembered rooms as rows to choose, then the send step. */
.share > section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    min-width: 0;
}

.share h2 { margin: 0; font-size: var(--fs-lg); min-width: 0; }
.share-text {
    margin: 0;
    max-height: 12em;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: var(--fs-sm);
}

.share-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.share-files li { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; min-width: 0; }
.share-files .icon { color: var(--accent); flex: none; }
.share-preview .refused { margin: 0; }

.room-list button.share-room {
    display: flex;
    flex: 1;
    min-width: 0;
    gap: var(--space-3);
    align-items: center;
    justify-content: flex-start;
    text-align: start;
    font-weight: normal;
    min-height: 44px;
    padding: var(--space-2);
    background: transparent;
    border-color: transparent;
    color: var(--text);
}

.room-list button.share-room:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.room-list button.share-room .room-icon { flex: none; }
.share-send { display: flex; flex-direction: column; gap: var(--space-3); }
.share-send .error { margin: 0; }
.share-send-button { flex: 1 1 auto; }
.share-send progress { width: 100%; }

.help-panel summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; gap: var(--space-2); align-items: center; list-style: none; }
/* A flex summary loses the browser's disclosure triangle: a chevron says it opens, and turns when it is open. */
.help-panel summary::-webkit-details-marker { display: none; }
.help-panel summary::before {
    content: "";
    flex: none;
    width: 0.45em;
    height: 0.45em;
    margin: 0 0.15em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
}
.help-panel[open] > summary::before { transform: rotate(45deg); }
.help-panel li { margin: 6px 0; }

.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    padding: 24px 16px;
    /* Above the page's popovers, below the toasts. */
    z-index: 15;
}

.dialog {
    width: 100%;
    max-width: 640px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* The room info panel. */
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.dialog-head .close { width: 44px; padding: 0; color: var(--muted); border-color: transparent; }
.room-info > .member-list, .room-info > .switches, .room-info > .actions, .room-info > .help-panel {
    border-top: 1px solid var(--border);
    padding-top: var(--space-3);
}
.room-info p { margin: 0; }
.this-device { display: flex; flex-direction: column; gap: var(--space-1); }
.this-device .fingerprint { overflow-wrap: anywhere; }
.switches { display: flex; flex-direction: column; gap: var(--space-2); }
.room-info > .watch-controls {
    border-top: 1px solid var(--border);
    padding-top: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.watch-controls h3 { margin: 0; font-size: var(--fs-base); }
.watch-controls .watch-indicator { margin: 0; max-width: none; }

/* The clipboard watch indicator (D§7.1): always visible while the watch runs, at the head of every window. */
.watch-indicator {
    max-width: 760px;
    margin: var(--space-3) auto 0;
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.watch-indicator.paused { border-left-color: var(--warn); }
.watch-indicator.blocked { border-left-color: var(--danger); }
.watch-indicator p { margin: 0; }
.watch-indicator .watch-line { display: flex; align-items: center; gap: var(--space-2); min-width: 0; font-weight: 600; }
.watch-indicator .watch-line > .icon { color: var(--accent); flex: none; }
.watch-indicator.paused .watch-line > .icon { color: var(--warn); }
.watch-indicator .room-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: isolate; }
.watch-indicator .watch-sends, .watch-indicator .watch-reason, .watch-indicator .watch-skip { color: var(--muted); font-size: var(--fs-sm); }
.watch-indicator .watch-held { display: flex; flex-direction: column; gap: var(--space-2); }
.watch-indicator .watch-held-preview { font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; letter-spacing: 0.05em; }

.qr { width: 220px; height: 220px; align-self: center; background: #fff; padding: 8px; border-radius: 4px; }
.link code { word-break: break-all; }

/* Admin screens (§9.1). */

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.admin-nav a { display: inline-flex; align-items: center; min-height: 44px; }
.admin-nav .sign-out { margin-left: auto; }

.room-settings { display: flex; flex-direction: column; gap: 8px; }

.settings-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.settings-fields legend { font-weight: 600; padding: 0 4px; }

input[type=number] {
    font: inherit;
    min-height: 44px;
    width: 10em;
    padding: 8px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 16px;
    margin: 0;
}

.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.danger-zone {
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invite-link {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.copy-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.copy-row code { flex: 1; min-width: 12em; word-break: break-all; }
.copy-label { font-weight: 600; min-width: 8em; }

/* On a phone the dates and counts go below the room's id instead of squeezing both into narrow columns. */
.admin-rooms a { flex-wrap: wrap; gap: 0 var(--space-3); padding: var(--space-1) 0; }
.admin-rooms .room-id { white-space: nowrap; font-weight: 600; }
.admin-rooms li.closed a { opacity: 0.6; }

.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: baseline;
    padding: 8px 0;
    border-top: 1px solid var(--border);
}
.admin-list .name { font-weight: 600; }
.admin-list .meta { flex: 1; }
.invite-link { flex: 1; min-width: 12em; }

.audit-log { width: 100%; border-collapse: collapse; }
.audit-log th, .audit-log td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--border); }

/* The new-release bar of js/sw-register.js (§9.2): outside the app's root, fixed at the bottom. */
.app-update {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 4px 16px rgb(0 0 0 / 0.15);
    z-index: 10;
}
/* The toasts (ToastHost.razor): bottom-centred, stacked, above the page and its dialogs. */
.toast-host {
    position: fixed;
    left: 50%;
    bottom: var(--space-4);
    transform: translateX(-50%);
    width: min(480px, calc(100% - 2 * var(--space-4)));
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    z-index: 20;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4);
    min-height: 52px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    animation: toast-in 160ms ease-out;
}

.toast.success { border-left-color: var(--ok); }
.toast.success > .icon { color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast.error > .icon { color: var(--danger); }
.toast-message { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.toast-action, .toast-close {
    background: transparent;
    border-color: transparent;
    color: var(--accent);
}

.toast-close { color: var(--muted); width: 44px; padding: 0; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .toast { animation: none; }
}

/* The static splash in index.html's #app (no script, no inline style): shown until the app's first render replaces it. */
.splash {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px;
}

.splash-logo { width: 72px; height: 72px; border-radius: 16px; }
.splash-name { margin: 0; font-size: var(--fs-2xl); font-weight: 600; color: var(--text); }

.splash-bar {
    position: relative;
    width: 160px;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    background: var(--border);
}

.splash-bar::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40%;
    border-radius: 2px;
    background: var(--accent);
    animation: splash-slide 1.2s ease-in-out infinite;
}

@keyframes splash-slide {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
    .splash-bar::before { animation: none; width: 100%; opacity: 0.5; }
}

/* The desktop settings page (D§4.3): one card per area; the room lists as on the share page, with a choose button per row. */
.desktop-settings > .settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
}
.desktop-settings p { margin: 0; }
.desktop-settings .switch { display: flex; flex-direction: column; gap: var(--space-1); }
.desktop-settings .field { display: flex; flex-direction: column; gap: var(--space-1); }
.desktop-settings .field input[type=number] { max-width: 10em; }
.desktop-settings .room-list li.chosen .room-title { color: var(--accent); }
.desktop-settings .room-list li > button { width: auto; flex: none; }
.desktop-settings .room-text { flex: 1; }
.desktop-settings .watch-indicator { margin: 0; max-width: none; }
.desktop-settings label.check.nested { padding-inline-start: var(--space-5); }
.desktop-settings .actions > button, .paste-ack .actions > button { width: auto; }
.first-press { display: flex; flex-direction: column; gap: var(--space-3); }
.quick-room-current { min-width: 0; overflow-wrap: anywhere; }

/* The shortcut recorder (D§6.1): the chord as keys, the capture field, and the paste-chord acknowledgement. */
.shortcut-recorder { display: flex; flex-direction: column; gap: var(--space-2); }
.shortcut-recorder > button { width: auto; align-self: flex-start; }
.chord-recording { display: flex; flex-direction: column; gap: var(--space-1); }
.chord-recording > button { width: auto; align-self: flex-start; }
kbd {
    font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
    font-size: var(--fs-sm);
    padding: 1px var(--space-2);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    white-space: nowrap;
}
.paste-ack, .hotkey-ack { display: flex; flex-direction: column; gap: var(--space-2); }

/* The audience confirmation (D§4.3, D§7.1): the room, its verified members, what the background send may do. */
.audience-confirm p { margin: 0; }
.audience-room { min-width: 0; overflow-wrap: anywhere; }
.audience-members { list-style: none; margin: 0; padding: 0; }
.audience-members li {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: baseline;
    padding: var(--space-2) 0;
    border-top: 1px solid var(--border);
}
.audience-members .label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: isolate; }
.audience-members .fingerprint { flex-basis: 100%; overflow-wrap: anywhere; }
.audience-confirm .actions > button { width: auto; }
.room-info > .shortcut-controls {
    border-top: 1px solid var(--border);
    padding-top: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.shortcut-controls h3 { margin: 0; font-size: var(--fs-base); }

/* The quick popup (/quick, D§5.1): a narrow, dense column. "Shortcut sends to", the viewed room with Paste & send and its newest
   five items as compact cards, the room chooser, then Open Clipboardy and Settings. Compact changes sizes only: trust marks, the
   unverified border, the read-once placeholder and the signature warning are the room page's. */
.page.quick { max-width: none; padding: var(--space-3); gap: var(--space-3); }
.page.quick:focus { outline: none; }
.quick .watch-indicator { margin: 0; max-width: none; padding: var(--space-2) var(--space-3); }
.quick > section { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.quick p { margin: 0; }
.quick-shortcut { overflow-wrap: anywhere; }
.quick-shortcut > button, .quick .actions > button { width: auto; }
.quick-viewed-head { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.quick-viewed-head h2 { flex: 1; min-width: 0; font-size: var(--fs-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Who Paste & send goes to: the count and the labels always, the fingerprint words when opened. */
.quick-members { min-width: 0; font-size: var(--fs-sm); }
.quick-members summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 2px var(--space-2); align-items: baseline; min-height: 32px; }
.quick-members summary .quick-members-count { color: var(--muted); }
.quick-members summary .label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: isolate; }
.quick-members-changed { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; font-size: var(--fs-sm); }
.quick-members-changed > p { flex: 1 1 12em; }
.quick-members-changed > button { width: auto; }
.quick-viewed .paste-send { flex: 1 1 auto; }
.quick-result-box { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.quick-result { color: var(--muted); font-size: var(--fs-sm); }
.quick .room-list li.chosen .room-title { color: var(--accent); }
.quick .room-list li > button { width: auto; flex: none; }
.quick .room-text { flex: 1; }
.quick-footer { border-top: 1px solid var(--border); padding-top: var(--space-2); }
.item-list.compact { gap: var(--space-2); }
.item.compact { padding: var(--space-2) var(--space-3); gap: var(--space-1); box-shadow: none; }
.item.compact .preview, .item.compact.latest .preview { max-height: 4.5em; font-size: var(--fs-sm); }
.item.compact .preview-image { max-height: 96px; }
.item.compact.latest { box-shadow: var(--shadow-1); }
.item.compact.latest .actions .copy { flex: none; min-height: 44px; font-size: var(--fs-base); }
.item.compact .item-meta { font-size: var(--fs-sm); }
