/* Deskville - Designsystem (hell, warm). Alle Schriften vom eigenen Server (DSGVO: keine Google Fonts). */
@font-face { font-family: 'Geist'; src: url('/fonts/geist/geist-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('/fonts/geist/geist-sans-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('/fonts/geist/geist-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('/fonts/geist/geist-sans-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/fonts/geist-mono/geist-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/fonts/geist-mono/geist-mono-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url('/fonts/pixelify-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url('/fonts/pixelify-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url('/fonts/pixelify-sans-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  /* warmes Kreide, Tinte, eine Akzentfarbe (Abendblau), ein Licht (Fensterlicht) */
  --bg: #f6f3ee;
  --bg-2: #efebe4;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --surface-3: #f1ede6;
  --line: #e7e1d7;
  --line-strong: #d8d1c5;
  --ink: #1d1b2b;
  --text: #1d1b2b;
  --text-2: #5b5868;
  --text-3: #6a6676;
  --accent: #3552d9;
  --accent-strong: #2f4bc9;
  --accent-ink: #ffffff;
  --accent-soft: #e3e8fd;
  --accent-tint: #f1f4fe;
  --ok: #1f9d55;
  --warn: #c98512;
  --danger: #d4483e;
  --danger-soft: #fbe9e7;
  --st-available: #2fb36a;
  --st-busy: #e6a21b;
  --st-dnd: #e0503f;
  --night: #16131e; /* Hintergrund rund um die Spielwelt */
  --abendblau: #3552d9;
  --licht: #ffcf5a;
  --kreide: #f6f3ee;

  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --px: 'Pixelify Sans', var(--font);

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  /* Schatten mit warmem Ton statt reinem Schwarz */
  --shadow-1: 0 1px 2px rgba(60, 44, 20, 0.06), 0 2px 8px -2px rgba(60, 44, 20, 0.06);
  --shadow-2: 0 2px 4px rgba(60, 44, 20, 0.05), 0 18px 40px -16px rgba(60, 44, 20, 0.22);
  --shadow-3: 0 4px 10px rgba(30, 22, 10, 0.12), 0 30px 70px -20px rgba(30, 22, 10, 0.45);
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px rgba(53, 82, 217, 0.55);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --z-hud: 10;
  --z-panel: 20;
  --z-pop: 30;
  --z-modal: 40;
  --z-toast: 50;
  --z-top: 60;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(53, 82, 217, 0.2); }

a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; transition: color 0.2s var(--ease); }
a:hover { color: var(--accent-strong); text-decoration: underline; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.12; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); text-wrap: balance; }
h1 { font-size: clamp(32px, 4.6vw, 54px); letter-spacing: -0.04em; font-weight: 650; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0 0 12px; text-wrap: pretty; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: 13px; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
.tabnum { font-variant-numeric: tabular-nums; }
hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--accent-strong); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; }
.eyebrow::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

:focus { outline: none; }
:focus-visible { box-shadow: var(--ring); border-radius: var(--r-sm); }

.skip { position: absolute; left: 12px; top: -60px; z-index: var(--z-top); background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: var(--r-sm); font-weight: 600; }
.skip:focus { top: 12px; color: var(--bg); }

/* ---------- Marke ---------- */
.logo, .brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand .wordmark { display: block; height: 20px; width: auto; }
.wordmark .wm-t { fill: currentColor; }
.wordmark .wm-px { fill: var(--licht); }
.logo:hover, .brand:hover { color: var(--ink); text-decoration: none; }
.mark, .brand-mark { display: block; width: 30px; height: 30px; flex: none; border-radius: 22.5%; box-shadow: 0 6px 16px -6px rgba(53, 82, 217, 0.6); }
.brand-mark.lg { width: 58px; height: 58px; box-shadow: 0 14px 34px -10px rgba(53, 82, 217, 0.65); }

/* ---------- Karten ---------- */
.box, .card-surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 24px;
}
.box > h2:first-child, .box > h3:first-child { margin-bottom: 6px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head p { margin: 0; }

/* ---------- Formulare ---------- */
label { display: grid; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 500; color: var(--text-2); }
label > .small { font-weight: 400; color: var(--text-3); }
input, select, textarea {
  font: 400 15px/1.3 var(--font); color: var(--text);
  width: 100%; padding: 11px 13px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
input::placeholder { color: var(--text-3); }
input:hover, select:hover { border-color: #c6bdaf; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type='checkbox'] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
input[type='range'] { padding: 0; accent-color: var(--accent); border: 0; background: none; box-shadow: none; }
input.code { font: 500 26px/1 var(--mono); letter-spacing: 0.4em; text-align: center; padding: 14px 10px; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%235b5868' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1 1 auto; }
.row > button, .row > .btn { flex: 0 0 auto; }
label.row { display: flex; font-weight: 400; color: var(--text-2); }
label.row input[type='checkbox'] { flex: none; }

/* ---------- Buttons ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 14px/1 var(--font); letter-spacing: -0.005em; color: var(--accent-ink); text-decoration: none;
  padding: 11px 16px; min-height: 40px; border-radius: var(--r-sm); cursor: pointer;
  background: var(--accent); border: 1px solid transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(47, 75, 201, 0.25), 0 8px 18px -10px rgba(47, 75, 201, 0.7);
  transition: background 0.2s var(--ease), transform 0.12s var(--ease), box-shadow 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.2s;
}
button:hover, .btn:hover { background: var(--accent-strong); color: var(--accent-ink); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px) scale(0.985); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
button.wide, .btn.wide { width: 100%; }
button svg, .btn svg { width: 18px; height: 18px; flex: none; }
button.ghost, .btn.ghost, button.secondary, .btn.secondary {
  background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-1);
}
button.ghost:hover, .btn.ghost:hover, button.secondary:hover, .btn.secondary:hover { background: var(--surface-2); border-color: #c6bdaf; color: var(--ink); }
button.danger, .btn.danger { background: var(--danger); color: #fff; box-shadow: 0 1px 2px rgba(150, 40, 30, 0.3), 0 8px 18px -10px rgba(212, 72, 62, 0.8); }
button.danger:hover { background: #bd3a31; color: #fff; }
button.link, .btn.link { background: none; border: 0; box-shadow: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 500; }
button.link:hover { color: var(--accent-strong); text-decoration: underline; background: none; }
button.sm, .btn.sm { min-height: 32px; padding: 7px 11px; font-size: 13px; }
.btn.lg, button.lg { min-height: 50px; padding: 14px 22px; font-size: 15px; border-radius: var(--r-md); }
.icon-btn {
  width: 38px; height: 38px; min-height: 0; padding: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-2); border: 1px solid transparent; box-shadow: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }

/* ---------- Meldungen, Badges ---------- */
.msg { padding: 11px 13px; margin: 12px 0; border: 1px solid var(--line-strong); background: var(--surface-2); border-radius: var(--r-sm); font-size: 14px; }
.msg.error { border-color: #f1c2bd; background: var(--danger-soft); color: #8e2a22; }
.msg.ok { border-color: #bfe6cf; background: #e9f7ef; color: #1c6b40; }
.msg.warn { border-color: #f0d9a7; background: #fdf4e1; color: #7c5309; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; font-size: 12px; font-weight: 500; border-radius: var(--r-xs); border: 1px solid var(--line-strong); color: var(--text-2); background: var(--surface-2); }
.badge.owner { border-color: #f0d9a7; color: #8a5c08; background: #fdf4e1; }
.badge.admin { border-color: #c9d3fa; color: var(--accent-strong); background: var(--accent-tint); }
.badge.on { border-color: #bfe6cf; color: var(--ok); background: #e9f7ef; }
.badge.off { border-color: #f1c2bd; color: var(--danger); background: var(--danger-soft); }
.dot { width: 9px; height: 9px; display: inline-block; flex: none; border-radius: 50%; background: var(--st-available); box-shadow: 0 0 0 2px var(--surface); }
.dot.busy { background: var(--st-busy); }
.dot.dnd { background: var(--st-dnd); }

/* ---------- Tabellen ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--text-3); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--surface-2); }
td .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
td select { padding: 6px 30px 6px 10px; width: auto; font-size: 13px; }
.table-wrap { overflow-x: auto; margin: 0 -6px; }

/* ---------- App-Rahmen für Konto & Verwaltung ---------- */
.topbar {
  position: sticky; top: 0; z-index: var(--z-panel);
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px clamp(16px, 4vw, 32px);
  background: rgba(246, 243, 238, 0.86); backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: var(--text-2); padding: 7px 12px; border-radius: var(--r-sm); font-size: 14px; font-weight: 500; }
.topbar nav a:hover { color: var(--ink); background: var(--surface-3); text-decoration: none; }
.topbar nav a.active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
.topbar .who { color: var(--text-2); font-size: 13px; display: inline-flex; align-items: center; gap: 8px; }
.topbar .who b { color: var(--ink); font-weight: 600; }
.topbar #logout { min-height: 34px; padding: 7px 12px; }
.page { width: min(1040px, 100%); margin: 0 auto; padding: clamp(22px, 4vw, 40px) clamp(16px, 4vw, 32px) 56px; display: grid; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.page-head h1 { font-size: clamp(26px, 3vw, 34px); margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--text-2); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; }

.linkbox { display: flex; gap: 8px; }
.linkbox input { font-family: var(--mono); font-size: 13px; }
.qr { width: 196px; height: 196px; image-rendering: pixelated; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); padding: 8px; display: block; margin: 10px 0; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; padding: 14px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--r-md); font-family: var(--mono); font-size: 13px; margin-bottom: 12px; }
details { border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; color: var(--text-2); font-weight: 500; }
summary:hover { color: var(--ink); }

.footer { display: flex; justify-content: center; gap: 18px; padding: 26px 16px 34px; font-size: 13px; color: var(--text-3); }
.footer a { color: var(--text-3); }
.footer a:hover { color: var(--text-2); }

/* ---------- Rechtstexte ---------- */
.legal { width: min(760px, 100%); margin: 0 auto; padding: 40px 20px 60px; }
.legal h1 { font-size: 34px; margin-bottom: 18px; }
.legal h2 { margin-top: 30px; font-size: 18px; }
.legal p, .legal li { color: var(--text-2); }
.legal li { margin-bottom: 6px; }
.todo { background: #fdf4e1; border: 1px dashed var(--warn); padding: 0 4px; border-radius: 4px; color: #7c5309; }

/* ---------- Anmeldung, Einrichtung, Einladung: geteilte Ansicht mit Live-Büro ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(400px, 0.85fr); }
.auth-visual { position: relative; overflow: hidden; background: var(--night); }
.auth-visual canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.auth-visual::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(22, 19, 30, 0) 52%, rgba(22, 19, 30, 0.88)); pointer-events: none; }
.auth-caption { position: absolute; left: clamp(20px, 4vw, 44px); right: clamp(20px, 4vw, 44px); bottom: clamp(22px, 4vw, 40px); z-index: 1; max-width: 520px; color: #fff; }
.auth-caption h2 { font-size: clamp(22px, 2.4vw, 30px); letter-spacing: -0.03em; margin-bottom: 8px; color: #fff; }
.auth-caption p { color: rgba(255, 255, 255, 0.78); margin: 0; }
.auth-panel { display: flex; flex-direction: column; padding: clamp(22px, 4vw, 44px); background: var(--bg); }
.auth-panel > .brand { align-self: flex-start; }
.auth-body { flex: 1; display: flex; flex-direction: column; justify-content: center; width: min(400px, 100%); margin: 28px auto; }
.auth-body h1 { font-size: 30px; margin-bottom: 6px; letter-spacing: -0.03em; }
.auth-body .lead { color: var(--text-2); margin-bottom: 24px; }
.auth-body form { margin: 0; }
.auth-foot { display: flex; gap: 16px; font-size: 13px; color: var(--text-3); }
.auth-foot a { color: var(--text-3); }
.trust { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 24px; font-size: 12px; color: var(--text-3); }
.trust span { display: inline-flex; align-items: center; gap: 6px; }
.trust svg { width: 14px; height: 14px; color: var(--accent); }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-visual { height: 34vh; min-height: 220px; }
  .auth-caption p { display: none; }
  .auth-body { margin: 20px auto; }
}

/* einfache zentrierte Ansicht (z. B. 404) */
.center { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.card { width: min(440px, 100%); }
.card .head { text-align: center; margin-bottom: 18px; }

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

/* 404 */
.notfound { background: radial-gradient(900px 500px at 50% 0%, var(--accent-tint), transparent 70%), var(--bg); }
.nf { width: min(520px, 100%); text-align: center; display: grid; justify-items: center; gap: 6px; }
.nf .brand { margin-bottom: 26px; }
.nf-code { font: 700 clamp(84px, 16vw, 140px)/0.9 var(--px); color: var(--accent); margin: 0; letter-spacing: 0.04em; text-shadow: 0 6px 0 var(--accent-soft); }
.nf h1 { font-size: clamp(26px, 4vw, 36px); margin: 10px 0 4px; }
.nf .muted { max-width: 42ch; }
.nf-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }

/* Anmeldeseiten: Details */
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[data-icon] { display: inline-flex; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.label-row a { font-weight: 500; }
.pw { position: relative; display: block; }
.pw input { padding-right: 46px; }
.pw-toggle {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; min-height: 0; padding: 0;
  background: transparent; color: var(--text-3); border: 0; box-shadow: none; border-radius: 8px;
}
.pw-toggle:hover { background: var(--surface-3); color: var(--ink); }
.pw-toggle:active { transform: translateY(-50%) scale(0.96); }
.center-text { text-align: center; margin-top: 14px; }
.auth-body form > .eyebrow { margin-bottom: 12px; }
.auth-body .lead { margin-bottom: 22px; }
.auth-body button.lg { margin-top: 4px; }
.auth-note { margin: 14px 0 0; }
.consent { align-items: flex-start; gap: 10px; }
.consent input { margin-top: 2px; }
.progress-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 22px; counter-reset: ps; }
.progress-steps li { counter-increment: ps; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.progress-steps li::before { content: counter(ps); display: grid; place-items: center; width: 20px; height: 20px; border-radius: 7px; background: var(--surface-3); font: 600 11px/1 var(--font); color: var(--text-2); }
.progress-steps li:not(:last-child)::after { content: ''; width: 18px; height: 1px; background: var(--line-strong); margin-left: 2px; }
.progress-steps li.on { color: var(--ink); font-weight: 600; }
.progress-steps li.on::before { background: var(--accent); color: #fff; }
.auth-visual canvas { opacity: 0; transition: opacity 0.8s var(--ease); }
.auth-visual canvas.ready { opacity: 1; }
.auth-visual { background: radial-gradient(120% 90% at 30% 20%, #2b2440, #16131e 70%); }
@media (max-width: 600px) {
  .auth-visual { display: none; }
  .auth-panel { background: radial-gradient(700px 360px at 80% 0%, var(--accent-tint), transparent 70%), var(--bg); min-height: 100dvh; }
}

/* Konto & Verwaltung */
.topbar nav a { display: inline-flex; align-items: center; gap: 7px; }
.topbar nav a .i { width: 16px; height: 16px; }
.topbar #logout .i { width: 16px; height: 16px; }
.page-head .btn .i { width: 16px; height: 16px; }
.box-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.box-head h2 { margin: 2px 0 2px; }
.box-head p { margin: 0; }
.box-ic { width: 38px; height: 38px; border-radius: 11px; display: grid !important; place-items: center; background: var(--accent-soft); color: var(--accent-strong); flex: none; }
.callout { display: flex; gap: 12px; align-items: flex-start; }
.callout .i { color: var(--ok); margin-top: 1px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-1); display: grid; gap: 4px; }
.stat-n { font: 650 28px/1 var(--font); letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-l { font-size: 13px; color: var(--text-3); }
.invite-result { margin-top: 12px; padding: 12px; border-radius: var(--r-md); background: var(--accent-tint); border: 1px dashed #b8e3da; }
.invite-result p { margin: 0 0 8px; }
#adminArea { display: grid; gap: 18px; }
#inviteForm input { flex: 3 1 280px; }
#inviteForm select { flex: 1 1 150px; width: auto; }
#adminArea[hidden] { display: none; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Kopfzeile der öffentlichen Seiten: Marke links, Tag/Nacht rechts ---------- */
.panel-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.auth-panel > .panel-top { align-self: stretch; }
.legal > .panel-top { margin-bottom: 18px; }
.corner-toggle { position: fixed; top: 16px; right: 16px; z-index: var(--z-top); }

/* ---------- Dunkles Theme der öffentlichen Seiten (Werte aus dem Deskville-CI) ---------- */
:root[data-theme='dunkel'] {
  color-scheme: dark;
  --bg: #16131e;
  --bg-2: #1b1825;
  --surface: #211d2b;
  --surface-2: #2a2536;
  --surface-3: #332d41;
  --line: #3a3448;
  --line-strong: #78718a;
  --ink: #f4efe6;
  --text: #f4efe6;
  --text-2: #b9b3c4;
  --text-3: #9a94a7;
  --accent: #8ea2ff;
  --accent-strong: #a9b8ff;
  --accent-ink: #16131e;
  --accent-soft: #1f2547;
  --accent-tint: #1b2140;
  --danger-soft: #3a1e22;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 18px 40px -16px rgba(0, 0, 0, 0.6);
  --shadow-3: 0 30px 70px -20px rgba(0, 0, 0, 0.75);
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px rgba(142, 162, 255, 0.65);
}
:root[data-theme='dunkel'] ::selection { background: rgba(142, 162, 255, 0.35); }
:root[data-theme='dunkel'] input:hover, :root[data-theme='dunkel'] select:hover { border-color: #9a94a7; }
:root[data-theme='dunkel'] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23b9b3c4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
:root[data-theme='dunkel'] button.ghost:hover, :root[data-theme='dunkel'] .btn.ghost:hover { border-color: #9a94a7; }
:root[data-theme='dunkel'] .msg.error { border-color: #6b2c2a; background: #3a1e22; color: #ff9d90; }
:root[data-theme='dunkel'] .msg.ok { border-color: #275a3c; background: #173326; color: #7fdba6; }
:root[data-theme='dunkel'] .msg.warn { border-color: #6b5420; background: #3a2e12; color: #ffcf5a; }
:root[data-theme='dunkel'] .todo { background: #3a2e12; color: #ffcf5a; border-color: #8a5c08; }
:root[data-theme='dunkel'] .box, :root[data-theme='dunkel'] .card-surface { box-shadow: none; }

/* ---------- Tag/Nacht-Schalter ----------
   Zustand über aria-checked, nur Transitions: schnelles Hin- und Herklicken lenkt um, statt neu zu starten.
   Bewegung mit --ease-in-out, Erscheinen mit --ease, Farben mit ease. */
.daynight {
  --w: 68px; --h: 34px; --k: 26px; --p: 4px;
  position: relative; flex: none; display: block; width: var(--w); height: var(--h); min-height: 0; padding: 0;
  border: 0; border-radius: 999px; cursor: pointer; overflow: hidden; isolation: isolate; background: transparent;
  box-shadow: inset 0 1px 3px rgba(22, 19, 30, 0.3), 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: box-shadow 0.2s ease; -webkit-tap-highlight-color: transparent;
}
.daynight:hover { background: transparent; }
.daynight:active { transform: none; }
.daynight:focus-visible { box-shadow: inset 0 1px 3px rgba(22, 19, 30, 0.3), 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.daynight i { position: absolute; display: block; font-style: normal; }
/* Himmel: Tag und Nacht als zwei Ebenen, die überblenden */
.dn-sky { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.dn-sky::before, .dn-sky::after { content: ''; position: absolute; inset: 0; }
.dn-sky::before { background: linear-gradient(180deg, #7b93f3 0%, #b9c6ff 100%); }
.dn-sky::after { background: linear-gradient(180deg, #0e0c14 0%, #1f2547 100%); opacity: 0; transition: opacity 0.45s ease; }
.daynight[aria-checked='true'] .dn-sky::after { opacity: 1; }
/* Pixel-Wolken: fallen beim Wechsel zur Nacht nach unten weg */
.dn-cloud { width: 2px; height: 2px; opacity: 1; translate: 0 0; transition: translate 0.35s var(--ease), opacity 0.25s ease; transition-delay: 0.12s; }
.dn-cloud::before { content: ''; position: absolute; left: 0; top: 0; width: 2px; height: 2px; animation: dn-wolke 5.5s var(--ease-in-out) infinite alternate; }
.dn-c1 { left: 37px; top: 9px; }
.dn-c1::before { box-shadow: 4px 0 #fff, 6px 0 #fff, 2px 2px #fff, 4px 2px #fff, 6px 2px #fff, 8px 2px #fff, 10px 2px #fff, 0 4px #fff, 2px 4px #fff, 4px 4px #fff, 6px 4px #fff, 8px 4px #fff, 10px 4px #fff, 12px 4px #fff, 14px 4px #fff; }
.dn-c2 { left: 46px; top: 21px; transition-delay: 0.16s; }
.dn-c2::before { opacity: 0.85; box-shadow: 2px 0 #fff, 4px 0 #fff, 0 2px #fff, 2px 2px #fff, 4px 2px #fff, 6px 2px #fff, 8px 2px #fff; animation-delay: -2.4s; }
.daynight[aria-checked='true'] .dn-cloud { translate: 0 14px; opacity: 0; transition-delay: 0s; }
/* Pixel-Sterne: erscheinen nacheinander und funkeln */
.dn-star { width: 2px; height: 2px; opacity: 0; scale: 0.5; transition: opacity 0.3s var(--ease), scale 0.3s var(--ease); }
.dn-star::before { content: ''; position: absolute; inset: 0; background: #f6f3ee; animation: dn-funkeln 2.4s ease-in-out infinite alternate; }
.dn-s1 { left: 11px; top: 8px; }
.dn-s2 { left: 21px; top: 20px; }
.dn-s3 { left: 8px; top: 23px; }
.dn-s4 { left: 29px; top: 9px; }
.dn-s5 { left: 17px; top: 13px; }
.dn-s5::before { box-shadow: -2px 0 rgba(246, 243, 238, 0.6), 2px 0 rgba(246, 243, 238, 0.6), 0 -2px rgba(246, 243, 238, 0.6), 0 2px rgba(246, 243, 238, 0.6); }
.dn-s2::before { animation-delay: -0.8s; }
.dn-s3::before { animation-delay: -1.6s; }
.dn-s4::before { animation-delay: -0.4s; }
.dn-s5::before { animation-delay: -1.2s; }
.daynight[aria-checked='true'] .dn-star { opacity: 1; scale: 1; }
.daynight[aria-checked='true'] .dn-s1 { transition-delay: 0.18s; }
.daynight[aria-checked='true'] .dn-s2 { transition-delay: 0.22s; }
.daynight[aria-checked='true'] .dn-s3 { transition-delay: 0.26s; }
.daynight[aria-checked='true'] .dn-s4 { transition-delay: 0.3s; }
.daynight[aria-checked='true'] .dn-s5 { transition-delay: 0.34s; }
/* Sternschnuppe: einmal quer über den Nachthimmel, wenn die Nacht beginnt */
.dn-shoot { left: 26px; top: 7px; width: 13px; height: 1.5px; border-radius: 2px; opacity: 0; rotate: -28deg; background: linear-gradient(90deg, #f6f3ee, rgba(246, 243, 238, 0)); }
.daynight[aria-checked='true'] .dn-shoot { animation: dn-schnuppe 0.9s var(--ease) 0.4s both; }
/* Knopf: Sonne mit Pixel-Strahlen rollt nach rechts und wird zum Mond mit Sichel */
.dn-knob {
  position: absolute; top: var(--p); left: var(--p); width: var(--k); height: var(--k); translate: 0 0;
  transform: translateX(0) rotate(0deg);
  transition: transform 0.5s var(--ease-in-out), translate 0.2s var(--ease);
}
.daynight[aria-checked='true'] .dn-knob { transform: translateX(calc(var(--w) - var(--k) - 2 * var(--p))) rotate(360deg); }
.dn-rays { inset: 0; animation: dn-drehen 14s linear infinite; }
.dn-rays::before {
  content: ''; position: absolute; left: calc(50% - 1px); top: calc(50% - 1px); width: 2px; height: 2px;
  box-shadow: 0 -16px #ffe7a8, 11px -11px #ffe7a8, 16px 0 #ffe7a8, 11px 11px #ffe7a8, 0 16px #ffe7a8, -11px 11px #ffe7a8, -16px 0 #ffe7a8, -11px -11px #ffe7a8;
  transition: opacity 0.3s var(--ease), scale 0.3s var(--ease);
}
.daynight[aria-checked='true'] .dn-rays::before { opacity: 0; scale: 0.6; }
.dn-disc {
  inset: 0; border-radius: 50%; overflow: hidden; background: #ffcf5a;
  box-shadow: inset -2px -3px 0 rgba(201, 141, 34, 0.35), 0 0 12px 1px rgba(255, 207, 90, 0.55);
  transition: background-color 0.45s ease, box-shadow 0.45s ease, scale 0.12s var(--ease);
}
.daynight[aria-checked='true'] .dn-disc { background: #f6f3ee; box-shadow: inset -2px -3px 0 rgba(29, 27, 43, 0.14), 0 0 12px 1px rgba(223, 229, 255, 0.35); }
.dn-bite { top: -6px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: #13122a; opacity: 0; transform: translate(9px, -9px); transition: transform 0.5s var(--ease-in-out), opacity 0.3s ease; }
.daynight[aria-checked='true'] .dn-bite { opacity: 1; transform: none; }
.dn-crater { left: 6px; top: 14px; width: 3px; height: 3px; background: rgba(29, 27, 43, 0.16); box-shadow: 5px 3px rgba(29, 27, 43, 0.12), 2px -6px rgba(29, 27, 43, 0.1); opacity: 0; transition: opacity 0.3s ease 0.2s; }
.daynight[aria-checked='true'] .dn-crater { opacity: 1; }
.daynight:active .dn-disc { scale: 0.88; }
@media (hover: hover) and (pointer: fine) {
  .daynight:hover .dn-knob { translate: 3px 0; }
  .daynight[aria-checked='true']:hover .dn-knob { translate: -3px 0; }
  .daynight:hover .dn-disc { box-shadow: inset -2px -3px 0 rgba(201, 141, 34, 0.35), 0 0 16px 3px rgba(255, 207, 90, 0.7); }
  .daynight[aria-checked='true']:hover .dn-disc { box-shadow: inset -2px -3px 0 rgba(29, 27, 43, 0.14), 0 0 16px 3px rgba(223, 229, 255, 0.5); }
}
@keyframes dn-wolke { from { transform: translateX(-2px); } to { transform: translateX(2px); } }
@keyframes dn-funkeln { from { opacity: 1; } to { opacity: 0.35; } }
@keyframes dn-drehen { to { transform: rotate(360deg); } }
@keyframes dn-schnuppe { 0% { opacity: 0; translate: 0 0; } 18% { opacity: 1; } 100% { opacity: 0; translate: -24px 13px; } }

/* ---------- Theme-Wechsel: Kreis vom Knopf aus (View Transitions), sonst kurze Überblendung ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }
html.thema-blende body, html.thema-blende body *:not(.daynight):not(.daynight *) {
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, fill 0.4s ease !important;
}
@media (prefers-reduced-motion: reduce) {
  .dn-rays, .dn-cloud::before, .dn-star::before { animation: none; }
  .daynight[aria-checked='true'] .dn-shoot { animation: none; }
}
