/* Fahrzeug- & Lehrgangskalender – Freiwillige Feuerwehr */
:root {
  --red: #b3121b;
  --red-dark: #8a0d14;
  --red-soft: #fdecec;
  --ink: #1c1917;
  --ink-2: #44403c;
  --muted: #78716c;
  --line: #e7e5e4;
  --line-2: #d6d3d1;
  --bg: #f6f5f3;
  --card: #ffffff;
  --green: #2e7d32;
  --green-soft: #e8f5e9;
  --amber: #b26a00;
  --amber-soft: #fff4e0;
  --blue: #1d4ed8;
  --blue-soft: #e8eefc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 25, 23, .06), 0 2px 8px rgba(28, 25, 23, .04);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--red); }
a:hover { color: var(--red-dark); }
h1 { font-size: 1.6rem; margin: 0 0 .75rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }
.logo { width: 38px; height: 38px; flex: none; }

/* ---------- Kopfzeile ---------- */
.topbar { background: #1c1917; color: #fff; border-bottom: 4px solid var(--red); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: .5rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; min-width: 0; }
.brand:hover { color: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text small { color: #d6d3d1; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text strong { font-size: .98rem; white-space: nowrap; }
.mainnav { display: flex; align-items: center; gap: .15rem; flex: 1; flex-wrap: wrap; }
.mainnav a, .linkbtn {
  color: #e7e5e4; text-decoration: none; padding: .45rem .7rem; border-radius: 6px; font-size: .92rem; white-space: nowrap;
  background: none; border: 0; font: inherit; font-size: .92rem; cursor: pointer;
}
.mainnav a:hover, .linkbtn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.mainnav a.active { background: rgba(255, 255, 255, .14); color: #fff; }
.nav-spacer { flex: 1; }
.count { display: inline-block; min-width: 1.35em; padding: 0 .4em; border-radius: 99px; background: var(--red); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.5; }
.nav-user { display: flex; align-items: center; gap: .45rem; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--red); color: #fff; display: inline-grid; place-items: center; font-size: .8rem; font-weight: 700; }
.logout-form { margin: 0; }
.navtoggle { position: absolute; opacity: 0; pointer-events: none; }
.navbtn { display: none; margin-left: auto; cursor: pointer; padding: .5rem; flex-direction: column; gap: 4px; }
.navbtn span { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; }
@media (max-width: 1440px) { .nav-user-name { display: none; } }
@media (max-width: 1060px) {
  .nav-user-name { display: inline; }
  .navbtn { display: flex; }
  .mainnav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: .5rem; }
  .navtoggle:checked ~ .mainnav { display: flex; }
  .nav-spacer { display: none; }
  .mainnav a, .linkbtn { text-align: left; padding: .6rem .7rem; }
}

/* ---------- Grundlayout ---------- */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; flex: 1; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1rem; }
.card > :last-child { margin-bottom: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 1.5rem 0 .6rem; }
.section-title h2 { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; color: var(--ink);
  font: inherit; font-size: .93rem; font-weight: 500; text-decoration: none; cursor: pointer; line-height: 1.2; white-space: nowrap;
}
.btn:hover { background: #fafaf9; border-color: #a8a29e; color: var(--ink); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #1b5e20; border-color: #1b5e20; color: #fff; }
.btn-danger { color: var(--red); border-color: #f1b5b8; }
.btn-danger:hover { background: var(--red-soft); color: var(--red-dark); border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: .35rem .65rem; font-size: .85rem; }
.btn-icon { width: 38px; height: 38px; padding: 0; font-size: 1.4rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline { display: inline; margin: 0; }

/* ---------- Formulare ---------- */
.form { display: grid; gap: .9rem; }
.form label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.form .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; font-weight: 400; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(179, 18, 27, .25); border-color: var(--red); }
input[type=color] { width: 56px; height: 40px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; cursor: pointer; }
textarea { min-height: 90px; resize: vertical; }
.form .check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.form .check input { width: 18px; height: 18px; accent-color: var(--red); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; padding-top: .25rem; }
.fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .9rem; display: grid; gap: .9rem; }
.fieldset legend { font-weight: 700; font-size: .85rem; padding: 0 .35rem; color: var(--ink-2); }

/* ---------- Hinweise ---------- */
.alert { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; font-size: .93rem; }
.alert-success { background: var(--green-soft); border-color: #a5d6a7; color: #1b5e20; }
.alert-error { background: var(--red-soft); border-color: #f4b4b7; color: var(--red-dark); }
.alert-info { background: var(--blue-soft); border-color: #b9c9f5; color: #1e3a8a; }
.alert-warning { background: var(--amber-soft); border-color: #ffd28a; color: #7a4800; }
.alert ul { margin: .3rem 0 0; padding-left: 1.2rem; }

/* ---------- Status-Badges ---------- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge.st-pending { background: var(--amber-soft); color: var(--amber); border-color: #ffd28a; }
.badge.st-approved { background: var(--green-soft); color: var(--green); border-color: #a5d6a7; }
.badge.st-rejected { background: var(--red-soft); color: var(--red); border-color: #f4b4b7; }
.badge.st-cancelled { background: #f5f5f4; color: var(--muted); border-color: var(--line-2); }
.badge.role-admin { background: #1c1917; color: #fff; }
.badge.role-user { background: #f5f5f4; color: var(--ink-2); border-color: var(--line-2); }

/* ---------- Kalender ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.toolbar form { margin: 0; display: flex; gap: .5rem; align-items: center; }
.toolbar select { width: auto; min-width: 200px; }
.month-nav { display: flex; align-items: center; gap: .5rem; }
.month-nav h2 { margin: 0; min-width: 170px; text-align: center; font-size: 1.35rem; }
.month-nav h2 span { color: var(--muted); font-weight: 500; }
.cal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-head, .cal-body { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: .5rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); text-align: left; }
.cal-head .we { color: var(--red); }
.cal-day { min-height: 118px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .3rem; display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.we { background: #fcfbfa; }
.cal-day.other { background: #f7f6f4; }
.cal-day.other .num { color: #b8b2ad; }
.cal-date { display: flex; align-items: center; justify-content: space-between; }
.cal-date .num { font-size: .85rem; font-weight: 600; width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 50%; }
.cal-day.today .num { background: var(--red); color: #fff; }
.cal-add { opacity: 0; width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; text-decoration: none; font-weight: 700; color: var(--muted); }
.cal-day:hover .cal-add, .cal-add:focus { opacity: 1; }
.cal-add:hover { background: var(--red-soft); color: var(--red); }
.cal-events { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chip {
  --c: #c62828;
  display: flex; gap: .3rem; align-items: baseline; padding: 2px 6px; border-radius: 5px; font-size: .76rem; line-height: 1.3;
  text-decoration: none; color: var(--ink); background: color-mix(in srgb, var(--c) 14%, #fff);
  border-left: 3px solid var(--c); white-space: nowrap; overflow: hidden; min-width: 0;
}
.chip:hover { background: color-mix(in srgb, var(--c) 24%, #fff); color: var(--ink); }
.chip-time { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; flex: none; }
.chip-text { overflow: hidden; text-overflow: ellipsis; }
.chip.st-pending {
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 10%, #fff) 0 5px, #fff 5px 10px);
  border-left-style: dashed; color: var(--ink-2);
}
.chip.st-pending .chip-text::after { content: " ?"; color: var(--amber); font-weight: 700; }
.chip.course { background: color-mix(in srgb, var(--c) 13%, #fff); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: .75rem 0 0; font-size: .82rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend a { color: inherit; text-decoration: none; }
.legend a:hover { text-decoration: underline; }
.swatch { --c: #c62828; width: 12px; height: 12px; border-radius: 3px; background: var(--c); flex: none; display: inline-block; }
.swatch.pending { background: repeating-linear-gradient(-45deg, #b26a00 0 2px, #fff 2px 4px); border: 1px solid #b26a00; }
@media (max-width: 720px) {
  .cal-day { min-height: 64px; padding: .2rem; }
  .cal-head div { padding: .4rem .2rem; text-align: center; font-size: .68rem; }
  .cal-date { justify-content: center; }
  .cal-add { display: none; }
  .cal-events { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 3px; }
  .chip { width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%; background: var(--c); }
  .chip.st-pending { background: #fff; border: 2px solid var(--c); }
  .chip-time, .chip-text { display: none; }
  .month-nav h2 { min-width: 0; font-size: 1.15rem; }
  .toolbar select { min-width: 0; }
}

/* ---------- Listen ---------- */
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: #fafaf9; color: var(--ink); }
.li-main { flex: 1; min-width: 0; }
.li-sub { display: block; color: var(--muted); font-size: .85rem; }
.li-sep { color: var(--line-2); }
.li-actions { display: flex; gap: .35rem; flex: none; }
.empty { padding: 1.5rem 1rem; text-align: center; color: var(--muted); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .65rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #fafaf9; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
tr.dim td { color: var(--muted); }
td .btn-row { flex-wrap: nowrap; }

/* ---------- Details ---------- */
.detail { border-top: 5px solid var(--c, var(--red)); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.25rem; margin: 0 0 1rem; }
.dl dt { color: var(--muted); font-size: .88rem; }
.dl dd { margin: 0; font-weight: 500; }
@media (max-width: 520px) { .dl { grid-template-columns: 1fr; gap: .1rem; } .dl dd { margin-bottom: .5rem; } }
.note-box { background: #fafaf9; border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; white-space: pre-wrap; }

/* ---------- Fahrzeuge ---------- */
.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
.vehicle { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.vehicle-top { height: 6px; background: var(--c); }
.vehicle-body { padding: 1rem; flex: 1; }
.vehicle-body h3 { font-size: 1.15rem; margin-bottom: .15rem; display: flex; align-items: center; gap: .5rem; }
.vehicle-meta { color: var(--muted); font-size: .88rem; margin-bottom: .5rem; }
.vehicle-foot { padding: .75rem 1rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; flex-wrap: wrap; background: #fcfbfa; }
.vehicle.inactive { opacity: .6; }

/* ---------- Anfragen ---------- */
.request { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: .8rem; display: grid; grid-template-columns: 1fr minmax(260px, 340px); gap: 1rem; }
@media (max-width: 820px) { .request { grid-template-columns: 1fr; } }
.request h3 { margin-bottom: .2rem; font-size: 1.05rem; }
.request form { display: grid; gap: .5rem; align-content: start; margin: 0; }

/* ---------- Codes ---------- */
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; font-size: 1rem; letter-spacing: .06em; background: #f5f5f4; padding: .15rem .45rem; border-radius: 5px; white-space: nowrap; }
tr.highlight td { background: #fffbea; }

/* ---------- Kennzahlen ---------- */
.stats { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; box-shadow: var(--shadow); min-width: 150px; }
.stat strong { display: block; font-size: 1.4rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .82rem; }
.people { display: flex; flex-wrap: wrap; gap: .4rem; }
.person-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .65rem .25rem .3rem; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-size: .85rem; }
.person-pill .dot { width: 20px; height: 20px; border-radius: 50%; background: var(--c); color: #fff; display: inline-grid; place-items: center; font-size: .7rem; font-weight: 700; }

/* ---------- Anmeldung ---------- */
body.bare { background: radial-gradient(1200px 500px at 50% -100px, #3a1214 0%, #1c1917 60%) fixed; }
main.auth { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; }
main.auth > .alert { width: 100%; max-width: 420px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 14px; padding: 1.75rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); border-top: 5px solid var(--red); }
.auth-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.25rem; line-height: 1.2; }
.auth-brand .logo { width: 46px; height: 46px; }
.auth-brand small { display: block; color: var(--muted); font-size: .8rem; }
.auth-brand strong { font-size: 1rem; }
.auth-foot { margin: 1rem 0 0; text-align: center; font-size: .9rem; }
.auth-foot.small { margin-top: .4rem; }
