:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --primary: #1d4ed8;
  --primary-soft: #dbeafe;
  --primary-text: #ffffff;
  --sidebar: #0f1d45;
  --sidebar-text: #c7d2fe;
  --success: #15803d;
  --success-soft: #dcfce7;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --neutral-soft: #e2e8f0;
  --car-body: #e2e8f0;
  --car-part: #f8fafc;
  --car-stroke: #94a3b8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .25);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #131c2e;
    --surface-2: #182237;
    --border: #26324a;
    --text: #e2e8f0;
    --text-2: #cbd5e1;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --primary-soft: #1e3a8a;
    --sidebar: #070d1c;
    --success: #4ade80;
    --success-soft: #14532d;
    --warning: #fbbf24;
    --warning-soft: #4a3510;
    --danger: #f87171;
    --danger-soft: #4c1414;
    --info: #93c5fd;
    --info-soft: #1e3a8a;
    --neutral-soft: #26324a;
    --car-body: #26324a;
    --car-part: #334155;
    --car-stroke: #64748b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: .95rem; margin: 1.2rem 0 .5rem; color: var(--text-2); }
p { margin: .4rem 0; }
small { font-size: .82em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pre { white-space: pre-wrap; }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.icon { width: 1.1em; height: 1.1em; vertical-align: -.18em; flex-shrink: 0; }
.print-only { display: none; }

/* ---- Layout ---------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.1rem .8rem; font-weight: 700; color: #fff; font-size: 1.05rem; }
.brand img { width: 32px; height: 32px; }
.brand-lg { color: var(--text); font-size: 1.4rem; justify-content: center; padding: 0 0 .5rem; }
.brand-lg img { width: 44px; height: 44px; }
.nav { display: flex; flex-direction: column; padding: .4rem .6rem; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 8px;
  color: var(--sidebar-text); font-weight: 500;
}
.nav a:hover { background: rgba(255, 255, 255, .07); text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, .14); color: #fff; }
.nav-badge { margin-left: auto; background: #f59e0b; color: #1f1300; border-radius: 99px; font-size: .72rem; padding: 0 .45rem; line-height: 1.4rem; min-width: 1.4rem; text-align: center; }
.sidebar-user { display: flex; align-items: center; gap: .4rem; padding: .8rem; border-top: 1px solid rgba(255, 255, 255, .1); }
.user-link { display: flex; align-items: center; gap: .6rem; flex: 1; color: #fff; min-width: 0; padding: .3rem; border-radius: 8px; }
.user-link:hover, .user-link.active { background: rgba(255, 255, 255, .08); text-decoration: none; }
.user-link span { display: flex; flex-direction: column; min-width: 0; }
.user-link strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.user-link small { color: var(--sidebar-text); }
.sidebar .btn-icon { color: var(--sidebar-text); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.view { padding: 1.5rem 2rem 3rem; max-width: 1400px; width: 100%; transition: opacity .15s; }
.view.loading { opacity: .5; pointer-events: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  .nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 20; }
  .topbar {
    display: flex; align-items: center; gap: .6rem; position: sticky; top: 0; z-index: 10;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: .5rem .8rem;
  }
  .topbar-title { font-weight: 600; flex: 1; }
  .view { padding: 1rem 1rem 3rem; }
  .page-header h1 { font-size: 1.25rem; }
}

/* ---- Bausteine --------------------------------------------------------------- */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.section { margin-top: 1.5rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.card-list { display: flex; flex-direction: column; gap: .6rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.clickable { cursor: pointer; }
.clickable:hover { border-color: var(--primary); }
.back-link { display: inline-flex; align-items: center; gap: .2rem; margin-bottom: .6rem; font-size: .9rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state h2 { color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 500;
  padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap; text-decoration: none; min-height: 38px;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.1); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-success { color: var(--success); border-color: var(--success); }
.btn-success:hover { background: var(--success-soft); }
.btn-sm { padding: .3rem .65rem; font-size: .85rem; min-height: 32px; }
.btn-block { width: 100%; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 8px;
  border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1.1rem;
}
.btn-icon:hover { background: rgba(127, 127, 127, .14); text-decoration: none; }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 60%, transparent); outline-offset: 2px; }

.badge { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px; white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--neutral-soft); color: var(--text-2); }
.badges { display: flex; flex-wrap: wrap; gap: .3rem; }

.notice { border-radius: var(--radius); padding: .7rem .9rem; margin: .8rem 0; background: var(--surface-2); border: 1px solid var(--border); display: flex; gap: .5rem; align-items: flex-start; }
.notice.info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.notice.warning { background: var(--warning-soft); border-color: transparent; color: var(--warning); }

.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 600; object-fit: cover; flex-shrink: 0; background: var(--neutral-soft); }
.avatar-xs { width: 24px; height: 24px; font-size: .6rem; }
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }
.avatar-md { width: 40px; height: 40px; font-size: .9rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar-xl { width: 120px; height: 120px; font-size: 2.4rem; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -6px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.inline-person { display: inline-flex; align-items: center; gap: .4rem; }

.vehicle-tag { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; }
.vehicle-tag small { font-weight: 400; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.plate { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 600; border: 1.5px solid var(--text); border-radius: 4px; padding: 0 .35rem; font-size: .8rem; background: var(--surface); white-space: nowrap; }

.segmented-links { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.segmented-links a { padding: .4rem .8rem; color: var(--text-2); display: inline-flex; gap: .3rem; align-items: center; font-size: .9rem; }
.segmented-links a + a { border-left: 1px solid var(--border); }
.segmented-links a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.segmented-links a:hover { text-decoration: none; }
@media (prefers-color-scheme: dark) { .segmented-links a.active { color: #fff; } }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin: 1rem 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; }
.stat small { color: var(--muted); display: block; }
.stat strong { font-size: 1.35rem; }

/* ---- Formulare ---------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: .85rem; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; font-size: .9rem; }
.form label.check { flex-direction: row; align-items: flex-start; gap: .5rem; font-weight: 400; }
.form label.check input { margin-top: .15rem; width: 18px; height: 18px; min-height: 0; flex-shrink: 0; }
.consent { background: var(--surface-2); border: 1px solid var(--border); padding: .7rem; border-radius: 8px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .5rem .65rem; min-height: 40px; width: 100%;
}
input[type=color] { padding: .2rem; height: 40px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 500; font-size: .9rem; margin-bottom: .4rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; }
@media (max-width: 600px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-top: .4rem; }
.form-actions.wrap { justify-content: flex-start; border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1rem; }
.form-error { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: .6rem .8rem; font-weight: 500; }
.form-error ul, .conflict-list { margin: .4rem 0 0; padding-left: 1.2rem; font-weight: 400; }
.search { max-width: 320px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: .5rem; }
.filter-bar label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); }
.filter-bar select, .filter-bar input { width: auto; }

.people-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .4rem; max-height: 240px; overflow-y: auto; padding: 2px; }
.form .person-check { flex-direction: row; align-items: center; gap: .5rem; border: 1px solid var(--border); border-radius: 8px; padding: .4rem .55rem; font-weight: 400; cursor: pointer; }
.person-check input { width: 18px; height: 18px; min-height: 0; flex-shrink: 0; }
.person-check span { display: flex; flex-direction: column; line-height: 1.2; }
.person-check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.person-check.busy .busy-hint { color: var(--warning); }
.person-check.is-driver { opacity: .45; pointer-events: none; }
option.busy { color: #b45309; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.form .segmented label { flex-direction: row; border: 1px solid var(--border); border-radius: 8px; padding: .5rem; cursor: pointer; gap: .4rem; }
.segmented input { width: 16px; min-height: 0; margin: .15rem 0 0; }
.segmented span { display: flex; flex-direction: column; }
.segmented small { color: var(--muted); font-weight: 400; }
.segmented label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
@media (max-width: 600px) { .segmented { grid-template-columns: 1fr; } }

.file-input { flex-direction: row !important; align-items: center; border: 1px dashed var(--border); border-radius: 8px; padding: .7rem; cursor: pointer; }
.file-input input { display: none; }
.photo-preview { max-width: 100%; max-height: 200px; border-radius: 8px; object-fit: cover; }
.context-box { display: flex; gap: .7rem; align-items: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .7rem; }
.context-box > div { flex: 1; }
.km-result { font-weight: 600; color: var(--success); min-height: 1.4em; }

/* ---- Modal & Toast ----------------------------------------------------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; z-index: 100; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; animation: pop .15s ease-out; }
.modal-wide { max-width: 860px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem .4rem; }
.modal-header h2 { margin: 0; font-size: 1.15rem; }
.modal-body { padding: .6rem 1.2rem 1.2rem; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
@media (max-width: 600px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 14px 14px 0 0; max-height: 94vh; overflow-y: auto; }
}
#toast-root { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; z-index: 200; width: max-content; max-width: 92vw; }
.toast { background: #0f172a; color: #fff; padding: .7rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow-lg); transition: opacity .4s, transform .4s; border-left: 4px solid #22c55e; }
.toast-error { border-left-color: #ef4444; }
.toast-info { border-left-color: #3b82f6; }
.toast.hide { opacity: 0; transform: translateY(10px); }

/* ---- Login --------------------------------------------------------------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: linear-gradient(160deg, #0f1d45, #1d4ed8); }
.login-card { background: var(--surface); padding: 2rem; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 380px; text-align: center; }
.login-card label { text-align: left; }

/* ---- Fahrplan ------------------------------------------------------------- */
.week-nav { display: flex; align-items: center; gap: .3rem; }
.week-label { display: flex; flex-direction: column; min-width: 150px; text-align: center; line-height: 1.2; }
.week-label strong { font-size: 1.15rem; }
.week-label small { color: var(--muted); }
.week-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.week-grid { border-collapse: collapse; width: 100%; min-width: 980px; table-layout: fixed; }
.week-grid th, .week-grid td { border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); vertical-align: top; padding: .4rem; }
.week-grid thead th { font-size: .82rem; font-weight: 600; color: var(--text-2); background: var(--surface-2); text-align: left; position: sticky; top: 0; }
.week-grid thead th.today { color: var(--primary); }
.week-grid .vehicle-col { width: 150px; border-left: 0; text-align: left; font-weight: 400; background: var(--surface); position: sticky; left: 0; z-index: 1; }
.week-grid .vehicle-col a { color: var(--text); display: block; }
.week-grid .vehicle-col small { display: flex; align-items: center; gap: .2rem; margin-top: .2rem; }
.week-grid tr:last-child td, .week-grid tr:last-child th { border-bottom: 0; }
.week-grid td { height: 92px; position: relative; }
.week-grid td.today { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.week-grid td.weekend { background: var(--surface-2); }
.week-grid td.can-add { cursor: copy; }
.add-hint { position: absolute; right: 4px; bottom: 2px; color: var(--muted); opacity: 0; transition: opacity .15s; }
.week-grid td.can-add:hover .add-hint { opacity: 1; }

.trip-chip {
  display: flex; flex-direction: column; align-items: stretch; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: color-mix(in srgb, var(--vc) 13%, var(--surface)); border: 0; border-left: 4px solid var(--vc);
  border-radius: 6px; padding: .3rem .4rem; margin-bottom: .3rem; cursor: pointer; font-size: .8rem; line-height: 1.25;
}
.trip-chip:hover { background: color-mix(in srgb, var(--vc) 22%, var(--surface)); }
.chip-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.chip-dest { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-meta { display: flex; align-items: center; justify-content: space-between; margin-top: .2rem; gap: .2rem; }
.chip-meta em { font-style: normal; font-size: .7rem; color: var(--muted); }
.status-entwurf.trip-chip, .status-entwurf.agenda-item { border-left-style: dashed; opacity: .8; background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(127, 127, 127, .09) 6px 12px); }
.status-storniert.trip-chip, .status-storniert.agenda-item { opacity: .5; }
.status-storniert .chip-dest, .status-storniert .agenda-main strong { text-decoration: line-through; }
.workshop-chip {
  display: flex; gap: .3rem; align-items: flex-start; font-size: .78rem; line-height: 1.2; padding: .3rem .4rem; border-radius: 6px; margin-bottom: .3rem;
  background: repeating-linear-gradient(135deg, var(--warning-soft) 0 8px, color-mix(in srgb, var(--warning-soft) 60%, var(--surface)) 8px 16px);
  color: var(--warning); font-weight: 600; cursor: default;
}
.workshop-chip small { font-weight: 400; }

.agenda { display: flex; flex-direction: column; gap: 1rem; }
.agenda-day h3 { margin: 0 0 .4rem; display: flex; gap: .4rem; align-items: center; color: var(--text); }
.agenda-day.today h3 { color: var(--primary); }
.agenda-item {
  display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--vc, var(--warning)); border-radius: 8px;
  padding: .6rem .8rem; margin-bottom: .4rem; cursor: pointer; box-shadow: var(--shadow);
}
.agenda-item.workshop { cursor: default; background: var(--warning-soft); color: var(--warning); border-color: transparent; border-left-color: var(--warning); }
.agenda-item.workshop div { display: flex; flex-direction: column; }
.agenda-time { font-weight: 600; font-variant-numeric: tabular-nums; width: 3.2rem; text-align: center; line-height: 1.2; }
.agenda-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.agenda-main small { color: var(--muted); }
.agenda-side { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }

/* ---- Fahrt-Details ------------------------------------------------------- */
.trip-detail.cancelled .detail-list { opacity: .6; }
.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; margin: 1rem 0 0; }
.detail-list dt { color: var(--muted); display: flex; align-items: center; gap: .35rem; }
.detail-list dd { margin: 0; }
.person-row { display: flex; align-items: center; gap: .7rem; padding: .35rem 0; }
.person-row > div { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.person-row small { color: var(--muted); }
.contact-links { display: flex; gap: .3rem; }
.contact-links a { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.contact-links a:hover { text-decoration: none; filter: brightness(.95); }
@media (prefers-color-scheme: dark) { .contact-links a { color: #fff; } }

/* ---- Karten-Listen ----------------------------------------------------------- */
.trip-card { display: flex; align-items: center; gap: 1rem; border-left: 4px solid var(--vc); cursor: pointer; }
.trip-card-main { flex: 1; display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.trip-card-main small { color: var(--muted); }
.trip-card-side { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.trip-card.status-storniert { opacity: .6; }
.trip-card.status-storniert strong { text-decoration: line-through; }

.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.vehicle-card { display: flex; flex-direction: column; gap: .5rem; color: var(--text); border-top: 4px solid var(--vc); }
.vehicle-card:hover { text-decoration: none; border-color: var(--primary); border-top-color: var(--vc); }
.vehicle-card.inactive { opacity: .55; }
.vehicle-card-head { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; }
.vehicle-card-head div { display: flex; flex-direction: column; }
.vehicle-card-head small { color: var(--muted); }
.vehicle-stats { display: flex; gap: 1rem; color: var(--text-2); font-size: .9rem; }
.status-line { min-height: 1.2em; }
.vehicle-title { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; border-left: 5px solid var(--vc); padding-left: .7rem; }
.vehicle-detail { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 800px) { .vehicle-detail { grid-template-columns: 1fr; } }

.damage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .8rem; margin-top: 1rem; }
.damage-card { display: flex; flex-direction: column; gap: .35rem; border-left: 4px solid var(--warning); }
.damage-card.sev-gering { border-left-color: #94a3b8; }
.damage-card.sev-hoch { border-left-color: var(--danger); }
.damage-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.damage-head strong { margin-right: auto; }
.damage-photo { max-width: 100%; max-height: 180px; border-radius: 8px; object-fit: cover; }

.visit-card { display: flex; gap: 1rem; align-items: center; }
.visit-main { flex: 1; display: flex; flex-direction: column; gap: .15rem; }
.visit-main small { color: var(--text-2); }
.visit-side { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }

.request-card.status-offen { border-left: 4px solid var(--warning); }
.request-head { display: flex; align-items: center; gap: .6rem; }
.request-head div { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.trip-ref { display: inline-flex; align-items: center; gap: .3rem; margin-top: .5rem; font: inherit; font-size: .85rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .25rem .5rem; color: var(--text-2); cursor: pointer; }
.response { margin-top: .6rem; padding: .5rem .8rem; background: var(--surface-2); border-radius: 8px; border-left: 3px solid var(--primary); }
.response small { color: var(--muted); }

.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; margin-top: 1rem; }
.person-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .3rem; }
.contact-list { display: flex; flex-direction: column; gap: .3rem; margin-top: .4rem; width: 100%; }
.contact-list a { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .4rem; border-radius: 8px; background: var(--surface-2); word-break: break-all; font-size: .9rem; }

.profile-grid { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; align-items: start; }
.profile-grid > section:nth-child(3) { grid-column: 2; }
.profile-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem; grid-row: span 2; }
.profile-card h2 { margin: .4rem 0 0; }
@media (max-width: 800px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-grid > section:nth-child(3) { grid-column: auto; }
}

/* ---- Tabellen & Diagramm ----------------------------------------------------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.table th, .table td { padding: .55rem .75rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.table th { background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: .82rem; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.inactive { opacity: .55; }

.bar-chart { display: flex; flex-direction: column; gap: .5rem; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 90px; align-items: center; gap: .6rem; font-size: .88rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.bar-track { height: 18px; }
.bar { display: block; height: 100%; min-width: 2px; background: var(--primary); border-radius: 0 4px 4px 0; transition: filter .15s; }
.bar-row:hover .bar { filter: brightness(1.15); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

/* ---- Fahrzeug-Grafik ------------------------------------------------------- */
.car-diagram { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.car-svg { width: 100%; max-width: 260px; height: auto; user-select: none; }
.car-diagram.compact .car-svg { max-width: 160px; }
.car-label { font-size: 11px; font-weight: 700; fill: var(--muted); text-anchor: middle; letter-spacing: .08em; }
.car-label.side { writing-mode: vertical-rl; dominant-baseline: middle; }
.car-body { fill: var(--car-body); stroke: var(--car-stroke); stroke-width: 1.5; }
.car-plate { fill: var(--surface); stroke: var(--car-stroke); }
.car-part { fill: var(--car-part); stroke: var(--car-stroke); stroke-width: 1.2; transition: fill .12s; }
.car-part.glass { fill: color-mix(in srgb, #7dd3fc 40%, var(--car-part)); }
.car-part.light { fill: color-mix(in srgb, #fde68a 60%, var(--car-part)); }
.car-part.wheel { fill: #334155; }
.car-part.dmg-gering { fill: #cbd5e1; stroke: #64748b; stroke-width: 2; }
.car-part.dmg-mittel { fill: #fbbf24; stroke: #b45309; stroke-width: 2; }
.car-part.dmg-hoch { fill: #ef4444; stroke: #991b1b; stroke-width: 2; }
.car-svg.interactive .car-part { cursor: pointer; }
.car-svg.interactive .car-part:hover { fill: color-mix(in srgb, var(--primary) 35%, var(--car-part)); }
.car-svg .car-part.selected, .car-svg.interactive .car-part.selected:hover { fill: var(--primary); stroke: var(--primary); stroke-width: 2.5; }
.car-svg .car-part:focus-visible { outline: none; stroke: var(--primary); stroke-width: 3; }
.car-extras { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; }
.chip-btn { font: inherit; font-size: .82rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: .3rem .7rem; cursor: pointer; }
.chip-btn:disabled { cursor: default; }
.chip-btn.dmg-mittel { border-color: #b45309; background: var(--warning-soft); }
.chip-btn.dmg-hoch { border-color: #991b1b; background: var(--danger-soft); }
.chip-btn.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.car-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; font-size: .78rem; color: var(--muted); }
.car-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.lg { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg.dmg-gering { background: #cbd5e1; }
.lg.dmg-mittel { background: #fbbf24; }
.lg.dmg-hoch { background: #ef4444; }
.damage-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1.2rem; align-items: start; }
.damage-fields { display: flex; flex-direction: column; gap: .85rem; }
.hint { margin: 0 0 .4rem; font-size: .88rem; color: var(--muted); text-align: center; }
.selected-part { padding: .6rem .8rem; border-radius: 8px; background: var(--surface-2); border: 1px dashed var(--border); color: var(--muted); }
.selected-part.active { border-style: solid; border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
@media (max-width: 700px) { .damage-layout { grid-template-columns: 1fr; } }

/* ---- Druck (Berichte) ------------------------------------------------------ */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f5f5f5; --border: #ccc; --text: #000; --muted: #444; }
  .sidebar, .topbar, .no-print, #toast-root { display: none !important; }
  .print-only { display: block; }
  .view { padding: 0; max-width: none; }
  .card, .stat, .table-wrap { box-shadow: none; break-inside: avoid; }
  .bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- Erweiterungen: Reiseart, Anhänger, Personenansicht, Kosten ---------------- */
.text-success { color: var(--success); }
.dot-mode { background: var(--muted); border-radius: 2px; }
.trailer-tag { color: var(--muted); }
.check-top { align-self: end; padding-bottom: .55rem; }
.form-warning { background: var(--warning-soft); color: var(--warning); border-radius: 8px; padding: .5rem .75rem; margin: 0; font-weight: 500; }
.chip-sub { display: flex; align-items: center; gap: .2rem; font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-chip.compact { padding: .2rem .35rem; margin-bottom: .2rem; }
.trip-chip.compact .chip-dest { font-size: .78rem; }
.week-grid.person-grid td { height: 52px; }
.week-grid.person-grid .vehicle-col { width: 170px; }
.trailer-row .vehicle-col { background: var(--surface-2); }
.mode-row .vehicle-col { background: var(--surface-2); }
.check-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.form .check-pill { flex-direction: row; align-items: center; gap: 0; font-weight: 500; }
.check-pill input { position: absolute; opacity: 0; pointer-events: none; }
.check-pill span { display: inline-block; border: 1px solid var(--border); border-radius: 99px; padding: .25rem .8rem; cursor: pointer; background: var(--surface); }
.check-pill input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.check-pill input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 60%, transparent); outline-offset: 2px; }
.login-fieldset, .cost-fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; background: var(--surface-2); }
.login-fieldset legend, .cost-fieldset legend { padding: 0 .4rem; }
.revenue-input { width: 110px; text-align: right; min-height: 34px; padding: .25rem .5rem; }
.table tfoot th { background: var(--surface-2); border-top: 2px solid var(--border); }
.table tfoot .num { text-align: right; }
.agenda-time { white-space: pre-line; }
.car-diagram.trailer .car-extras { flex-direction: column; align-items: stretch; width: 100%; max-width: 280px; }
.car-diagram.trailer .chip-btn { border-radius: 8px; padding: .55rem .8rem; text-align: left; }
.stat strong { overflow-wrap: anywhere; }

/* ---- Zugangslinks --------------------------------------------------------------- */
.login-hint { background: var(--info-soft); color: var(--text); border-radius: var(--radius); padding: .8rem; text-align: left; font-size: .92rem; }
.login-sep { margin: .4rem 0 0; text-align: left; }
.access-options { display: flex; flex-direction: column; gap: .4rem; }
.form .access-option { flex-direction: row; align-items: flex-start; gap: .6rem; font-weight: 400; border: 1px solid var(--border); border-radius: 8px; padding: .55rem .7rem; background: var(--surface); cursor: pointer; }
.access-option input { width: 18px; min-height: 0; margin-top: .2rem; flex-shrink: 0; }
.access-option span { display: flex; flex-direction: column; }
.access-option small { color: var(--muted); }
.access-option em { color: var(--muted); font-style: normal; font-weight: 400; }
.access-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.access-detail { margin-top: .7rem; }
.link-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .4rem 0; }
.link-row input { flex: 1; min-width: 220px; font-size: .82rem; font-family: ui-monospace, Menlo, Consolas, monospace; }
.bulk-row { padding: .5rem 0; border-bottom: 1px solid var(--border); }
@media print {
  .modal-overlay { position: static; background: none; padding: 0; display: block; }
  .modal { box-shadow: none; max-width: none; }
  .modal-header button, #modal-root .form-actions, #modal-root .btn { display: none !important; }
  body.modal-open .shell { display: none; }
  .link-row input { border: 0; padding: 0; width: 100%; }
}

/* ---- Datenschutz & Sicherung -------------------------------------------------------- */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem; }
@media (max-width: 800px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
.prose { max-width: 820px; }
.prose h2 { margin-top: 1.4rem; }
.prose h2:first-child { margin-top: 0; }
.prose li { margin: .25rem 0; }
.notice ul { margin: .3rem 0 .6rem 1.1rem; padding: 0; }
