/* Spinx: light, mobile-first styles. Colours are tokens so dark mode only redefines them. */

:root {
    --primary: #2e7d6b;
    --primary-strong: #23604f;
    --primary-soft: #e3f1ec;
    --on-primary: #ffffff;
    --bg: #f5f6f3;
    --surface: #ffffff;
    --text: #1d2421;
    --text-muted: #67716c;
    --border: #e1e5e1;
    --danger: #c0392b;
    --warning: #b7791f;

    --radius: 14px;
    --tap: 48px;
    --header-h: 56px;
    --nav-h: 64px;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary: #5fbfa6;
        --primary-strong: #82d3bd;
        --primary-soft: #1d3530;
        --on-primary: #0e1a17;
        --bg: #111614;
        --surface: #1a201e;
        --text: #e7ece9;
        --text-muted: #9aa5a0;
        --border: #2a322f;
        --danger: #ef7064;
        --warning: #e0b05a;
        color-scheme: dark;
    }
}

/* ---------- Colour themes (chosen per device under Meer > Instellingen) ---------- */

.theme-root {
    display: contents;
}

[data-theme="oceaan"] { --primary: #1f6fa8; --primary-strong: #17577f; --primary-soft: #e2eef7; }
[data-theme="lavendel"] { --primary: #6b4fb3; --primary-strong: #553d91; --primary-soft: #ece7f7; }
[data-theme="terracotta"] { --primary: #c0562f; --primary-strong: #9c4424; --primary-soft: #f8e8e1; }
[data-theme="framboos"] { --primary: #c2185b; --primary-strong: #9b1248; --primary-soft: #f9e3ec; }
[data-theme="leisteen"] { --primary: #455a64; --primary-strong: #34454d; --primary-soft: #e6ebed; }

@media (prefers-color-scheme: dark) {
    [data-theme="oceaan"] { --primary: #6fb3e3; --primary-strong: #9ccbee; --primary-soft: #173041; }
    [data-theme="lavendel"] { --primary: #b19ef0; --primary-strong: #cbbcf6; --primary-soft: #2a2342; }
    [data-theme="terracotta"] { --primary: #ef9a76; --primary-strong: #f5b89d; --primary-soft: #3d2219; }
    [data-theme="framboos"] { --primary: #f27aa6; --primary-strong: #f6a0c0; --primary-soft: #3f1a29; }
    [data-theme="leisteen"] { --primary: #9fb3bd; --primary-strong: #bccbd3; --primary-soft: #263035; }
}

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

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior: none;
}

#app {
    height: 100%;
}

h1, h2, h3 {
    margin: 0;
    font-weight: 600;
}

h2 {
    font-size: 1.05rem;
}

h1:focus {
    outline: none;
}

button {
    font: inherit;
    color: inherit;
}

/* ---------- App shell ---------- */

.shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
}

.app-header {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: calc(var(--header-h) + var(--safe-top));
    padding: var(--safe-top) calc(12px + var(--safe-right)) 0 calc(16px + var(--safe-left));
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.app-header > .icon-button:last-child {
    margin-right: -8px;
}

.app-header .title {
    flex: 1;
    min-width: 0;
    font-size: 1.2rem;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-main {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px calc(16px + var(--safe-right)) 24px calc(16px + var(--safe-left));
}

.bottom-nav {
    flex: none;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: var(--nav-h);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
}

.bottom-nav a .icon {
    width: 26px;
    height: 26px;
    padding: 1px 14px;
    box-sizing: content-box;
    border-radius: 999px;
}

.bottom-nav a.active {
    color: var(--primary);
}

.bottom-nav a.active .icon {
    background: var(--primary-soft);
}

/* ---------- Building blocks ---------- */

.icon {
    width: 24px;
    height: 24px;
    flex: none;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--tap);
    height: var(--tap);
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
}

.icon-button:active {
    background: var(--primary-soft);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--tap);
    padding: 0 20px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--on-primary);
}

.btn-primary:active {
    background: var(--primary-strong);
}

.btn-block {
    width: 100%;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.small {
    font-size: 0.875rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state p {
    margin: 0;
}

.empty-state .icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
    opacity: 0.7;
}

.kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    margin: 0;
}

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

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

.btn-danger {
    border-color: var(--danger);
    background: var(--danger);
    color: #fff;
}

.btn-small {
    min-height: 36px;
    padding: 0 14px;
    font-size: 0.875rem;
}

.btn-text {
    border: 0;
    background: transparent;
    color: var(--primary);
}

.btn:disabled {
    opacity: 0.5;
}

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

.field {
    width: 100%;
    min-height: var(--tap);
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

textarea.field {
    min-height: 96px;
    resize: vertical;
}

select.field {
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    padding-right: 36px;
}

.field-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.field-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.field-row > .field {
    flex: 1;
    min-width: 0;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--tap);
    cursor: pointer;
}

.toggle-row input {
    width: 22px;
    height: 22px;
    accent-color: var(--primary);
}

.segmented {
    display: flex;
    padding: 3px;
    border-radius: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.segmented button {
    flex: 1;
    min-height: 40px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
}

.segmented a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 9px;
    color: var(--text-muted);
    font-weight: 600;
    text-decoration: none;
}

.segmented.tabs {
    margin-bottom: 8px;
}

.segmented a.selected,
.segmented button.selected {
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* ---------- Chips ---------- */

.chip-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: 0 -16px;
    padding: 2px 16px 4px;
    scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
    display: none;
}

.chip-row.wrap {
    flex-wrap: wrap;
    overflow-x: visible;
}

.chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.chip .icon {
    width: 16px;
    height: 16px;
}

.chip.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--on-primary);
}

.chip-ghost {
    padding: 0 10px;
    border-style: dashed;
    color: var(--text-muted);
}

.chip-count {
    min-width: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

.chip.selected .chip-count {
    background: rgba(255, 255, 255, 0.25);
    color: inherit;
}

.chip-fav .icon {
    color: var(--warning);
}

/* ---------- Lists of rows ---------- */

.add-bar {
    position: sticky;
    /* Sticky offsets count from inside .app-main's padding; -16px sticks to its very top. */
    top: -16px;
    z-index: 2;
    margin: 0 -16px;
    padding: 8px 16px;
    background: var(--bg);
}

.app-main > .ptr + .add-bar {
    margin-top: -16px;
    padding-top: 12px;
}

.icon-button.toggle {
    color: var(--border);
}

.icon-button.toggle.on {
    color: var(--primary);
}

.icon-button.toggle.on.fav {
    color: var(--warning);
}

.icon-button.toggle.on .icon {
    fill: currentColor;
}

.icon-button.back {
    margin-left: -12px;
    color: var(--text);
}

.icon.inline {
    width: 16px;
    height: 16px;
    vertical-align: -3px;
}

.add-bar form {
    display: flex;
    gap: 8px;
}

.add-bar .field {
    flex: 1;
    min-width: 0;
}

.add-bar form > .field.qty {
    flex: none;
    width: 64px;
    padding: 10px 8px;
    text-align: center;
}

.add-bar form.add-extras {
    align-items: center;
    margin-top: 8px;
}

.add-extras .field {
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 0.9rem;
}

.add-extras .promo-toggle {
    flex: none;
    width: var(--tap);
    height: 40px;
    color: var(--text-muted);
    opacity: 0.45;
}

.add-extras .promo-toggle.on {
    opacity: 1;
    color: var(--warning);
}

.add-bar form > .btn {
    flex: none;
    width: var(--tap);
    padding: 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px 4px 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.section-header .grow {
    flex: 1;
}

.section-header .btn {
    text-transform: none;
    letter-spacing: 0;
}

.rows {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.row {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 56px;
    padding: 4px 8px 4px 4px;
    border-top: 1px solid var(--border);
}

.row:first-child {
    border-top: 0;
}

.row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-self: stretch;
    padding: 6px 4px;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

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

.row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.row-meta .icon {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
}

.row-note {
    margin-top: 1px;
    color: var(--text-muted);
    font-size: 0.8rem;
    overflow-wrap: anywhere;
}

.row .promo-toggle {
    flex: none;
    width: 36px;
    height: 36px;
    opacity: 0.35;
}

.row .promo-toggle .icon,
.promo-mark .icon {
    width: 18px;
    height: 18px;
}

.row .promo-toggle.on {
    opacity: 1;
    color: var(--warning);
}

.promo-mark {
    flex: none;
    display: inline-flex;
    padding: 0 6px;
    color: var(--warning);
    opacity: 0.6;
}

.toggle-row .icon {
    width: 16px;
    height: 16px;
    vertical-align: -3px;
}

.row-side {
    flex: none;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.row.done .row-title {
    color: var(--text-muted);
    text-decoration: line-through;
}

.row .icon-button {
    width: 40px;
    height: 40px;
    color: var(--text-muted);
}

.row .icon-button:disabled {
    opacity: 0.25;
}

a.row {
    color: inherit;
    text-decoration: none;
    padding-left: 16px;
}

.check {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--tap);
    height: var(--tap);
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    position: relative;
}

.check::before {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-muted);
    border-radius: 999px;
}

.check.checked::before {
    border-color: var(--primary);
    background: var(--primary);
}

.check .icon {
    position: relative;
    width: 16px;
    height: 16px;
    color: var(--on-primary);
    stroke-width: 3;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--bg);
    font-weight: 600;
}

.badge.overdue {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    color: var(--danger);
}

.badge.today, .badge.soon {
    background: color-mix(in srgb, var(--warning) 16%, transparent);
    color: var(--warning);
}

.badge.person {
    background: var(--primary-soft);
    color: var(--primary);
}

/* ---------- Finance ---------- */

.money-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 4px;
}

.money-summary > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.money-summary span {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.money-summary strong {
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.money-summary small {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.money-summary strong.income,
.row-side.amount.income {
    color: var(--primary);
}

.money-summary strong.negative,
.row-side.amount.negative {
    color: var(--danger);
}

.shares {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    margin: 8px 4px 0;
    font-size: 0.8rem;
}

.shares strong {
    font-variant-numeric: tabular-nums;
}

.reminder {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    margin-bottom: 8px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--warning) 12%, var(--surface));
    color: var(--text);
    font: inherit;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
}

.reminder .icon {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    color: var(--warning);
}

button.month-row {
    width: 100%;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.month-row.current .row-title {
    color: var(--primary);
    font-weight: 600;
}

.month-row .row-main {
    padding-left: 12px;
}

.bar {
    display: block;
    height: 4px;
    margin-top: 6px;
    border-radius: 2px;
    background: var(--bg);
    overflow: hidden;
}

.bar > span {
    display: block;
    height: 100%;
    border-radius: 2px;
    background: var(--primary);
    opacity: 0.7;
}

.history {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 16px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.row-side.amount {
    color: var(--text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.row-side.amount.changed {
    color: var(--warning);
}

.row.paid .row-title,
.row.paid .row-side.amount {
    color: var(--text-muted);
}

/* ---------- Weekly menu ---------- */

.week-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.week-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.day {
    margin-top: 12px;
    padding: 4px 4px 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.day.today {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.day.past {
    opacity: 0.6;
}

.day-header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
}

.day-header .grow {
    flex: 1;
}

.day-name {
    font-weight: 650;
    text-transform: capitalize;
}

.day.today .day-name {
    color: var(--primary);
}

.meal {
    display: flex;
    flex-direction: column;
    width: calc(100% - 12px);
    margin: 4px 0;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: var(--bg);
    text-align: left;
    cursor: pointer;
}

/* ---------- Stock ---------- */

.row.out .row-title {
    color: var(--text-muted);
}

.stepper {
    flex: none;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
}

.stepper button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: var(--surface);
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.stepper button:active {
    background: var(--primary-soft);
}

.stepper-count {
    min-width: 28px;
    text-align: center;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.out-toggle {
    flex: none;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.out-toggle.restock {
    border-color: var(--primary);
    color: var(--primary);
}

/* ---------- Settings ---------- */

.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.theme-option.selected {
    border-color: var(--primary);
}

.theme-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    color: #fff;
}

.theme-swatch .icon {
    stroke-width: 3;
}

/* ---------- Bottom sheet ---------- */

.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.35);
    animation: fade-in 0.15s ease-out;
}

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 51;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    max-width: 560px;
    border-radius: 20px 20px 0 0;
    background: var(--surface);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
    animation: slide-up 0.2s ease-out;
}

.sheet-handle {
    flex: none;
    width: 40px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 999px;
    background: var(--border);
}

.sheet-header {
    flex: none;
    display: flex;
    align-items: center;
    padding: 4px 8px 0 20px;
}

.sheet-header h2 {
    flex: 1;
    font-size: 1.1rem;
}

.sheet-body {
    overflow-y: auto;
    padding: 12px 20px calc(20px + var(--safe-bottom));
}

.menu {
    display: flex;
    flex-direction: column;
    margin: 0 -8px;
}

.menu button, .menu a {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 52px;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.menu button:active, .menu a:active {
    background: var(--bg);
}

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

.menu .danger, .menu .danger .icon {
    color: var(--danger);
}

@keyframes slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
    z-index: 60;
    max-width: calc(100% - 32px);
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    font-size: 0.9rem;
    transform: translateX(-50%);
    animation: fade-in 0.15s ease-out;
}

/* ---------- Sync status ---------- */

.sync-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    cursor: pointer;
}

.sync-status.idle {
    color: var(--primary);
}

.sync-status.error {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger);
}

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

.spin {
    animation: spin 1s linear infinite;
}

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

/* Pull-to-refresh indicator, moved by app.js while pulling. */
.app-main {
    position: relative;
}

.ptr {
    position: absolute;
    top: 4px;
    left: 50%;
    z-index: 5;
    width: 36px;
    height: 36px;
    margin-left: -18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    opacity: 0;
    pointer-events: none;
}

.ptr .icon {
    width: 20px;
    height: 20px;
}

.ptr.ready {
    color: var(--primary);
}

.sync-status .icon {
    width: 16px;
    height: 16px;
}

/* ---------- Splash / welcome ---------- */

.splash {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100dvh;
    background: var(--primary);
    color: var(--on-primary);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.welcome {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 24px;
    min-height: 100dvh;
    padding: calc(32px + var(--safe-top)) 24px calc(32px + var(--safe-bottom));
    max-width: 480px;
    margin: 0 auto;
}

.welcome h1 {
    font-size: 1.8rem;
}

.member-choice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.member-choice button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
}

.member-choice button:active {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 700;
}

/* ---------- Blazor error UI ---------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    padding: 12px 48px calc(12px + var(--safe-bottom)) 16px;
    background: #fff4c2;
    color: #3d3300;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.2);
}

#blazor-error-ui .reload {
    margin-left: 8px;
    color: inherit;
    font-weight: 600;
}

#blazor-error-ui .dismiss {
    position: absolute;
    right: 16px;
    top: 12px;
    cursor: pointer;
}

.blazor-error-boundary {
    padding: 16px;
    border-radius: var(--radius);
    background: var(--danger);
    color: #fff;
}

.blazor-error-boundary::after {
    content: "Er liep iets mis op dit scherm.";
}
