:root {
    --red: #b01030;
    --red-deep: #900018;
    --ink: #0f172a;
    --muted: #64748b;
    --surface: #ffffff;
    --line: rgba(15, 23, 42, 0.08);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: "IBM Plex Sans", -apple-system, system-ui, sans-serif;
    color: var(--ink);
    background: #f8fafc;
    min-height: 100vh;
    min-height: 100dvh;
}

.shell {
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-columns: 1fr minmax(0, 520px);
}
@media (max-width: 880px) {
    .shell { grid-template-columns: 1fr; }
}

.hero {
    position: relative;
    padding: clamp(32px, 6vw, 64px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    background:
        radial-gradient(120% 80% at 10% 0%, rgba(176, 16, 48, 0.12) 0%, transparent 55%),
        radial-gradient(90% 60% at 100% 100%, rgba(255, 182, 193, 0.28) 0%, transparent 50%),
        linear-gradient(165deg, #f8fafc 0%, #f4f4f6 45%, #f8fafc 100%);
}
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 75%);
    pointer-events: none;
}
.hero-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
}
.hero-brand img {
    width: 52px;
    height: 52px;
    border-radius: 6px;
    box-shadow: none;
}
.hero-brand .hero-brand__wordmark {
    width: auto;
    height: 48px;
    border-radius: 0;
}
.member-portal-brand .member-portal-brand__wordmark {
    width: auto;
    height: 26px;
    border-radius: 0;
}
.hero-brand span {
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -0.03em;
    color: var(--red);
}
.hero-copy {
    position: relative;
    z-index: 1;
    max-width: 420px;
}
.hero-copy h1 {
    margin: 0 0 12px;
    font-size: clamp(1.5rem, 2.5vw, 1.85rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.25;
    color: var(--ink);
}
.hero-copy p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--muted);
}
.hero-foot {
    position: relative;
    z-index: 1;
    font-size: 13px;
    color: #94a3b8;
}
.hero-foot a {
    color: var(--red);
    text-decoration: none;
    font-weight: 500;
}
.hero-foot a:hover { text-decoration: underline; }

.panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 8vw, 48px);
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: none;
}
@media (max-width: 880px) {
    .panel {
        border-left: none;
        box-shadow: none;
        padding-top: 0;
    }
    .hero { order: 0; padding-bottom: 24px; }
    .panel { order: 1; }
}

.card {
    width: 100%;
    max-width: 400px;
}
.card h2 {
    margin: 0 0 8px;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.card .lead {
    margin: 0 0 28px;
    font-size: 15px;
    color: var(--muted);
    line-height: 1.5;
}
label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}
input[type="email"], input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: none;
}
.btn {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(180deg, var(--red) 0%, var(--red-deep) 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: none;
    transition: transform 0.12s, box-shadow 0.12s;
}
.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: none;
}
.btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }
.msg {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.45;
    display: none;
}
.msg.err {
    display: block;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}
.msg.info {
    display: block;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
}

/* Dashboard (sichtbar nur mit .show; Layout siehe .account-dashboard) */
#view-dash { display: none; }
#view-login.hide { display: none; }
.totp-panel {
    margin-top: 8px;
    padding: 18px 20px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: none;
}
.totp-panel .totp-status { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.totp-panel .totp-status.ok { color: #047857; }
.totp-panel label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 6px;
}
.totp-panel p + label,
.totp-panel .lead + label {
    margin-top: 16px;
}
.totp-subsection label:first-of-type,
.totp-disclosure__panel label:first-of-type {
    margin-top: 0;
}
.totp-panel input[type="password"],
.totp-panel input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 16px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.totp-panel input[type="password"]:focus,
.totp-panel input[type="text"]:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: none;
}
.totp-subsection {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}
.totp-subsection-title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}
.totp-subsection-desc {
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--muted);
}
.totp-panel .btn-portal {
    margin-top: 4px;
}
.totp-panel .totp-disable-btn {
    margin-top: 18px;
    width: 100%;
    max-width: 320px;
}

.user-block {
    display: flex;
    align-items: center;
    gap: 14px;
}
.avatar {
    width: 52px;
    height: 52px;
    border-radius: 6px;
    background: linear-gradient(135deg, #f9d0d9 0%, #f43f5e 45%, #b01030 100%);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: none;
}
.user-meta h2 { margin: 0 0 4px; font-size: 1.2rem; }
.user-meta p { margin: 0; font-size: 14px; color: var(--muted); word-break: break-all; }
.btn-ghost {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: var(--muted);
    background: #f1f5f9;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
.btn-ghost:hover { background: #e2e8f0; color: var(--ink); }

.section-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 0 0 12px;
}
.org-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.org-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}
.org-card strong {
    display: block;
    font-size: 15px;
    line-height: 1.3;
}
.org-portal-host {
    margin-top: 8px;
}
.org-portal-host a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(241, 245, 249, 0.85);
    border: 1px solid rgba(15, 23, 42, 0.08);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.org-portal-host a::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #16a34a;
    flex-shrink: 0;
}
.org-portal-host a:hover {
    color: var(--red);
    border-color: rgba(176, 16, 48, 0.25);
    background: rgba(255, 255, 255, 0.95);
}
.role-pill {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
.role-pill.role-admin { background: #dbeafe; color: #1d4ed8; }
.role-pill.role-flugbegleiter { background: #dcfce7; color: #047857; }
.role-pill.role-einsatzzentrale { background: #fffbeb; color: #b45309; }
.role-pill.role-fuehrungskraft { background: #ede9fe; color: #6d28d9; }
.role-pill.role-member { background: #f1f5f9; color: #475569; }

.empty-orgs {
    padding: 20px;
    border-radius: 6px;
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.5;
}
.org-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}
.btn-portal {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: var(--red);
    background: #fff;
    border: 1px solid rgba(176, 16, 48, 0.35);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.btn-portal:hover {
    background: rgba(176, 16, 48, 0.06);
    border-color: var(--red);
}

#login-shell.hidden {
    display: none !important;
}

/* Freigegebene Anmeldekarte: Video, dunkler Schleier, helle Karte. */
#login-shell.rn-login {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 88px 16px 72px;
    padding-top: calc(54px + env(safe-area-inset-top, 0px) + 28px);
    overflow: hidden;
    background: #0b1220;
    grid-template-columns: 1fr;
}
#login-shell .rn-login-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: #0b1220 url("/assets/auth/login-poster.jpg") center / cover no-repeat;
}
#login-shell .rn-login-bg video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.06);
    opacity: 0;
}
#login-shell.rn-login--motion .rn-login-bg video { opacity: 1; }
#login-shell .rn-login-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.55) 0%, rgba(15, 23, 42, 0.35) 40%, rgba(15, 23, 42, 0.72) 100%),
        radial-gradient(ellipse 80% 60% at 50% 40%, transparent 0%, rgba(11, 18, 32, 0.45) 100%);
}
/* Volle Markenleiste über der Anmeldekarte, nicht nur der 3-px-Kartenstrich. */
#login-shell .rn-login-brand {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    height: calc(54px + env(safe-area-inset-top, 0px));
    margin: 0;
    padding: env(safe-area-inset-top, 0px) 16px 0 max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    box-sizing: border-box;
    background: #b01030;
    color: #fff;
}
#login-shell .rn-login-brand img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
    flex: none;
}
#login-shell .rn-login-brand .name {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.05;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
}
#login-shell .rn-login-brand .sub {
    margin-top: 2px;
    font-family: "IBM Plex Sans", system-ui, sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.92);
}
#login-shell .rn-login-still {
    display: none;
    position: absolute;
    left: 24px;
    bottom: 22px;
    z-index: 2;
    margin: 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.78);
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
#login-shell .rn-login-card {
    position: relative;
    z-index: 1;
    width: min(400px, 100%);
    max-width: 400px;
    min-width: 0;
    margin: 0;
    padding: 32px 28px 26px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 14px;
    box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.12);
}
#login-shell .rn-login-card::before {
    content: "";
    position: absolute;
    left: 20px;
    right: 20px;
    top: 0;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: #b01030;
}
#login-shell .rn-login-kicker {
    margin: 0 0 8px;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #b01030;
}
#login-shell .rn-login-card h1 {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.015em;
    color: #0f172a;
}
#login-shell .rn-login-card .lead {
    margin: 0 0 22px;
    font-size: 13.5px;
    line-height: 1.55;
    color: #64748b;
}
#login-shell .rn-login-field { margin-bottom: 14px; }
#login-shell label {
    display: block;
    margin: 0 0 6px;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}
#login-shell input[type="email"],
#login-shell input[type="password"] {
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    color: #0f172a;
    font: 400 14px/1 "IBM Plex Sans", system-ui, sans-serif;
    -webkit-appearance: none;
    appearance: none;
}
#login-shell input:focus {
    outline: none;
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}
#login-shell .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    margin-top: 6px;
    padding: 0 16px;
    border: none;
    border-radius: 4px;
    background: #b01030;
    color: #fff;
    font: 600 14px/1 "IBM Plex Sans", system-ui, sans-serif;
    box-shadow: none;
    transform: none;
}
#login-shell .btn:hover:not(:disabled) {
    background: #8c0d26;
    transform: none;
    box-shadow: none;
}
#login-shell .rn-login-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    font-size: 12.5px;
    font-weight: 500;
}
#login-shell .rn-login-links a { color: #b01030; text-decoration: none; font-weight: 500; }
#login-shell .rn-login-links a.muted { color: #64748b; }
#login-shell .rn-login-links button.muted {
    background: none;
    border: 0;
    padding: 0;
    color: #64748b;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}
#login-shell .rn-login-links button.muted:hover { text-decoration: underline; }
#login-shell .rn-login-links a:hover { text-decoration: underline; }
#login-shell .rn-login-meta {
    margin: 18px 0 0;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
    font-size: 12px;
    line-height: 1.45;
    color: #94a3b8;
    text-align: center;
}
#login-shell .msg { margin-bottom: 14px; }
@media (max-width: 640px), (max-width: 1024px) and (max-height: 500px) {
    html:has(#login-shell:not(.hidden)),
    body:has(#login-shell:not(.hidden)) {
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }
    #login-shell.rn-login {
        place-items: start center;
        align-content: start;
        height: auto;
        overflow: visible;
        padding:
            calc(env(safe-area-inset-top, 0px) + 78px)
            max(16px, env(safe-area-inset-right, 0px))
            calc(env(safe-area-inset-bottom, 0px) + 34vh)
            max(16px, env(safe-area-inset-left, 0px));
    }
    #login-shell .rn-login-card {
        width: 100%;
        padding: 26px 18px 20px;
        margin: 4px 0 12px;
    }
    #login-shell .rn-login-brand > div { min-width: 0; }
    #login-shell input[type="email"],
    #login-shell input[type="password"] {
        height: 48px;
        font-size: 16px;
        scroll-margin-top: 22vh;
        scroll-margin-bottom: 38vh;
    }
    #login-shell .btn {
        height: 48px;
        scroll-margin-bottom: 28vh;
    }
    #login-shell .rn-login-links { flex-wrap: wrap; row-gap: 0; }
    #login-shell .rn-login-links a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding: 8px 2px;
    }
}
@media (max-width: 759px), (hover: none) and (pointer: coarse) and (max-width: 1024px) {
    #login-shell .rn-login-bg video { display: none; }
    #login-shell .rn-login-still {
        display: inline-flex;
        top: calc(env(safe-area-inset-top, 0px) + 62px);
        right: max(16px, env(safe-area-inset-right, 0px));
        bottom: auto;
        left: auto;
    }
}
@media (max-width: 419px) {
    #login-shell .rn-login-still { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    #login-shell .rn-login-bg video { transform: none; }
    #login-shell .rn-login-still { display: inline-flex; }
}
@media (prefers-reduced-motion: reduce) and (max-width: 419px) {
    #login-shell .rn-login-still {
        display: inline-flex;
        top: calc(env(safe-area-inset-top, 0px) + 62px);
        right: max(16px, env(safe-area-inset-right, 0px));
        bottom: auto;
        left: auto;
    }
}

.account-dashboard {
    display: none;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}
#view-dash.show.account-dashboard {
    display: flex;
    flex-direction: column;
}

.member-portal-brand--app {
    text-transform: none;
    letter-spacing: -0.02em;
    font-size: 1rem;
    font-weight: 700;
}
.member-portal-brand--app .member-portal-brand__title {
    text-transform: none;
    letter-spacing: -0.02em;
}

.account-user-block {
    align-items: center;
}
.account-user-block .avatar {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    font-size: 1rem;
}
.account-user-block .user-meta h2 {
    font-size: 1.05rem;
    margin: 0 0 4px;
}
.account-user-block .user-meta p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
    word-break: break-all;
}

body.member-portal-body .dash-card .totp-panel {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
    margin: 0;
}
body.member-portal-body #account-member-main .account-surface .totp-panel {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
    margin: 0;
}
body.member-portal-body #account-member-main .org-list .org-card {
    background: var(--surface, #fff);
    box-shadow: none;
}
body.member-portal-body #account-member-main .empty-orgs {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(15, 23, 42, 0.12);
}
