:root {
    color-scheme: light dark;
    --bg: #ffffff;
    --card-bg: #f5f5f7;
    --field-bg: #ffffff;
    --section-bg: #ffffff;
    --text: #1c1c1e;
    --muted: #6e6e73;
    --accent: #0066cc;
    --error: #c0152f;
    --border: #d2d2d7;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding: 3.5rem 1rem 1rem;
}

/* body is a centring flex container; without this, <main> cannot shrink
   below the width of its widest content (the admin tables), so it overflowed
   equally on both sides and the left half was unreachable by scrolling. */
main {
    /* Fill the window (the children cap their own width: .card 380px,
       .app-shell 1280px/1200px) instead of shrink-wrapping to whatever the
       content happens to measure, which made the layout width independent
       of the window width. */
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card {
    width: 100%;
    max-width: 380px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
}

.card.centered { align-self: center; }

.card.wide {
    max-width: none;
}

/* The banner sits inside the card above the title. It is shown whole (a
   wide banner or a logo lock-up used as one must not be cropped), at most
   360px high. */
.form-banner {
    display: block;
    width: 100%;
    height: auto;
    max-height: 360px;
    margin: 0 0 1.5rem;
    object-fit: contain;
    object-position: left center;
    border-radius: 8px;
}

/* House-style logos are wide lock-ups with their own margins; 160x80 left
   the mark itself tiny. Allow the full width of the card, within a sensible
   height. */
.form-logo,
.site-logo {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 140px;
    margin-bottom: 1rem;
    object-fit: contain;
}

/* At the top of a form page the logo is the header: the page's own gap
   spaces it, no extra margin. */
.app-shell > .form-logo {
    margin-bottom: 0;
    /* In a flex column an image with width:auto is stretched to the full
       width, and object-fit:contain then centres the picture in that box.
       Keep the box as wide as the picture and at the left. */
    align-self: flex-start;
    object-position: left center;
}

.site-logo-small {
    display: inline-block;
    /* rem, not em -- .topbar's own font-size (0.9rem) was silently
       capping this at ~35px even after an earlier bump to 2.4em, since
       em is relative to the topbar's small text size, not independent
       of it (issue #9: still "icon-sized" after that fix). rem decouples
       it entirely. */
    max-height: 3.5rem;
    max-width: 16rem;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 0.5rem;
    /* A logo saved as a JPEG has a white background: give it a white chip so
       it reads as intended on the grey page instead of as a stray box. */
    padding: 0.25rem 0.5rem;
    background: #ffffff;
    border-radius: 6px;
}

.app-shell {
    width: 100%;
    /* Doubled from 640px (issue #15) -- width: 100% above already keeps
       this responsive on narrower viewports; this only raises the cap
       on wide screens. */
    max-width: 1280px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* The admin panel is data-dense (tables with per-row schedule inputs,
   share links, action buttons) -- the 640px single-column form width
   is far too narrow for it. */
.app-shell.wide {
    max-width: 1200px;
}

h1 {
    margin: 0 0 0.5rem;
    font-size: 1.4rem;
}

p {
    margin: 0 0 1rem;
}

.hint {
    color: var(--muted);
    font-size: 0.9rem;
}

.breadcrumb {
    color: var(--muted);
    font-size: 0.8rem;
    margin: 0.25rem 0 1rem;
}

.submission-reference {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
}

.error,
.rule-error {
    color: var(--error);
}
.rule-error { font-weight: 600; }

.banner {
    background: color-mix(in srgb, #b8860b 15%, var(--card-bg));
    border: 1px solid #b8860b;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text);
}

form label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

input,
select {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--field-bg);
    color: var(--text);
}

/* A dropdown is as wide as its widest option (not a fixed 8rem that clips a long
   one, and not the full width of the form), never wider than its container. */
select {
    width: auto;
    max-width: 100%;
}

button {
    width: 100%;
    padding: 0.65rem;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

button:disabled {
    opacity: 0.6;
    cursor: default;
}

#name-fields[hidden] {
    display: none;
}

#lang-switcher {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.25rem;
}

.lang-btn {
    width: auto;
    padding: 0.3rem;
    line-height: 1;
    font-size: 1.3rem;
    background: var(--field-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    opacity: 0.55;
    filter: grayscale(40%);
}

.lang-flag {
    display: block;
    width: 1.75rem;
    height: 1.2rem;
    /* The Union Jack is 2:1, the others 3:2 -- same box for all three. */
    object-fit: cover;
    border-radius: 2px;
}

.lang-btn:hover {
    opacity: 0.85;
}

.lang-btn.active {
    opacity: 1;
    filter: none;
    border-color: var(--accent);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.topbar-actions {
    display: flex;
    /* Admin/Design/Registrar buttons plus the always-present two do not fit
       on one line on a phone; wrap instead of pushing the page wider. */
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    /* Keeps this reliably right-aligned whether or not .topbar has a
       left-side sibling (e.g. the submission form's topbar no longer
       does, since the signed-in-as text moved to a breadcrumb below
       it) -- justify-content: space-between on .topbar alone would
       otherwise push a lone child to the left instead (issue #16). */
    margin-left: auto;
}

.topbar-actions button {
    width: auto;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

textarea {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    resize: vertical;
}

.save-indicator {
    min-height: 1.1em;
    font-size: 0.8rem;
    color: var(--muted);
    margin: -0.5rem 0 1rem;
}

.form-section {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem 1rem 1rem;
    margin: 0 0 1.25rem;
    background: var(--section-bg);
}

.form-section legend {
    padding: 0 0.4rem;
    font-weight: 600;
}

.section-description {
    white-space: pre-line;
    margin-top: 0;
}

.named-list-field {
    margin-bottom: 1rem;
}

.named-list-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.named-list-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.named-list-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.4rem;
}

.named-list-inputs input {
    margin-top: 0;
}

.named-list-empty-hint {
    margin: 0.4rem 0 0;
}

.submission-total {
    text-align: right;
    font-size: 1.05rem;
    margin: 0 0 1rem;
}

/* SumUp's Card Widget renders its own iframe/fields into this element --
   min-height keeps the card from collapsing/jumping while the SDK script
   is still loading and the widget hasn't mounted anything into it yet. */
.sumup-widget {
    min-height: 220px;
    margin: 1rem 0;
}

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, 90vw);
    background: var(--bg);
    border-left: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.sidebar.wide {
    width: min(480px, 90vw);
}

.sidebar[hidden] {
    display: none;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.sidebar-backdrop[hidden] {
    display: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.sidebar-header button {
    width: auto;
    background: none;
    color: var(--text);
    font-size: 1.5rem;
    line-height: 1;
    padding: 0;
}

.submission-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.submission-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
}

.submission-item p {
    margin: 0;
}

.submission-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--border);
    white-space: nowrap;
}

.submission-item.status-paid .status-badge {
    background: #1e7e34;
    color: #fff;
}

.submission-item.status-payment_failed .status-badge {
    background: var(--error);
    color: #fff;
}

.submission-item.status-pending_payment .status-badge {
    background: #b8860b;
    color: #fff;
}

.status-badge.status-active {
    background: #1e7e34;
    color: #fff;
}

.status-badge.status-disabled {
    background: var(--error);
    color: #fff;
}

.admin-user-disabled {
    opacity: 0.6;
}

.submission-item .retry-payment-btn {
    width: auto;
    margin-top: 0.5rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.submission-item .error {
    margin-top: 0.5rem;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 3;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal[hidden] {
    display: none;
}

.modal-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 420px;
    /* Grows with its content up to most of the window; beyond that the list scrolls. */
    max-height: 88vh;
    max-height: 88dvh;
    background: var(--bg);
    border-radius: 12px;
    padding: 1.5rem;
}

.modal-card h2,
.modal-card .breakdown-total,
.modal-card .modal-actions { flex: none; }

.modal-body-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.5rem;
    /* A scrollbar that stays visible (overlay scrollbars hide until you touch them). */
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--border);
}

.modal-body::-webkit-scrollbar { width: 10px; }
.modal-body::-webkit-scrollbar-track { background: var(--border); border-radius: 5px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 5px; }

/* Fades the lines out at the bottom and carries the "scroll for more" pill while more is below. */
.scroll-hint:not([hidden]) { display: block; }
.scroll-hint {
    position: absolute;
    left: 50%;
    bottom: 0.4rem;
    transform: translateX(-50%);
    width: auto;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.modal-body-wrap:has(.scroll-hint:not([hidden]))::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3.2rem;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--bg));
}
.modal-body-wrap .scroll-hint { z-index: 1; }

.breakdown-total { margin-top: 0.5rem; border-top: 2px solid var(--border); }
.breakdown-total td { padding-top: 0.7rem; }

.modal-card h2 {
    margin: 0 0 1rem;
    font-size: 1.2rem;
}

.breakdown-table {
    width: 100%;
    border-collapse: collapse;
}

.breakdown-table td {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
}

.breakdown-table tfoot td {
    border-bottom: none;
    border-top: 2px solid var(--border);
    padding-top: 0.7rem;
}

.breakdown-section-row td {
    padding-top: 0.9rem;
    border-bottom: none;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--muted);
}

.breakdown-section-row:first-child td {
    padding-top: 0;
}

.breakdown-amount {
    text-align: right;
    white-space: nowrap;
    padding-left: 1rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.modal-actions button {
    flex: 1;
}

button.secondary,
.builder-field button,
.builder-section button,
.admin-role-actions button {
    background: var(--field-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

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

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

.admin-table th {
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
}

.admin-search {
    margin-bottom: 0.75rem;
}

.admin-search input {
    max-width: 22rem;
    margin: 0;
}

.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.admin-page-size label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: normal;
}

.admin-page-size select {
    width: auto;
    margin: 0;
    padding: 0.25rem 0.4rem;
    font-size: 0.85rem;
}

.admin-page-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-page-nav button {
    width: auto;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    margin: 0;
}

.admin-page-info {
    color: var(--muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.admin-sortable {
    cursor: pointer;
    user-select: none;
}

.admin-sortable::after {
    content: '';
    display: inline-block;
    width: 0.6em;
    margin-left: 0.3em;
    opacity: 0.4;
}

.admin-sortable.sort-asc::after {
    content: '▲';
    opacity: 1;
}

.admin-sortable.sort-desc::after {
    content: '▼';
    opacity: 1;
}

.admin-context {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    max-width: 22rem;
    word-break: break-word;
    color: var(--muted);
}

.admin-role-actions {
    white-space: nowrap;
}

.admin-role-actions select {
    display: inline-block;
    width: auto;
    margin: 0 0.4rem 0 0;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
}

.admin-role-actions button {
    width: auto;
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    margin-right: 0.35rem;
}

.admin-share-input {
    width: 14rem;
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
    margin: 0;
    color: var(--muted);
}

.admin-branding-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.admin-branding-item .hint {
    width: 100%;
    font-size: 0.7rem;
    margin: 0;
}

.admin-branding-item input[type="file"] {
    width: auto;
    max-width: 9rem;
    margin: 0;
    font-size: 0.7rem;
}

.admin-branding-item input[type="color"] {
    width: 2.2rem;
    height: 1.8rem;
    padding: 0.1rem;
    margin: 0;
}

.admin-branding-item button {
    width: auto;
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
}

.admin-thumb {
    display: block;
    max-width: 3rem;
    max-height: 2rem;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.admin-thumb-wide {
    max-width: 5rem;
}

.builder-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.builder-row label {
    flex: 1 1 200px;
    margin-bottom: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.builder-row.locales label {
    flex: 1 1 260px;
}

.builder-locale-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.builder-locale-btn {
    width: auto;
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
    /* The global button rule sets white text; on this white background it
       made the EN/FR/NL labels invisible. */
    color: var(--text);
    background: var(--field-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    opacity: 0.55;
}

.builder-locale-btn:hover {
    opacity: 0.85;
}

.builder-locale-btn.active {
    opacity: 1;
    border-color: var(--accent);
}

/* The global input rule stretches every input to full width with large
   padding, which squashes a colour swatch into a thin line. */
input[type="color"] {
    width: 3rem;
    height: 2.2rem;
    padding: 0.15rem;
}

.builder-row label input,
.builder-row label select,
.builder-row label textarea {
    color: var(--text);
    font-size: 1rem;
}

.builder-checkbox {
    display: flex !important;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex: 0 1 auto !important;
}

.builder-checkbox input {
    width: auto;
    margin: 0;
}

.builder-basics {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem 1.25rem 1.25rem;
    margin: 0 0 1.5rem;
}

.builder-basics legend {
    padding: 0 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.builder-section-heading {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0.5rem 0 0.75rem;
}

.builder-section {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem 1.25rem 1.25rem;
    margin-bottom: 1.25rem;
    background: var(--bg);
}

.builder-section > .builder-row:first-child {
    margin-top: 0.75rem;
}

.builder-field {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.85rem;
    background: var(--card-bg);
}

.builder-fields {
    margin-top: 0.75rem;
}

/* A field's block, top to bottom: type + key, label, its options (price,
   maximum, control), then one line of small actions. */
.builder-field-head {
    display: grid;
    grid-template-columns: minmax(11rem, 15rem) 1fr;
    gap: 1rem;
}

.builder-field-head label {
    min-width: 0;
}

.builder-field .b-field-type {
    max-width: none;
}

.builder-field-options label {
    flex: 1 1 8rem;
}

.builder-field-options select {
    width: 100%;
    max-width: none;
}

.builder-field-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.25rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--border);
}

/* All three the same small size (global buttons are full-width). */
.builder-field .builder-field-actions button {
    width: auto;
    min-width: 2.4rem;
    padding: 0.25rem 0.7rem;
    font-size: 0.8rem;
    line-height: 1.3;
}

.builder-field-actions .b-remove-field {
    margin-left: auto;
}

@media (max-width: 34rem) {
    .builder-field-head {
        grid-template-columns: 1fr;
    }
}

.builder-submit-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.builder-submit-row button {
    flex: 1;
}

.builder-section button,
.builder-field button,
.admin-role-actions button {
    flex: none;
}

/* Form picker, shown when more than one form is open for registration */
.form-choices {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.form-choice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    text-align: left;
}

.form-choice-logo {
    max-height: 2rem;
    width: auto;
}

/* Live preview of a theme/colour choice (builder and Design panel): a small
   form page drawn with inline colours, independent of the app's own theme. */
.theme-preview-host {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.theme-preview {
    width: 100%;
    max-width: 22rem;
    padding: 0.75rem;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
}

.theme-preview-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.7rem;
    border: 1px solid;
    border-radius: 8px;
    font-size: 0.85rem;
}

.theme-preview-section {
    padding: 0.4rem 0.6rem;
    border: 1px solid;
    border-radius: 6px;
}

.theme-preview-button {
    align-self: flex-start;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Whole-number field: a text input with two tiny buttons stacked inside the
   field's own border (the quantity fields of a form). */
.number-field {
    margin-bottom: 1rem;
}

.number-field label {
    display: block;
}

.number-control {
    display: flex;
    align-items: stretch;
    width: 7rem;
    margin-top: 0.25rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--field-bg);
    overflow: hidden;
}

.number-control:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

.number-control .number-control-input {
    flex: 1;
    min-width: 0;
    width: auto;
    margin: 0;
    padding: 0.5rem 0.6rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-variant-numeric: tabular-nums;
}

.number-control .number-control-input:focus {
    outline: none;
}

.number-control-buttons {
    display: flex;
    flex-direction: column;
    width: 1.6rem;
    border-left: 1px solid var(--border);
}

.number-control-buttons button {
    position: relative;
    flex: 1;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: var(--section-bg);
    color: var(--text);
    font-size: 0;
    cursor: pointer;
}

.number-control-buttons button + button {
    border-top: 1px solid var(--border);
}

.number-control-buttons button:hover:not(:disabled) {
    background: var(--border);
}

/* the arrows: small CSS triangles, no font or image needed */
.number-control-buttons button::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    border: 5px solid transparent;
    transform: translate(-50%, -50%);
}

/* Same specificity as the rule above (and later), or its "transparent" wins. */
.number-control-buttons .number-control-up::before {
    border-bottom-color: currentColor;
    border-top-width: 0;
}

.number-control-buttons .number-control-down::before {
    border-top-color: currentColor;
    border-bottom-width: 0;
}

.number-control-buttons button:disabled {
    opacity: 0.3;
    cursor: default;
}

.number-control-msg {
    margin: 0.3rem 0 0;
    font-size: 0.85rem;
    color: var(--error);
}

/* Bank transfer: payment choice on the form, details + QR on the confirmation. */
.payment-choice { margin-top: 0.75rem; }
.payment-choice-label { margin: 0 0 0.35rem; font-weight: 600; }
.payment-choice-option { display: flex; align-items: center; gap: 0.5rem; margin: 0.25rem 0; font-weight: 400; }
.payment-choice-option input { width: auto; margin: 0; }
.wire-details h2 { font-size: 1.1rem; margin: 1rem 0 0.5rem; }
.wire-list { margin: 0.75rem 0; padding: 0; }
.wire-row { display: grid; grid-template-columns: 8rem 1fr; gap: 0.25rem 0.75rem; padding: 0.3rem 0; border-bottom: 1px solid rgba(0, 0, 0, 0.08); }
.wire-row dt { color: #555; }
.wire-row dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; user-select: all; }
.wire-qr { width: 100%; max-width: 15rem; margin: 0.5rem 0 1rem; background: #fff; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 6px; }
.wire-qr svg { display: block; width: 100%; height: auto; }
@media (max-width: 480px) { .wire-row { grid-template-columns: 1fr; } }

.form-deadline { margin: -0.25rem 0 1rem; color: var(--muted); font-weight: 600; }

/* Outstanding payments: a red count on the submissions button, and a toast. */
#sidebar-toggle { position: relative; }
#sidebar-toggle[data-count]::after {
    content: attr(data-count);
    position: absolute; top: -9px; right: -9px;
    min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px; background: #d92d20; color: #fff;
    font-size: 0.75rem; font-weight: 700; line-height: 1;
    box-shadow: 0 0 0 2px #fff;
}
.toast {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
    display: flex; align-items: center; gap: 0.75rem;
    max-width: min(26rem, calc(100vw - 2rem)); padding: 0.75rem 1rem;
    border-radius: 10px; background: #1c1c1e; color: #fff;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.toast-text { flex: 1; }
.toast-action { background: #fff; color: #1c1c1e; padding: 0.35rem 0.8rem; }
.toast-close { background: transparent; color: #fff; padding: 0 0.35rem; font-size: 1.25rem; line-height: 1; }
@media (max-width: 480px) { .toast { left: 1rem; max-width: none; } }

.toast { opacity: 1; transform: translateY(0); transition: opacity 0.6s ease, transform 0.6s ease; animation: toast-in 0.25s ease-out; }
.toast.toast-hiding { opacity: 0; transform: translateY(8px); pointer-events: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .toast, .toast.toast-hiding { transition: none; animation: none; } }
/* The toast must never stand between a person and the page: only its own buttons take clicks. */
.toast { pointer-events: none; }
.toast button { pointer-events: auto; }

/* Admin "Controls": a list of actions with a button beside each (wraps under the text when narrow). */
.admin-action { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.75rem 0; border-bottom: 1px solid rgba(0, 0, 0, 0.08); }
.admin-action:last-child { border-bottom: 0; }
.admin-action-text { flex: 1 1 16rem; min-width: 0; }
.admin-action-text p { margin: 0.2rem 0 0; overflow-wrap: anywhere; }
.admin-action .admin-action-run { flex: none; width: auto; padding: 0.6rem 1.2rem; white-space: nowrap; }

/* Title of the staff pages (admin, design, wire transfers): the page's heading, in the theme colour. */
.page-title { margin: 0; font-size: 1.9rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; color: var(--accent); }
.app-shell > .form-logo + .topbar { margin-top: 0.75rem; }

/* "Payment details" in the submissions list: a small button, not a full-width one. */
.wire-details-btn { width: auto; padding: 0.3rem 0.75rem; font-size: 0.85rem; margin-top: 0.25rem; }

/* The read-only registration page: just the form. */
.bare-page #lang-switcher { display: none; }
.reference-link { color: inherit; text-decoration: underline; }
.readonly-form input:disabled,
.readonly-form select:disabled,
.readonly-form textarea:disabled { opacity: 1; color: var(--text); -webkit-text-fill-color: var(--text); background: var(--field-bg); cursor: default; }
.readonly-form .number-control-buttons { display: none; }

/* Login page: where you are signing in to. */
.login-context { margin: 0 0 1rem; padding: 0.7rem 0.9rem; border-radius: 8px; background: var(--section-bg, rgba(0, 0, 0, 0.04)); }
.login-context-line { margin: 0 0 0.25rem; }
.login-context p:last-child { margin-bottom: 0; }
.login-deadline { color: var(--muted); font-size: 0.9rem; }
.login-forms { margin: 0.25rem 0 0; padding-left: 1.2rem; }
.login-forms li { margin: 0.25rem 0; }

/* Login: the automatic "are you a person" check (quiet, resolves itself). */
.human-check { display: flex; align-items: center; gap: 0.5rem; min-height: 1.4rem; margin: 0.25rem 0 0.75rem; font-size: 0.85rem; color: var(--muted); }
.human-check:empty { display: none; }
.human-icon { flex: none; width: 1rem; height: 1rem; border-radius: 50%; box-sizing: border-box; }
.human-checking .human-icon { border: 2px solid var(--border); border-top-color: var(--accent); animation: human-spin 0.8s linear infinite; }
.human-ok { color: #1a7f37; font-weight: 600; }
.human-ok .human-icon { background: #1a7f37; position: relative; animation: human-pop 0.3s ease-out; }
.human-ok .human-icon::after { content: ''; position: absolute; left: 0.33rem; top: 0.14rem; width: 0.25rem; height: 0.5rem; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); box-sizing: border-box; }
.human-failed { color: var(--muted); }
.human-failed .human-icon { border: 2px solid var(--border); }
@keyframes human-spin { to { transform: rotate(360deg); } }
@keyframes human-pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .human-checking .human-icon, .human-ok .human-icon { animation: none; } }

.breakdown-free { color: var(--muted); font-style: italic; }

/* After asking for the login link: a pointed reminder to look in the spam folder too. */
.check-email-spam { margin: 0.75rem 0 0; padding: 0.6rem 0.8rem; border-left: 4px solid var(--accent); border-radius: 4px; background: var(--section-bg, rgba(0, 0, 0, 0.04)); font-weight: 600; }
/* First login: the name fields are mandatory, and the page says so plainly. */
.names-required-note { margin: 0.25rem 0 0.75rem; padding: 0.6rem 0.8rem; border-left: 4px solid var(--accent); border-radius: 4px; background: var(--section-bg, rgba(0, 0, 0, 0.04)); font-weight: 600; }
.required-mark { color: var(--error); font-weight: 700; }
.browser-note { margin: 1.25rem 0 0; padding: 0.6rem 0.8rem; border-left: 4px solid #c98a00; border-radius: 4px; background: #fff4d6; color: #4a3400; font-size: 0.9rem; font-weight: 600; }
.required-legend { margin: -0.25rem 0 0.75rem; font-size: 0.85rem; color: var(--muted); }
