/* MiniBank's block world (docs/superpowers/specs/2026-11-23-landing-page-design.md). The pixel face is for headings and
   big numbers only; everything else is Rubik. App pages sit on the sky with cream panels outlined in ink; the ground
   (grass over dirt) is the footer. The pixel art comes from tools/pixel-art/generate.py, in the same colours as here. */
:root {
    --sky-hi: #4FA8EC;
    --sky-mid: #6DBDF5;
    --sky-lo: #92D2FB;
    --cloud: #FFFFFF;
    --grass: #5DBA3B;
    --grass-dark: #3C8A24;
    --grass-light: #86D45A;
    --dirt: #8A5A35;
    --dirt-dark: #74492A;
    --stone: #9BA1A8;
    --stone-light: #C9CDD2;
    --stone-dark: #7C828A;
    --deep: #363940;
    --deep-dark: #2C2F35;
    --deep-light: #40434B;
    --bed: #1F2025;
    --bed-dark: #17181C;
    --gold: #FFC83A;
    --gold-dark: #D08B10;
    --gold-light: #FFE58C;
    --fine: #D93A30;
    --fine-dark: #9E241C;
    --fine-light: #FF8A7E;
    --fine-wash: #FFE1DC;
    --bonus: #2F7D1E;
    --bonus-light: #8EE06A;
    --ink: #1C1F25;
    --ink-soft: #3A4350;
    --cream: #FFF5E1;
    --cream-dark: #E7D6AE;
    --white: #FFFFFF;
    --paper: #E6E3D8;
    --paper-ink: #22211D;

    --font-display: "Pixelify Sans", ui-monospace, "Cascadia Mono", monospace;
    --font-body: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-code: ui-monospace, "Cascadia Mono", Consolas, monospace;

    /* A block: an ink outline and a bevel, light on the top left and dark on the bottom right. */
    --outline: 4px solid var(--ink);
    --focus: var(--ink);
    --gutter-l: max(16px, env(safe-area-inset-left, 0px));
    --gutter-r: max(16px, env(safe-area-inset-right, 0px));
    color-scheme: light;
}

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

html {
    scrollbar-color: var(--stone-dark) var(--sky-lo);
}

html,
body {
    margin: 0;
    background: var(--sky-lo);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.55;
    font-variant-ligatures: none;
    -webkit-font-smoothing: antialiased;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

::selection {
    background: var(--gold);
    color: var(--ink);
}

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

.page {
    flex: 1 0 auto;
    width: 100%;
    max-width: 40rem;
    margin: 0 auto;
    padding: 3.5rem var(--gutter-r) 5rem var(--gutter-l);
}

h1 {
    margin: 0 0 1rem;
    font-family: var(--font-display);
    font-size: clamp(2.3rem, 7vw, 3.4rem);
    font-weight: 700;
    line-height: 1;
    text-wrap: balance;
}

h2,
h3 {
    text-wrap: balance;
}

/* A small caption over a list or a title. */
.label {
    margin: 0 0 0.75rem;
    color: var(--ink-soft);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

a {
    color: var(--ink);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.2em;
}

a:hover {
    text-decoration-color: var(--gold-dark);
}

/* Once a label font; now the body face, keeping figures in columns. */
.mono {
    font-family: var(--font-body);
    font-variant-numeric: tabular-nums;
}

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

/* ---- Header (Components/Layout/SiteHeader): the wordmark on the deeper sky, the account on the right. It wraps at
   phone width, so a long email never pushes the row past the screen. ---- */
.site-header {
    background: var(--sky-hi);
    border-bottom: 4px solid color-mix(in srgb, var(--sky-hi) 80%, var(--ink));
}

.site-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    max-width: 74rem;
    margin: 0 auto;
    padding: 0.9rem var(--gutter-r) 0.9rem var(--gutter-l);
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}

.wordmark::before {
    content: "";
    flex: none;
    width: 36px;
    height: 36px;
    background: url("/img/pixel/coin.png") 0 0 / 100% 100%;
    image-rendering: pixelated;
}

.site-pagenav {
    display: none;
    gap: 1.6rem;
    font-weight: 600;
}

.site-pagenav a {
    text-decoration: none;
}

.site-pagenav a:hover {
    text-decoration: underline;
}

.site-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 0.9rem;
    min-width: 0;
}

.header-email {
    font-size: 0.95rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.signout-form {
    display: inline-flex;
    margin: 0;
}

@media (min-width: 64rem) {
    .site-pagenav {
        display: flex;
    }
}

@media (max-width: 30rem) {
    .site-header-inner {
        gap: 0.75rem 1rem;
    }

    .wordmark {
        font-size: 1.4rem;
    }

    .wordmark::before {
        width: 30px;
        height: 30px;
    }
}

/* ---- Footer (Components/Layout/SiteFooter): grass over dirt. ---- */
.site-footer {
    flex: none;
    color: var(--cream);
    --focus: var(--gold-light);
}

.site-footer-grass {
    height: 64px;
    background: url("/img/pixel/edge-grass.png") repeat-x 0 0 / 64px 64px;
    image-rendering: pixelated;
}

.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 2rem;
    padding: 1.25rem var(--gutter-r) 2rem var(--gutter-l);
    background: var(--dirt) url("/img/pixel/tex-dirt.png") 0 0 / 64px 64px;
    image-rendering: pixelated;
    font-size: 0.95rem;
}

.site-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

/* The slogan above the copyright: Rubik, since the pixel face is for headings only. */
.site-footer-brand {
    display: grid;
    gap: 0.15rem;
}

.site-footer-slogan {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--gold-light);
}

.site-footer a {
    color: var(--cream);
}

.site-footer-mail {
    user-select: all;
}

/* ---- Blocks: buttons, tabs, the switch ---- */
.btn,
.header-signout {
    --bg: var(--stone-light);
    --hi: #E8EAED;
    --lo: var(--stone);
    --fg: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    min-height: 3rem;
    padding: 0.5rem 1.25rem;
    border: var(--outline);
    border-radius: 0;
    background: var(--bg);
    box-shadow: inset 4px 4px 0 var(--hi), inset -4px -4px 0 var(--lo);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover,
.header-signout:hover {
    filter: brightness(1.06);
}

.btn:active,
.header-signout:active {
    box-shadow: inset 4px 4px 0 var(--lo), inset -4px -4px 0 var(--hi);
    transform: translateY(2px);
}

.btn-primary {
    --bg: var(--gold);
    --hi: var(--gold-light);
    --lo: var(--gold-dark);
}

/* Deleting: a red block. The confirmation pages' main button and the Settings tab's Delete wallet. */
.btn-danger,
.confirm .btn-primary,
.settings-delete {
    --bg: var(--fine-dark);
    --hi: #C4473C;
    --lo: #6E1812;
    --fg: var(--cream);
}

.btn-block {
    width: 100%;
}

.btn-sm,
.header-signout {
    min-height: 2.5rem;
    padding: 0.35rem 0.85rem;
    border-width: 3px;
    box-shadow: inset 3px 3px 0 var(--hi), inset -3px -3px 0 var(--lo);
    font-size: 0.95rem;
}

.btn-sm:active,
.header-signout:active {
    box-shadow: inset 3px 3px 0 var(--lo), inset -3px -3px 0 var(--hi);
}

.btn-big {
    min-height: 3.75rem;
    padding: 0.6rem 1.6rem;
    font-size: 1.2rem;
}

/* Sending state, set by js/forms.js between Send and the redirect. */
.btn-send:disabled {
    cursor: progress;
    filter: saturate(0.6);
}

.spinner {
    display: inline-block;
    width: 0.8rem;
    height: 0.8rem;
    margin-right: 0.6rem;
    vertical-align: -1px;
    border: 3px solid color-mix(in srgb, var(--ink) 25%, transparent);
    border-top-color: var(--ink);
    animation: spin 0.8s steps(4) infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    /* The spinner is feedback, not decoration: stopping it altogether reads as a stuck page, so it keeps turning
       here, slowly enough not to draw the eye. */
    .spinner {
        animation-duration: 2.4s;
    }
}

/* Tabs: blocks side by side; the open one is gold. */
.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 3px solid var(--ink);
    background: var(--ink);
    gap: 3px;
}

.tab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.3rem 0.5rem;
    background: var(--stone-light);
    box-shadow: inset 3px 3px 0 #E8EAED, inset -3px -3px 0 var(--stone);
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.tab:hover {
    filter: brightness(1.05);
}

.tab-on {
    background: var(--gold);
    box-shadow: inset 3px 3px 0 var(--gold-light), inset -3px -3px 0 var(--gold-dark);
    font-weight: 700;
}

/* The header's User | Admin switch (Components/Layout/AdminSwitch): two blocks; the area you are in is gold. */
.admin-switch {
    display: inline-flex;
    border: 3px solid var(--ink);
    background: var(--ink);
    gap: 3px;
}

.admin-switch-side {
    display: inline-flex;
    align-items: center;
    min-height: 2.2rem;
    padding: 0 0.8rem;
    background: var(--stone-light);
    box-shadow: inset 3px 3px 0 #E8EAED, inset -3px -3px 0 var(--stone);
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}

.admin-switch-on {
    background: var(--gold);
    box-shadow: inset 3px 3px 0 var(--gold-light), inset -3px -3px 0 var(--gold-dark);
    font-weight: 700;
}

/* ---- Panels: cream, outlined in ink, bevelled ---- */
.account-panel,
.wallet-panel,
.admin-panel,
.wallet-master,
.admin-master {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
    padding: 1.75rem;
    border: var(--outline);
    background: var(--cream);
    box-shadow: inset 5px 5px 0 var(--white), inset -5px -5px 0 var(--cream-dark);
}

/* The account pages: one panel on the right of the split; its forms stack at the same gap. */
.account-panel {
    width: 30rem;
    max-width: 100%;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin: 0;
}

.form-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.25rem 1rem;
    padding-bottom: 0.9rem;
    border-bottom: 3px dashed var(--cream-dark);
}

/* The old design's path captions ("account/ · sent") belong to its look, not this one. */
.form-head .label {
    display: none;
}

.form-title,
.wallet-panel-title,
.admin-panel-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.panel-text {
    margin: 0;
}

/* ---- Forms ---- */
.fld {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.fld-label {
    display: block;
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 600;
}

.fld-label i {
    font-style: normal;
    color: var(--fine-dark);
}

.in {
    display: block;
    width: 100%;
    height: 3rem;
    padding: 0 0.9rem;
    border: 3px solid var(--ink);
    border-radius: 0;
    background: var(--white);
    box-shadow: inset 3px 3px 0 #E4E7EA;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: normal;
}

.in::placeholder {
    color: #6A717C;
}

.in:focus {
    outline: 3px solid var(--gold-dark);
    outline-offset: 2px;
}

.in-static {
    display: flex;
    align-items: center;
    min-height: 3rem;
    padding: 0.4rem 0.9rem;
    border: 3px dashed var(--cream-dark);
    color: var(--ink-soft);
    font-size: 1rem;
    overflow-wrap: anywhere;
}

.in-wrap {
    position: relative;
}

.in-wrap .in {
    padding-right: 4.5rem;
}

.pw-toggle {
    position: absolute;
    top: 0;
    right: 0.9rem;
    height: 3rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.2em;
    cursor: pointer;
}

.chk {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.chk .bx {
    flex: none;
    width: 1.3rem;
    height: 1.3rem;
    border: 3px solid var(--ink);
    background: var(--white);
}

.chk:has(input:checked) .bx {
    background: var(--gold);
    box-shadow: inset 3px 3px 0 var(--gold-light), inset -3px -3px 0 var(--gold-dark);
}

.chk:has(input:focus-visible) .bx {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.account-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem 1rem;
}

.account-link {
    font-size: 0.95rem;
    font-weight: 500;
}

.account-note {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.92rem;
    line-height: 1.6;
}

.validation-message {
    margin: 0;
    color: var(--fine-dark);
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.5;
}

.form-error {
    padding: 0.7rem 0.9rem;
    border: 3px solid var(--fine-dark);
    background: var(--fine-wash);
}

/* Honeypot: off-screen for people, present for bots. */
.hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---- The slider puzzle (CaptchaField). The pictures come from the captcha service. ---- */
.captcha-stage {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 3px solid var(--ink);
    background: var(--sky-lo);
}

.captcha-bg {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
}

.captcha-piece {
    position: absolute;
    left: 0;
    height: auto;
    image-rendering: pixelated;
    touch-action: none;
    user-select: none;
    cursor: grab;
}

.captcha-piece:active {
    cursor: grabbing;
}

.captcha-slider {
    display: block;
    width: 100%;
    height: 1.6rem;
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.captcha-slider::-webkit-slider-runnable-track {
    height: 8px;
    border: 2px solid var(--ink);
    background: var(--stone-light);
}

.captcha-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.6rem;
    height: 1.6rem;
    margin-top: calc(-0.8rem + 2px);
    border: 3px solid var(--ink);
    border-radius: 0;
    background: var(--gold);
}

.captcha-slider::-moz-range-track {
    height: 8px;
    border: 2px solid var(--ink);
    background: var(--stone-light);
}

.captcha-slider::-moz-range-thumb {
    width: 1.3rem;
    height: 1.3rem;
    border: 3px solid var(--ink);
    border-radius: 0;
    background: var(--gold);
}

.captcha-noscript {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

/* ---- Check your inbox (SentPage): resend and start again ---- */
.sent-rows {
    display: flex;
    flex-direction: column;
    border-top: 3px dashed var(--cream-dark);
}

.sent-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem 1rem;
    padding: 0.8rem 0;
    border-bottom: 3px dashed var(--cream-dark);
}

.sent-row .mono {
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.sent-row form {
    margin: 0;
}

.sent-action {
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.2em;
    cursor: pointer;
}

.sent-action:hover {
    text-decoration-color: var(--gold-dark);
}

.sent-status {
    color: var(--ink);
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* Signed in (MemberArea): the one panel, as wide as the column. */
.member-card {
    width: 100%;
}

.in-static.account-email {
    color: var(--ink);
    font-weight: 500;
}

@media (max-width: 30rem) {
    .account-panel,
    .wallet-panel,
    .admin-panel,
    .wallet-master,
    .admin-master {
        padding: 1.25rem;
    }
}

/* ---- Wide pages: the account split, the user area and the admin widen the page column ---- */
.page:has(.account-hero),
.page:has(.user),
.page:has(.admin) {
    max-width: 68rem;
    padding-top: 3rem;
}

/* ---- Admin area (Components/Pages/Admin) ---- */
.admin {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.admin-head .label {
    margin-bottom: 0.4rem;
}

.admin-title {
    margin: 0;
}

/* Master-detail: the list on the left, the selected user on the right; one column below 52rem. */
.admin-split,
.wallets-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 30rem);
    gap: 1.5rem;
    align-items: start;
}

.admin-search {
    margin: 0;
}

.admin-users-head,
.wallet-list-head {
    padding-bottom: 0.6rem;
    border-bottom: 3px dashed var(--cream-dark);
}

.admin-users-head .label,
.wallet-list-head .label {
    margin: 0;
}

.admin-users,
.wallet-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* A row in a list (a user, a wallet, a device): a flat block; the open one is gold. */
.admin-user,
.wallet-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.7rem 0.85rem;
    border: 3px solid transparent;
    color: var(--ink);
    font-size: 1rem;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.admin-user:hover,
.wallet-row:hover {
    border-color: var(--ink);
    background: var(--white);
}

.admin-user-on,
.wallet-row-on,
.admin-user-on:hover,
.wallet-row-on:hover {
    border-color: var(--ink);
    background: var(--gold);
    box-shadow: inset 3px 3px 0 var(--gold-light), inset -3px -3px 0 var(--gold-dark);
    font-weight: 600;
}

.admin-user:focus-visible,
.wallet-row:focus-visible {
    outline-offset: 1px;
}

.admin-hint,
.admin-count,
.wallet-hint,
.history-count {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* As many equal columns as the panel has tabs. */
.admin-panel-tabs {
    grid-template-columns: none;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
}

.admin-info {
    display: flex;
    flex-direction: column;
    margin: 0;
    border-top: 3px dashed var(--cream-dark);
}

.admin-info-row {
    display: grid;
    grid-template-columns: 8rem minmax(0, 1fr);
    gap: 0.25rem 1rem;
    padding: 0.75rem 0;
    border-bottom: 3px dashed var(--cream-dark);
}

.admin-info dt {
    color: var(--ink-soft);
    font-size: 0.9rem;
    font-weight: 600;
}

.admin-info dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.admin-muted {
    color: var(--ink-soft);
}

@media (max-width: 52rem) {
    .admin-split {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Stacked, an open panel comes before the list, so picking a user shows them without scrolling past it. */
    .admin-detail-col:has(.admin-panel) {
        order: -1;
    }
}

@media (max-width: 30rem) {
    .admin-info-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---- User area (Components/Shared/UserShell, UserNav; Components/Pages/Wallets) ---- */

/* The frame: the nav on the left, the page on the right; below 56rem the nav is a row above the page. */
.user {
    display: grid;
    grid-template-columns: 10rem minmax(0, 1fr);
    gap: 1.75rem;
}

.user-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-nav-link {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.3rem 0.9rem;
    border: 3px solid var(--ink);
    background: var(--stone-light);
    box-shadow: inset 3px 3px 0 #E8EAED, inset -3px -3px 0 var(--stone);
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}

.user-nav-link:hover {
    filter: brightness(1.05);
}

/* The section you are in: gold. */
.user-nav-link[aria-current] {
    background: var(--gold);
    box-shadow: inset 3px 3px 0 var(--gold-light), inset -3px -3px 0 var(--gold-dark);
    font-weight: 700;
}

/* A long name wraps; the amount never breaks. */
.wallet-balance {
    font-weight: 600;
    white-space: nowrap;
}

/* The wallets list's currency and amount, kept on one line: the code quieter than the amount it labels. */
.wallet-money {
    white-space: nowrap;
}

.wallet-currency {
    color: var(--ink-soft);
    font-size: 0.85em;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.wallet-balance.is-negative {
    color: var(--fine-dark);
}

.wallet-new {
    margin-top: 0.25rem;
}

.wallet-panel-head .label {
    margin-bottom: 0.3rem;
}

.balance {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0 0;
}

.balance-currency {
    color: var(--ink-soft);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.06em;
}

.balance-amount {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6vw, 3.2rem);
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.balance-amount.is-negative {
    color: var(--fine-dark);
}

/* The record form's two submit buttons, side by side: the pressed one decides the sign. A bonus is green, a fine red. */
.record-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.record-actions .btn-primary {
    --bg: var(--grass);
    --hi: var(--grass-light);
    --lo: var(--grass-dark);
}

.record-actions .btn:not(.btn-primary) {
    --bg: var(--fine-dark);
    --hi: #C4473C;
    --lo: #6E1812;
    --fg: var(--cream);
}

/* The history: when over the reason on the left, the signed amount and Delete on the right. */
.history {
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 3px dashed var(--cream-dark);
}

.history-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
        "when amount delete"
        "reason amount delete";
    gap: 0.1rem 1rem;
    align-items: center;
    padding: 0.7rem 0;
    border-bottom: 3px dashed var(--cream-dark);
}

.history-when {
    grid-area: when;
    color: var(--ink-soft);
    font-size: 0.85rem;
}

.history-reason {
    grid-area: reason;
    overflow-wrap: anywhere;
}

.history-amount {
    grid-area: amount;
    font-weight: 700;
}

.history-up {
    color: var(--bonus);
}

.history-down {
    color: var(--fine-dark);
}

.history-delete {
    grid-area: delete;
    color: var(--fine-dark);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Both links on the right, so Older keeps its place from page to page, alone on the first page or after Newer. */
.history-pager {
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    font-weight: 600;
}

/* The Settings tab: the delete link set apart from the rename form. */
.settings-danger {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 3px dashed var(--cream-dark);
}

/* The confirmation pages: the caption sits on its question as the wallet's does on its name (the panel's gap less 1rem). */
.confirm > .label {
    margin-bottom: -1rem;
}

/* The action and Cancel side by side. */
.confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.confirm-actions .btn {
    padding: 0.4rem 0.75rem;
}

/* The transaction to delete, shown as its history row, without the Delete column. */
.confirm-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "when amount"
        "reason amount";
    border-top: 3px dashed var(--cream-dark);
}

/* The signed-in account card (MemberArea) in the user shell: no wider than a reading column. */
.user .member-card {
    max-width: 38rem;
}

@media (max-width: 56rem) {
    .user {
        grid-template-columns: minmax(0, 1fr);
    }

    .user-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

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

    /* Stacked, an open panel comes before the list, so opening a wallet shows it without scrolling past the list. */
    .wallet-detail:has(.wallet-panel) {
        order: -1;
    }
}

@media (max-width: 30rem) {
    /* Too narrow for the two labels side by side: the action over Cancel, each the panel's width. */
    .confirm-actions {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---- Devices (Components/Pages/Devices; the admin Devices tab: UserDevicesTab, AdminUnassign) ---- */

/* The user's device list reuses the wallet rows, but the right-hand text is a wallet's name (up to 50 characters):
   it wraps where .wallet-balance's nowrap would push the row past the phone's width. */
.wallet-row .device-wallet {
    font-weight: 500;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: right;
}

.admin-devices-tab,
.admin-confirm {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.admin-devices {
    width: 100%;
    border-collapse: collapse;
}

.admin-devices th {
    padding: 0 0.75rem 0.5rem 0;
    border-bottom: 3px solid var(--ink);
    color: var(--ink-soft);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
}

.admin-devices td {
    padding: 0.65rem 0.75rem 0.65rem 0;
    border-bottom: 3px dashed var(--cream-dark);
    font-size: 0.95rem;
    vertical-align: middle;
}

.admin-devices th:last-child,
.admin-devices td:last-child {
    padding-right: 0;
    text-align: right;
}

.admin-device-id {
    font-weight: 600;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* A row's button, smaller than a form's. */
.admin-device-newkey {
    min-height: 2.25rem;
    padding: 0.2rem 0.7rem;
    border-width: 3px;
    box-shadow: inset 3px 3px 0 var(--hi), inset -3px -3px 0 var(--lo);
    font-size: 0.85rem;
    white-space: nowrap;
}

.admin-confirm-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

@media (max-width: 30rem) {
    .admin-devices td {
        padding-right: 0.5rem;
        font-size: 0.88rem;
    }
}

/* Admin Users > Devices: the assign picker with its button beside it (under it on a phone), and a table that scrolls
   sideways instead of widening the page. */
.assign-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
}

.admin-wide-table {
    overflow-x: auto;
}

@media (max-width: 30rem) {
    .assign-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---- Admin › Devices (AdminDevices, AdminDeviceRemove, AdminDeviceNewKey) ---- */

/* The filter on the left, Set up a brick and Erase a brick on the right; they wrap under it when there is no room. */
.list-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: center;
}

.key-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

/* The USB buttons until the page's script finds Web Serial: greyed, and the note under them says why. */
.key-actions .btn:disabled {
    cursor: not-allowed;
    filter: saturate(0.3);
    opacity: 0.6;
    transform: none;
}

/* All / In stock / Sold: joined blocks, the one shown in gold. */
.filter-tabs {
    display: inline-flex;
    border: 3px solid var(--ink);
    background: var(--ink);
    gap: 3px;
}

.filter-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 2.2rem;
    padding: 0 0.8rem;
    background: var(--stone-light);
    box-shadow: inset 3px 3px 0 #E8EAED, inset -3px -3px 0 var(--stone);
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}

.filter-tabs a[aria-current] {
    background: var(--gold);
    box-shadow: inset 3px 3px 0 var(--gold-light), inset -3px -3px 0 var(--gold-dark);
    font-weight: 700;
}

/* A device with no owner yet. */
.stock-pill {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border: 2px solid var(--ink);
    background: var(--stone-light);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

/* A long email wraps rather than widen the table. */
.admin-device-owner {
    overflow-wrap: anywhere;
}

/* Set up a brick and Erase a brick open their panel above the list: a gold block outlined in ink (the mockup's
   device-key-panel), showing one state of its flow at a time. */
.setup-panel,
.erase-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border: 3px solid var(--ink);
    background: var(--gold-light);
}

.setup-panel .label,
.erase-panel .label {
    margin: 0;
    color: var(--ink);
}

/* js/brick-usb.js shows a panel, a state and a line kept for one case with the hidden attribute alone; the display
   rules here would otherwise win over it. */
[data-usb][hidden],
[data-usb] [hidden] {
    display: none;
}

.setup-state {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Setting up: the steps done (green), the one under way (gold) and those to come (outlined). */
.setup-steps {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.setup-steps li {
    position: relative;
    padding-left: 1.8rem;
    color: var(--ink-soft);
}

.setup-steps li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.3rem;
    width: 0.95rem;
    height: 0.95rem;
    border: 3px solid var(--ink-soft);
    background: var(--white);
}

.setup-steps li.now {
    color: var(--ink);
    font-weight: 600;
}

.setup-steps li.now::before {
    border-color: var(--ink);
    background: var(--gold);
}

.setup-steps li.done {
    color: var(--ink);
}

.setup-steps li.done::before {
    border-color: var(--ink);
    background: var(--bonus);
    box-shadow: inset 0 0 0 2px var(--white);
}

/* The flashing progress; the script sets the inner span's width. */
.setup-bar {
    display: block;
    height: 0.9rem;
    margin-top: 0.35rem;
    border: 3px solid var(--ink);
    background: var(--white);
}

.setup-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--gold-dark);
}

/* The brick's ID, large, to copy onto its sticker. */
.setup-id {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.1;
}

/* The owner of the brick about to be erased, bold as in the mockup; a long email wraps. */
.erase-panel [data-field="owner"] {
    font-weight: 700;
    overflow-wrap: anywhere;
}

@media (max-width: 30rem) {
    .setup-panel,
    .erase-panel {
        padding: 0.85rem 1rem;
    }
}

/* ---------- Orders: Admin → Orders and My orders (mockup docs/mockups/orders-v1.html) ---------- */
.status { display: inline-flex; align-items: center; padding: 0.15rem 0.5rem; border: 2px solid var(--ink); font: 600 0.8rem var(--font-body);
    letter-spacing: 0.02em; white-space: nowrap; color: var(--ink); }
.status.paid { background: var(--gold-light); }
.status.shipped { background: #CDEFC0; }
.status.refunded { background: #F2D3CF; }
/* A test-mode order (paid with a Stripe test card): dashed, sky blue, next to its status. */
.status.test { background: #D6ECFB; border-style: dashed; }
.pills { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
.panel-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; }
/* The Stripe Live | Test switch above Admin → Orders (mockup docs/mockups/stripe-modes-v1.html). */
.stripe-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin: 0 0 1.25rem; padding: 0.85rem 1rem;
    border: 3px solid var(--ink); background: var(--cream); }
.stripe-mode.is-test { background: #D6ECFB; }
.stripe-mode .admin-switch { flex: none; }
.stripe-mode button.admin-switch-side { border: 0; font-family: inherit; cursor: pointer; }
.stripe-mode-lead { font-weight: 700; }
.stripe-mode-note { flex: 1 1 18rem; margin: 0; font-size: 0.9rem; color: var(--ink-soft); }
.orders-show { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0.75rem 0; }
.order-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.2rem 0.75rem; align-items: center; }
.order-row .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-row .meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; opacity: 0.8; }
.order-lines { display: grid; gap: 0.45rem; margin: 0; }
.order-lines div { display: flex; justify-content: space-between; gap: 1rem; }
.order-lines dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.order-lines .total { padding-top: 0.55rem; border-top: 3px solid var(--ink); font-size: 1.1rem; }
.order-lines .off dd { color: var(--bonus); }
.address { margin: 0; font-style: normal; line-height: 1.45; }
.block-title { margin: 1.4rem 0 0.6rem; font-family: var(--font-display); font-size: 1.25rem; }
.note { margin: 0.6rem 0 0; font-size: 0.92rem; color: var(--ink-soft); }
.ship-form { display: grid; gap: 0.8rem; margin-top: 0.4rem; padding: 1rem; border: 3px dashed var(--ink-soft); }
.ship-two { display: grid; gap: 0.8rem; }
.tracking-no, .track code { padding: 0.1rem 0.35rem; border: 2px solid var(--ink); background: var(--white); }
.track { display: grid; gap: 0; margin: 0.5rem 0 0; padding: 0; list-style: none; }
.track li { position: relative; display: grid; grid-template-columns: 2.1rem minmax(0, 1fr); gap: 0.85rem; padding-bottom: 1.1rem; }
.track li::after { content: ""; position: absolute; left: calc(1.05rem - 2px); top: 2.1rem; bottom: 0; width: 4px; background: var(--cream-dark); }
.track li:last-child::after { display: none; }
.track li.done::after { background: var(--grass); }
.track .dot { z-index: 1; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border: 3px solid var(--ink); background: #C9CDD2; }
.track .done .dot { background: #CDEFC0; }
.track .now .dot { background: var(--gold); box-shadow: inset 3px 3px 0 var(--gold-light), inset -3px -3px 0 var(--gold-dark); }
.track .later img, .track .now:not(.done) .dot:empty { visibility: hidden; }
.track .dot img { width: 18px; image-rendering: pixelated; }
.track h3 { margin: 0.15rem 0 0.2rem; font-size: 1.05rem; }
.track p { margin: 0; color: var(--ink-soft); }
.track .tracking { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-top: 0.45rem; }
.my-orders-note { margin-top: 1rem; }
@media (min-width: 700px) {
    .ship-two { grid-template-columns: 1fr 1fr; }
}

/* ---- Admin › Firmware (AdminFirmware, AdminFirmwareRelease) ---- */

/* The versions over the upload form. */
.fw-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

/* The update's size, with its share of a program slot under it. */
.fw-size {
    white-space: nowrap;
}

.fw-size small {
    display: block;
    color: var(--ink-soft);
    font-size: 0.8rem;
}

/* The released version's tag, in bevelled gold. */
.live-pill {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border: 3px solid var(--ink);
    background: var(--gold);
    box-shadow: inset 2px 2px 0 var(--gold-light), inset -2px -2px 0 var(--gold-dark);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}
