:root {
    --wolfi_orange: #e3593c;
    --wolfi_blue: #1b2a33;
    --wolfi_gray: #828282;
    --wolfi_red: #872825;
    --wolfi_page_bg: #121c22;
    --wolfi_layout_bg: #0f232e;
    --wolfi_card_bg: #273945;
    --wolfi_input_bg: #142028;
    --wolfi_border: #3b505c;
    --wolfi_overlay: rgb(0 0 0 / 60%);
    --wolfi_text: #ffffff;
    --wolfi_text_muted: #a0acb5;
    --wolfi_action: var(--wolfi_orange);
    --wolfi_action_hover: #f07158;
    --wolfi_link: #9fd6ff;
    --wolfi_focus: #9fd6ff;
    --wolfi_info: #9fd6ff;
    --wolfi_info_bg: #193747;
    --wolfi_warning: #ffb3a8;
    --wolfi_warning_bg: #3b2828;
    --wolfi_error: var(--wolfi_red);
    --wolfi_error_bg: #3a2224;
    --wolfi_success: #28a745;
    --wolfi_success_text: #d4edda;
    --wolfi_success_bg: #193526;
}

/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-user-select: none; /* Verhindert Textmarkierung beim Touch-Gebrauch */
    user-select: none;
}

/* Eingabefelder müssen markierbar und bearbeitbar sein */
input, select, textarea {
    user-select: text;
    -webkit-user-select: text;
}

/* Layout */
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--wolfi_page_bg);
    color: var(--wolfi_text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    flex: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.site-header {
    background: var(--wolfi_card_bg);
    border-bottom: 3px solid var(--wolfi_orange);
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Markenblock im Kopfbereich (identisch in WOLFiSlot und WOLFiFleet):
   Alleima-Logo, Trennlinie, WOLFi-Wolf und zweifarbiger Produktname.
   Alle Teile stehen auf EINER Grundlinie (align-items: baseline): Bilder sitzen mit ihrer
   Unterkante auf der Schriftgrundlinie. Der Wolf ist auf die sichtbare Fläche beschnitten. */
.brand {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    color: var(--wolfi_text);
    text-decoration: none;
    font-weight: 700;
    line-height: 1;
}
.brand img {
    display: block;
    width: auto;
}
.brand .brand-alleima {
    height: 30px;
}
.brand .brand-wolf {
    height: 26px;
}
.brand-divider {
    align-self: stretch;
    width: 1px;
    margin: 0.15rem 0.1rem 0;
    background: var(--wolfi_border);
}
.brand-name {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.brand-name-prefix {
    color: var(--wolfi_gray);
}
.brand-name-suffix {
    color: var(--wolfi_orange);
    font-weight: 300;
}
.brand-tag {
    color: var(--wolfi_text_muted);
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 0.1rem;
}

/* Schmale Bildschirme: Markenblock verkleinern, damit der Name nie abgeschnitten wird */
@media (max-width: 520px) {
    .brand { gap: 0.5rem; }
    .brand .brand-alleima { height: 22px; }
    .brand .brand-wolf { height: 19px; }
    .brand-name { font-size: 1.15rem; }
    .brand-divider { margin-top: 0.1rem; }
}
@media (max-width: 360px) {
    .brand { gap: 0.4rem; }
    .brand .brand-alleima { height: 18px; }
    .brand .brand-wolf { height: 16px; }
    .brand-name { font-size: 1rem; }
}

.site-nav {
    display: flex;
    gap: 1.1rem;
    align-items: center;
    flex-wrap: wrap;
}

.site-nav a {
    white-space: nowrap;
}

a {
    color: var(--wolfi_link);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--wolfi_focus);
    outline-offset: 2px;
}

.site-nav a {
    color: var(--wolfi_text_muted);
    text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active {
    color: var(--wolfi_orange);
}

.lang-switch a {
    font-weight: 600;
}

/* Navigation mit vielen Einträgen (Admin: 8): ab Laptop-Breite kompakter, damit sie neben dem Markenblock bleibt.
   Unter 1100 px darf sie bewusst in eine zweite Zeile umbrechen. */
@media (max-width: 1500px) {
    .site-nav { gap: 0.8rem; font-size: 0.92rem; }
    .site-nav a i { display: none; }
}
@media (max-width: 1100px) {
    .site-nav a i { display: inline-block; }
}

.card {
    background: var(--wolfi_card_bg);
    border-radius: 10px;
    padding: 2rem 2.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.card h1 {
    font-size: 1.6rem;
    margin-bottom: 1.25rem;
    color: var(--wolfi_text);
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    color: var(--wolfi_text);
}

.site-footer {
    background: var(--wolfi_card_bg);
    color: var(--wolfi_text_muted);
    text-align: center;
    padding: 0.75rem;
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--wolfi_action);
    color: var(--wolfi_text);
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.1rem;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    background: var(--wolfi_action_hover);
}

.btn-secondary {
    background: var(--wolfi_border);
    color: var(--wolfi_text);
}

.btn-secondary:hover {
    background: var(--wolfi_card_bg);
}

/* Meldungen */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-error {
    background: var(--wolfi_error_bg);
    color: var(--wolfi_text);
    border: 1px solid var(--wolfi_error);
}

.alert-success {
    background: var(--wolfi_success_bg);
    color: var(--wolfi_success_text);
    border: 1px solid var(--wolfi_success);
}

.alert-warning {
    background: var(--wolfi_warning_bg);
    color: var(--wolfi_warning);
    border: 1px solid var(--wolfi_warning);
}

/* Formulare */
input, select, textarea {
    background: var(--wolfi_input_bg);
    color: var(--wolfi_text);
    border: 1px solid var(--wolfi_border);
    border-radius: 6px;
    padding: 0.6rem;
    font-size: 1rem;
    width: 100%;
}

label {
    display: block;
    margin: 0.75rem 0 0.3rem;
    color: var(--wolfi_text_muted);
}

.form-card {
    max-width: 480px;
    margin: 1rem auto;
}

.form-card .check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    color: var(--wolfi_text);
    margin: 0.4rem 0;
}

.form-card .check input {
    width: auto;
    margin-top: 0.25rem;
}

.form-links {
    margin-top: 1rem;
    text-align: center;
}

.form-links a,
.hint {
    color: var(--wolfi_text_muted);
}

.hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.85rem;
}

/* Profil */
.profile-data {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1rem;
    margin-bottom: 1rem;
}

.profile-data dt {
    color: var(--wolfi_text_muted);
}

.sub-title {
    font-size: 1.15rem;
    margin: 1rem 0 0.5rem;
    color: var(--wolfi_orange);
}

/* Benutzerverwaltung */
.filter-tabs {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-tabs a {
    color: var(--wolfi_text_muted);
    text-decoration: none;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    border: 1px solid var(--wolfi_border);
    white-space: nowrap;
}

.filter-tabs a.active,
.filter-tabs a:hover {
    color: var(--wolfi_orange);
    border-color: var(--wolfi_orange);
}

.table-wrap {
    overflow-x: auto;
    margin: 0 -0.5rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th,
.table td {
    text-align: left;
    padding: 0.75rem 0.8rem;
    border-bottom: 1px solid var(--wolfi_input_bg);
    vertical-align: middle;
}

.table th {
    color: var(--wolfi_text_muted);
    font-weight: 600;
    line-height: 1.3;
}

.table td {
    line-height: 1.45;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--wolfi_border);
    border-radius: 999px;
    font-size: 0.8rem;
    line-height: 1.3;
    background: var(--wolfi_card_bg);
    color: var(--wolfi_text_muted);
    max-width: 14rem;
}

.badge-active { background: var(--wolfi_success_bg); color: var(--wolfi_success_text); }
.badge-pending { background: var(--wolfi_info_bg); color: var(--wolfi_info); }
.badge-blocked { background: var(--wolfi_error_bg); color: var(--wolfi_warning); }

.actions {
    min-width: 8rem;
}

.fleet-link {
    color: var(--wolfi_success_text);
    font-size: 1.1rem;
    cursor: help;
}

.inline-form {
    display: inline-block;
    margin: 0 0.35rem 0.35rem 0;
}

.inline-form input {
    display: none;
}

/* Checkboxen (Label mit Text rechts, Box fest auf Standardgröße) */
label.check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--wolfi_text);
    margin: 0.75rem 0 0.25rem;
    cursor: pointer;
}
label.check input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
    accent-color: var(--wolfi_orange);
}

/* Einheitliches Modal (ersetzt alert/confirm) */
.app-modal {
    /* Reset-Regel (* { margin: 0 }) hebt die Zentrierung auf, daher explizit setzen */
    position: fixed;
    inset: 0;
    margin: auto;
    height: fit-content;
    max-height: 90vh;
    border: 1px solid var(--wolfi_border);
    border-radius: 12px;
    background: var(--wolfi_card_bg);
    color: var(--wolfi_text);
    padding: 0;
    width: min(92vw, 440px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.app-modal::backdrop { background: var(--wolfi_overlay); }
.app-modal-body { padding: 1.5rem 1.75rem 1.25rem; }
.app-modal h2 {
    color: var(--wolfi_orange);
    font-size: 1.2rem;
    margin: 0 0 0.6rem;
}
.app-modal p {
    color: var(--wolfi_text);
    line-height: 1.5;
    margin: 0 0 1.25rem;
    white-space: pre-line;
}
.app-modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }
.btn-danger { background: var(--wolfi_error); }
.btn-danger:hover { background: var(--wolfi_error); filter: brightness(1.15); }

/* Ressourcen-Auswahl als Kacheln */
.type-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 0.75rem; }
.type-chip {
    all: unset;
    cursor: pointer;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--wolfi_border);
    color: var(--wolfi_text_muted);
    font-size: 0.85rem;
}
.type-chip:hover { color: var(--wolfi_orange); border-color: var(--wolfi_orange); }
.type-chip.is-active { background: var(--wolfi_action); border-color: var(--wolfi_action); color: var(--wolfi_text); }
a.type-chip { text-decoration: none; display: inline-block; }

.pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.6rem;
    max-height: 320px;
    overflow-y: auto;
    padding: 0.25rem;
}
.pick-card {
    all: unset;
    box-sizing: border-box;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.7rem 0.8rem;
    border-radius: 8px;
    background: var(--wolfi_input_bg);
    border: 2px solid transparent;
    min-width: 0;
}
.pick-card[hidden] { display: none; }
.pick-card:hover { border-color: var(--wolfi_border); }
.pick-card.is-selected { border-color: var(--wolfi_orange); background: var(--wolfi_layout_bg); }
.pick-card:disabled { cursor: default; opacity: 0.6; }
.pick-card:focus-visible { outline: 2px solid var(--wolfi_focus); }
.pick-name { font-weight: 600; color: var(--wolfi_text); line-height: 1.25; }
.pick-desc { color: var(--wolfi_text); font-size: 0.85rem; line-height: 1.3; }
.pick-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; color: var(--wolfi_text_muted); font-size: 0.78rem; margin-top: auto; }
.pick-meta span + span::before { content: "·"; margin-right: 0.5rem; opacity: 0.6; }
.pick-lock { color: var(--wolfi_orange); font-size: 0.8rem; font-weight: 500; }
.pick-card.is-locked { border-left: 3px solid var(--wolfi_orange); }

@media (max-width: 600px) {
    .pick-grid { grid-template-columns: 1fr; max-height: 240px; }
}

/* Benutzersuche im Buchungsdialog */
.book-for-wrap { position: relative; margin-top: 0.25rem; }
.suggest-list {
    list-style: none;
    margin-top: 0.3rem;
    background: var(--wolfi_input_bg);
    border: 1px solid var(--wolfi_border);
    border-radius: 6px;
    max-height: 220px;
    overflow-y: auto;
}
.suggest-list li {
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    color: var(--wolfi_text);
    border-bottom: 1px solid var(--wolfi_card_bg);
}
.suggest-list li:last-child { border-bottom: none; }
.suggest-list li:hover { background: var(--wolfi_layout_bg); color: var(--wolfi_orange); }
.suggest-list li.suggest-empty { color: var(--wolfi_text_muted); cursor: default; }
.suggest-list li.suggest-empty:hover { background: none; color: var(--wolfi_text_muted); }

/* Belegungsplan */
.cal-card { padding: 1.5rem 1.75rem; }
.cal-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.cal-nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cal-month { font-size: 1.4rem; color: var(--wolfi_text); }
.cal-hint { margin: 0 0 1rem; }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: auto;
    border: 1px solid var(--wolfi_input_bg);
    border-radius: 8px;
    overflow: hidden;
    background: var(--wolfi_input_bg);
    gap: 1px;
}
.cal-weekday {
    background: var(--wolfi_blue);
    padding: 0.6rem;
    text-align: center;
    font-weight: 600;
    color: var(--wolfi_text_muted);
    font-size: 0.85rem;
}
/* Hintergrund je Tag: läuft über die ganze Wochenzeile (Klickfläche) */
.cal-day {
    background: var(--wolfi_card_bg);
    min-width: 0;
    min-height: 6.5rem;
    z-index: 0;
}
.cal-day.is-other { background: var(--wolfi_blue); opacity: 0.4; }
.cal-day.is-past { opacity: 0.55; }
.cal-day.is-bookable { cursor: pointer; }
.cal-day.is-bookable:hover { background: var(--wolfi_layout_bg); }

/* Tageszahl oben rechts, liegt über dem Hintergrund, klickt durch */
.cal-daynum {
    position: relative;
    z-index: 1;
    pointer-events: none;
    display: flex;
    justify-content: flex-end;
    padding: 0.35rem 0.5rem 0 0;
    min-width: 0;
}
.cal-daynum.is-other { opacity: 0.4; }
.cal-daynum.is-past { opacity: 0.55; }
.day-num {
    font-size: 0.85rem;
    color: var(--wolfi_text_muted);
    line-height: 1.2;
}
.cal-daynum.is-today .day-num {
    background: var(--wolfi_info);
    color: var(--wolfi_blue);
    border-radius: 999px;
    padding: 0 0.45rem;
}

/* Balken über mehrere Tage: durchgehend, mit Rundung nur an den echten Enden */
.chip {
    position: relative;
    z-index: 1;
    align-self: stretch;
    margin: 3px 0;
    min-height: 1.6rem;
    display: flex;
    align-items: center;
    background: var(--c, var(--wolfi_gray));
    color: var(--t, var(--wolfi_text));
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.chip.cont-left { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.chip.cont-right { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: -1px; }
.chip.is-mine { box-shadow: inset 0 0 0 2px #fff; }
/* Sperre / Nichtverfügbarkeit: gestreift */
.chip.is-block {
    background: repeating-linear-gradient(45deg, var(--wolfi_border) 0 8px, var(--wolfi_card_bg) 8px 16px);
    border: 1px solid var(--wolfi_border);
    color: var(--wolfi_text);
}
.chip.is-hidden { display: none; }

.legend-box {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--wolfi_input_bg);
    border-radius: 8px;
}
.legend-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.legend { display: flex; flex-wrap: wrap; gap: 0.6rem 1.1rem; }
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    color: var(--wolfi_text);
    cursor: pointer;
}
.legend-item input[type="checkbox"] { width: auto; }
.legend-item.is-off { opacity: 0.35; }
.legend-item.is-locked .swatch { opacity: 0.45; outline: 1px dashed var(--wolfi_text_muted); }
.swatch {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 3px;
    background: var(--c);
    display: inline-block;
}
.hint-inline { color: var(--wolfi_text_muted); font-size: 0.85rem; }
.quick-filter { margin: 0; display: flex; align-items: center; gap: 0.5rem; color: var(--wolfi_text_muted); }
.quick-filter select { width: auto; min-width: 16rem; }

.book-dialog {
    position: fixed;
    margin: 0;
    z-index: 1000;
    width: min(96vw, 980px) !important;
    background: var(--wolfi_card_bg);
    color: var(--wolfi_text);
    border: 1px solid var(--wolfi_border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem 1.5rem;
    width: min(92vw, 460px);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.book-dialog h2 {
    color: var(--wolfi_orange);
    margin: 0 0 0.5rem;
    padding: 0.4rem 0.5rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    border-radius: 6px;
    cursor: move;
    touch-action: none;
    background: var(--wolfi_input_bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.book-dialog h2::after {
    content: "\f47f";
    font-family: "Font Awesome 6 Free", "FontAwesome";
    font-weight: 900;
    color: var(--wolfi_text_muted);
    font-size: 0.9rem;
}
.dlg-times { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
/* Dialog-Raster: Felder nebeneinander */
.dlg-row { display: grid; gap: 1rem; margin-top: 0.25rem; }
.dlg-row-2 { grid-template-columns: 1fr 1fr; }
.dlg-row > div { min-width: 0; }
.dlg-options { align-items: center; margin-top: 0.5rem; }
.dlg-options .check { margin: 0; }
.book-dialog [hidden] { display: none !important; }

/* Kacheln: drei nebeneinander im Dialog */
.book-dialog .pick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: 300px;
}
@media (max-width: 760px) {
    .book-dialog .pick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .dlg-row-2 { grid-template-columns: 1fr; }
    .book-dialog .pick-grid { grid-template-columns: 1fr; }
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.25rem; }

@media (max-width: 720px) {
    .cal-day { min-height: 4.5rem; }
    .chip { font-size: 0.65rem; }
    .cal-weekday { font-size: 0.7rem; padding: 0.4rem 0.1rem; }
}

/* Aktionsbuttons: einheitliche Breite */
.actions .btn,
.actions .btn-secondary,
.inline-form button {
    min-width: 8.5rem;
    justify-content: center;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    margin: 0 0.3rem 0.3rem 0;
}

.btn-warn:hover,
.inline-form button.btn-warn:hover {
    background: var(--wolfi_error);
    filter: none;
}

.inline-form button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--wolfi_action);
    color: var(--wolfi_text);
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}

.inline-form button.btn-secondary {
    background: var(--wolfi_border);
    color: var(--wolfi_text);
}

@media (max-width: 600px) {
    .site-nav {
        width: 100%;
        justify-content: space-between;
    }
}

/* Abstands-Hilfsklassen (ersetzen feste Inline-Abstände) */
.mt-1   { margin-top: 1rem; }
.mt-125 { margin-top: 1.25rem; }
.mt-15  { margin-top: 1.5rem; }
.mt-2   { margin-top: 2rem; }
.mb-125 { margin-bottom: 1.25rem; }

/* Farbpunkt für Fahrzeuge. Die Farbe kommt über die Variable --c (objektbezogene Datenfarbe) */
.color-dot {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    vertical-align: middle;
    background: var(--c);
}

/* Standort-Auswahl im Formular (Benutzer anlegen): Rahmen und Innenabstand */
.location-box {
    border: 1px solid var(--wolfi_border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0 1rem;
}

.location-box legend {
    padding: 0 0.4rem;
    color: var(--wolfi_text_muted);
}
