/* DW-Veranstaltungen – eigenes Design in den Farben des Deichwacht-Wappens */
:root {
  --navy: #1f1d6b;
  --navy-2: #2d2a8a;
  --navy-soft: #e9e8f7;
  --yellow: #f6c90e;
  --yellow-soft: #fff6d1;
  --green: #17945a;
  --green-soft: #ddf3e7;
  --red: #d23b3b;
  --red-soft: #fbe3e3;
  --blue-soft: #e2ecfb;
  --ink: #17172e;
  --muted: #6b6b85;
  --line: #e3e3ee;
  --bg: #f3f3f9;
  --card: #fff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 60, .06), 0 4px 16px rgba(20, 20, 60, .05);
  --side: 232px;
  --top: 60px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
a { color: var(--navy-2); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hp { position: absolute; left: -9999px; }
.ico { width: 20px; height: 20px; flex: none; }

/* ---------- Kopf & Navigation ---------- */
:root { --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); --rail: 88px; }
.topbar {
  position: fixed; inset: 0 0 auto 0; height: calc(var(--top) + var(--safe-top)); padding: var(--safe-top) 16px 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--navy); color: #fff; border-bottom: 4px solid var(--yellow);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 1.02rem; min-width: 0; white-space: nowrap; }
.brand img { width: 38px; height: 38px; flex: none; }
.brand strong { color: var(--yellow); }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user small { opacity: .7; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--yellow); color: var(--navy); font-weight: 700; font-size: .85rem;
}
.icon-btn { color: #fff; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; }
.icon-btn:hover { background: rgba(255, 255, 255, .12); }

.sidenav {
  position: fixed; top: calc(var(--top) + var(--safe-top)); left: 0; bottom: 0; width: var(--side); padding: 16px 12px;
  background: #fff; border-right: 1px solid var(--line); overflow-y: auto; z-index: 20;
}
.sidenav a {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px;
  color: var(--ink); text-decoration: none; font-weight: 500; margin-bottom: 2px;
}
.sidenav a:hover { background: var(--bg); }
.sidenav a.active { background: var(--navy); color: #fff; }
.sidenav a.active .ico { color: var(--yellow); }
.bottomnav { display: none; }

.main { margin: calc(var(--top) + var(--safe-top)) 0 0 var(--side); padding: 24px 28px 60px; max-width: calc(1180px + var(--side)); }
.main-guest { padding: 24px 16px; min-height: 100vh; display: flex; justify-content: center; align-items: flex-start;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 45%, var(--bg) 45.1%); }

/* Tablet: schmale Icon-Leiste links */
@media (min-width: 640px) and (max-width: 1099px) {
  .sidenav { width: var(--rail); padding: 12px 8px; }
  .sidenav a { flex-direction: column; gap: 4px; padding: 10px 4px; font-size: .7rem; text-align: center; line-height: 1.15; }
  .sidenav a .ico { width: 24px; height: 24px; }
  .main { margin-left: var(--rail); padding: 22px 24px 60px; }
}

/* Handy: Leiste unten */
@media (max-width: 639px) {
  .sidenav { display: none; }
  .hide-sm { display: none; }
  .main { margin-left: 0; padding: 16px 14px calc(92px + var(--safe-bottom)); }
  .bottomnav {
    display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-bottom)); z-index: 30;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(31, 29, 107, .08); border-radius: 22px; padding: 6px;
    box-shadow: 0 10px 30px rgba(20, 20, 60, .18);
  }
  .bottomnav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 16px;
    padding: 7px 2px 6px; font-size: .66rem; color: var(--muted); text-decoration: none; font-weight: 500;
    -webkit-tap-highlight-color: transparent;
  }
  .bottomnav a.active { color: var(--navy); font-weight: 700; background: var(--yellow-soft); }
  .bottomnav .ico { width: 23px; height: 23px; }
}
@media (max-width: 400px) { .brand-sub { display: none; } }

/* ---------- Bausteine ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; border: 1px solid rgba(0,0,0,.02); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.6rem; color: var(--navy); line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }
@media (max-width: 899px) { .cols { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  min-height: 40px; transition: transform .05s, background .15s;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-yellow { background: var(--yellow); border-color: var(--yellow); color: var(--navy); }
.btn-yellow:hover { background: #ffd83d; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: #13804d; }
.btn-red { background: #fff; border-color: #f0b8b8; color: var(--red); }
.btn-red:hover { background: var(--red-soft); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; min-height: 32px; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: 14px 20px; font-size: 1.05rem; min-height: 52px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > form { margin: 0; }
.inline { display: inline; margin: 0; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.badge-green { background: var(--green-soft); color: #0e6a40; }
.badge-red { background: var(--red-soft); color: #a52828; }
.badge-yellow { background: var(--yellow-soft); color: #7a5d00; }
.badge-gray { background: #ececf3; color: #55556e; }
.badge-blue { background: var(--blue-soft); color: #234f97; }
.badge-navy { background: var(--navy); color: var(--yellow); }

.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; }
.flash-ok { background: var(--green-soft); color: #0e6a40; }
.flash-err { background: var(--red-soft); color: #a52828; }
.flash-info { background: var(--yellow-soft); color: #6b5200; }

/* ---------- Formulare ---------- */
.form label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 12px; }
.form label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid #d4d4e3;
  border-radius: 10px; font: inherit; background: #fff; color: var(--ink);
}
input[type=checkbox], input[type=radio] { width: auto; display: inline-block; margin: 3px 0 0; accent-color: var(--navy); }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--yellow-soft); border-color: var(--navy-2); }
input[type=file] { padding: 8px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.input-sm { padding: 5px 8px; margin: 0; min-width: 0; border-radius: 8px; font-size: .9rem; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 4px; margin: 0 0 14px; }
legend { font-weight: 700; padding: 0 6px; color: var(--navy); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: #fafaff; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line); }

/* ---------- Veranstaltungs-Karten ---------- */
.event-list { display: grid; gap: 12px; }
.event {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px;
  text-decoration: none; color: inherit; border-left: 5px solid var(--navy);
}
.event:hover { box-shadow: 0 2px 4px rgba(20,20,60,.08), 0 8px 24px rgba(20,20,60,.08); }
.event.past { opacity: .65; border-left-color: #b8b8c8; }
.event.zugesagt { border-left-color: var(--green); }
.event-date { background: var(--navy); color: #fff; border-radius: 12px; text-align: center; padding: 6px 0; }
.event-date b { display: block; font-size: 1.45rem; line-height: 1.1; color: var(--yellow); }
.event-date span { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.event h3 { margin: 0 0 3px; }
.event .meta { color: var(--muted); font-size: .85rem; display: flex; gap: 10px; flex-wrap: wrap; }
.event-side { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
@media (max-width: 560px) {
  .event { grid-template-columns: 54px 1fr; }
  .event-side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
}
.bar { height: 8px; background: #ececf3; border-radius: 99px; overflow: hidden; min-width: 90px; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.bar.low i { background: var(--yellow); }

/* ---------- Mein Einsatz ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff;
  border-radius: 18px; padding: 20px; margin-bottom: 16px; position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: rgba(246, 201, 14, .14); }
.hero h2 { color: #fff; margin-bottom: 4px; }
.hero .muted { color: rgba(255,255,255,.75); }
.hero-pos { font-size: 2.3rem; font-weight: 800; color: var(--yellow); line-height: 1; margin: 12px 0 4px; }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0; position: relative; z-index: 1; }
.hero-grid div { background: rgba(255,255,255,.1); border-radius: 10px; padding: 8px 10px; }
.hero-grid small { display: block; opacity: .7; font-size: .75rem; }
.hero .btn-row { position: relative; z-index: 1; }
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.checklist li:last-child { border: 0; }
.checklist input { width: 20px; height: 20px; margin: 0; }
.checklist li.done span { text-decoration: line-through; color: var(--muted); }
.doc { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.doc:last-child { border: 0; }
.doc .ico { color: var(--navy); width: 26px; height: 26px; }
.doc-main { flex: 1; min-width: 0; }
.doc-main a { font-weight: 600; text-decoration: none; }
.weather { display: flex; gap: 14px; align-items: center; }
.weather b { font-size: 1.5rem; }

/* ---------- Live / Planung ---------- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.person {
  display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px;
}
.person.da { border-color: #a6ddc0; background: #f5fcf8; }
.person.fehlt { border-color: #f0b8b8; background: #fff8f8; }
.person .avatar { background: var(--navy-soft); color: var(--navy); }
.person.da .avatar { background: var(--green); color: #fff; }
.person-main { flex: 1; min-width: 0; }
.person-main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-main small { color: var(--muted); }
.alert-box { border-left: 5px solid var(--red); background: var(--red-soft); padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 7px 13px; border-radius: 99px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; font-size: .88rem; }
.tabs a.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.qr-box { display: grid; place-items: center; padding: 10px; }
.qr-box canvas, .qr-box img, .qr-box svg { width: 260px; height: 260px; image-rendering: pixelated; }
.u18 { background: #ffe9c7; color: #8a4b00; }

/* ---------- Auth ---------- */
.auth-card { background: #fff; border-radius: 20px; box-shadow: 0 10px 40px rgba(10, 10, 50, .25); padding: 28px 24px; width: 100%; max-width: 420px; margin-top: 30px; }
.auth-card.wide { max-width: 640px; }
.auth-logo { display: block; width: 104px; height: 104px; margin: -80px auto 10px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.25)); }
.auth-card h1 { text-align: center; }
.auth-card > p.muted { text-align: center; margin-top: -4px; }
.list-plain { padding-left: 18px; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.menu-list a { display: flex; gap: 12px; align-items: center; padding: 14px 6px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; }
.copy-field { display: flex; gap: 6px; }
.copy-field input { margin: 0; font-size: .85rem; }

/* ---------- App installieren ---------- */
.install-card { position: relative; border: 2px solid var(--yellow); }
.install-card[hidden], [data-os][hidden] { display: none !important; }
.install-row { display: flex; gap: 14px; align-items: center; margin-bottom: 4px; }
.install-row img { width: 54px; height: 54px; border-radius: 14px; box-shadow: var(--shadow); }
.install-row h3 { margin: 0 0 2px; }
.install-row p { margin: 0; }
.install-card .btn { margin-top: 10px; }
.install-x { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 1.4rem; color: var(--muted); cursor: pointer; line-height: 1; padding: 4px 8px; }

/* ---------- Startseite ---------- */
.greet { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 16px; }
.greet h1 { margin: 2px 0 0; font-size: 1.6rem; }
.greet-date { color: var(--muted); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.greet-avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: var(--yellow); font-weight: 800; text-decoration: none; flex: none; box-shadow: 0 4px 14px rgba(31,29,107,.3); }
@media (min-width: 640px) { .greet-avatar { display: none; } }

.home-grid { display: grid; gap: 18px; }
@media (min-width: 900px) { .home-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; } }
.home-main, .home-side { display: grid; gap: 18px; min-width: 0; }
.home-section { min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-head h2 { margin: 0; font-size: 1.08rem; }
.section-head a { font-weight: 600; text-decoration: none; font-size: .9rem; }
.pill { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 99px; font-weight: 800; font-size: .8rem; }
.pill-yellow { background: var(--yellow); color: var(--navy); }
.pill-red { background: var(--red); color: #fff; }

/* Karte „Nächster Einsatz“ */
.next-card {
  position: relative; overflow: hidden; color: #fff; border-radius: 24px; padding: 20px;
  background: radial-gradient(120% 90% at 100% 0%, #3b37b0 0%, rgba(59,55,176,0) 60%), linear-gradient(150deg, #1f1d6b 0%, #2a278a 100%);
  box-shadow: 0 14px 34px rgba(31, 29, 107, .35);
}
.next-card::before { content: ""; position: absolute; right: -60px; bottom: -70px; width: 220px; height: 220px; border-radius: 50%; border: 28px solid rgba(246, 201, 14, .12); }
.next-card > * { position: relative; }
.next-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.next-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; opacity: .7; font-weight: 600; }
.countdown { background: rgba(255,255,255,.14); color: #fff; padding: 4px 12px; border-radius: 99px; font-weight: 800; font-size: .82rem; }
.countdown.soon { background: var(--yellow); color: var(--navy); }
.next-card h2 { color: #fff; font-size: 1.45rem; margin: 0 0 14px; }
.next-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.fact { background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 10px 12px; min-width: 0; }
.fact small { display: block; font-size: .72rem; opacity: .7; text-transform: uppercase; letter-spacing: .04em; }
.fact strong { display: block; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact em { font-style: normal; font-size: .78rem; opacity: .7; }
.fact-big strong { font-size: 2rem; line-height: 1.1; color: var(--yellow); }
.fact-wide { grid-column: 1 / -1; }
.next-actions { display: grid; gap: 10px; }
.next-actions form { margin: 0; }
.next-btns { display: flex; gap: 8px; }
.next-btns .btn { flex: 1; min-height: 46px; }
.next-btns .btn:last-child:not(:first-child)[title] { flex: 0 0 52px; }
.btn-glass { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.18); color: #fff; }
.btn-glass:hover { background: rgba(255,255,255,.2); }
.next-empty p { opacity: .8; margin: 0 0 14px; }
.next-empty h2 { margin-top: 6px; }

/* Schnell-Antwort */
.answer-list { display: grid; gap: 10px; }
.answer-card { background: #fff; border-radius: 18px; padding: 12px; box-shadow: var(--shadow); display: grid; gap: 10px; }
.answer-info { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; min-width: 0; }
.answer-info strong { display: block; }
.answer-info small { display: block; color: var(--muted); }
.date-chip, .mini-date { display: grid; place-items: center; flex: none; width: 50px; height: 54px; border-radius: 14px; background: var(--navy-soft); color: var(--navy); font-size: .7rem; font-weight: 700; text-transform: uppercase; line-height: 1.05; }
.date-chip b, .mini-date b { font-size: 1.3rem; }
.answer-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.answer-btns .btn { min-height: 46px; }
@media (min-width: 640px) {
  .answer-card { grid-template-columns: 1fr auto; align-items: center; }
  .answer-btns { grid-template-columns: auto auto; }
}

/* Demnächst – waagerecht wischen */
.scroller { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 10px; margin: 0 -14px; padding-left: 14px; padding-right: 14px; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.mini-event { flex: 0 0 172px; scroll-snap-align: start; background: #fff; border-radius: 18px; padding: 12px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 6px; border-top: 4px solid var(--navy-soft); }
.mini-event.is-in { border-top-color: var(--green); }
.mini-event strong { font-size: .95rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-event small { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-event .badge { align-self: flex-start; margin-top: auto; }
.mini-date { width: 46px; height: 48px; }
@media (min-width: 640px) { .scroller { margin: 0; padding-left: 2px; padding-right: 2px; } }

/* Kacheln */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (min-width: 640px) and (max-width: 899px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 360px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile { position: relative; background: #fff; border-radius: 18px; padding: 12px 6px 10px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; -webkit-tap-highlight-color: transparent; transition: transform .1s; }
.tile:active { transform: scale(.96); }
.tile-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; }
.tile-ico .ico { width: 22px; height: 22px; }
.tile-navy .tile-ico { background: var(--navy-soft); color: var(--navy); }
.tile-yellow .tile-ico { background: var(--yellow-soft); color: #8a6a00; }
.tile-green .tile-ico { background: var(--green-soft); color: var(--green); }
.tile-gray .tile-ico { background: #ececf3; color: #55556e; }
.tile-label { font-size: .74rem; font-weight: 600; line-height: 1.2; }
.tile-count { position: absolute; top: 6px; right: 8px; background: var(--red); color: #fff; border-radius: 99px; font-size: .7rem; font-weight: 800; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; }

/* Jahres-Zahlen */
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.mini-stats > * { background: #fff; border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow); }
.mini-stats b { display: block; font-size: 1.35rem; color: var(--navy); white-space: nowrap; }
.mini-stats span { font-size: .8rem; color: var(--muted); }
.mini-stats .alert b { color: var(--red); }

/* Besetzung */
.occ-list { display: grid; gap: 8px; }
.occ { background: #fff; border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: grid; gap: 7px; }
.occ-top { display: flex; justify-content: space-between; gap: 10px; }
.occ-top span { white-space: nowrap; color: var(--muted); }
.occ-top b { color: var(--navy); font-size: 1.05rem; }
.occ small { color: var(--muted); display: block; }
.occ-row { grid-template-columns: 1fr auto; align-items: center; }
.occ-row form { margin: 0; }
@media (max-width: 639px) {
  .topbar-user .avatar { display: none; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
}

/* ---------- Push ---------- */
.push-card[hidden] { display: none !important; }
.push-bell { width: 54px; height: 54px; border-radius: 14px; background: var(--yellow-soft); display: grid; place-items: center; font-size: 1.6rem; flex: none; }
.push-card .btn-row .btn[hidden] { display: none; }

/* ---------- Tausch ---------- */
.tausch-box summary { cursor: pointer; font-weight: 600; display: flex; gap: 8px; align-items: center; list-style: none; color: var(--navy); }
.tausch-box summary::-webkit-details-marker { display: none; }
.tausch-card { text-decoration: none; color: inherit; border-left: 5px solid var(--yellow); }

/* ---------- Verfügbarkeit ---------- */
.vf-months { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.vf-month { margin: 0; }
.vf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.vf-day { position: relative; border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 6px 0 5px; display: flex; flex-direction: column; align-items: center; cursor: pointer; font: inherit; color: var(--ink); -webkit-tap-highlight-color: transparent; transition: transform .08s; }
.vf-day:active { transform: scale(.94); }
.vf-day small { font-size: .68rem; color: var(--muted); font-weight: 600; }
.vf-day b { font-size: 1.15rem; line-height: 1.1; }
.vf-day.ja { background: var(--green); border-color: var(--green); color: #fff; }
.vf-day.ja small { color: rgba(255,255,255,.85); }
.vf-day.nein { background: var(--red-soft); border-color: #f0b8b8; color: #a52828; }
.vf-day.nein b { text-decoration: line-through; }
.vf-day i { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 2px #fff; }
.vf-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 12px; font-size: .85rem; color: var(--muted); }
.vf-legend .vf-day { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border-radius: 8px; cursor: default; }
.vf-ev { margin-top: 6px; }

/* ---------- Feedback ---------- */
.fb-faces { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 12px; }
.fb-faces label { margin: 0 !important; }
.fb-faces input { position: absolute; opacity: 0; pointer-events: none; }
.fb-faces span { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border: 2px solid var(--line); border-radius: 16px; font-size: 1.9rem; cursor: pointer; background: #fff; }
.fb-faces span small { font-size: .7rem; font-weight: 600; color: var(--muted); }
.fb-faces input:checked + span { border-color: var(--navy); background: var(--navy-soft); }
.fb-prob { display: flex; gap: 8px; margin-bottom: 10px; }
.fb-prob label { flex: 1; margin: 0 !important; }
.fb-prob input { position: absolute; opacity: 0; }
.fb-prob span { display: block; text-align: center; padding: 10px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 600; }
.fb-prob input:checked + span { border-color: var(--navy); background: var(--navy-soft); }

/* ---------- Abzeichen ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.abz { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 6px 10px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.abz .abz-ico { font-size: 1.9rem; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--yellow-soft); box-shadow: inset 0 0 0 3px var(--yellow); }
.abz b { font-size: .76rem; line-height: 1.2; }
.abz small { font-size: .68rem; color: var(--muted); }
.abz.zu .abz-ico { filter: grayscale(1); opacity: .35; background: #ececf3; box-shadow: none; }
.abz.zu b { color: var(--muted); }
.abz .bar { width: 80%; min-width: 0; height: 5px; }

/* ---------- Zuverlässigkeit ---------- */
.zdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-left: 4px; cursor: help; }
.zdot-green { background: var(--green); }
.zdot-yellow { background: var(--yellow); }
.zdot-red { background: var(--red); }
.zdot-gray { background: #cfcfdc; }
.fb-hint { text-decoration: none; color: inherit; border-left: 5px solid var(--navy); }

/* ---------- Unterschrift ---------- */
.sig-pad { position: relative; border: 2px dashed #c8c8da; border-radius: 16px; background: #fff; height: 220px; touch-action: none; }
.sig-pad canvas { width: 100%; height: 100%; display: block; border-radius: 14px; touch-action: none; cursor: crosshair; }
.sig-line { position: absolute; left: 20px; right: 20px; bottom: 44px; border-top: 1px solid #c8c8da; color: #a0a0b8; font-size: .75rem; padding-top: 4px; pointer-events: none; }
.sig-pad.signed .sig-line { color: transparent; }
.sig-img { max-width: 100%; height: 110px; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
@media (orientation: landscape) and (max-height: 500px) { .sig-pad { height: 170px; } }

/* ---------- Karte ---------- */
.map-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
.map { height: calc(100vh - 210px); min-height: 420px; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); z-index: 1; }
.map-side { margin: 0; max-height: calc(100vh - 210px); overflow-y: auto; padding: 12px; }
@media (max-width: 899px) { .map-wrap { grid-template-columns: 1fr; } .map { height: 62vh; min-height: 340px; } .map-side { max-height: none; } }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .75rem; color: var(--muted); margin-bottom: 10px; }
.map-legend span { display: flex; gap: 5px; align-items: center; }
.mk { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-style: normal; font-size: .7rem; font-weight: 800; color: #fff; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); flex: none; }
.mk.big { width: 34px; height: 34px; font-size: .78rem; }
.mk.green { background: var(--green); } .mk.yellow { background: #e0a800; } .mk.red { background: var(--red); } .mk.gray { background: #8b8ba3; }
.mk.alert { background: var(--red); font-size: 1.1rem; animation: puls 1.2s infinite; }
.mk.treff { background: var(--navy); color: var(--yellow); }
@keyframes puls { 0%,100% { box-shadow: 0 0 0 0 rgba(210,59,59,.6); } 50% { box-shadow: 0 0 0 10px rgba(210,59,59,0); } }
.map-list { display: grid; gap: 6px; }
.map-item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font: inherit; cursor: pointer; color: var(--ink); }
.map-item.sel { border-color: var(--navy); background: var(--navy-soft); }
.map-item span { flex: 1; min-width: 0; }
.map-item strong { display: block; font-size: .88rem; }
.map-item small { display: block; color: var(--muted); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-item em { font-size: .7rem; color: var(--red); font-style: normal; white-space: nowrap; }
.map-hint { background: #fff; padding: 10px 12px; border-radius: 12px; box-shadow: var(--shadow); font-size: .85rem; max-width: 220px; }
.pop-list { margin: 6px 0; padding-left: 16px; }

/* ---------- Scanner ---------- */
.scan-wrap { max-width: 560px; margin: 0 auto; }
.scan-cam { position: relative; background: #0d0c2b; border-radius: 20px; overflow: hidden; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.scan-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; width: 58%; aspect-ratio: 1; border: 3px solid var(--yellow); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); opacity: 0; }
.cam-on .scan-frame { opacity: 1; }
.scan-cam .btn { position: relative; z-index: 2; }
.scan-log { display: grid; gap: 6px; }
.scan-item { display: block; padding: 10px 12px; border-radius: 12px; font-weight: 600; text-decoration: none; }
.scan-item.ok { background: var(--green-soft); color: #0e6a40; }
.scan-item.err { background: var(--red-soft); color: #a52828; }
[data-nur][hidden] { display: none !important; }

/* ---------- Überlauf auf schmalen Bildschirmen verhindern ---------- */
.copy-field input, .copy-field select { flex: 1; min-width: 0; }
.cols > *, .grid2 > *, .home-grid > * { min-width: 0; }
.stat span, .mini-stats span { overflow-wrap: anywhere; }
html, body { max-width: 100%; overflow-x: hidden; }
