:root {
  --bg: #06070d;
  --grid: rgba(120, 140, 255, 0.06);
  --surface: rgba(20, 23, 42, 0.86);
  --surface-2: #171b33;
  --text: #eef1ff;
  --text-soft: #a9b0d6;
  --muted: #7d84a8;
  --border: rgba(140, 150, 255, 0.16);
  --g: linear-gradient(135deg, #a3e635 0%, #4d7c0f 60%, #14532d 120%);
  --accent: #a3e635;
  --projekt: #bef264;
  --ok: #22e07a;
  --warn: #ffb020;
  --off: #ff5c7c;
}
* { box-sizing: border-box; margin: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(132, 204, 22, 0.13), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 16px 28px;
}
header.top, nav.tabs, main, footer { width: 100%; max-width: 760px; }

header.top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.home {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  text-decoration: none; font-size: 18px;
}
.title { display: flex; align-items: baseline; gap: 10px; flex: 1; }
h1 {
  font-size: 26px; font-weight: 800;
  background: linear-gradient(90deg, #fff, #d9f99d 60%, #a3e635);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.proto {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--warn);
  border: 1px solid rgba(255, 176, 32, .4); border-radius: 999px; padding: 2px 8px;
}
.selects { display: flex; gap: 8px; }

select, input, button { font: inherit; color: inherit; }
select, input[type="text"], input[type="number"], input[type="date"], input[type="time"] {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; width: 100%; min-width: 0; color-scheme: dark;
}
select { width: auto; max-width: 180px; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

nav.tabs { display: flex; gap: 6px; margin: 18px 0 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 4px; }
nav.tabs button { flex: 1; background: none; border: 0; border-radius: 10px; padding: 10px 6px; color: var(--text-soft); cursor: pointer; font-weight: 600; }
nav.tabs button.on { background: var(--g); color: #fff; }

button { cursor: pointer; }
.primary, .ghost, .danger {
  border-radius: 14px; padding: 12px 18px; font-weight: 700; border: 1px solid transparent;
}
.primary { background: var(--g); color: #fff; }
.ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.danger { background: none; border-color: rgba(255, 92, 124, .5); color: var(--off); }
.big { width: 100%; padding: 18px; font-size: 18px; }
.buttons { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; margin-bottom: 18px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 16px; margin-bottom: 10px; backdrop-filter: blur(10px);
}
.card h3 { font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--text-soft); padding: 28px 16px; line-height: 1.5; }

/* Laufende Fahrt */
.running { border-color: rgba(34, 224, 122, .5); }
.running .pulse { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); margin-right: 8px; }
.running .primary { margin-top: 12px; }

/* Fahrtenliste */
.trip { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; width: 100%; text-align: left; cursor: pointer; }
.trip .route { font-weight: 700; overflow-wrap: anywhere; }
.trip .km { font-weight: 800; font-size: 18px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.trip .sub { grid-column: 1 / -1; color: var(--text-soft); font-size: 14px; overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; margin-right: 6px; border: 1px solid currentColor; }
.badge.storno { color: var(--off); }
.gap {
  border: 1px dashed rgba(255, 176, 32, .6); color: var(--warn); border-radius: 12px;
  padding: 8px 12px; margin-bottom: 10px; font-size: 14px;
}

/* Auswertung */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--text-soft); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 4px; text-align: right; border-bottom: 1px solid var(--border); font-size: 13px; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; }
.links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.links a { text-decoration: none; display: inline-block; }

/* Formulare */
form.inline { display: grid; gap: 10px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--text-soft); min-width: 0; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
fieldset { border: 0; padding: 0; min-width: 0; }
legend { font-size: 13px; color: var(--text-soft); margin-bottom: 6px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg label { display: block; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; text-align: center; padding: 11px 4px; border-radius: 12px; font-weight: 700; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft); cursor: pointer;
}
.seg input:checked + span { background: var(--g); color: #fff; border-color: transparent; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.strecke { font-weight: 700; color: var(--ok); }
.error { color: var(--off); font-weight: 600; }
.strecke:empty, .error:empty, .hint:empty { display: none; }
.hint { color: var(--text-soft); font-size: 14px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
[hidden] { display: none !important; }

dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); margin: auto;
  background: #0e1122; color: var(--text); border: 1px solid var(--border); border-radius: 22px; padding: 20px;
}
dialog::backdrop { background: rgba(3, 4, 10, .72); backdrop-filter: blur(3px); }
dialog form { display: grid; gap: 12px; }
dialog h2 { font-size: 20px; }
#tripExtra { border-top: 1px solid var(--border); padding-top: 12px; display: grid; gap: 10px; }
#tripExtra:empty { display: none; }
#tripExtra ul { list-style: none; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--text-soft); }

footer { margin-top: auto; padding-top: 28px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---- Stundentool ---- */
.selects { margin-left: auto; }
.badge.projekt { color: var(--projekt); }
.badge.ohne { color: var(--muted); }
.plus { color: var(--ok); }
.minus { color: var(--off); }
.kennzahlen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.kennzahlen .card { margin: 0; padding: 12px 14px; }
.stat b { white-space: nowrap; }
.stat b span { font-size: inherit; }
.stat b .plus { color: var(--ok); }
.stat b .minus { color: var(--off); }
.day { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 4px 8px; color: var(--text-soft); font-size: 14px; font-weight: 600; }
.day b { color: var(--text); font-variant-numeric: tabular-nums; }
h3 + .muted, h3 + form, h3 + .scroll { margin-top: 8px; }
details.card summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.card summary::-webkit-details-marker { display: none; }
details.card form { margin-top: 12px; }

@media (max-width: 560px) {
}

/* ---- Spesen ---- */
.kennzahlen { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); }
.kennzahlen .stat b { font-size: 17px; }
.nummer { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; margin-right: 6px; }
.badge.offen { color: var(--warn); }
.badge.eingereicht { color: #7dd3fc; }
.badge.erstattet { color: var(--ok); }
.zurueck { background: none; border: 0; color: var(--text-soft); font-weight: 600; padding: 4px 0; margin-bottom: 10px; }
.kopf h2 { font-size: 20px; margin: 6px 0; overflow-wrap: anywhere; }
.section { display: flex; justify-content: space-between; align-items: center; margin: 18px 4px 8px; }
.section h3 { font-size: 15px; color: var(--text-soft); }
.section button { padding: 6px 12px; border-radius: 10px; font-size: 14px; }
.mahl { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; font-size: 13px; color: var(--text-soft); }
.mahl input { width: 18px; height: 18px; accent-color: var(--accent); }
td.mahlzeiten { text-align: left; white-space: nowrap; }
.gesamt { display: flex; justify-content: space-between; align-items: baseline; font-size: 20px; font-weight: 800; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.zeile { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; color: var(--text-soft); }
.zeile b { color: var(--text); font-variant-numeric: tabular-nums; }
@media print {
  .noprint, dialog, .zurueck, .section button { display: none !important; }
  .trip { border: 0; border-bottom: 1px solid #999; border-radius: 0; margin: 0; padding: 6px 0; color: #000; }
  .trip .sub, .section h3, .zeile, .zeile b, .badge { color: #000; }
  .mahl input { accent-color: #000; }
}

/* Benutzerkonto der Firmen-Apps: wer angemeldet ist */
.wer { font-size: 12px; font-weight: 600; color: var(--text-soft); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.wer:empty { display: none; }

/* Kopfzeile: Kennzeichnungen brechen unter den Titel um, statt den Pfeil in eine eigene Zeile zu schieben */
.title { flex-wrap: wrap; row-gap: 4px; min-width: 0; }

/* Bewirtungsbelege */
textarea {
  font: inherit; color: inherit; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; width: 100%; min-width: 0; resize: vertical; color-scheme: dark;
}
textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.block { display: grid; gap: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.haken { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text); }
.haken input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.badge.fehlt { color: var(--off); }
.klein { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.unter { margin: -4px 4px 10px; text-align: right; }
.beleg h2 { font-size: 20px; margin-bottom: 10px; }
.beleg .zeile b { text-align: right; overflow-wrap: anywhere; }
.unterschrift { display: flex; gap: 24px; margin-top: 44px; }
.unterschrift span { flex: 1; border-top: 1px solid var(--text-soft); padding-top: 6px; font-size: 12px; color: var(--text-soft); }
.gap.rot { border-color: rgba(255, 92, 124, .7); color: var(--off); }
@media print {
  .unterschrift span { border-color: #000; color: #000; }
  .beleg { border: 0; }
}
