/* Trolley-Schichtplanung – Stylesheet (keine externen Ressourcen) */
:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --ink: #1c2533;
  --muted: #5d6879;
  --line: #dde3ec;
  --primary: #4a6da7;
  --primary-ink: #ffffff;
  --primary-soft: #e6ecf6;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn: #8a5a00;
  --warn-soft: #fff4d6;
  --info-soft: #e8f0fb;
  --empty: #eef1f0;
  --low: #cdebd9;
  --half: #fff1b8;
  --full: #f8d3cf;
  --ok: #cdebd9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 32, 56, .06), 0 2px 8px rgba(20, 32, 56, .05);
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--primary); }
h1 { font-size: 1.45rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 1rem; flex: 1; }
.narrow { max-width: 560px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; height: 62px; padding: 0 1rem; background: var(--primary); color: var(--primary-ink);
}
.brand { display: flex; align-items: center; gap: .55rem; color: inherit; text-decoration: none; font-weight: 650; }
.brand img { width: 48px; height: 48px; flex: none; }
.brand span { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { min-width: 0; }
.menu { position: relative; }
.menu summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem;
  padding: .4rem .7rem; border-radius: 8px; background: rgba(255,255,255,.14); user-select: none;
}
.menu summary::-webkit-details-marker { display: none; }
.burger, .burger::before, .burger::after { display: block; width: 18px; height: 2px; background: #fff; position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -6px; } .burger::after { top: 6px; }
.menu nav {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; max-height: 80vh; overflow: auto;
  background: var(--card); color: var(--ink); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.18);
  padding: .4rem; display: flex; flex-direction: column;
}
.menu nav a, .menu nav .linklike { padding: .55rem .75rem; border-radius: 7px; color: var(--ink); text-decoration: none; text-align: left; }
.menu nav a:hover, .menu nav .linklike:hover { background: var(--primary-soft); }
.nav-head { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .7rem .75rem .2rem; }
.logout { border-top: 1px solid var(--line); margin-top: .4rem; padding-top: .3rem; }
.footer { text-align: center; padding: 1.2rem; color: var(--muted); font-size: .85rem; }
.footer a { color: var(--muted); }

/* ---------- Elemente */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.flashes { margin-bottom: 1rem; }
.flash { padding: .7rem .9rem; border-radius: 8px; margin-bottom: .5rem; background: var(--info-soft); }
.flash-success { background: var(--primary-soft); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--info-soft); }
.btn, button, input[type=submit] {
  font: inherit; cursor: pointer; border: 1px solid var(--primary); background: var(--primary); color: var(--primary-ink);
  padding: .5rem .95rem; border-radius: 8px; text-decoration: none; display: inline-flex; align-items: center; gap: .35rem;
  line-height: 1.2; min-height: 40px;
}
.btn:hover, button:hover { filter: brightness(1.08); }
.btn-secondary { background: #fff; color: var(--primary); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-sm { padding: .25rem .6rem; min-height: 32px; font-size: .875rem; }
.linklike { background: none; border: 0; color: var(--primary); padding: 0; min-height: 0; font: inherit; cursor: pointer; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
form.inline { display: inline; }
label { display: block; font-weight: 600; font-size: .9rem; margin: .7rem 0 .25rem; }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number], input[type=date],
input[type=time], input[type=search], select, textarea {
  font: inherit; width: 100%; padding: .55rem .65rem; border: 1px solid #c6cfdc; border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(74,109,167,.35); outline-offset: 1px;
}
.help { font-size: .82rem; color: var(--muted); margin-top: .2rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { padding: .5rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; background: #fafbfb; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; }
.badge { display: inline-block; font-size: .75rem; padding: .1rem .45rem; border-radius: 99px; background: var(--empty); color: var(--muted); font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok); color: #165c3f; }
.badge-pending { background: var(--half); color: var(--warn); }
.badge-locked { background: #e3e3e3; color: #555; }
.badge-leader { background: var(--info-soft); color: #234e8c; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.pagehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .8rem; }
.pagehead h1 { margin: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1rem; }
.tabs a { padding: .35rem .7rem; border-radius: 99px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: .9rem; }
.tabs a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Login */
.auth-page { display: flex; align-items: center; justify-content: center; }
.auth-box { width: 100%; max-width: 400px; margin: 8vh auto 0; }
.auth-box .logo { display: flex; flex-direction: column; align-items: center; gap: .4rem; margin-bottom: 1rem; }
.auth-box .logo img { width: 120px; height: 120px; }
.auth-box button { width: 100%; justify-content: center; margin-top: 1rem; }

/* ---------- Kalender */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .8rem; }
.cal-nav h1 { margin: 0; text-align: center; flex: 1; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .8rem; color: var(--muted); margin: .2rem 0 .9rem; }
.legend span::before { content: ""; display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; border: 1px solid rgba(0,0,0,.08); }
.legend .l-empty::before { background: var(--empty); } .legend .l-low::before { background: var(--low); }
.legend .l-half::before { background: var(--half); } .legend .l-full::before { background: var(--full); }
.legend .l-locked::before { background: repeating-linear-gradient(45deg, #ddd, #ddd 3px, #f3f3f3 3px, #f3f3f3 6px); }
.legend .l-mine::before { background: #fff; border: 2px solid var(--primary); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { font-size: .8rem; font-weight: 700; color: var(--muted); text-align: center; padding: .2rem 0; }
.cal-day {
  background: var(--card); border-radius: 8px; min-height: 120px; padding: .35rem; display: flex; flex-direction: column; gap: 4px;
  text-decoration: none; color: inherit; border: 1px solid transparent; box-shadow: var(--shadow);
}
.cal-day:hover { border-color: var(--primary); }
.cal-day.other { opacity: .5; }
.cal-day.today { border: 2px solid var(--primary); }
.cal-day.closed-week .daynum::after { content: " ✓"; color: var(--primary); font-size: .7rem; }
.daynum { font-weight: 700; font-size: .9rem; display: flex; justify-content: space-between; }
.daynum .wd { display: none; color: var(--muted); font-weight: 500; }
.chip { display: block; border-radius: 5px; padding: 2px 5px; font-size: .72rem; line-height: 1.25; background: var(--empty); border: 2px solid transparent; overflow: hidden; }
.chip .t { font-weight: 700; }
.chip .loc { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.low { background: var(--low); } .chip.half { background: var(--half); } .chip.full { background: var(--full); }
.chip.locked { background: repeating-linear-gradient(45deg, #e4e4e4, #e4e4e4 4px, #f3f3f3 4px, #f3f3f3 8px); color: #777; }
.chip.mine-pending { border-color: #ef7d1a; } .chip.mine-confirmed { border-color: #1f8f5f; }
.chip .pct { float: right; font-weight: 700; margin-left: 3px; }
.weekbar { grid-column: 1 / -1; display: none; }

/* ---------- Tagesansicht */
.day-nav { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.day-nav h1 { margin: 0; font-size: 1.2rem; text-align: center; }
.shift { border-left: 6px solid var(--empty); }
.shift.low { border-left-color: #3fa66f; } .shift.half { border-left-color: #e5c100; }
.shift.full { border-left-color: #d9534f; } .shift.locked { border-left-color: #aaa; }
.shift-head { display: flex; justify-content: space-between; gap: .8rem; flex-wrap: wrap; align-items: baseline; }
.shift-time { font-size: 1.15rem; font-weight: 750; }
.shift-loc { font-weight: 600; }
.progress { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); margin: .4rem 0; }
progress { width: 140px; height: 10px; accent-color: var(--primary); }
.people { list-style: none; margin: .5rem 0; padding: 0; }
.people li { padding: .35rem 0; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.people li:first-child { border-top: 0; }
.people .me { font-weight: 700; }
.people .tel { color: var(--muted); font-size: .9rem; }
.slot-free { color: var(--muted); font-style: italic; }
.reason { font-size: .85rem; color: var(--muted); margin-top: .4rem; }

/* ---------- Wochenverwaltung */
.week-day { margin-bottom: 1.2rem; }
.week-day > h2 { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; border-bottom: 2px solid var(--line); padding-bottom: .3rem; }
.wshift { display: grid; grid-template-columns: 210px 1fr; gap: .8rem; padding: .7rem .9rem; }
@media (max-width: 760px) { .wshift { grid-template-columns: 1fr; } }
.wshift .people li { justify-content: space-between; }
.wshift .acts { display: flex; gap: .25rem; flex-wrap: wrap; }
.addform { display: flex; gap: .4rem; margin-top: .4rem; }
.addform select { flex: 1; min-width: 0; }

/* ---------- Vorlage */
.tpl-day h3 { display: flex; justify-content: space-between; align-items: center; }
.tpl-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .45rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- Druckpläne */
.plan-day { break-inside: avoid; margin-bottom: 1rem; }
.plan-day h2 { margin: .8rem 0 .3rem; font-size: 1rem; }
.plan-table td:first-child { width: 120px; white-space: nowrap; }
.plan-table td:nth-child(2) { width: 30%; }
.plan-text { margin: .5rem 0 1rem; }
@media print {
  body { background: #fff; font-size: 11pt; }
  .no-print, .topbar, .footer, .flashes { display: none !important; }
  .container { max-width: none; padding: 0; }
  .card, .table-wrap { box-shadow: none; }
  th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}
.danger-zone { border: 1px solid var(--danger-soft); }
.temp-pw { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.4rem; background: var(--primary-soft); padding: .6rem 1rem; border-radius: 8px; display: inline-block; letter-spacing: .05em; user-select: all; }
.faq details { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem 1rem; margin-bottom: .6rem; }
.faq summary { font-weight: 650; cursor: pointer; }
.prewrap { white-space: pre-wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem 1rem; }
.kpi .v { font-size: 1.5rem; font-weight: 750; }
.kpi .l { font-size: .8rem; color: var(--muted); }
.groups-pick { display: flex; flex-wrap: wrap; gap: .3rem .8rem; }
.groups-pick label { margin: 0; font-weight: 500; display: flex; align-items: center; gap: .3rem; }
.mt { margin-top: .6rem; }
.code-input { font-size: 1.4rem; letter-spacing: .25em; text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; }
.qr { text-align: center; }
.qr img { background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; background: var(--primary-soft); padding: .5rem .8rem; border-radius: 8px; word-break: break-all; user-select: all; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.1rem; }
.codes li { background: var(--primary-soft); padding: .45rem .7rem; border-radius: 6px; text-align: center; }
/* Eigene Eintragung: farbiges Personen-Icon */
.me-icon { display: inline-block; vertical-align: -3px; flex: none; }
.me-confirmed .bg { fill: #1f8f5f; }
.me-pending .bg { fill: #ef7d1a; }
.chip .me-icon { margin-right: 4px; vertical-align: -3px; }
.legend .l-me::before { display: none; }
.legend .l-me { display: inline-flex; align-items: center; gap: .3rem; }
.shift-time .me-icon { vertical-align: -3px; }

/* ---------- Navigation: deutliche Pfeil-Buttons und Zurück-Button */
.btn-nav {
  display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; flex: none;
  border-radius: 12px; background: var(--primary); color: #fff; box-shadow: var(--shadow); text-decoration: none;
}
.btn-nav:hover { filter: brightness(1.12); }
.btn-nav:active { transform: translateY(1px); }
.btn-back { gap: .5rem; font-weight: 650; padding: .55rem 1.1rem .55rem .8rem; min-height: 46px; }
.btn-back .arrow { flex: none; }
.backbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 0 0 1rem; }
.backbar.bottom { margin-top: 1.2rem; }
.sticky-nav { position: sticky; top: 62px; z-index: 10; background: var(--bg); padding: .5rem 0; margin-top: -.5rem; }

/* ---------- Kalender: Vergangenheit, Heute, Wochenleisten */
.cal-day.past { opacity: .55; }
.cal-day.past.other { opacity: .35; }
.cal-day { scroll-margin-top: 130px; }

@media (max-width: 760px) {
  .container { padding: .75rem; }
  .cal-nav h1 { font-size: 1.3rem; }
  .legend { gap: .25rem .8rem; font-size: .75rem; margin-bottom: .5rem; }
  .legend::-webkit-scrollbar { display: none; }
  .sticky-nav { top: 62px; }
}
@media (max-width: 760px) {
  .backbar .btn-back { flex: 1; justify-content: center; }
  .day-nav h1 { font-size: 1.1rem; }
}

/* ---------- Kalender: kompakte Monatsansicht auf dem Smartphone */
.t-short { display: none; }
.month-mine { margin-top: 1rem; }
.month-mine ul { list-style: none; margin: 0; padding: 0; }
.month-mine li a { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.month-mine li:first-child a { border-top: 0; }
.month-mine .what { display: flex; flex-wrap: wrap; column-gap: .8rem; min-width: 0; }
.month-mine .when { font-weight: 700; white-space: nowrap; }
.month-mine .where { color: var(--muted); }
.month-mine .count { margin-left: auto; }
@media (max-width: 760px) {
  .cal { gap: 4px; }
  .cal-head { font-size: .75rem; }
  .cal-day { min-height: 74px; padding: 4px 2px 5px; gap: 3px; border-radius: 8px; align-items: stretch; }
  .cal-day.other { visibility: hidden; }
  .daynum { justify-content: center; font-size: .9rem; }
  .daynum .wd { display: none; }
  .cal-day.today { border: 2px solid var(--primary); }
  .cal-day.today .daynum span:first-child { background: var(--primary); color: #fff; border-radius: 99px; padding: 0 .4rem; }
  .chips { display: flex; flex-direction: column; gap: 3px; }
  .chip { padding: 2px 0; text-align: center; font-size: .7rem; font-weight: 700; border-radius: 5px; border-width: 1px; }
  .chip .t, .chip .loc, .chip .pct, .chip .me-icon { display: none; }
  .chip .t-short { display: inline; }
  .chip.mine-confirmed { background: #1f8f5f; color: #fff; border-color: #1f8f5f; }
  .chip.mine-pending { background: #ef7d1a; color: #fff; border-color: #ef7d1a; }
  .cal-day .small.muted { display: none; }
  .month-mine .what { flex-direction: column; }
}
@media (max-width: 360px) { .chip { font-size: .62rem; } }
