/* Kurslokal Kalender */

:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --line: #e2e5ea;
  --line-strong: #cfd4dc;
  --text: #111827;
  --muted: #6b7280;
  --soft: #f8f9fb;
  --primary: #111827;
  --ok: #15803d;
  --ok-bg: #ecfdf3;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --warn-bg: #fffbeb;
  --warn: #92400e;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.18);
}

/* Kein Zoomen: schnelles Tippen (zum Beispiel auf die Pfeile) springt sofort weiter */
html, body { touch-action: manipulation; }
button, a, input, select, textarea, label, .cell, .chip, [role="button"] { touch-action: manipulation; }
button, .btn, .cell, .chip, .tabs, .seg, .kalbar, .kalpick { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}

body.noscroll { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }

[hidden] { display: none !important; }

.boot { padding: 48px 20px; text-align: center; color: var(--muted); }

.muted { color: var(--muted); }

.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }

.ic { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; flex: none; }
.ic svg { width: 20px; height: 20px; }

/* ---------- Knöpfe und Felder ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--soft); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #1f2937; }
.btn.primary:disabled:hover { background: var(--primary); }
.btn.danger { color: var(--bad); border-color: #f3c2c2; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.big { min-height: 52px; font-size: 16px; justify-content: flex-start; padding: 12px 16px; }

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.iconbtn:hover { background: var(--soft); }
.iconbtn.plain { border-color: transparent; background: transparent; }
.iconbtn.plain:hover { background: var(--soft); }

.field { margin-bottom: 14px; }
.field > label, .label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
.input, input[type="text"], input[type="password"], input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  font-size: 16px;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input[type="date"], input[type="time"] { min-width: 0; }
select {
  background-image: linear-gradient(45deg, transparent 50%, #6b7280 50%), linear-gradient(135deg, #6b7280 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
textarea { min-height: 180px; resize: vertical; font-size: 15px; line-height: 1.5; }
.input:focus, input:focus, select:focus, textarea:focus { border-color: #6b7280; box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08); }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }

.hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.err { color: var(--bad); font-size: 14px; margin: 8px 0 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--c, #9ca3af);
  flex: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef0f3;
  color: #374151;
  white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- Anmelden und Einrichtung ---------- */

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
}
.gate-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 24px;
  box-shadow: 0 4px 20px rgba(17, 24, 39, 0.06);
}
.gate-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  margin-bottom: 14px;
}
.gate h1 { font-size: 22px; margin: 0 0 4px; }
.gate .sub { color: var(--muted); margin: 0 0 22px; }
.who { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.who button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
}
.who button.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary) inset; }

/* Kalender wählen (Luzern, Brunnen, Küssnacht) */
.kalpick, .kalbar { display: flex; flex-wrap: wrap; gap: 6px; }
.kalpick { margin-bottom: 16px; }
.kalpick button, .kalbar button {
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
}
.kalpick button.on, .kalbar button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.kalbar { margin: 2px 0 10px; }
.kalbar button { padding: 7px 14px; font-size: 14px; }
.checks { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 6px; font-size: 14px; }
.checks li { display: flex; gap: 8px; align-items: center; }

/* ---------- Kopfzeile ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.brand-text { min-width: 0; }
.brand-title { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c, #6b7280);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex: none;
}
.userbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 10px max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.nav { display: flex; align-items: center; gap: 6px; }
.monthlabel { font-size: 22px; margin: 0 0 0 8px; font-weight: 700; white-space: nowrap; }
.tools { display: flex; align-items: center; gap: 8px; }

.seg { display: inline-flex; background: #e9ebef; border-radius: 10px; padding: 3px; }
.seg button {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  color: #4b5563;
}
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: #374151; margin: 0 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .me { font-weight: 700; }

/* ---------- Monatsansicht ---------- */

.month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.dow {
  padding: 8px 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}
.cell {
  min-height: 96px;
  padding: 5px 6px 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  position: relative;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
}
.cell:nth-child(7n) { border-right: 0; }
.cell:hover { background: #fafbfc; }
.cell:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.cell.we { background: #fbfbfc; }
.cell.out { background: #f6f7f9; }
.cell.out .daynum { color: #a3a9b3; }
.cell.past .chips { opacity: 0.55; }
.daynum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 2px;
}
.cell.today .daynum { background: var(--primary); color: #fff; }
.chips { display: flex; flex-direction: column; gap: 2px; }
.chip {
  display: block;
  font-size: 12px;
  line-height: 1.3;
  padding: 2px 6px;
  border-radius: 6px;
  color: #fff;
  background: var(--c, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.chip .t { font-weight: 700; }
.chip.nh { background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0) 0 10px, rgba(255, 255, 255, 0.13) 10px 20px), var(--c); }
/* eigener Kurs in einem anderen Kalender: grau und gestreift */
.chip.fremd, .wk-ev.fremd { background: repeating-linear-gradient(135deg, #e5e7eb 0 6px, #f3f4f6 6px 12px); color: #374151; box-shadow: inset 0 0 0 1px #d1d5db; }
.srow.fremd .bar { background: repeating-linear-gradient(180deg, #9ca3af 0 5px, #d1d5db 5px 10px); }
.legend .fremd .dot { background: repeating-linear-gradient(135deg, #9ca3af 0 3px, #e5e7eb 3px 6px); }
.more { font-size: 11.5px; color: var(--muted); padding-left: 2px; }

/* ---------- Wochenansicht ---------- */

.week {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.wk-head, .wk-body { display: grid; grid-template-columns: 54px repeat(7, minmax(0, 1fr)); }
.wk-head { border-bottom: 1px solid var(--line); background: var(--soft); }
.wk-day {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 4px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}
.wk-day .wd { text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px; color: var(--muted); }
.wk-day .n { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; border-radius: 999px; font-size: 14px; }
.wk-day.today .n { background: var(--primary); color: #fff; }
.wk-day:hover { background: #eef0f3; }
.wk-times { position: relative; }
.wk-times span { position: absolute; right: 7px; font-size: 11.5px; color: var(--muted); line-height: 1; }
.wk-times i { font-style: normal; }
.wk-col {
  position: relative;
  border-left: 1px solid var(--line);
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 100% var(--hour, 46px);
  cursor: pointer;
}
.wk-col.we { background-color: #fbfbfc; }
.wk-col.past { background-color: #f7f8fa; }
.wk-ev, .wk-free {
  position: absolute;
  left: 3px;
  right: 3px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  border-radius: 7px;
  padding: 3px 7px;
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.wk-ev { border: 0; background: var(--c, #6b7280); color: #fff; box-shadow: 0 1px 2px rgba(17, 24, 39, 0.15); }
.wk-ev.nh { background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0) 0 10px, rgba(255, 255, 255, 0.13) 10px 20px), var(--c); }
.wk-ev .t { font-weight: 700; }
.wk-ev .l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wk-ev .p { display: none; }
.wk-col.past .wk-ev { opacity: 0.6; }
.wk-free {
  border: 1.5px dashed #8fd0a6;
  background: rgba(236, 253, 243, 0.75);
  color: var(--ok);
  font-weight: 600;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.wk-free .plus { font-size: 16px; font-weight: 700; line-height: 1; }
.wk-free:hover { background: var(--ok-bg); border-color: var(--ok); }
.wk-now { position: absolute; left: -1px; right: 0; height: 2px; background: #ef4444; pointer-events: none; z-index: 2; }
.wk-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; }
.wk-hint { margin-top: 8px; }

/* ---------- Liste ---------- */

.listbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.daygroup { margin-bottom: 14px; }
.daygroup h3 { font-size: 14px; margin: 0 0 6px; color: #374151; }
.daygroup h3.today::after { content: "Heute"; margin-left: 8px; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--primary); color: #fff; vertical-align: 1px; }
.empty {
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

.srow {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
}
.srow:hover { background: #fafbfc; }
.srow .bar { width: 5px; align-self: stretch; border-radius: 3px; background: var(--c, #9ca3af); flex: none; }
.srow .when { font-weight: 700; font-size: 14px; white-space: nowrap; min-width: 112px; }
.srow .what { flex: 1; min-width: 0; }
.srow .what small { display: block; color: var(--muted); font-size: 12.5px; }
.srow.static { cursor: default; }

/* ---------- Fenster (Sheets) ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade 0.15s ease-out;
}
.backdrop[hidden] { display: none !important; }
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop 0.16s ease-out;
}
.sheet.wide { max-width: 860px; }
.sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 12px 18px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.sheet-head .iconbtn { width: 36px; height: 36px; }
.sheet-head .back { margin-left: -8px; }
.sheet-title { flex: 1; font-size: 17px; margin: 0; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { padding: 16px 18px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.sheet-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--card);
  flex: none;
}
.sheet-foot .spacer { flex: 1; }

@keyframes fade { from { background-color: rgba(17, 24, 39, 0); } to { background-color: rgba(17, 24, 39, 0.45); } }
@keyframes pop { from { transform: translateY(10px); } to { transform: none; } }

.sec { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 18px 0 8px; }
.sec:first-child { margin-top: 0; }
.free-note { background: var(--ok-bg); color: var(--ok); border-radius: 10px; padding: 10px 12px; font-weight: 600; margin: 0; }

.freegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.freebtn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #bfe5cc;
  background: var(--ok-bg);
  cursor: pointer;
  text-align: left;
}
.freebtn strong { font-size: 15px; }
.freebtn span { font-size: 12.5px; color: var(--ok); font-weight: 600; }
.freebtn.busy { border-color: #f3c2c2; background: var(--bad-bg); cursor: default; }
.freebtn.busy span { color: var(--bad); }
.freebtn:not(.busy):hover { border-color: var(--ok); }

.choices { display: grid; gap: 8px; }
.choices .btn.big .ic { margin-right: 4px; }

/* Details */
.owner { display: flex; align-items: center; gap: 10px; font-size: 16px; margin-bottom: 12px; }
.owner .dot { width: 14px; height: 14px; }
.parts-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.parts-list .pl {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.parts-list .pl:last-child { border-bottom: 0; }
.pl .pnum { font-weight: 700; }
.pl .ptime { color: #374151; white-space: nowrap; }
.meta { font-size: 13px; color: var(--muted); margin-top: 12px; }
.nhbox { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--soft); border: 1px solid var(--line); }
.nhbox strong { display: block; }

/* ---------- VKU-Formular ---------- */

.ownerline { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.part {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
}
.part.okay { border-color: #bfe5cc; }
.part.problem { border-color: #f3c2c2; }
.part-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pbadge { font-weight: 700; font-size: 14px; background: var(--primary); color: #fff; border-radius: 7px; padding: 3px 9px; }
.pwd { color: var(--muted); font-size: 14px; font-weight: 600; }
.part-date { margin-bottom: 8px; }
.times { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tbtn {
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tbtn:hover { background: var(--soft); }
.tbtn.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.tbtn.busy { background: var(--bad-bg); color: #b4232a; border-color: #f3c2c2; text-decoration: line-through; cursor: not-allowed; }
.custom-time { margin-top: 8px; max-width: 180px; }
.pstatus { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 9px; font-size: 14px; min-height: 20px; }
.pstatus .ptime { font-weight: 600; color: #374151; }
.pstatus .ok { color: var(--ok); font-weight: 600; }
.pstatus .bad { color: var(--bad); font-weight: 600; }
.formnote { font-size: 13.5px; color: var(--muted); margin-right: auto; }
.formnote.ok { color: var(--ok); font-weight: 600; }

/* Farben wählen */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px 7px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.swatch .dot { width: 18px; height: 18px; }
.swatch.on { box-shadow: 0 0 0 2px var(--primary) inset; border-color: var(--primary); }
.swatch:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Verwaltung ---------- */

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
  border: 1px solid var(--line-strong);
  background: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}
.tabs button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.ucard {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
}
.ucard .dot { width: 16px; height: 16px; }
.ucard .uinfo {
  flex: 1;
  min-width: 160px;
  border: 0;
  background: transparent;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ucard .uinfo:hover { background: var(--soft); }
.ucard .uinfo:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.ucard .uinfo strong { font-size: 16px; margin-right: 6px; }
.ucard .uinfo small { display: block; color: var(--muted); font-size: 13px; }
.ucard .ukurse { display: inline-flex; align-items: center; gap: 1px; margin-top: 3px; font-size: 13.5px; font-weight: 700; color: var(--primary); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line-strong); }
.ucard .ukurse .ic, .ucard .ukurse .ic svg { width: 16px; height: 16px; }
.ucard .uact { display: flex; gap: 6px; flex-wrap: wrap; }
.ucard.off { opacity: 0.6; }
.uhint { margin-top: 12px; }

/* Kurse eines Fahrlehrers */
.yearseg { margin-bottom: 12px; flex-wrap: wrap; }
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.stat { border-radius: 12px; padding: 12px 14px; border: 1px solid var(--line); background: var(--soft); }
.stat b { display: block; font-size: 30px; line-height: 1.1; }
.stat span { display: block; font-weight: 700; font-size: 15px; }
.stat small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat.done { background: var(--ok-bg); border-color: #bfe5cc; }
.stat.done b { color: var(--ok); }
.ustats .sec { margin-top: 16px; }
.srow.kstat .what strong { font-size: 14.5px; }
.srow.kstat .pill { flex: none; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { font-size: 14px; }

.nhlist .srow { margin-bottom: 4px; }
.nhlist .srow .when { min-width: 150px; }
.imp-summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.imp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.imp-table td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.imp-table td.st { white-space: nowrap; }
.imp-table small { display: block; color: var(--muted); }
.skipped { font-size: 13px; color: var(--muted); margin-top: 10px; }

.selftest { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--soft); font-size: 14px; }
.selftest.ok { background: var(--ok-bg); color: var(--ok); }
.selftest.bad { background: var(--bad-bg); color: var(--bad); }

/* Kursliste (PDF) */
.btn.disabled { opacity: 0.45; }
.pdf-open { margin-bottom: 4px; }
.pdfopts { display: grid; gap: 8px; margin: 4px 0 12px; }
.pp-note { margin: 0; flex: 1; min-width: 200px; }
.kz-label { font-weight: 600; font-size: 14px; margin: 0 0 6px; }
.kz-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 8px; }
.kz-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 12px; background: #fff; cursor: text; }
.kz-row .dot { width: 13px; height: 13px; }
.kz-row.off { opacity: 0.6; }
.kz-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input.kz-input { width: 64px; min-height: 38px; padding: 6px 8px; text-align: center; font-weight: 700; font-size: 16px; flex: none; }
.kz-hint { margin-bottom: 4px; }

/* Zugang pro Kalender (Hauptverwaltung) */
.kalmatrix { display: grid; gap: 8px; }
.kalrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 12px; }
.kalrow span { font-weight: 600; }
.kalrow select { width: auto; min-width: 190px; }
.uact .nomanage { margin: 0; font-size: 12.5px; max-width: 220px; }
.newkal input { flex: 1; min-width: 180px; }

/* PDF-Fenster */
.sheet.viewer { max-width: 980px; height: calc(100vh - 48px); max-height: none; }
.sheet.viewer .sheet-body { padding: 0; display: flex; flex-direction: column; overflow: hidden; background: #e5e7eb; }
.sheet.viewer .sheet-head .iconbtn:not(.back) { background: #eef0f3; border-radius: 999px; }
.pv { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pv-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.pv-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px; }
.pv-hint { color: #4b5563; }
.pp {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.06);
}
.pp-title { font-weight: 700; font-size: 18px; }
.pp-place { color: #4b5563; font-size: 13.5px; margin-top: 2px; }
.pp-sum { color: var(--muted); font-size: 12.5px; margin: 3px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.pp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pp-card { border: 1px solid #cfd4dc; border-radius: 8px; overflow: hidden; }
.pp-head { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; border-bottom: 1px solid #e5e7eb; }
.pp-head strong { font-size: 15px; }
.pp-ini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--c, #6b7280);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.pp-ini.plain { background: #fff; color: #111827; border: 1.5px solid #6b7280; }
.pp-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 6px; padding: 5px 10px; font-size: 13.5px; border-top: 1px solid #f0f1f3; }
.pp-head + .pp-row { border-top: 0; }
.pp-time { white-space: nowrap; }

/* Update */
.upd-ver { display: flex; align-items: baseline; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); margin-bottom: 14px; }
.upd-ver strong { font-size: 20px; }
input[type="file"] { width: 100%; font-size: 15px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 10px; background: #fff; }

/* Bestätigen */
.backdrop.confirm { z-index: 80; }
.confirm-box {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  animation: pop 0.15s ease-out;
}
.confirm-box p { margin: 0 0 18px; font-size: 16px; }

/* Meldung unten */
.toast {
  position: fixed;
  left: 50%;
  top: calc(14px + env(safe-area-inset-top));
  transform: translate(-50%, -20px);
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  background: #111827;
  color: #fff;
  padding: 11px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14.5px;
  max-width: calc(100% - 32px);
  box-shadow: var(--shadow);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #b91c1c; }

/* ---------- Handy ---------- */

@media (max-width: 700px) {
  .topbar { padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: 8px; }
  .brand img { width: 30px; height: 30px; }
  .brand-title { font-size: 16px; }
  .userbtn .uname { display: none; }
  .topbar .btn.small .uname { display: none; }
  .topbar .btn.small { min-height: 40px; padding: 6px 10px; }
  .userbtn { padding: 0 6px; }
  .sheet-foot { flex-wrap: wrap; }
  .sheet-foot .formnote { flex-basis: 100%; margin: 0 0 2px; }
  .nhlist .srow { flex-wrap: wrap; }
  .nhlist .srow .when { min-width: 0; }
  .wrap { padding-top: 8px; }
  .legend { font-size: 12.5px; gap: 3px 12px; margin-bottom: 6px; }
  .iconbtn { width: 38px; height: 38px; }
  .toolbar .btn.small { min-height: 38px; }
  .tools .btn.primary { min-height: 38px; padding: 7px 14px; }
  .seg button { padding: 6px 12px; }
  .toolbar { gap: 8px; }
  .nav { width: 100%; }
  .monthlabel { font-size: 18px; margin-left: 4px; flex: 1; }
  .tools { width: 100%; justify-content: space-between; }
  .tools .btn.primary .lbl-long { display: none; }
  .dow { padding: 6px 2px; text-align: center; font-size: 11px; }
  .cell { min-height: 58px; padding: 2px 2px 4px; }
  .daynum { font-size: 12.5px; min-width: 20px; height: 20px; margin: 0 auto 2px; display: flex; width: fit-content; }
  .chip { font-size: 10px; padding: 1px 3px; border-radius: 4px; text-align: center; }
  .chip .l { display: none; }
  .monthlabel.weeklabel { font-size: 16px; white-space: normal; line-height: 1.2; }
  .wk-head, .wk-body { grid-template-columns: 30px repeat(7, minmax(0, 1fr)); }
  .wk-day { flex-direction: column; gap: 0; padding: 4px 0; }
  .wk-day .wd { font-size: 10.5px; }
  .wk-day .n { min-width: 24px; height: 24px; font-size: 13px; }
  .wk-times span { right: 3px; font-size: 10.5px; }
  .wk-times i { display: none; }
  .wk-ev, .wk-free { left: 1px; right: 1px; padding: 2px 2px; font-size: 10px; border-radius: 5px; align-items: center; text-align: center; }
  .wk-ev .l { font-size: 9.5px; }
  .wk-ev.nh .l { white-space: normal; text-overflow: clip; -webkit-hyphens: manual; hyphens: manual; }
  .wk-ev .p { display: block; font-size: 9.5px; opacity: 0.9; }
  .wk-free .l { display: none; }
  .more { font-size: 10px; text-align: center; padding: 0; }
  .backdrop { padding: 0; align-items: flex-end; }
  .sheet, .sheet.wide { max-width: none; max-height: 94vh; border-radius: 16px 16px 0 0; }
  .sheet-body { padding: 14px 14px 16px; }
  .sheet-foot { padding-left: 14px; padding-right: 14px; }
  .srow .when { min-width: 96px; font-size: 13.5px; }
  .parts-list .pl { grid-template-columns: 58px 1fr; }
  .parts-list .pl .ptime { grid-column: 2; }
  .two { grid-template-columns: 1fr; }
  .pp { padding: 12px; }
  .pp-grid { grid-template-columns: 1fr; }
  .sheet.viewer { height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  .sheet.viewer .sheet-head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .sheet.viewer .sheet-head .iconbtn { width: 42px; height: 42px; }
  .pv-scroll { padding: 10px; }
  .stat b { font-size: 26px; }
  .stat { padding: 10px 12px; }
  .srow.kstat { gap: 10px; padding: 9px 10px; }
  .srow.kstat .pill { font-size: 11.5px; padding: 2px 7px; }
  .kz-list { grid-template-columns: 1fr 1fr; }
  .kalbar { flex-wrap: wrap; margin-bottom: 8px; }
  .kalbar button { flex: 1 1 auto; padding: 7px 10px; font-size: 13.5px; }
  .kalpick button { flex: 1 1 auto; }
  .kalrow { flex-wrap: wrap; }
  .kalrow select { min-width: 0; flex: 1; }
  input.kz-input { width: 52px; }
  .kz-row { padding-left: 10px; gap: 7px; }
  .confirm-box { margin: 0 16px 16px; }
  .backdrop.confirm { align-items: flex-end; }
}

@media (min-width: 701px) and (max-width: 1000px) {
  .cell { min-height: 88px; }
  .chip { font-size: 11.5px; }
}
