/*
    LiverbirdsMember — mobile-first stylesheet, sharing its design system with StavangerTurer and
    RentalCalendar (same tokens, same components) so the apps read as one family. Shared
    part copied from StavangerTurer's app.css; this app's own components are at the end.

      - 16px minimum on form controls, or iOS Safari zooms the page on focus.
      - 44px minimum on anything tappable (Apple's HIG figure).
      - env(safe-area-inset-*) so the sticky header clears the notch.
      - Nothing wider than the viewport: the page never scrolls sideways.
*/

:root {
    --accent: #a6212a;
    --accent-contrast: #ffffff;

    /* Same accent, used wherever it colours text, an icon, a thin border or an outline
       rather than filling a solid shape. Identical to --accent in light mode; dark mode
       overrides it below. */
    --accent-text: var(--accent);
    --danger: #b3261e;
    --warning: #b26a00;

    /* Affirmative green ("valid", "done") — a separate hue from --accent so
       status reads at a glance, same treatment as --danger/--warning below. */
    --success: #2e7d32;
    --success-text: var(--success);

    --bg: #f6f6f8;
    --surface: #ffffff;
    --surface-alt: #f0f0f4;
    --text: #16161a;
    --text-muted: #6b6b76;
    --border: #e0e0e6;

    --radius: 12px;
    --radius-sm: 8px;

    --header-height: 52px;
    --tabbar-height: 56px;
    --tap: 44px;

    /* Tells the browser this page fully themes its own native form controls (date
       picker, checkbox) for both schemes — without this, some mobile browsers force
       their own dark-mode inversion onto native inputs regardless of our CSS, which is
       what caused near-invisible pale text in a completed trip's date field. */
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121216;
        --surface: #1c1c22;
        --surface-alt: #24242c;
        --text: #f2f2f5;
        --text-muted: #a0a0ad;
        --border: #34343e;

        /* Lighter tints of the same hues — the base colours are too dark to read
           clearly against a near-black page. */
        --accent-text: #e57373;
        --success-text: #66bb6a;
    }
}

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

html {
    /* Stops iOS bumping text size when the device is rotated. */
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    overscroll-behavior-y: contain;
}

a,
button,
[role="button"] {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

h1 {
    font-size: 1.35rem;
    margin: 0 0 0.75rem;
}

h1:focus {
    outline: none;
}

h2 {
    font-size: 1.05rem;
    margin: 0 0 0.5rem;
}

h3 {
    font-size: 0.95rem;
    margin: 0 0 0.5rem;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

/*
    The page title already shows in the sticky header, but the document still needs an
    <h1> — it's the focus target after navigation and the outline for screen readers.
    This keeps it available to assistive tech without drawing it twice.
*/
.visually-hidden-heading {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

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

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

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

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--header-height);
    padding: 0 0.75rem;
    padding-top: env(safe-area-inset-top);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.app-header .brand {
    flex: 1;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header .who {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40vw;
}

.app-main {
    flex: 1;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 0.75rem;
    /* Clears the fixed tab bar plus the home indicator. */
    padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 1rem);
}

.app-main.no-tabbar {
    padding-bottom: calc(env(safe-area-inset-bottom) + 1rem);
}

/* ---- Bottom tab bar ------------------------------------------------------ */

.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
}

.tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: var(--tabbar-height);
    padding: 6px 2px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
}

.tabbar a.active {
    color: var(--accent-text);
}

.tabbar .icon {
    font-size: 1.15rem;
    line-height: 1;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: var(--tap);
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.btn-block {
    width: 100%;
}

.btn-secondary {
    background: transparent;
    color: var(--accent-text);
    border-color: var(--border);
}

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

.btn-small {
    min-height: 34px;
    padding: 0.25rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Sub-navigation within a section, e.g. the account-settings sub-pages (Profile/Email/
   Password/...) — a wrapping row of chip-like links rather than Identity's default
   Bootstrap nav-pills list. */
.subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.subnav a.active {
    background: var(--accent);
    color: var(--accent-contrast);
    border-color: var(--accent);
}

/* ---- Forms -------------------------------------------------------------- */

.field {
    display: block;
    margin-bottom: 1rem;
}

.field > label,
.label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* input:not([type]) because Blazor's <InputText> renders a bare <input> with no type
   attribute, which none of the type-specific selectors below would match. */
input:not([type]),
input[type="text"],
input[type="tel"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="url"],
select,
textarea {
    width: 100%;
    min-height: var(--tap);
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    /* 16px exactly — anything smaller makes iOS Safari zoom in on focus. */
    font-size: 1rem;
    font-family: inherit;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--accent-text);
    outline-offset: 1px;
}

input[type="date"] {
    appearance: none;
    -webkit-appearance: none;
}

.invalid {
    outline: 1px solid var(--danger);
}

.valid.modified:not([type="checkbox"]) {
    outline: 1px solid var(--success);
}

.validation-message {
    display: block;
    margin-top: 0.25rem;
    color: var(--danger);
    font-size: 0.8rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, var(--danger);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: var(--radius-sm);
}

.blazor-error-boundary::after {
    content: "Det oppstod en feil.";
}

/* ---- Toggle switch ----------------------------------------------------- */

.switch {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 48px;
    height: 30px;
}

.switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.switch .track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    /* --border rather than --surface-alt: in dark mode those two tokens sit too close
       together to read as a visible pill against the card behind it. */
    background: var(--border);
    border: 1px solid var(--border);
    transition: background 0.15s ease;
    pointer-events: none;
}

.switch .track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    /* Fixed light thumb regardless of theme — stays visible against the track above in
       both light and dark, rather than tracking --surface (near-black in dark mode,
       which made the thumb disappear into its own track). */
    background: #ffffff;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.4);
    transition: transform 0.15s ease;
}

.switch input:checked + .track {
    /* --success-text rather than --success: the base green reads as too dark/muddy on
       a near-black card in dark mode, where --success-text is already the lighter tint
       used everywhere else for that reason. */
    background: var(--success-text);
    border-color: var(--success-text);
}

.switch input:checked + .track::after {
    transform: translateX(18px);
}

.switch input:focus-visible + .track {
    outline: 2px solid var(--accent-text);
    outline-offset: 2px;
}

.switch.switch-small {
    width: 38px;
    height: 24px;
}

.switch.switch-small .track::after {
    width: 18px;
    height: 18px;
}

.switch.switch-small input:checked + .track::after {
    transform: translateX(14px);
}

/* ---- Radio rows ----------------------------------------------------------- */

.radio-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.radio-row input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* A labelled switch as its own row, e.g. "Admin" / "Active" toggles in a list. */
.switch-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: var(--tap);
    padding: 0.15rem 0;
}

.switch-row .name {
    flex: 1;
}

/* ---- Users / badges -------------------------------------------------------- */

.user-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-row .who {
    flex: 1;
    min-width: 0;
}

.user-row .who strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--surface-alt);
    color: var(--text-muted);
}

.badge.admin {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent-text);
}

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

/* ---- Cards and notices --------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem;
    margin-bottom: 0.75rem;
}

.muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.empty {
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.notice {
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.notice-error {
    color: var(--danger);
    border-color: var(--danger);
    background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.notice-warning {
    color: var(--warning);
    border-color: var(--warning);
    background: color-mix(in srgb, var(--warning) 10%, transparent);
}

.notice-ok {
    color: var(--success-text);
    border-color: var(--success-text);
    background: color-mix(in srgb, var(--success) 8%, transparent);
}

/* ---- Sign-in / register -------------------------------------------------- */

.login {
    max-width: 380px;
    margin: 0 auto;
    padding-top: 2rem;
}

.login h1 {
    text-align: center;
    font-size: 1.6rem;
}

.login .lead {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login .alt-links {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.9rem;
}

.login .alt-links p {
    margin: 0.4rem 0;
}

/* ---- Identity scaffold compatibility ---------------------------------------
    The scaffolded account pages (Manage/*) were written against Bootstrap. These rules
    give the handful of Bootstrap classes they use the app's own look, so those pages
    don't each need rewriting.
*/

/* Bootstrap's floating label puts the <label> after the <input> in the markup; reversing
   the column shows it above the field instead, like .field does. */
.form-floating {
    display: flex;
    flex-direction: column-reverse;
    margin-bottom: 1rem;
}

.form-floating > label {
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* order: -1 puts it at the visual bottom of the reversed column, under the field. */
.form-floating .btn-link {
    order: -1;
    align-self: flex-start;
    margin-top: 0.5rem;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-group-text {
    color: var(--success-text);
    font-weight: 700;
}

.mb-3 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.w-100 { width: 100%; }
.mx-auto { margin-left: auto; margin-right: auto; }
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success-text); }
.text-secondary { color: var(--text-muted); }

.btn-link {
    background: transparent;
    color: var(--accent-text);
    border-color: var(--border);
}

/* ---- Wider screens -------------------------------------------------------- */

@media (min-width: 700px) {
    :root {
        --header-height: 58px;
    }

    .app-main {
        /* padding-bottom set individually, not via the shorthand above — the shorthand
           would reset it to a flat 1.25rem and wipe out the tab bar clearance from the
           base rule, hiding whatever sits last on a page (e.g. the logout button) behind
           the fixed tab bar. */
        padding: 1.25rem;
        padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 1.25rem);
    }

    .app-main.no-tabbar {
        padding-bottom: calc(env(safe-area-inset-bottom) + 1.25rem);
    }
}


/* ==========================================================================
    LiverbirdsMember components — everything below is specific to this app.
   ========================================================================== */

/* Sub-navigation chips can also be <button>s (in-page tabs), not only NavLinks. */
.subnav .active {
    background: var(--accent);
    color: var(--accent-contrast);
    border-color: var(--accent);
}

.subnav .count {
    display: inline-block;
    min-width: 1.3em;
    padding: 0 0.35em;
    border-radius: 999px;
    background: color-mix(in srgb, currentColor 18%, transparent);
    font-size: 0.75rem;
    text-align: center;
}

.stack > * + * {
    margin-top: 0.5rem;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.page-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    margin-bottom: 0.75rem;
}

.page-title h1,
.page-title h2 {
    margin: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    font-size: 0.9rem;
    text-decoration: none;
}

/* Two fields side by side once there is room for it; stacked on a phone. */
.field-pair {
    display: grid;
    gap: 0 0.75rem;
}

@media (min-width: 520px) {
    .field-pair {
        grid-template-columns: 1fr 1fr;
    }
}

.check-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.check-list .radio-row {
    min-height: var(--tap);
}

.check-list input[type="checkbox"],
.radio-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
    cursor: pointer;
    flex: 0 0 auto;
}

.badge.ok {
    background: color-mix(in srgb, var(--success-text) 15%, transparent);
    color: var(--success-text);
}

.badge.pending {
    background: color-mix(in srgb, var(--warning) 15%, transparent);
    color: var(--warning);
}

/* ---- Start page: one tile per organisation -------------------------------- */

.org-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
}

.org-tile {
    display: block;
    overflow: hidden;
    padding: 0;
    color: var(--text);
    text-decoration: none;
}

.org-tile:focus-visible {
    outline: 2px solid var(--accent-text);
    outline-offset: 1px;
}

.org-tile-image {
    aspect-ratio: 3 / 2;
    background: var(--surface-alt);
}

.org-tile-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.org-tile-image.greyscale img {
    filter: grayscale(1);
}

.org-tile-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #4a0d12);
}

.org-tile-body {
    padding: 0.75rem 0.9rem 0.85rem;
}

.org-tile-body .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.org-tile-body strong {
    font-size: 1.05rem;
}

/* ---- Admin lists ---------------------------------------------------------- */

.member-head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}

.member-number {
    flex: 0 0 auto;
    min-width: 2.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent-text);
}

.member-head .who {
    flex: 1;
    min-width: 0;
}

.member-head .who strong,
.member-head .who .muted {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inline-edit {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

.inline-edit input {
    max-width: 8rem;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: flex-end;
    margin-bottom: 0.75rem;
}

.toolbar .field {
    flex: 1 1 200px;
    margin-bottom: 0;
}

.thumb {
    display: block;
    width: 100%;
    max-width: 220px;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-top: 0.5rem;
}

/* ---- Card editor ---------------------------------------------------------- */

.editor-preview {
    position: sticky;
    top: calc(var(--header-height) + env(safe-area-inset-top) + 0.5rem);
    z-index: 5;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: var(--bg);
}

.slider-row {
    display: grid;
    grid-template-columns: 1fr 5.5rem;
    gap: 0.25rem 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.slider-row .label {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

.slider-row input[type="range"] {
    width: 100%;
    min-height: var(--tap);
    accent-color: var(--accent);
}

.color-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-row input[type="color"] {
    flex: 0 0 auto;
    width: var(--tap);
    height: var(--tap);
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

input[type="file"] {
    width: 100%;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ---- The membership card ------------------------------------------------ */

/* The card page: everything between the top of the screen and the tab bar is black
   stage, and the card fills it in landscape whatever way the phone is held.

   - Landscape screen: the card is drawn as is.
   - Portrait screen (phone upright, or turned sideways with rotation locked): the card is
     turned a quarter so it fills the screen, like a boarding pass. app.js picks the
     direction from the motion sensor (data-turn), so it reads the right way up whichever
     side the phone is tipped to.
   - Tapping the card asks for full screen and, where the browser allows (Android), locks
     the screen to landscape — then the OS keeps it upright in both directions.

   The stage is a size container, so the card is sized against the stage, not the window. */
.card-stage {
    position: fixed;
    inset: 0 0 calc(var(--tabbar-height) + env(safe-area-inset-bottom)) 0;
    z-index: 25;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    container: stage / size;
    cursor: pointer;
}

.card-stage:fullscreen {
    inset: 0;
}

/* The card and anything laid on it (the pay button) turn as one. */
.card-turn {
    position: relative;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.card-stage .mcard {
    width: min(96cqw, calc(96cqh * var(--aspect)));
}

@container stage (orientation: portrait) {
    .card-stage .mcard {
        width: min(96cqh, calc(96cqw * var(--aspect)));
    }

    .card-turn {
        transform: rotate(90deg);
    }

    .card-stage[data-turn="ccw"] .card-turn {
        transform: rotate(-90deg);
    }
}



.card-message {
    min-height: calc(100dvh - var(--header-height) - var(--tabbar-height) - 2rem);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
    padding: 2rem 1.25rem;
    background: #111116;
    color: #f2f2f5;
}

.card-message p {
    max-width: 30rem;
    margin: 0;
    color: #c8c8d0;
}

/* The card. Children size their text in cqw — percent of this element's width. */
.mcard {
    position: relative;
    width: 100%;
    aspect-ratio: var(--aspect);
    container-type: inline-size;
    overflow: hidden;
    border-radius: 1.2% / 1.8%;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    background: #111;
}

.mcard-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.mcard-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #4a0d12);
    color: #fff;
}

.mcard-fallback-org {
    font-size: 7cqw;
    font-weight: 700;
    text-align: center;
    padding: 0 6cqw;
    margin-top: -14cqw;
}

.mcard-fallback-period {
    font-size: 4cqw;
    opacity: 0.85;
}

.mcard-text {
    position: absolute;
    white-space: nowrap;
    line-height: 1;
    text-shadow: 0 0.15cqw 0.4cqw rgb(0 0 0 / 0.45);
}

.mcard-clock {
    font-variant-numeric: tabular-nums;
}

/* Not valid: the whole card goes grey under a red stamp. */
.mcard-invalid .mcard-bg,
.mcard-invalid .mcard-text {
    filter: grayscale(1);
}

.mcard-stamp {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.mcard-stamp span {
    color: #e11d1d;
    font-family: Impact, "Arial Black", "Segoe UI", sans-serif;
    font-weight: 900;
    font-size: 12cqw;
    letter-spacing: 0.4cqw;
    white-space: nowrap;
    padding: 0.5cqw 3cqw;
    border: 1cqw solid #e11d1d;
    border-radius: 1.5cqw;
    background: rgb(255 255 255 / 0.55);
    text-shadow: 0 0 1cqw rgb(255 255 255 / 0.6);
    /* Along the diagonal from bottom-left to top-right; the fallback angle suits a ~3:2 card. */
    transform: rotate(-34deg);
    transform: rotate(calc(atan(calc(1 / var(--aspect))) * -1));
}

/* Anti-screenshot: a band of light sweeps across a live card continuously. A screenshot
   or a recording made earlier freezes it, and the clock shows a stale time. */
.mcard-shimmer {
    position: absolute;
    inset: -50%;
    pointer-events: none;
    background: linear-gradient(105deg,
        transparent 40%,
        rgb(255 255 255 / 0) 44%,
        rgb(255 255 255 / 0.28) 50%,
        rgb(255 255 255 / 0) 56%,
        transparent 60%);
    mix-blend-mode: overlay;
    animation: mcard-sweep 3.2s linear infinite;
}

@keyframes mcard-sweep {
    from { transform: translateX(-60%); }
    to { transform: translateX(60%); }
}

@media (prefers-reduced-motion: reduce) {
    .mcard-shimmer {
        animation-duration: 8s;
    }
}
/* ---- Liverbirds additions -------------------------------------------------- */

.app-header .brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-header .brand img {
    height: 34px;
    width: auto;
}

.login-logo {
    display: block;
    width: 120px;
    height: auto;
    margin: 0 auto 0.5rem;
}

.card-message .login-logo {
    width: 96px;
}

/* Top-right corner of the card, clear of the name, number and clock along the bottom. */
.card-pay {
    position: absolute;
    top: 3%;
    right: 2.5%;
    z-index: 5;
    display: flex;
    align-items: center;
    min-height: var(--tap);
    padding: 0 1rem;
    border-radius: 999px;
    background: #ff5b24;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.4);
}

/* Unread count on the Messages tab. */
.tabbar .icon {
    position: relative;
}

.tab-badge {
    position: absolute;
    top: -6px;
    right: -12px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.message-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.message-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.message-meta {
    font-size: 0.8rem;
    margin: 0.2rem 0 0.6rem;
}

.message-body {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.message-new {
    border-left: 4px solid var(--accent);
}

.vipps {
    text-align: center;
}

.vipps-qr {
    display: block;
    width: min(240px, 70vw);
    height: auto;
    margin: 0.5rem auto;
    border-radius: var(--radius-sm);
    background: #fff;
}

.vipps-number {
    margin: 0.25rem 0;
    font-size: 1.05rem;
}

.vipps-text {
    margin: 0.25rem 0;
}

.btn-vipps {
    margin-top: 0.75rem;
    background: #ff5b24;
    border-color: #ff5b24;
}

/* Quiet link under "Logg ut" on Min info — a deliberate choice, not a main action. */
.deactivate-link {
    margin: 1.25rem 0 0.5rem;
    text-align: center;
    font-size: 0.9rem;
}

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