:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #16181d;
  --text-2: #5b6170;
  --text-3: #8b909c;
  --border: #e2e5ea;
  --border-2: #cfd4dc;
  --accent: #1f5fbf;
  --accent-bg: #e7effb;
  --accent-text: #174a96;
  --on-accent: #ffffff;
  --success: #2e7d32;
  --success-bg: #e8f4e9;
  --danger: #c62828;
  --danger-bg: #fbeaea;
  --warn-bg: #fdf2dc;
  --warn-text: #7a4e05;
  --radius: 10px;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1b1e24;
    --surface-2: #252932;
    --text: #eceef2;
    --text-2: #a8aebb;
    --text-3: #7a808d;
    --border: #2d323c;
    --border-2: #3b414d;
    --accent: #5b93e6;
    --accent-bg: #1c2b44;
    --accent-text: #a9c8f5;
    --on-accent: #0b1220;
    --success: #6cc070;
    --success-bg: #1c2e1e;
    --danger: #ef7070;
    --danger-bg: #3a1d1d;
    --warn-bg: #3a2d12;
    --warn-text: #f1c979;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .5rem; font-weight: 600; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 16px; }
p { margin: 0 0 .75rem; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; color: var(--text-3); }
.hidden { display: none !important; }
.i { width: 20px; height: 20px; flex-shrink: 0; vertical-align: -4px; }
.i-lg { width: 26px; height: 26px; }

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.boot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; height: 100vh; font-size: 26px; font-weight: 800; letter-spacing: 1.5px; }
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo img { width: 32px; height: 32px; display: block; }
.logo span { font-weight: 800; letter-spacing: 1.2px; font-size: 19px; color: var(--text); }

/* Kopf und Navigation */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.logo { font-size: 20px; font-weight: 700; text-decoration: none; color: var(--text); letter-spacing: -.3px; }
/* Handy: Menü fest am unteren Bildschirmrand (funktioniert in allen Handy-Browsern).
   translateZ + feste Höhe verhindern das Ruckeln, wenn die Adressleiste ein- und ausfährt. */
.page { padding: 16px 16px 24px; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border);
  transform: translateZ(0); will-change: transform;
}
/* Platz unter dem Inhalt, damit die letzte Zeile nicht unter dem Menü verschwindet */
.app.shell { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.nav-in { max-width: 520px; margin: 0 auto; height: var(--nav-h); display: flex; }
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; color: var(--text-3); text-decoration: none; position: relative;
}
.nav a.on { color: var(--accent); }
.badge-dot {
  position: absolute; top: 8px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; line-height: 16px; text-align: center;
}

/* Bausteine */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.tag {
  display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 8px; margin: 2px 4px 2px 0;
  background: var(--surface-2); color: var(--text-2);
}
.tag.accent { background: var(--accent-bg); color: var(--accent-text); }
.tag.ok { background: var(--success-bg); color: var(--success); }
.tag.warn { background: var(--warn-bg); color: var(--warn-text); }
.tag.bad { background: var(--danger-bg); color: var(--danger); }
.offerbox {
  display: flex; gap: 8px; align-items: flex-start; background: var(--warn-bg); color: var(--warn-text);
  border-radius: var(--radius); padding: 8px 10px; font-size: 13px; margin-top: 10px;
}
.avatar {
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-weight: 600; overflow: hidden; background-size: cover; background-position: center;
}
.av-40 { width: 40px; height: 40px; font-size: 14px; }
.av-32 { width: 32px; height: 32px; font-size: 12px; }
.av-64 { width: 64px; height: 64px; font-size: 20px; }
.av-80 { width: 80px; height: 80px; font-size: 26px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; }
.metric b { display: block; font-size: 22px; font-weight: 600; }
.empty { text-align: center; color: var(--text-2); padding: 40px 16px; }
.empty .i { width: 32px; height: 32px; margin-bottom: 8px; }

/* Formulare */
label.f { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 500; }
label.f .tiny { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=url], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; font-size: 16px;
  color: var(--text); background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin-bottom: 12px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--accent); }
.err { color: var(--danger); font-size: 14px; margin: 4px 0 10px; }
.invalid input, .invalid select, .invalid textarea, input.invalid { border-color: var(--danger) !important; outline: 2px solid var(--danger); outline-offset: -1px; }
label.check.invalid { color: var(--danger); }
.field-err { color: var(--danger); font-size: 13px; margin: -8px 0 12px; }
.opt { font-weight: 400; color: var(--text-3); font-size: 12px; }
.req { color: var(--danger); }
.highlight { animation: hl 1.6s ease 2; border-radius: 12px; }
@keyframes hl { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 4px var(--accent); } }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px;
  font: inherit; font-size: 15px; font-weight: 500; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-2); border-radius: var(--radius); cursor: pointer; text-decoration: none;
}
button:hover, .btn:hover { background: var(--surface-2); }
button:disabled { opacity: .6; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.primary:hover { background: var(--accent); filter: brightness(1.08); }
.danger { color: var(--danger); border-color: var(--danger); }
.ghost { border-color: transparent; background: transparent; }
.block { width: 100%; }
.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: none; }
.chip {
  white-space: nowrap; font-size: 13px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text-2); cursor: pointer; min-height: 0;
}
.chip.on { background: var(--accent-bg); color: var(--accent-text); border-color: var(--accent); }

/* Verfügbarkeit */
.avail { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 12px; }
.avail th { font-weight: 500; color: var(--text-2); }
.avail td button {
  width: 100%; min-height: 26px; padding: 0; border-radius: 6px; font-size: 11px; color: var(--text-3);
  background: var(--surface-2); border-color: transparent;
}
.avail td button.on { background: var(--accent); color: var(--on-accent); }

/* Swipe-Karten */
.stack-area { position: relative; height: min(64vh, 520px); margin-bottom: 16px; }
.swipe-card {
  position: absolute; inset: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  overflow: hidden; touch-action: none; cursor: grab; user-select: none; display: flex; flex-direction: column;
  transition: transform .3s ease;
}
.swipe-card .pic {
  height: 42%; min-height: 140px; display: flex; align-items: center; justify-content: center;
  font-size: 54px; font-weight: 600; background-size: cover; background-position: center;
}
.swipe-card .body { padding: 14px 16px; overflow-y: auto; flex: 1; }
.stamp {
  position: absolute; top: 20px; font-size: 22px; font-weight: 700; padding: 4px 12px; border: 3px solid;
  border-radius: 8px; opacity: 0; pointer-events: none; background: var(--surface);
}
.stamp.yes { left: 18px; color: var(--success); transform: rotate(-12deg); }
.stamp.no { right: 18px; color: var(--danger); transform: rotate(12deg); }
.swipe-btns { display: flex; justify-content: center; gap: 32px; }
.round { width: 62px; height: 62px; border-radius: 50%; padding: 0; background: var(--surface); }
.round.no { color: var(--danger); border-color: var(--danger); }
.round.yes { color: var(--success); border-color: var(--success); }

/* Overlays */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.5); display: flex;
  align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--surface);
  border-radius: 20px 20px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
}
.sheet .grip { width: 40px; height: 4px; border-radius: 2px; background: var(--border-2); margin: 0 auto 12px; }
.center-sheet { text-align: center; }
.share-row { display: flex; gap: 6px; margin: 14px 0; }
.share-row > * {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--text);
  text-decoration: none; background: none; border: 0; padding: 0; min-height: 0; cursor: pointer;
}
.share-row .ic { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.msgbox { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; color: var(--text-2); word-break: break-word; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px); transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px;
  max-width: calc(100% - 32px); box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.toast.bad { background: var(--danger); color: #fff; }

/* Admin */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; scrollbar-width: none; }
.admin-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.admin-item:last-child { border-bottom: 0; }
pre.mail { white-space: pre-wrap; font: 13px/1.5 ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 10px; border-radius: 8px; margin: 6px 0 0; }

/* Anmeldung */
.auth { padding: 32px 16px 40px; }
.auth .logo { display: flex; flex-direction: column; gap: 10px; margin: 0 auto 6px; width: max-content; }
.auth .logo img { width: 96px; height: 96px; }
.auth .logo span { font-size: 30px; letter-spacing: 3px; }
.auth .claim { text-align: center; color: var(--text-2); margin-bottom: 24px; }
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); margin: 18px 0 8px; }
.footer-links { text-align: center; font-size: 13px; margin-top: 24px; }
.footer-links a { color: var(--text-2); margin: 0 6px; }
.cards > .card { margin-bottom: 12px; }
.terms-box { border: 2px solid var(--accent); background: var(--accent-bg); color: var(--text); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; font-size: 14px; }
.terms-box .terms-title { font-weight: 700; color: var(--accent-text); margin-bottom: 6px; }
.terms-box ul { margin: 0 0 8px; padding-left: 18px; }
.terms-box li { margin-bottom: 6px; }
.disclaimer { font-size: 11px; color: var(--text-3); margin-top: 8px; }
.report-link { background: none; border: 0; min-height: 0; padding: 0; font-size: 12px; color: var(--text-3); text-decoration: underline; cursor: pointer; }
.page-footer { text-align: center; font-size: 12px; color: var(--text-3); padding: 16px 20px 28px; }
.footer-note { margin: 0 auto 12px; max-width: 420px; font-size: 11px; line-height: 1.5; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; }
.footer-nav a { white-space: nowrap; margin: 0 !important; padding: 2px 0; }
@media (min-width: 900px) { .app.shell .page-footer { grid-column: 2; padding: 0 32px 32px; margin-top: 0; } }
.page-footer a { color: var(--text-3); margin: 0 6px; }
.qr { background: #fff; border-radius: 12px; padding: 12px; width: 220px; height: 220px; margin: 0 auto; display: block; }
.qr svg { width: 100%; height: 100%; display: block; }
.ev-date { width: 56px; flex-shrink: 0; text-align: center; border-radius: 10px; background: var(--accent-bg); color: var(--accent-text); padding: 6px 0; line-height: 1.2; }
.ev-date b { display: block; font-size: 22px; }
.ev-date span { font-size: 11px; text-transform: uppercase; }
.av-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.offer-link { width: 100%; border: 1px solid transparent; cursor: pointer; font: inherit; min-height: 0; text-align: left; }
.offer-link:hover { background: var(--warn-bg); border-color: var(--warn-text); }
.offer-go { font-size: 12px; font-weight: 600; white-space: nowrap; align-self: center; }
.icon-btn { position: relative; padding: 0 8px; }
.icon-btn .count {
  position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
}
.me-link { display: inline-flex; border-radius: 50%; outline-offset: 2px; text-decoration: none; }
.me-link.on { outline: 2px solid var(--accent); }
.nav a.desktop-only { display: none; }
@media (max-width: 420px) { .hide-xs { display: none; } }
.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.seg a { flex: 1; text-align: center; padding: 7px 0; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--text-2); text-decoration: none; }
.seg a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: var(--accent); border-radius: 4px; }
.home-block { margin-bottom: 16px; }
.home-block h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); text-decoration: none; color: var(--text); }
.list-row:first-of-type { border-top: 0; }
.clickable { cursor: pointer; }
.clickable:hover { border-color: var(--border-2); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; margin-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 10px; color: var(--text-3); }
.bars .bar i { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .bar b { font-weight: 600; color: var(--text-2); font-size: 11px; }
.steps { display: flex; gap: 6px; justify-content: center; margin: 12px 0; }
.steps i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-2); }
.steps i.on { background: var(--accent); }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 8px; }
.slot { flex-direction: column; gap: 2px; min-height: 58px; padding: 6px; font-size: 13px; }
.slot b { font-weight: 600; }
.slot span { color: var(--text-2); }
.slot:hover { border-color: var(--accent); background: var(--accent-bg); }
.fb-row { display: flex; gap: 6px; }
.fb-row button { flex: 1; min-height: 36px; padding: 0 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.fb-row button:hover { color: var(--text); border-color: var(--accent); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); margin-top: 12px; padding-top: 10px; }
.link-btn { background: none; border: 0; padding: 0; min-height: 0; font-size: 13px; font-weight: 500; color: var(--accent); cursor: pointer; text-align: left; }
.link-btn:hover { background: none; text-decoration: underline; }
.kbd-hint { display: none; }

/* ---------- PC / Tablet quer ---------- */
@media (min-width: 900px) {
  .app { max-width: none; }
  .auth { max-width: 480px; margin: 0 auto; padding-top: 8vh; }

  .app.shell {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    padding-bottom: 0;
  }
  .app.shell .top { grid-column: 1 / -1; padding: 14px 28px; }
  .app.shell .nav {
    grid-column: 1; grid-row: 2; position: sticky; top: 63px; bottom: auto; left: auto; right: auto; align-self: start; margin-top: 0;
    height: calc(100vh - 63px); padding: 16px 12px; border-top: 0; border-right: 1px solid var(--border);
    background: var(--bg);
  }
  .app.shell .nav-in { flex-direction: column; height: auto; gap: 4px; max-width: none; }
  .app.shell .nav a {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 14px;
    font-size: 15px; border-radius: var(--radius); color: var(--text-2);
  }
  .app.shell .nav a:hover { background: var(--surface-2); }
  .app.shell .nav a.on { background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }
  .app.shell .badge-dot { position: static; margin-left: auto; }
  .app.shell .nav a.desktop-only { display: flex; }
  .app.shell .page { grid-column: 2; padding: 28px 32px 48px; max-width: 1200px; width: 100%; }

  /* Am PC kann man mit der Maus nicht seitlich wischen – Knopf-Leisten brechen deshalb um */
  .chips, .tabs { flex-wrap: wrap; overflow: visible; }
  .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; align-items: start; }
  .cards > .card { margin-bottom: 0; }
  .narrow { max-width: 760px; }
  .metrics { grid-template-columns: repeat(4, 1fr); }

  .stack-area { max-width: 440px; margin: 0 auto 20px; height: min(68vh, 600px); }
  .kbd-hint { display: block; text-align: center; margin-top: 12px; }

  .overlay { align-items: center; }
  .sheet { border-radius: 20px; max-width: 480px; padding-bottom: 20px; }
  .sheet .grip { display: none; }

  .toast { bottom: 28px; }
}

@media (min-width: 1400px) {
  .app.shell { grid-template-columns: 260px minmax(0, 1fr); }
}

/* Wartungsmodus: Hinweis für Admins */
.maint-banner { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 12px; background: #f59e0b; color: #1f1300; font-weight: 600; font-size: 14px; text-decoration: none; text-align: center; }
.maint-banner:hover { background: #fbbf24; }
.maint-banner.test { background: var(--accent-bg); color: var(--accent-text); }
.mode-pick { display: grid; gap: 8px; margin: 12px 0; }
.mode-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.mode-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.mode-opt input { margin-top: 3px; }
.mode-opt span { display: grid; gap: 2px; }
.mode-opt small { color: var(--text-2); font-size: 13px; }
.center { text-align: center; }
.maint-banner { border-radius: var(--radius); margin: 8px 16px 0; }
@media (min-width: 900px) { .app.shell .maint-banner { grid-column: 2; grid-row: 2; align-self: start; margin: 12px 32px 0; } .app.shell .maint-banner ~ .page { grid-row: 2; padding-top: 64px; } .app.shell .maint-banner { position: relative; z-index: 1; } }

/* Server-Übersicht */
.meter { margin-top: 12px; }
.meter-bar { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin: 4px 0 2px; }
.meter-bar span { display: block; height: 100%; border-radius: 6px; background: var(--ok, #16a34a); transition: width .4s; }
.meter.warn .meter-bar span { background: #f59e0b; }
.meter.bad .meter-bar span { background: var(--danger); }
.svc { padding: 6px 0; border-top: 1px solid var(--border); gap: 8px; }
.svc .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--ok, #16a34a); }
.svc .dot.warn { background: #f59e0b; }
.svc .dot.bad { background: var(--danger); }
