/* =========================================================================
   SelaMurša – Gestaltung
   Drei Themes über <html data-theme="…">: basis (grün, Standard), hell, dunkel
   Alle Farben nur über Variablen – Komponenten unten verwenden keine festen Farben.
   ========================================================================= */

:root,
[data-theme="basis"] {
    color-scheme: light;
    --bg: #f6f4ef;
    --surface: #ffffff;
    --surface-2: #faf9f5;
    --topbar: #ffffff;
    --text: #22261f;
    --muted: #6b7064;
    --border: #e1ddd2;
    --border-strong: #cfcabd;
    --primary: #3d6b4f;
    --primary-hover: #2f5640;
    --primary-text: #ffffff;
    --primary-soft: #e6efe8;
    --danger: #a3392f;
    --ok-bg: #e3f0e6; --ok-text: #235b34;
    --warn-bg: #fbf0d6; --warn-text: #7a5410;
    --err-bg: #f8e1de; --err-text: #8a2c23;
    --info-bg: #e3ecf4; --info-text: #2b4d6b;
    --shadow: 0 1px 2px rgba(34, 38, 31, .05);
    --shadow-lg: 0 8px 30px rgba(34, 38, 31, .08);
    --radius: 10px;
    --radius-sm: 7px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-head: var(--font);
}

/* Hell: warmes Papierweiss, Korallen-Akzent, Serifen-Titel */
[data-theme="hell"] {
    color-scheme: light;
    --bg: #faf9f5;
    --surface: #ffffff;
    --surface-2: #f5f4ee;
    --topbar: #f5f4ee;
    --text: #141413;
    --muted: #6e6c64;
    --border: #e6e3d9;
    --border-strong: #d3cfc2;
    --primary: #c6613f;
    --primary-hover: #ad5232;
    --primary-text: #ffffff;
    --primary-soft: #f6e6df;
    --danger: #b3412e;
    --ok-bg: #e6efe2; --ok-text: #3d5a2d;
    --warn-bg: #f7ecd5; --warn-text: #7a5a14;
    --err-bg: #f6e0da; --err-text: #9a3a27;
    --info-bg: #e8ecef; --info-text: #3c4f5e;
    --shadow: 0 1px 2px rgba(20, 20, 19, .04);
    --shadow-lg: 0 10px 30px rgba(20, 20, 19, .07);
    --radius: 12px;
    --radius-sm: 8px;
    --font-head: var(--font);
}

/* Dunkel: warmes Anthrazit, Korallen-Akzent */
[data-theme="dunkel"] {
    color-scheme: dark;
    --bg: #262624;
    --surface: #30302e;
    --surface-2: #2b2b29;
    --topbar: #1f1e1d;
    --text: #f2f0e9;
    --muted: #a8a59b;
    --border: #3e3d39;
    --border-strong: #55534d;
    --primary: #d97757;
    --primary-hover: #e48b6d;
    --primary-text: #1f1e1d;
    --primary-soft: #44332c;
    --danger: #ec8a74;
    --ok-bg: #2f3b2a; --ok-text: #b6d3a3;
    --warn-bg: #43391f; --warn-text: #ead08f;
    --err-bg: #4a2c26; --err-text: #f2b3a3;
    --info-bg: #2c3640; --info-text: #b4c8db;
    --shadow: 0 1px 2px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 34px rgba(0, 0, 0, .35);
    --radius: 12px;
    --radius-sm: 8px;
    --font-head: var(--font);
}

/* ------------------------------------------------------------ Grundlagen */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
code { font-size: .85em; background: var(--surface-2); padding: .05rem .3rem; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.prewrap { white-space: pre-wrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.negative { color: var(--danger); }
.mono, textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: .88rem; }
::selection { background: var(--primary-soft); }

/* ------------------------------------------------------------ Kopfzeile */
.topbar { background: var(--topbar); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: .55rem 16px; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; }
.brand { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--text); display: inline-flex; align-items: center; gap: .45rem; }
.brand-mark { width: .8rem; height: .8rem; border-radius: 50%; border: 2px solid var(--primary); box-shadow: 0 0 6px var(--primary), inset 0 0 3px var(--primary); display: inline-block; flex: none; }
.mainnav { display: flex; flex-wrap: wrap; gap: .15rem; }
.mainnav a { text-decoration: none; color: var(--muted); padding: .35rem .65rem; border-radius: var(--radius-sm); font-size: .95rem; }
.mainnav a:hover { background: var(--surface-2); color: var(--text); }
.mainnav a[aria-current="page"] { background: var(--primary-soft); color: var(--text); font-weight: 600; }
.usermenu { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.usermenu form { margin: 0; }
.usermenu a { color: var(--text); text-decoration: none; font-weight: 600; }

/* Theme-Umschalter */
.theme-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 99px; padding: 2px; background: var(--surface); }
.theme-switch button { font: inherit; font-size: .78rem; border: 0; background: none; color: var(--muted); padding: .15rem .6rem; border-radius: 99px; cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--primary); color: var(--primary-text); }
.theme-switch button:hover:not([aria-pressed="true"]) { color: var(--text); }

.container { max-width: 1200px; margin: 0 auto; padding: 1.75rem 16px 3rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }

/* ------------------------------------------------------------ Formulare */
.stack { display: flex; flex-direction: column; gap: .95rem; }
.narrow { max-width: 420px; }
.form-wide { max-width: 860px; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .92rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
label.check select, label.check input[type=text] { width: auto; flex: 1; min-width: 160px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number],
input[type=date], input[type=month], input[type=file], select, textarea {
    font: inherit; padding: .55rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); width: 100%; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 1rem; height: 1rem; }
.code-input { font-size: 1.4rem; letter-spacing: .3em; text-align: center; max-width: 12rem; }
.input-num { text-align: right; max-width: 9rem; margin-left: auto; display: block; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 1rem 1.2rem 1.2rem; margin: 0; display: flex; flex-direction: column; gap: .8rem; box-shadow: var(--shadow); }
legend { font-family: var(--font-head); font-weight: 600; padding: 0 .4rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }

.btn { font: inherit; font-weight: 600; font-size: .95rem; display: inline-flex; align-items: center; gap: .35rem; padding: .5rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-text); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--err-bg); color: var(--danger); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------------------ Meldungen */
.flash { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; }
.flash a { color: inherit; font-weight: 600; }
.flash-success { background: var(--ok-bg); color: var(--ok-text); }
.flash-info { background: var(--info-bg); color: var(--info-text); }
.flash-warn { background: var(--warn-bg); color: var(--warn-text); }
.flash-error { background: var(--err-bg); color: var(--err-text); }
.badge { display: inline-block; font-size: .76rem; font-weight: 600; padding: .1rem .55rem; border-radius: 99px; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge-info { background: var(--info-bg); color: var(--info-text); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* ------------------------------------------------------------ Karten & Panels */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.05rem 1.25rem; box-shadow: var(--shadow); }
.panel { margin-top: 1.5rem; }
.card p { margin: 0; }
.card-label { font-size: .84rem; color: var(--muted); }
.card-value { font-family: var(--font-head); font-size: 1.85rem; font-weight: 600; font-variant-numeric: tabular-nums; margin: .15rem 0 !important; }
.card-note { font-size: .8rem; color: var(--muted); }
a.card { text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--primary); transform: translateY(-1px); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.grid-2 > .panel { margin-top: 0; }

/* ------------------------------------------------------------ Tabellen */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); font-weight: 600; }
th.num { text-align: right; }
tbody tr:hover td { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
tr.inactive td { color: var(--muted); }
table.plain td { border-bottom: 1px solid var(--border); padding: .45rem .2rem; }
table.plain tbody tr:hover td, table.plain tr:hover td { background: none; }
table.plain tr.total td { font-weight: 700; }
.details { display: block; max-width: 28rem; white-space: pre-wrap; word-break: break-word; background: none; padding: 0; }

/* ------------------------------------------------------------ Diverses */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.checklist { list-style: none; padding: 0; margin: 0; columns: 2 220px; }
.checklist li::before { content: "✓ "; color: var(--ok-text); font-weight: 700; }
.checklist li.missing::before { content: "✗ "; color: var(--err-text); }
.checklist li.missing { color: var(--err-text); }
.searchbar { display: flex; gap: .5rem; max-width: 520px; margin-bottom: .75rem; }
.filterbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.filterbar select, .filterbar input[type=search], .filterbar input[type=month] { width: auto; min-width: 140px; padding: .45rem .6rem; }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
.steps li { margin-bottom: .75rem; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 1.15rem; background: var(--surface-2); border: 1px dashed var(--border-strong); padding: .5rem .75rem; border-radius: var(--radius-sm); display: inline-block; margin: .4rem 0; word-break: break-all; }
.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .4rem 1rem; }
.toolbar { flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.toolbar form { margin: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 1.1rem; border-bottom: 1px solid var(--border); }
.tabs a { text-decoration: none; color: var(--muted); padding: .5rem .8rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }
.tabs .count { font-size: .74rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 0 .45rem; margin-left: .15rem; }
.row-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin-top: .75rem; }
.row-form label { min-width: 140px; }
.assign-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 0; }
.assign-form select { max-width: 280px; width: auto; }
.assign-form input[type=date] { width: auto; }
details.inline-form, details.mail { margin-top: .75rem; }
details > summary { cursor: pointer; }
details.mail { border-top: 1px solid var(--border); padding-top: .55rem; }
.mailbody { white-space: pre-wrap; background: var(--surface-2); padding: .8rem; border-radius: var(--radius-sm); font: .88rem/1.5 var(--font); border: 1px solid var(--border); }
.history, .todo { margin: 0; padding-left: 1.1rem; }
.history li, .todo li { margin-bottom: .35rem; }

/* ------------------------------------------------------------ Login */
body.public { display: flex; flex-direction: column; min-height: 100vh; align-items: center; justify-content: flex-start; }
.auth-box { width: calc(100% - 32px); max-width: 410px; margin: 10vh 16px 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.9rem; box-shadow: var(--shadow-lg); }
.auth-brand { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; color: var(--text); margin: 0 0 1.25rem; display: flex; align-items: center; gap: .5rem; }
.auth-greeting { color: var(--muted); font-family: var(--font-head); font-size: 1.05rem; margin: .5rem 0 2rem; text-align: center; }
.public-theme { margin-bottom: 1.5rem; }

/* ------------------------------------------------------------ Mobil */
@media (max-width: 600px) {
    .usermenu { margin-left: 0; width: 100%; justify-content: space-between; }
    .card-value { font-size: 1.5rem; }
    .facts { grid-template-columns: 1fr; }
    .facts dd { margin-bottom: .5rem; }
    .container { padding-top: 1.25rem; }
    h1 { font-size: 1.45rem; }
}

/* ------------------------------------------------------------ Schnellerfassung (nur Handy) */
.fab { display: none; }

/* ------------------------------------------------------------ Handy (≤ 640 px) */
@media (max-width: 640px) {
    body { font-size: 16px; }
    .container { padding: 1rem 12px 6rem; }
    h1 { font-size: 1.35rem; }

    /* Kopfzeile kompakt, Menü als wischbare Leiste */
    .topbar-inner { padding: .45rem 12px .35rem; gap: .35rem .75rem; }
    .brand { font-size: 1rem; }
    .usermenu { margin-left: auto; width: auto; gap: .6rem; font-size: .9rem; }
    .usermenu .theme-switch { display: none; }
    .mainnav { order: 3; width: calc(100% + 24px); margin: 0 -12px; padding: .1rem 12px .25rem; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: .25rem; }
    .mainnav::-webkit-scrollbar { display: none; }
    .mainnav a { white-space: nowrap; padding: .45rem .75rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; }
    .mainnav a[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }

    /* Seitenkopf: Knöpfe gleichmässig, gut tippbar */
    .page-head { align-items: stretch; }
    .page-head .actions { width: 100%; gap: .4rem; }
    .page-head .actions .btn { flex: 1 1 auto; justify-content: center; }
    .btn { min-height: 44px; padding: .55rem .9rem; }
    .toolbar .btn, .toolbar form { flex: 1 1 auto; }
    .toolbar form .btn { width: 100%; justify-content: center; }
    .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .tabs a { white-space: nowrap; }

    /* Formulare: volle Breite, grosse Tippflächen */
    input[type=text], input[type=email], input[type=password], input[type=search], input[type=number],
    input[type=date], input[type=month], input[type=file], select, textarea { min-height: 44px; font-size: 16px; }
    .searchbar, .filterbar { max-width: none; }
    .filterbar select, .filterbar input[type=search], .filterbar input[type=month] { flex: 1 1 45%; min-width: 0; }
    .row-form label, .row-form .btn { flex: 1 1 100%; }
    .actions .btn-primary { flex: 1 1 auto; justify-content: center; }
    fieldset { padding: .9rem; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .cards { grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1.1rem; }
    .card { padding: .75rem .85rem; }
    .card-value { font-size: 1.3rem; }
    .panel { padding: .9rem; margin-top: 1rem; }
    .facts { grid-template-columns: 1fr; gap: 0; }
    .facts dt { font-size: .8rem; margin-top: .45rem; }
    .facts dd { margin-bottom: .1rem; }

    /* Tabellen werden zu Karten */
    .table-wrap { border: 0; background: none; box-shadow: none; overflow: visible; }
    table.responsive thead { display: none; }
    table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
    table.responsive tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .6rem; padding: .5rem .85rem; box-shadow: var(--shadow); }
    table.responsive tr.inactive { opacity: .7; }
    table.responsive td { border: 0; padding: .28rem 0; text-align: right; overflow-wrap: anywhere; }
    table.responsive td::after { content: ""; display: block; clear: both; }
    table.responsive td::before { content: attr(data-label); float: left; color: var(--muted); font-size: .78rem; text-align: left; max-width: 42%; padding-right: .75rem; line-height: 1.9; }
    table.responsive td[data-label=""]::before { display: none; }
    table.responsive td:first-child { font-weight: 600; }
    table.responsive tbody tr:hover td { background: none; }
    table.responsive td .assign-form, table.responsive td form { width: 100%; justify-content: flex-end; }
    table.responsive td .assign-form select { max-width: none; flex: 1 1 100%; }
    .details { max-width: none; text-align: left; }

    /* Schnellerfassung unten rechts */
    .fab { display: inline-flex; align-items: center; gap: .4rem; position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 20;
           background: var(--primary); color: var(--primary-text); text-decoration: none; font-weight: 700; padding: .85rem 1.15rem; border-radius: 99px; box-shadow: var(--shadow-lg); }
    .fab:hover { color: var(--primary-text); background: var(--primary-hover); }
    .fab-plus { font-size: 1.25rem; line-height: 1; }

    .auth-box { margin-top: 6vh; padding: 1.4rem; }
}

/* ------------------------------------------------------------ Login mit Foto (überschreibt die einfachen Login-Regeln) */
body.public { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(380px, 1fr); min-height: 100vh; min-height: 100dvh; align-items: stretch; }
.login-photo { position: relative; overflow: hidden; background: #0e0d0c; min-height: 100%; }
.login-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 26% 58%; }
.login-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,.55) 100%); pointer-events: none; }
.login-photo-text { position: absolute; left: 2.5rem; bottom: 2.4rem; z-index: 1; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.login-photo-text p { margin: 0; }
.login-title { font-size: 2.3rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.login-sub { font-size: 1rem; opacity: .85; margin-top: .35rem !important; }
.photo-credit { position: absolute; right: .8rem; bottom: .55rem; z-index: 1; font-size: .7rem; color: rgba(255,255,255,.6); }
.login-side { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.5rem 16px; background: var(--bg); }
.login-side .auth-box { margin: 0 0 1.1rem; width: 100%; max-width: 400px; }
.login-side .auth-greeting { margin: .25rem 0 1.25rem; }
.login-side .public-theme { margin: 0; }

@media (max-width: 820px) {
    body.public { display: block; }
    .login-photo { height: 44vh; min-height: 250px; max-height: 420px; }
    .login-photo img { object-position: 22% 62%; }
    .login-photo::after { background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,.35) 70%, var(--bg) 100%); }
    .login-photo-text { left: 1.25rem; bottom: 4.4rem; }
    .login-title { font-size: 1.65rem; }
    .login-sub { font-size: .9rem; }
    .photo-credit { top: .5rem; bottom: auto; right: .6rem; }
    .login-side { margin-top: -3rem; padding: 0 14px 2rem; background: none; position: relative; z-index: 2; justify-content: flex-start; }
    .login-side .auth-box { margin: 0 0 1rem; padding: 1.4rem; }
}
/* Tagesmotiv: Pilatus und Zelt im Bild behalten */
.login-photo-day img { object-position: 42% 45%; }
@media (max-width: 820px) { .login-photo-day img { object-position: 55% 30%; } }

/* ------------------------------------------------------------ Login Handy: Vollbild-Foto wie selamursa.ch */
@media (max-width: 820px) {
    body.public { display: block; min-height: 100vh; min-height: 100dvh; background: #0e1a22; }
    .login-photo { position: fixed; inset: 0; height: auto; min-height: 0; max-height: none; z-index: 0; }
    .login-photo img, .login-photo-day img { object-position: 50% 50%; }
    .login-photo-day::after { background: linear-gradient(180deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,0) 26%, rgba(7,33,48,0) 42%, rgba(7,33,48,.6) 66%, rgba(7,33,48,.9) 100%); }
    .login-photo-night::after { background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 24%, rgba(0,0,0,.15) 50%, rgba(0,0,0,.7) 72%, rgba(0,0,0,.9) 100%); }

    .login-photo-text { left: 0; right: 0; top: calc(env(safe-area-inset-top) + 2.2rem); bottom: auto; text-align: center; padding: 0 16px; }
    .login-title { font-size: 2rem; }
    .login-sub { font-size: .95rem; }
    .login-photo-day .login-photo-text { color: #10283a; text-shadow: 0 1px 10px rgba(255,255,255,.7); }
    .login-photo-day .login-sub { color: #6b3b1e; opacity: 1; }
    .photo-credit { top: auto; bottom: calc(env(safe-area-inset-bottom) + .4rem); right: 0; left: 0; text-align: center; }

    .login-side { position: relative; z-index: 2; margin: 0; min-height: 100vh; min-height: 100dvh; padding: 42vh 14px calc(env(safe-area-inset-bottom) + 2rem); background: none; justify-content: flex-start; }
    .login-side .auth-box { margin: 0 0 1rem; padding: 1.35rem; background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-color: rgba(255,255,255,.18); }
    .login-side .auth-greeting { color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
    .login-side .theme-switch { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); }
    .login-side .theme-switch button { color: rgba(255,255,255,.85); }
    .login-side .theme-switch button[aria-pressed="true"] { color: var(--primary-text); }
}
@media (max-width: 820px) {
    .photo-credit { top: calc(env(safe-area-inset-top) + .35rem); bottom: auto; left: auto; right: .6rem; text-align: right; }
    .login-photo-night ~ .login-side { padding-top: 56vh; }
}

/* 2FA-Einrichtung: QR am Computer, Knopf auf dem Handy */
.only-mobile { display: none; }
.qr img { background: #fff; padding: 6px; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.btn-block { width: 100%; justify-content: center; }
.twofa-setup .panel { margin-top: 0; }
@media (max-width: 820px), (pointer: coarse) {
    .only-mobile { display: block; }
    .only-desktop { display: none; }
}

/* ------------------------------------------------------------ Code-Eingabe (2FA) */
.otp-page { text-align: center; }
.otp-page h1 { margin-bottom: .4rem; }
.otp-page > p.muted { margin: 0 0 1.25rem; }
.otp-input, .code-input {
    width: 100% !important; max-width: none; height: 64px; text-align: center;
    font: 600 1.9rem/1 ui-monospace, "SF Mono", Consolas, monospace !important;
    letter-spacing: .45em; padding-left: .45em !important; font-variant-numeric: tabular-nums;
    border-radius: var(--radius) !important; border-width: 2px !important;
}
.otp-input::placeholder, .code-input::placeholder { color: var(--border-strong); letter-spacing: .45em; }
form.is-sending .btn-primary { opacity: .7; pointer-events: none; }
.otp-help { margin-top: 1rem; text-align: left; }
.otp-help summary { text-align: center; color: var(--muted); font-size: .88rem; }
.otp-back { margin: 1rem 0 0; font-size: .92rem; }
@media (max-width: 820px) {
    /* Code-Seite: Karte höher, damit das Feld über der Tastatur bleibt */
    .login-side:has(.otp-page), .login-photo-night ~ .login-side:has(.otp-page) { padding-top: 20vh; }
}
