/* Design system shared by every page: tokens (light and dark), base elements and components.
   The app shell (sidebar, mobile header and bottom bar) and the plan calendar live in app.css,
   the sign-in pages in auth.css. */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
    color-scheme: light;
    --color-bg: #f7f7fa;
    --color-surface: #ffffff;
    --color-surface-subtle: #f1f0f5;
    --color-text: #172126;
    --color-text-secondary: #625e70;
    --color-border: #e2e0e8;
    --color-control-border: #858197;
    --color-accent: #6d28d9;
    --color-accent-hover: #5b21b6;
    --color-accent-subtle: #ede9fe;
    --color-on-accent: #ffffff;
    --color-focus: #006fbd;
    --color-success-bg: #e7f4ec;
    --color-success-text: #235d3d;
    --color-warning-bg: #fff4e5;
    --color-warning-text: #8f4400;
    --color-danger-bg: #fcebed;
    --color-danger-text: #a12a3e;
    --color-danger: #a12a3e;
    --color-danger-hover: #842033;
    --color-neutral-bg: #edf0f3;
    --color-neutral-text: #465566;
    --color-info-bg: #e5edf9;
    --color-info-text: #23427a;
    --color-info-line: #3d6bc4;
    --color-boost: #0e7490;
    --color-boost-bg: #dff3f7;
    --color-boost-text: #155e75;
    --color-art-bg: #172126;
    --color-art-text: #f7f7fa;
    --color-art-muted: #e2e0e8;
    --color-art-line: #a78bfa;
    --font-family: "Inter", "Segoe UI", Arial, sans-serif;
    --text-xs: 13px;
    --text-sm: 15px;
    --text-base: 16px;
    --text-lg: 18px;
    --text-xl: 22px;
    --text-2xl: 28px;
    --text-stat: 36px;
    --line-body: 1.5;
    --line-heading: 1.2;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --radius-control: 8px;
    --radius-panel: 12px;
    --radius-pill: 999px;
    --shadow-panel: 0 1px 2px rgb(23 33 38 / 0.04);
    --shadow-menu: 0 12px 32px rgb(23 33 38 / 0.14);
    --shadow-dialog: 0 24px 80px rgb(0 0 0 / 0.22);
    --color-overlay: rgb(12 14 20 / 0.55);
    --sidebar-width: 248px;
    --content-max: 1120px;
    --bottom-bar-height: 64px;
}

/* Dark mode follows the device setting; data-theme="light" / "dark" on <html> forces one. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --color-bg: #121117;
        --color-surface: #1b1a22;
        --color-surface-subtle: #24222d;
        --color-text: #f4f3f8;
        --color-text-secondary: #c4c0d0;
        --color-border: #33303f;
        --color-control-border: #8a8599;
        --color-accent: #b69cf8;
        --color-accent-hover: #cfbdfb;
        --color-accent-subtle: #2e2547;
        --color-on-accent: #1e1035;
        --color-focus: #86caff;
        --color-success-bg: #203e2e;
        --color-success-text: #a5dfb9;
        --color-warning-bg: #3b2a1a;
        --color-warning-text: #ffc078;
        --color-danger-bg: #41252e;
        --color-danger-text: #ffb4c0;
        --color-danger: #ffb4c0;
        --color-danger-hover: #ffd0d8;
        --color-neutral-bg: #2b3540;
        --color-neutral-text: #c2cedd;
        --color-info-bg: #1f3048;
        --color-info-text: #b9d0f5;
        --color-info-line: #7fa6e8;
        --color-boost: #5fcbe0;
        --color-boost-bg: #12343d;
        --color-boost-text: #a5e9f5;
        --shadow-panel: none;
        --shadow-menu: 0 12px 32px rgb(0 0 0 / 0.5);
        --shadow-dialog: 0 24px 80px rgb(0 0 0 / 0.5);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --color-bg: #121117;
    --color-surface: #1b1a22;
    --color-surface-subtle: #24222d;
    --color-text: #f4f3f8;
    --color-text-secondary: #c4c0d0;
    --color-border: #33303f;
    --color-control-border: #8a8599;
    --color-accent: #b69cf8;
    --color-accent-hover: #cfbdfb;
    --color-accent-subtle: #2e2547;
    --color-on-accent: #1e1035;
    --color-focus: #86caff;
    --color-success-bg: #203e2e;
    --color-success-text: #a5dfb9;
    --color-warning-bg: #3b2a1a;
    --color-warning-text: #ffc078;
    --color-danger-bg: #41252e;
    --color-danger-text: #ffb4c0;
    --color-danger: #ffb4c0;
    --color-danger-hover: #ffd0d8;
    --color-neutral-bg: #2b3540;
    --color-neutral-text: #c2cedd;
    --color-info-bg: #1f3048;
    --color-info-text: #b9d0f5;
    --color-info-line: #7fa6e8;
    --color-boost: #5fcbe0;
    --color-boost-bg: #12343d;
    --color-boost-text: #a5e9f5;
    --shadow-panel: none;
    --shadow-menu: 0 12px 32px rgb(0 0 0 / 0.5);
    --shadow-dialog: 0 24px 80px rgb(0 0 0 / 0.5);
}

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

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--color-bg);
    color: var(--color-text);
    font: 400 var(--text-base) / var(--line-body) var(--font-family);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: var(--line-heading);
    font-weight: 600;
}

h1 {
    font-size: var(--text-2xl);
    letter-spacing: -0.02em;
}

h2 {
    font-size: var(--text-lg);
}

h3 {
    font-size: var(--text-base);
}

p {
    margin: 0;
}

a {
    color: var(--color-accent);
    text-underline-offset: 4px;
}

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

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

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

[hidden] {
    display: none !important;
}

.num,
.nums {
    font-variant-numeric: tabular-nums;
}

.muted {
    color: var(--color-text-secondary);
}

.small {
    font-size: var(--text-sm);
}

svg.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Buttons ---------- */

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    background: var(--color-accent);
    color: var(--color-on-accent);
    font: 600 var(--text-sm) / 1.3 var(--font-family);
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    touch-action: manipulation;
}

button:hover,
.btn:hover {
    background: var(--color-accent-hover);
    color: var(--color-on-accent);
}

button:disabled,
button[aria-disabled="true"] {
    opacity: 0.58;
    cursor: not-allowed;
}

button:disabled:hover {
    background: var(--color-accent);
}

/* A button waiting for the server: keeps its label, adds a spinner, can't be pressed again. */
button[aria-busy="true"] {
    cursor: progress;
    opacity: 0.8;
}

button[aria-busy="true"]::before {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

button.secondary,
.btn.secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-control-border);
}

button.secondary:hover,
.btn.secondary:hover,
button.secondary:disabled:hover {
    background: var(--color-surface-subtle);
    color: var(--color-text);
}

button.ghost,
.btn.ghost {
    background: transparent;
    color: var(--color-accent);
    border-color: transparent;
}

button.ghost:hover,
.btn.ghost:hover {
    background: var(--color-accent-subtle);
    color: var(--color-accent-hover);
}

/* Destructive list actions (Cancel, Reject, Disable, Remove): outlined, in the danger colour. */
button.danger,
.btn.danger {
    background: var(--color-surface);
    color: var(--color-danger-text);
    border-color: var(--color-danger);
}

button.danger:hover,
.btn.danger:hover,
button.danger:disabled:hover {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
}

/* The confirming action of a destructive confirmation dialog. */
button.danger-solid {
    background: var(--color-danger);
    color: var(--color-surface);
}

button.danger-solid:hover,
button.danger-solid:disabled:hover {
    background: var(--color-danger-hover);
    color: var(--color-surface);
}

button.small,
.btn.small {
    min-height: 36px;
    padding: 6px 12px;
    font-size: var(--text-xs);
}

button.full,
.btn.full {
    width: 100%;
}

button.link {
    min-height: 44px;
    padding: 0;
    background: none;
    border: 0;
    color: var(--color-accent);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 4px;
}

button.link:hover {
    background: none;
    color: var(--color-accent-hover);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: 44px;
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
}

/* ---------- Form fields ---------- */

/* Field titles: bold, full text colour, on every page. */
label {
    display: block;
    margin: 0 0 var(--space-2);
    color: var(--color-text);
    font-size: var(--text-sm);
    font-weight: 700;
}

/* :where() keeps this at element-level weight, so a page or component rule (e.g. margin: 0
   inside a row of fields) always wins over these defaults. */
input:where(:not([type="checkbox"]):not([type="radio"])),
textarea,
select {
    display: block;
    width: 100%;
    min-height: 48px;
    margin: 0 0 var(--space-5);
    padding: 11px 12px;
    border: 1px solid var(--color-control-border);
    border-radius: var(--radius-control);
    background: var(--color-surface);
    color: var(--color-text);
    font: 400 var(--text-base) / 1.4 var(--font-family);
}

textarea {
    min-height: 112px;
    resize: vertical;
}

input:hover,
textarea:hover,
select:hover {
    border-color: var(--color-accent);
}

input::placeholder,
textarea::placeholder {
    color: var(--color-text-secondary);
    opacity: 1;
}

input:disabled,
textarea:disabled,
select:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

input:disabled:hover,
textarea:disabled:hover,
select:disabled:hover {
    border-color: var(--color-control-border);
}

[aria-invalid="true"] {
    border: 2px solid var(--color-danger) !important;
}

input[type="checkbox"],
input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--color-accent);
}

input[type="date"] {
    min-width: 0;
}

fieldset {
    margin: 0 0 var(--space-5);
    padding: 0;
    border: 0;
    min-width: 0;
}

legend {
    margin-bottom: var(--space-2);
    padding: 0;
    font-size: var(--text-sm);
    font-weight: 700;
}

.field {
    margin-bottom: var(--space-5);
}

.field > input,
.field > select,
.field > textarea {
    margin-bottom: 0;
}

.field-help,
.field-hint {
    margin: calc(var(--space-5) * -1 + var(--space-2)) 0 var(--space-5);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.field > .field-help {
    margin: var(--space-2) 0 0;
}

.optional {
    font-weight: 400;
    color: var(--color-text-secondary);
}

/* A field's own error, right under it (forms.js). Fields outside a .field box keep a gap under
   them, so the message tucks up into it, as a hint does. */
.field-error {
    margin: calc(var(--space-5) * -1 + var(--space-2)) 0 var(--space-5);
    color: var(--color-danger-text);
    font-size: var(--text-xs);
    font-weight: 600;
}

.field > .field-error,
.inline-fields .field-error,
.pkg-qty .field-error,
.picker .field-error {
    margin: var(--space-2) 0 0;
}

/* A row of fields with an error under one of them lines up at the top instead, so that field's
   box stays level with the others; its buttons move down by a label's height to stay beside them. */
.inline-fields:has(.field-error) {
    align-items: flex-start;
}

.inline-fields:has(.field-error) > :is(button, .btn, .actions) {
    margin-top: calc(var(--text-sm) * var(--line-body) + var(--space-2));
}

.form-error {
    margin: 0 0 var(--space-4);
    padding: 10px 14px;
    border-radius: var(--radius-control);
    border-inline-start: 3px solid currentColor;
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    font-size: var(--text-sm);
}

/* A checkbox with its text, as a 44 px target. */
label.check,
.check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin: 0;
    font-size: var(--text-sm);
    font-weight: 400;
    cursor: pointer;
}

/* The Active switch: a checkbox drawn as a toggle, always with the word Active beside it. */
.toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    width: 40px;
    height: 24px;
    border: 1px solid var(--color-control-border);
    border-radius: 20px;
    background: var(--color-surface-subtle);
    cursor: pointer;
}

.toggle input[type="checkbox"]::before {
    content: "";
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-text-secondary);
    transition: inset-inline-start 0.15s;
}

.toggle input[type="checkbox"]:checked {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.toggle input[type="checkbox"]:checked::before {
    inset-inline-start: 19px;
    background: var(--color-on-accent);
}

/* Two fields side by side (one column on phones). */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 var(--space-4);
}

.form-grid .full {
    grid-column: 1 / -1;
}

/* Fields and their buttons on one line (filters, discount + Save, amount + note + Add…).
   Everything sits on the same bottom line and buttons are as tall as the fields. */
.inline-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
}

.inline-fields > div {
    flex: 1 1 180px;
    min-width: 0;
}

.inline-fields > .narrow {
    flex: 0 1 170px;
}

.inline-fields input:where(:not([type="checkbox"]):not([type="radio"])),
.inline-fields select {
    height: 48px;
    margin: 0;
}

.inline-fields button,
.inline-fields .btn,
.inline-fields .actions {
    flex: 0 0 auto;
}

.inline-fields button,
.inline-fields .btn {
    min-height: 48px;
}

.inline-fields label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.form-actions .spacer {
    margin-inline-end: auto;
}

/* Payment choices: radio cards. */
.radio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: var(--space-3);
}

.radio-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    margin: 0;
    padding: 14px 12px;
    border: 1px solid var(--color-control-border);
    border-radius: var(--radius-control);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
}

.radio-card:hover {
    background: var(--color-surface-subtle);
}

.radio-card:has(input:checked) {
    padding: 13px 11px;
    border: 2px solid var(--color-accent);
    background: var(--color-accent-subtle);
}

/* ---------- Banners (success / error / info) ---------- */

.alert,
.error,
.success,
.notice {
    margin: 0 0 var(--space-5);
    padding: 14px 18px;
    border-radius: var(--radius-control);
    border-inline-start: 3px solid currentColor;
    background: var(--color-neutral-bg);
    color: var(--color-neutral-text);
    font-size: var(--text-sm);
    overflow-wrap: anywhere;
}

/* The sign-in pages show these by setting style.display. */
.error,
.success {
    display: none;
}

.error,
.alert.error {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
}

.success,
.alert.success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.alert.warning,
.notice.warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.notice.info {
    background: var(--color-info-bg);
    color: var(--color-info-text);
}

.notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
}

.notice a {
    color: inherit;
    font-weight: 600;
}

/* ---------- Page header ---------- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--space-4) var(--space-6);
    margin-bottom: var(--space-6);
}

.page-head .titles {
    min-width: 0;
}

.page-head p {
    margin-top: var(--space-2);
    max-width: 640px;
    color: var(--color-text-secondary);
}

.page-head .actions {
    flex-shrink: 0;
}

.eyebrow {
    margin-bottom: var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
}

/* ---------- Cards ---------- */

.panel,
.card {
    margin-bottom: var(--space-6);
    padding: var(--space-6);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-panel);
    min-width: 0;
}

.panel > h2,
.card > h2 {
    margin-bottom: var(--space-4);
}

.card-head,
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-4);
}

.card-head h2,
.panel-head h2 {
    margin: 0;
}

.card-head .count {
    color: var(--color-text-secondary);
    font-weight: 500;
}

.card-foot {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

.card-foot a {
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
}

.sub {
    margin: 0 0 var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 var(--space-6);
    align-items: start;
}

.divider {
    margin: var(--space-6) 0;
    border: 0;
    border-top: 1px solid var(--color-border);
}

/* ---------- Lists ---------- */

/* Rows: what it is first, figures second, status/actions last. */
.row,
.item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-5);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border);
}

.row:first-child,
.item:first-child {
    padding-top: 0;
}

.row:last-child,
.item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.row-main,
.item-info {
    flex: 1;
    min-width: 200px;
}

.row-title,
.item-title {
    font-size: var(--text-base);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.row-sub,
.item-meta {
    margin-top: 2px;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    overflow-wrap: anywhere;
}

.row-side {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2) var(--space-3);
}

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

.price {
    font-size: var(--text-lg);
    font-weight: 600;
    text-align: end;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.price del {
    display: block;
    font-size: var(--text-xs);
    font-weight: 400;
    color: var(--color-text-secondary);
}

.brief {
    margin-top: var(--space-2);
    padding: 8px 12px;
    border-inline-start: 3px solid var(--color-border);
    background: var(--color-surface-subtle);
    border-radius: 0 var(--radius-control) var(--radius-control) 0;
    font-size: var(--text-sm);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.brief-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-text-secondary);
}

.clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Status pills, badges, chips ---------- */

.pill,
.badge,
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--color-neutral-bg);
    color: var(--color-neutral-text);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    vertical-align: middle;
}

.badge {
    border-radius: 6px;
}

/* Status: a dot plus words, never colour alone. */
.status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.status.waiting,
.pill.warning,
.badge.warning,
.badge-unverified {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.status.active,
.pill.info,
.badge.info {
    background: var(--color-info-bg);
    color: var(--color-info-text);
}

.status.done,
.badge-discount {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.status.problem,
.pill.danger,
.badge.danger,
.badge-disabled {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
}

.status.neutral {
    background: var(--color-neutral-bg);
    color: var(--color-neutral-text);
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: var(--radius-pill);
    background: var(--color-accent);
    color: var(--color-on-accent);
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 0 0 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-surface-subtle);
    color: var(--color-text);
    font-size: var(--text-sm);
}

.chip button {
    min-width: 40px;
    min-height: 34px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: none;
    color: var(--color-danger-text);
    font-size: 18px;
    font-weight: 400;
}

.chip button:hover {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

/* ---------- Credit figures ---------- */

/* Available, Reserved and Balance follow the room they actually have (a sidebar can take part of
   the screen), not the screen size: when it's tight, Available gets its own row and the other two
   share the next one, their numbers shrinking a little on the narrowest phones. */
.stats {
    container-type: inline-size;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.stats > .stat {
    flex: 1 1 0;
}

.stats > .stat.primary {
    flex-grow: 1.3;
}

@container (max-width: 720px) {
    .stats > .stat.primary {
        flex-basis: 100%;
    }

    .stats > .stat:not(.primary) .stat-value {
        font-size: clamp(20px, 8cqi, var(--text-stat));
    }
}

.stat {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
    padding: var(--space-5) var(--space-6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    box-shadow: var(--shadow-panel);
}

.stat-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
}

.stat-value {
    font-size: var(--text-stat);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.stat-value small {
    margin-inline-start: 6px;
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0;
}

.stat-hint {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.stat .stat-action {
    margin-top: var(--space-3);
    align-self: flex-start;
}

/* The available figure: the one that matters most, with Add credits right on it. */
.stat.primary {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-on-accent);
}

.stat.primary .stat-label,
.stat.primary .stat-hint {
    color: var(--color-on-accent);
    opacity: 0.9;
}

.stat.primary .btn,
.stat.primary button {
    background: var(--color-on-accent);
    color: var(--color-accent);
}

.stat.primary .btn:hover,
.stat.primary button:hover {
    background: var(--color-accent-subtle);
    color: var(--color-accent-hover);
}

a.stat,
button.stat {
    color: var(--color-text);
    text-align: start;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
}

a.stat:hover,
button.stat:hover {
    border-color: var(--color-accent);
    background: var(--color-surface);
    color: var(--color-text);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.stat-grid .stat {
    padding: var(--space-4) var(--space-5);
}

.stat-grid .stat-value {
    font-size: 30px;
}

.stat.attention .stat-value {
    color: var(--color-warning-text);
}

/* ---------- Tabs and segmented filters ---------- */

.tabs {
    display: flex;
    gap: var(--space-1);
    margin: 0 0 var(--space-6);
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tabs a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    min-height: 44px;
    padding: 10px 14px;
    border-bottom: 3px solid transparent;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.tabs a:hover {
    color: var(--color-text);
}

.tabs a[aria-current="page"] {
    border-bottom-color: var(--color-accent);
    color: var(--color-accent);
}

.seg {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.seg button {
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid var(--color-control-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--text-xs);
    font-weight: 600;
}

.seg button:hover {
    background: var(--color-surface-subtle);
    color: var(--color-text);
}

.seg button[aria-pressed="true"] {
    border-color: var(--color-accent);
    background: var(--color-accent);
    color: var(--color-on-accent);
}

.seg .n {
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}

.filters {
    margin-bottom: var(--space-4);
}

.filters .inline-fields > div {
    flex: 1 1 150px;
}

.result-count {
    margin: 0 0 var(--space-3);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

/* ---------- Pagination ---------- */

.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.pager .actions {
    gap: var(--space-2);
}

/* ---------- Statement table ---------- */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    font-weight: 700;
    text-align: start;
    white-space: nowrap;
}

.table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.table tr:last-child td {
    border-bottom: 0;
}

.table .amount,
.table .balance {
    text-align: end;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.table th.amount,
.table th.balance {
    text-align: end;
}

.amount.plus {
    color: var(--color-success-text);
    font-weight: 600;
}

.amount.minus {
    color: var(--color-text);
    font-weight: 600;
}

.amount.hold {
    color: var(--color-text-secondary);
    font-style: normal;
}

tr.is-hold td {
    background: var(--color-surface-subtle);
}

tr.is-hold .desc {
    color: var(--color-text-secondary);
}

.table .when {
    white-space: nowrap;
    color: var(--color-text-secondary);
}

.table .lbl {
    display: none;
}

.desc-main {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.desc-sub {
    margin-top: 2px;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.tag {
    display: inline-block;
    margin-inline-end: 6px;
    padding: 0 6px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    vertical-align: 1px;
}

.statement-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-6);
    margin-bottom: var(--space-4);
    padding: 12px 14px;
    border-radius: var(--radius-control);
    background: var(--color-surface-subtle);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
}

.statement-summary strong {
    font-weight: 700;
}

/* ---------- Empty, loading and error states ---------- */

.empty {
    margin: 0;
    padding: var(--space-8) var(--space-4);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.empty .btn,
.empty button {
    margin-top: var(--space-4);
}

.empty-title {
    margin-bottom: var(--space-1);
    color: var(--color-text);
    font-size: var(--text-base);
    font-weight: 600;
}

.loading {
    margin: 0;
    padding: var(--space-4) 0;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

/* Grey bars while a view loads; no made-up values. */
.skeleton {
    display: grid;
    gap: var(--space-3);
    padding: var(--space-2) 0;
}

.skeleton span {
    display: block;
    height: 14px;
    border-radius: 6px;
    background: var(--color-surface-subtle);
    animation: pulse 1.4s ease-in-out infinite;
}

.skeleton span:nth-child(2n) {
    width: 60%;
}

.skeleton span:nth-child(3n) {
    width: 80%;
}

@keyframes pulse {
    50% { opacity: 0.55; }
}

.load-error {
    padding: var(--space-6);
    border: 1px solid var(--color-danger);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    text-align: center;
}

.load-error p {
    margin-bottom: var(--space-4);
    color: var(--color-danger-text);
    font-size: var(--text-sm);
}

/* ---------- Payment instructions and the copy box ---------- */

.instructions {
    margin: 0 0 var(--space-5);
    padding: var(--space-5);
    border-radius: var(--radius-control);
    background: var(--color-surface-subtle);
}

.instructions h3 {
    margin-bottom: var(--space-2);
}

.instructions-text {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    white-space: pre-wrap;
}

.copy-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin: var(--space-4) 0;
    padding: 8px 8px 8px 16px;
    border: 1px solid var(--color-control-border);
    border-radius: var(--radius-control);
    background: var(--color-surface);
}

.copy-box code {
    direction: ltr;
    unicode-bidi: isolate;
    font: 600 var(--text-base) / 1.4 var(--font-family);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    overflow-wrap: anywhere;
}

.copy-box button {
    flex-shrink: 0;
}

.instructions > :last-child {
    margin-bottom: 0;
}

.steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.steps > li {
    position: relative;
    padding-inline-start: 44px;
    padding-bottom: var(--space-6);
}

.steps > li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-accent-subtle);
    color: var(--color-accent-hover);
    font-size: var(--text-sm);
    font-weight: 700;
}

.steps > li > h3 {
    margin: 2px 0 var(--space-3);
}

/* ---------- Dialogs (ui.js) ---------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: var(--space-4);
    overflow-y: auto;
    background: var(--color-overlay);
}

.dialog {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: auto;
    padding: var(--space-6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    box-shadow: var(--shadow-dialog);
}

.dialog h2 {
    font-size: var(--text-lg);
    overflow-wrap: anywhere;
}

.dialog .dialog-message {
    margin-top: var(--space-3);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    overflow-wrap: anywhere;
}

/* What an action does, line by line: Business, Item, Credits, Balance 500 → 470… */
.dialog-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px var(--space-4);
    margin: var(--space-4) 0 0;
    padding: var(--space-4);
    border-radius: var(--radius-control);
    background: var(--color-surface-subtle);
    font-size: var(--text-sm);
}

.dialog-details dt {
    color: var(--color-text-secondary);
}

.dialog-details dd {
    margin: 0;
    font-weight: 600;
    text-align: end;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

.dialog-details .change {
    white-space: nowrap;
}

.dialog-fields {
    margin-top: var(--space-4);
}

.dialog .notice {
    margin: var(--space-4) 0 0;
}

.dialog .form-error {
    margin: var(--space-4) 0 0;
}

.dialog .actions {
    justify-content: flex-end;
    margin-top: var(--space-6);
}

/* × in the corner of a dialog that has one (closeLabel); the title keeps clear of it. */
.dialog-close {
    position: absolute;
    top: var(--space-3);
    inset-inline-end: var(--space-3);
    width: 40px;
    min-height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
}

.dialog-close:hover {
    background: var(--color-surface-subtle);
    color: var(--color-text);
}

.dialog:has(.dialog-close) h2 {
    padding-inline-end: 40px;
}

/* A small emoji after a dialog's title (titleIcon). */
.dialog-title-icon {
    font-size: 0.9em;
}

/* The welcome after signing in: compact, and eases in (no movement with reduced motion). */
.dialog-welcome {
    max-width: 420px;
    animation: dialog-welcome-in 0.22s ease-out;
}

@keyframes dialog-welcome-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

/* ---------- Toasts ---------- */

.toasts {
    position: fixed;
    inset-inline-end: var(--space-6);
    bottom: var(--space-6);
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 12px 12px 12px 16px;
    border-radius: var(--radius-control);
    border-inline-start: 4px solid var(--color-success-text);
    background: var(--color-surface);
    box-shadow: var(--shadow-menu);
    color: var(--color-text);
    font-size: var(--text-sm);
    pointer-events: auto;
}

.toast.toast-error {
    border-inline-start-color: var(--color-danger);
}

/* The same message again: the toast already showing flashes instead of a second one appearing. */
.toast.is-refreshed {
    animation: toast-refresh 0.6s ease-out;
}

@keyframes toast-refresh {
    from { box-shadow: 0 0 0 3px var(--color-accent-subtle), var(--shadow-menu); }
    to { box-shadow: var(--shadow-menu); }
}

.toast.toast-info {
    border-inline-start-color: var(--color-info-line);
}

.toast p {
    flex: 1;
    padding-top: 6px;
    overflow-wrap: anywhere;
}

.toast button {
    min-height: 32px;
    padding: 4px 10px;
    border: 0;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 18px;
}

.toast button:hover {
    background: var(--color-surface-subtle);
    color: var(--color-text);
}

/* ---------- Menus (account menu, More) ---------- */

.menu {
    position: absolute;
    z-index: 80;
    min-width: 230px;
    padding: var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    box-shadow: var(--shadow-menu);
}

.menu-head {
    padding: 8px 12px 10px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-1);
    font-size: var(--text-sm);
}

.menu-head strong {
    display: block;
    overflow-wrap: anywhere;
}

.menu-head span {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    overflow-wrap: anywhere;
}

.menu a,
.menu button {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--radius-control);
    background: none;
    color: var(--color-text);
    font: 500 var(--text-sm) / 1.3 var(--font-family);
    text-align: start;
    text-decoration: none;
}

.menu a:hover,
.menu button:hover {
    background: var(--color-surface-subtle);
    color: var(--color-text);
}

.menu button[data-logout],
.menu button[data-logout]:hover {
    color: var(--color-danger-text);
}

.menu button[data-logout]:hover {
    background: var(--color-danger-bg);
}

.menu a[aria-current="page"] {
    color: var(--color-accent);
    font-weight: 700;
}

/* ---------- Lists inside cards, tiles, editors ---------- */

/* Rows grouped in a .list keep their dividers between rows only (not before a footer or pager). */
.list > .row:last-child,
.list > .item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.list + .pager,
.list + .card-foot {
    margin-top: var(--space-4);
}

.row.editing {
    display: block;
}

.card.inset {
    margin-bottom: var(--space-5);
    background: var(--color-surface-subtle);
    box-shadow: none;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-3);
}

/* A clickable summary card (a client, a client plan). */
.tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface);
    color: var(--color-text);
    text-decoration: none;
}

.tile:hover {
    border-color: var(--color-accent);
    background: var(--color-surface-subtle);
    color: var(--color-text);
}

.tile .cal-progress {
    align-self: stretch;
}

.tile-title {
    max-width: 100%;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.tile-sub {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

.tile-figure {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

.tile-figure strong {
    color: var(--color-text);
    font-size: var(--text-xl);
}

.tile-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px;
}

.warn {
    color: var(--color-warning-text);
}

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

/* A boost's days: one small button per day with its share; charged days ticked, days taken out
   struck through. */
.boost-days {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: var(--space-2);
}

.boost-day {
    flex-direction: column;
    gap: 0;
    min-width: 56px;
    min-height: 44px;
    padding: 4px 8px;
    border: 1px solid var(--color-control-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
}

.boost-day strong {
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
}

.boost-day:hover {
    border-color: var(--color-accent);
    background: var(--color-surface-subtle);
    color: var(--color-text);
}

.boost-day.is-charged,
.boost-day.is-charged:hover {
    border-color: var(--color-success-text);
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.boost-day.is-out,
.boost-day.is-out:hover {
    border-style: dashed;
    background: transparent;
    color: var(--color-text-secondary);
    text-decoration: line-through;
}

.boost-day:disabled {
    opacity: 1;
    cursor: default;
}

.boost-days-hint {
    margin: var(--space-2) 0 0;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.plan-item .row-side input[type="date"],
.wc-row .row-side input[type="date"] {
    min-height: 40px;
    margin: 0;
    padding: 6px 10px;
    font-size: var(--text-sm);
}

/* Package items: services from the catalogue (admin-manage.js). The picker is a search box with
   a list of matching services under it; the highlighted one is outlined as well as tinted. */
.picker {
    position: relative;
    margin-bottom: var(--space-4);
}

.picker-list {
    position: absolute;
    z-index: 30;
    inset-inline: 0;
    max-height: 288px;
    overflow-y: auto;
    margin: 4px 0 0;
    padding: 4px;
    list-style: none;
    background: var(--color-surface);
    border: 1px solid var(--color-control-border);
    border-radius: var(--radius-control);
    box-shadow: var(--shadow-menu);
}

.picker-list [role="option"] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.picker-list [data-service]:hover,
.picker-list [data-service].is-active {
    background: var(--color-accent-subtle);
}

.picker-list [data-service].is-active {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

.picker-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.picker-price {
    flex-shrink: 0;
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

.picker-list .picker-empty {
    cursor: default;
    color: var(--color-text-secondary);
}

.pkg-lines {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.pkg-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px 150px auto;
    gap: var(--space-2) var(--space-4);
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface);
}

.pkg-line.needs-link {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto;
    border-color: var(--color-warning-text);
    background: var(--color-warning-bg);
}

.pkg-line-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    min-width: 0;
}

.pkg-line-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.pkg-line .field,
.pkg-line .picker {
    margin: 0;
}

.pkg-qty input {
    min-height: 40px;
    margin: 0;
    padding: 6px 10px;
}

.pkg-line-total {
    display: flex;
    flex-direction: column;
    font-variant-numeric: tabular-nums;
}

.pkg-remove {
    color: var(--color-danger-text);
}

.pkg-empty {
    margin: 0;
}

.plan-total {
    margin: var(--space-3) 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

details.card > summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    cursor: pointer;
}

/* ---------- Phones ---------- */

@media (max-width: 760px) {
    h1 {
        font-size: 24px;
    }

    .page-head {
        align-items: flex-start;
        margin-bottom: var(--space-5);
    }

    .page-head .actions {
        width: 100%;
    }

    .page-head .actions .btn,
    .page-head .actions button {
        flex: 1;
    }

    .panel,
    .card {
        margin-bottom: var(--space-4);
        padding: var(--space-4);
    }

    .form-grid,
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* Phones: fields share the width, buttons take a full line below them. */
    .inline-fields > .narrow {
        flex: 1 1 140px;
    }

    .inline-fields > button,
    .inline-fields > .btn,
    .inline-fields > .actions {
        flex: 1 1 100%;
    }

    .inline-fields > .actions button {
        flex: 1;
    }

    .row,
    .item {
        gap: var(--space-2) var(--space-3);
    }

    .row-main,
    .item-info {
        flex-basis: 100%;
        min-width: 0;
    }

    .row-side {
        width: 100%;
        justify-content: space-between;
    }

    .row-side .actions {
        width: 100%;
    }

    .row-side .actions button {
        flex: 1;
    }

    .price {
        text-align: start;
    }

    .stats {
        gap: var(--space-3);
    }

    .stats .stat {
        padding: var(--space-4);
    }

    .stat-value {
        font-size: 28px;
    }

    .stat.primary .stat-value {
        font-size: var(--text-stat);
    }

    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-grid .stat-value {
        font-size: 26px;
    }

    .radio-grid {
        grid-template-columns: 1fr;
    }

    .instructions {
        padding: var(--space-4);
    }

    .copy-box {
        align-items: flex-start;
    }

    .copy-box code {
        padding-top: 7px;
    }

    .dialog {
        padding: var(--space-5);
    }

    .dialog .actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    /* Phones: actions stack full-width, the main one on top. */
    .form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .form-actions .spacer {
        margin: 0;
    }

    .pkg-line,
    .pkg-line.needs-link {
        grid-template-columns: 1fr 1fr;
    }

    .pkg-line-main,
    .pkg-line .picker {
        grid-column: 1 / -1;
    }

    .pkg-remove {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .client-app .page-head .eyebrow {
        display: none;
    }

    /* The statement becomes one card per entry. */
    .table thead {
        display: none;
    }

    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
    }

    .table tr {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 2px var(--space-3);
        padding: 12px 0;
        border-bottom: 1px solid var(--color-border);
    }

    .table tr.is-hold {
        padding-inline: 10px;
        border-radius: var(--radius-control);
        background: var(--color-surface-subtle);
    }

    .table tr:last-child {
        border-bottom: 0;
    }

    .table td {
        padding: 0;
        border: 0;
    }

    tr.is-hold td {
        background: none;
    }

    .table td.desc {
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    .table td.when {
        grid-column: 1;
        grid-row: 3;
        font-size: var(--text-xs);
    }

    .table td.amount {
        grid-column: 2;
        grid-row: 1;
    }

    .table td.balance {
        grid-column: 2;
        grid-row: 2 / span 2;
        font-size: var(--text-xs);
        color: var(--color-text-secondary);
    }

    .table .lbl {
        display: inline;
    }

    .toasts {
        inset-inline: 16px;
        bottom: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom, 0px) + 12px);
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}
