:root {
    /* Foxfleet-Markenfarben - aus der Referenz-Farbpalette übernommen */
    --color-bg: #f3f5f7;
    --color-surface: #ffffff;
    --color-border: #dde3e7;
    --color-primary: #2f7d93;      /* Teal - primäre Aktionen */
    --color-primary-hover: #1f5c6e;
    --color-primary-tint: #e4f0f2;
    --color-primary-light: #a8d3d6; /* helles Teal aus der Palette, für Akzentflächen */
    --color-accent: #a06a3e;       /* Kupfer/Braun - Sekundär-Aktionen (z.B. "Navigation") */
    --color-accent-hover: #8a5732;
    --color-accent-tan: #d1a677;   /* Tan-Ton aus der Palette (z.B. "Abgeschlossen") */
    --color-slate: #5c7284;
    --color-text: #1a2b3c;
    --color-muted: #64748b;
    --color-danger: #dc2626;
    --color-success: #16a34a;
    --color-info: #3b82f6;
    --radius: 12px;
    --radius-lg: 20px;
    --shadow-card: 0 2px 8px rgba(15,42,63,0.06), 0 1px 2px rgba(15,42,63,0.04);
    --shadow-elevated: 0 12px 32px rgba(15,42,63,0.14);
    /* Dunkles Sidebar-Farbschema */
    --sidebar-bg-from: #14313f;
    --sidebar-bg-to: #1a4a5c;
    --sidebar-text: #cbd8e3;
    --sidebar-text-active: #ffffff;
    --topbar-height: 72px;
    /* Zentrale Icon-Größen - hier einmal ändern, wirkt überall */
    --icon-size-nav: 1.25rem;
    --icon-size-badge: 1.3rem;
    --icon-badge-box: 36px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 16px;
    display: flex;
    flex-wrap: wrap;
    min-height: 100vh;
}

/* --- Globale obere Leiste (Suche/Datum/Glocke/Nutzer) - auf jeder Seite --- */
.app-topbar {
    width: 100%;
    height: var(--topbar-height);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* --- Login --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(160deg, var(--sidebar-bg-from), var(--sidebar-bg-to));
}

.login-box {
    background: var(--color-surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 340px;
}

.login-box h1 { margin: 0; font-size: 1.75rem; }
.login-box .subtitle { color: var(--color-muted); margin-top: 0.25rem; margin-bottom: 1.5rem; }

.login-box form { display: flex; flex-direction: column; gap: 0.5rem; }
.login-box label { font-size: 0.85rem; color: var(--color-muted); margin-top: 0.5rem; }
.login-box input {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
}
.login-box button {
    margin-top: 1.25rem;
    padding: 0.7rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
}
.login-box button:hover { background: var(--color-primary-hover); }

.alert { padding: 0.6rem 0.8rem; border-radius: var(--radius); font-size: 0.9rem; margin-bottom: 0.5rem; }
.alert-error { background: #fee2e2; color: var(--color-danger); }

/* --- Sidebar-Navigation --- */
.sidebar {
    width: 250px;
    flex-shrink: 0;
    order: 0;
    background: linear-gradient(180deg, var(--sidebar-bg-from), var(--sidebar-bg-to));
    display: flex;
    flex-direction: column;
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
}
.sidebar-brand {
    padding: 1.5rem 1.25rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.sidebar-brand.has-custom-logo { flex-direction: column; align-items: stretch; }
.sidebar-brand::before {
    content: "🦊";
    font-size: 1.4rem;
    width: 40px; height: 40px; flex-shrink: 0;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.sidebar-brand.has-custom-logo::before { display: none; }
.sidebar-brand-logo-full { width: 100%; max-height: 64px; object-fit: contain; object-position: left center; }
.sidebar-brand.has-custom-logo .sidebar-brand-name { display: none; }
.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-brand-name { font-weight: 700; font-size: 1.15rem; color: white; letter-spacing: -0.01em; }
.sidebar-brand-tagline { font-size: 0.72rem; color: var(--sidebar-text); }
.sidebar-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: white; }
.sidebar-link.active, .sidebar-link.active * { color: white !important; }
.sidebar-link.active { background: var(--color-primary); color: white; font-weight: 600; box-shadow: 0 4px 12px rgba(15,110,124,0.4); }
.sidebar-icon {
    font-size: var(--icon-size-nav);
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.sidebar-footer a { color: var(--sidebar-text); text-decoration: none; }
.sidebar-footer a:hover { color: white; }
.sidebar-footer a[href="/logout.php"] { color: #f3a5a5; }
.sidebar-user-name { color: white; font-weight: 600; }

.sidebar-info-card {
    margin: 0.5rem 1rem 0;
    padding: 1rem;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
}
.sidebar-info-card-title { font-size: 0.8rem; color: var(--sidebar-text); margin-bottom: 0.3rem; }
.sidebar-info-card-count { font-size: 1.05rem; font-weight: 700; color: white; }
.sidebar-info-card-sub { font-size: 0.75rem; color: var(--sidebar-text); margin-top: 0.2rem; }

.nav-badge {
    display: inline-block;
    background: var(--color-danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    margin-left: auto;
}

@media (max-width: 800px) {
    body { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .sidebar-brand { padding: 0.75rem 1rem; }
    .sidebar-links { flex-direction: row; flex-wrap: wrap; padding: 0.5rem; }
    .sidebar-footer { flex-direction: row; margin-left: auto; border-top: none; }
}

/* --- Schlanker Header für Melder-Portal (keine Sidebar) --- */
body.stacked { flex-direction: column; }
.mini-header {
    display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(90deg, var(--sidebar-bg-from), var(--sidebar-bg-to));
    padding: 0.85rem 1.5rem; width: 100%;
}
.mini-header-brand { font-weight: 700; font-size: 1.25rem; color: white; }
.mini-header nav a { color: var(--sidebar-text); text-decoration: none; margin-right: 1rem; }
.mini-header nav a.active { color: white; font-weight: 600; }
.mini-header-user { display: flex; gap: 1rem; align-items: center; font-size: 0.9rem; color: var(--sidebar-text); }
.mini-header-user a { color: #f3a5a5; text-decoration: none; }

/* --- In-Page-Tabs (z.B. Fahrzeug-Historie) --- */
.tabbar { display: flex; gap: 0.5rem; border-bottom: 2px solid var(--color-border); margin-bottom: 1rem; }
.tabbar a { padding: 0.6rem 1rem; text-decoration: none; color: var(--color-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabbar a.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }

/* --- Content --- */
.content { padding: 1.5rem; margin: 0; flex: 1; min-width: 0; order: 1; }

/* --- Dauerhafter rechter Bereich (Schnellzugriff/Statistik) - auf jeder Seite sichtbar --- */
.dash-side-persistent {
    order: 2;
    width: 320px;
    flex-shrink: 0;
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: var(--color-bg);
    border-left: 1px solid var(--color-border);
}
.dash-filter-card { background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; }
.dash-filter-card a { color: var(--color-text); text-decoration: none; font-size: 0.85rem; padding: 0.3rem 0; }
.dash-filter-card a:hover { color: var(--color-primary); }

@media (max-width: 1100px) {
    .dash-side-persistent { display: none; } /* auf schmalen Bildschirmen ausblenden statt zu quetschen */
}

.impersonation-banner {
    position: fixed; top: 0; left: 0; right: 0; z-index: 200;
    background: var(--color-danger); color: white; text-align: center;
    padding: 0.5rem; font-size: 0.9rem;
}
.impersonation-banner a { color: white; text-decoration: underline; margin-left: 1rem; }
.content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

.btn-primary {
    background: var(--color-primary);
    color: white;
    border: none;
    text-decoration: none;
    padding: 0.6rem 1.3rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}
.btn-primary:hover { background: var(--color-primary-hover); }

/* --- Dashboard tiles --- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.tile {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1.25rem;
    text-decoration: none;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: transform 0.12s, box-shadow 0.12s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-elevated); }
.tile-number { font-size: 1.75rem; font-weight: 700; color: var(--color-primary); }
.tile-label { color: var(--color-muted); font-size: 0.9rem; }

/* --- Order board (links auswählen, rechts Übersicht) --- */
.board-layout { display: flex; gap: 1.25rem; align-items: flex-start; }
.board-sidebar {
    width: 220px; flex-shrink: 0; background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 0.75rem; display: flex; flex-direction: column; gap: 0.2rem;
}
.board-status-filter {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.65rem 0.75rem; border-radius: 10px;
    text-decoration: none; color: var(--color-text); font-size: 0.9rem;
}
.board-status-filter:hover { background: var(--color-bg); }
.board-status-filter.active { background: var(--color-primary-tint); color: var(--color-primary); font-weight: 600; }
.board-status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.board-status-count { margin-left: auto; font-size: 0.78rem; color: var(--color-muted); }
.board-status-filter.active .board-status-count { color: var(--color-primary); }

.board-overview {
    flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.9rem; align-content: start;
}

.order-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
}
.order-card-top { display: flex; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.3rem; }
.order-card-top .board-status-dot { margin-top: 0.35rem; }
.order-status-select { margin-left: auto; font-size: 0.75rem; border: 1px solid var(--color-border); border-radius: 6px; padding: 0.15rem 0.3rem; }
.order-title { font-weight: 600; flex: 1; }
.order-address, .order-driver, .order-time { color: var(--color-muted); font-size: 0.8rem; }

/* --- License center --- */
.alert-info { background: var(--color-primary-tint); color: var(--color-primary); }

.license-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
    background: transparent;
    margin-bottom: 1.5rem;
}
.license-table thead th { background: none; border: none; color: var(--color-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; padding-bottom: 0.4rem; }
.license-table tbody tr {
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
    border-radius: var(--radius-lg);
    transition: box-shadow 0.15s, transform 0.15s;
}
.license-table tbody tr:hover { box-shadow: var(--shadow-elevated); transform: translateY(-1px); }
.license-table th, .license-table td {
    text-align: left;
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    border: none;
}
.license-table td:first-child, .license-table th:first-child { border-radius: var(--radius-lg) 0 0 var(--radius-lg); font-weight: 600; }
.license-table td:last-child, .license-table th:last-child { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}
.badge-on { background: #dcfce7; color: #16a34a; }
.badge-off { background: #eef1f4; color: var(--color-muted); }
.badge-accent { background: #fef3d9; color: #b3720a; }
.badge-danger { background: #fee2e2; color: var(--color-danger); cursor: help; }

.license-class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem 1rem;
    margin: 0.75rem 0;
}
.license-class-row { display: flex; align-items: center; gap: 0.5rem; }
.license-class-row input[type="date"] {
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    width: 120px;
}

.inline-form { display: flex; gap: 0.4rem; align-items: center; margin: 0; }
.inline-form input[type="date"] {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
}
.btn-small {
    padding: 0.35rem 0.7rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    background: var(--color-primary);
    color: white;
}
.btn-small:hover { background: var(--color-primary-hover); }
.btn-danger { background: var(--color-danger); }
.btn-danger:hover { background: #b91c1c; }

/* --- Panels & forms (Firmen-/Paketverwaltung) --- */
.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}
.panel h2 { margin-top: 0; font-size: 1.1rem; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem 1.25rem;
}
.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--color-muted);
}
.form-grid label.full-width { grid-column: 1 / -1; }
.form-grid input, .form-grid textarea, .form-grid select {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--color-text);
}
.form-grid button { grid-column: 1 / -1; justify-self: start; }

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    margin: 0.75rem 0;
}
.checkbox-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; font-weight: 400; color: var(--color-text); }

.hint { color: var(--color-muted); font-size: 0.8rem; }

.tile-disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal-overlay.hidden { display: none; }
.modal {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal h2 { margin-top: 0; }
.modal form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.modal label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--color-muted); }
.modal label.full-width { grid-column: 1 / -1; }
.modal input, .modal select, .modal textarea {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
}
.modal-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.5rem; }

/* --- Chat --- */
.chat-layout { display: flex; gap: 1rem; height: calc(100vh - 120px); }
.chat-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-y: auto;
}
.chat-sidebar h2 { font-size: 0.9rem; color: var(--color-muted); margin-top: 0; }
.chat-contact-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.chat-contact {
    display: block;
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--color-text);
    font-size: 0.9rem;
}
.chat-contact:hover { background: var(--color-bg); }
.chat-contact.active { background: var(--color-primary-tint); color: var(--color-primary); font-weight: 600; }

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.chat-bubble {
    max-width: 60%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.chat-bubble-other { align-self: flex-start; background: var(--color-bg); }
.chat-bubble-mine { align-self: flex-end; background: var(--color-primary-tint); }
.chat-bubble-flash { animation: chat-flash 2s ease-out; }
@keyframes chat-flash {
    0% { background: #fef3c7; box-shadow: 0 0 0 3px #fbbf24; }
    100% { background: var(--color-bg); box-shadow: none; }
}
.chat-new-tag {
    background: var(--color-danger); color: white; font-size: 0.6rem; font-weight: 700;
    padding: 0.05rem 0.35rem; border-radius: 999px; margin-left: 0.4rem; vertical-align: middle;
}
.chat-sender { font-size: 0.7rem; color: var(--color-muted); font-weight: 600; }
.chat-time { font-size: 0.65rem; color: var(--color-muted); align-self: flex-end; }

.chat-form { display: flex; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid var(--color-border); }
.chat-form input { flex: 1; padding: 0.6rem 0.75rem; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 0.95rem; }

.status-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--color-border); margin-right: 0.4rem;
}
.status-dot.online { background: #16a34a; }

.emoji-picker {
    position: absolute; bottom: 60px; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius);
    padding: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.3rem; max-width: 220px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15); z-index: 10;
}
.emoji-picker.hidden { display: none; }
.emoji-option { cursor: pointer; font-size: 1.2rem; padding: 0.15rem; }
.emoji-option:hover { background: var(--color-bg); border-radius: 4px; }

.tile-icon-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: var(--icon-badge-box); height: var(--icon-badge-box); border-radius: 8px; font-size: var(--icon-size-badge);
    margin-bottom: 0.4rem; line-height: 1;
}

/* --- Auftragsplanung (moderner Kalender-Stil) --- */
.planner-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem; }
.planner-date-nav { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.planner-nav-btn {
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--color-surface); border: 1px solid var(--color-border);
    color: var(--color-primary); font-size: 1.2rem; text-decoration: none;
}
.planner-nav-btn:hover { background: var(--color-primary-tint); }
.planner-date-label { font-weight: 600; min-width: 160px; text-align: center; }
.planner-date-input { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 0.4rem 0.6rem; }

.planner-layout { display: flex; gap: 1.25rem; align-items: flex-start; }
.planner-sidebar {
    width: 240px; flex-shrink: 0; background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 1rem;
}
.planner-sidebar h2 { font-size: 0.9rem; color: var(--color-muted); margin: 0 0 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
.planner-order-chip {
    background: var(--color-bg); border-left: 4px solid var(--color-border); border-radius: 10px;
    padding: 0.6rem 0.75rem; margin-bottom: 0.6rem; font-size: 0.8rem; cursor: pointer;
    display: flex; flex-direction: column; gap: 0.15rem; transition: transform 0.1s;
    text-decoration: none; color: var(--color-text);
}
.planner-order-chip:hover { transform: translateX(2px); }
.planner-order-chip span { color: var(--color-muted); }
.planner-order-chip.selected { outline: 2px solid var(--color-primary); background: var(--color-primary-tint); }

/* --- Auftragsplanung: Sidebar-Tabs (eigene Klassen, keine Kollision mit .tabbar) --- */
.planner-tabs { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.75rem; }
.planner-tab-btn {
    text-decoration: none; color: var(--color-text); background: var(--color-bg);
    border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.82rem;
}
.planner-tab-btn.active { background: var(--color-primary); color: white; font-weight: 600; }

/* --- Auftragsplanung: horizontale Zeitleiste (Slot-Planung-Stil) --- */
.hplanner { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); flex: 1; overflow: hidden; }
.hplanner-scroll { overflow-x: auto; position: relative; }
.hplanner-now-line {
    position: absolute; top: 0; bottom: 0; width: 2px; background: var(--color-danger); z-index: 5; pointer-events: none;
}
.hplanner-now-line::before {
    content: ""; position: absolute; top: -4px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--color-danger);
}
.hplanner-header-row { display: flex; border-bottom: 1px solid var(--color-border); background: var(--color-bg); }
.hplanner-corner { width: 160px; flex-shrink: 0; position: sticky; left: 0; background: var(--color-bg); z-index: 3; border-right: 1px solid var(--color-border); }
.hplanner-hour-label { flex-shrink: 0; text-align: center; font-size: 0.75rem; color: var(--color-muted); padding: 0.5rem 0; border-right: 1px dashed var(--color-border); }
.hplanner-hour-label-full { font-weight: 700; color: var(--color-text); border-right: 1px solid var(--color-border); }
.hplanner-row { display: flex; border-bottom: 1px solid var(--color-border); }
.hplanner-row:last-child { border-bottom: none; }
.hplanner-row-label {
    width: 160px; flex-shrink: 0; position: sticky; left: 0; background: var(--color-surface); z-index: 2;
    padding: 0 0.75rem; font-weight: 600; font-size: 0.85rem; border-right: 1px solid var(--color-border);
    display: flex; align-items: center;
}
.hplanner-row-label a { color: inherit; text-decoration: none; }
.hplanner-track { position: relative; height: 64px; flex-shrink: 0; }
.hplanner-track.drag-over { background: var(--color-primary-tint); }
.hplanner-hour-cell { position: absolute; top: 0; bottom: 0; border-right: 1px dashed var(--color-border); }
.hplanner-hour-cell-full { border-right: 1px solid var(--color-border); }
.hplanner-event {
    position: absolute; top: 8px; bottom: 8px; border-radius: 6px; padding: 0.25rem 0.5rem;
    color: white; font-size: 0.75rem; font-weight: 600; text-decoration: none; overflow: hidden;
    white-space: nowrap; text-overflow: ellipsis; z-index: 2; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.hplanner-event-transit {
    outline: 3px solid #c86f48;
    outline-offset: 2px;
    animation: hplanner-pulse 1.1s ease-in-out infinite;
    z-index: 4 !important;
}
@keyframes hplanner-pulse {
    0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,0.15), 0 0 0 0 rgba(200,111,72,0.7); transform: scale(1); }
    50% { box-shadow: 0 1px 3px rgba(0,0,0,0.15), 0 0 0 10px rgba(200,111,72,0); transform: scale(1.05); }
}
.hplanner-buffer { position: absolute; top: 8px; bottom: 8px; opacity: 0.5; border-radius: 4px; z-index: 1; }

.hplanner-event-draft {
    position: absolute; top: 8px; bottom: 8px; border-radius: 6px; z-index: 3;
    background: repeating-linear-gradient(45deg, #d1d5db, #d1d5db 6px, #e5e7eb 6px, #e5e7eb 12px);
    border: 1px dashed #6b7280; display: flex; align-items: center; justify-content: space-between;
    padding: 0 0.3rem; cursor: grab; overflow: hidden;
}
.hplanner-draft-label { font-size: 0.72rem; font-weight: 600; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hplanner-draft-actions { display: flex; gap: 0.2rem; flex-shrink: 0; }
.hplanner-draft-actions button {
    width: 20px; height: 20px; border-radius: 50%; border: none; font-size: 0.7rem; cursor: pointer; line-height: 1;
}
.btn-draft-confirm { background: #16a34a; color: white; }
.btn-draft-discard { background: #dc2626; color: white; }

/* --- Dashboard-Grid (Drag-and-Drop-Widgets) --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 60px;
    gap: 12px;
    position: relative;
}
.dashboard-widget {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.dashboard-widget.dragging { opacity: 0.85; box-shadow: var(--shadow-elevated); z-index: 50; }
.widget-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--color-border);
    background: var(--color-bg); cursor: grab; font-size: 0.9rem; font-weight: 600;
}
.widget-header:active { cursor: grabbing; }
.widget-controls { display: flex; gap: 0.2rem; }
.widget-controls button {
    background: none; border: 1px solid var(--color-border); border-radius: 4px;
    width: 22px; height: 22px; font-size: 0.75rem; cursor: pointer; color: var(--color-muted); line-height:1;
}
.widget-body { flex: 1; overflow: auto; padding: 0.6rem 0.75rem; }

/* --- Auftrags-Widget: farbliche Liste --- */
.order-widget-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--color-border); font-size: 0.85rem; }
.order-widget-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.order-widget-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-widget-row select { font-size: 0.75rem; padding: 0.15rem; border: 1px solid var(--color-border); border-radius: 4px; }

/* --- iOS-artiges Chat-Widget --- */
.ios-chat-messages { display: flex; flex-direction: column; gap: 0.4rem; height: 100%; overflow-y: auto; }
.ios-bubble { max-width: 75%; padding: 0.5rem 0.8rem; border-radius: 18px; font-size: 0.85rem; line-height: 1.3; }
.ios-bubble-mine { align-self: flex-end; background: var(--color-primary); color: white; border-bottom-right-radius: 4px; }
.ios-bubble-other { align-self: flex-start; background: #e5e7eb; color: #1f2937; border-bottom-left-radius: 4px; }
.ios-chat-input { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.ios-chat-input input { flex: 1; border-radius: 999px; padding: 0.4rem 0.9rem; border: 1px solid var(--color-border); font-size: 0.85rem; }
.ios-chat-input button { border-radius: 999px; width: 32px; height: 32px; background: var(--color-primary); color: white; border: none; cursor: pointer; }

/* --- Telematik --- */
.tracking-map { width: 100%; height: 500px; border-radius: var(--radius); border: 1px solid var(--color-border); margin-bottom: 1.5rem; }
.vehicle-marker-dot {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid white; box-shadow: 0 0 4px rgba(0,0,0,0.4);
}

/* --- Toggle switch (Fahrer-Standortfreigabe) --- */
.toggle-switch { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-track {
    width: 40px; height: 22px; background: var(--color-border);
    border-radius: 999px; position: relative; transition: background 0.15s;
}
.toggle-track::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; background: white; border-radius: 50%;
    transition: transform 0.15s;
}
.toggle-switch input:checked + .toggle-track { background: #16a34a; }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(18px); }

/* ============================================================
   Büro-Dashboard (Admin/Verwalter/Disponent) - DriveEase-Vorbild
   ============================================================ */
.dash-search {
    flex: 1; min-width: 220px; display: flex; align-items: center; gap: 0.5rem;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 999px;
    padding: 0.7rem 1.1rem; color: var(--color-muted);
}
.dash-search input { border: none; outline: none; background: none; flex: 1; font-size: 0.9rem; }
.dash-date-pill {
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 999px;
    padding: 0.65rem 1.1rem; font-weight: 600; font-size: 0.85rem; color: var(--color-text); text-decoration: none; white-space: nowrap;
}
.dash-bell {
    position: relative; width: 42px; height: 42px; border-radius: 50%; background: var(--color-surface);
    border: 1px solid var(--color-border); display: flex; align-items: center; justify-content: center; text-decoration: none; flex-shrink: 0;
}
.dash-bell-badge {
    position: absolute; top: -4px; right: -4px; background: var(--color-danger); color: white;
    font-size: 0.65rem; font-weight: 700; border-radius: 999px; padding: 0.05rem 0.35rem; border: 2px solid var(--color-bg);
}
.dash-user { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.dash-avatar {
    width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.dash-user-text { display: flex; flex-direction: column; font-size: 0.85rem; line-height: 1.3; }
.dash-user-text span { color: var(--color-muted); font-size: 0.75rem; }

.dash-layout { display: flex; gap: 1.5rem; align-items: flex-start; }
.dash-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1.5rem; }
.dash-side { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 1.25rem; }

.dash-hero { display: grid; grid-template-columns: 340px 1fr; gap: 1.25rem; }
@media (max-width: 900px) { .dash-hero { grid-template-columns: 1fr; } .dash-side { width: 100%; } .dash-layout { flex-direction: column; } }
.dash-hero-card {
    background: linear-gradient(160deg, var(--sidebar-bg-from), var(--color-primary));
    color: white; border-radius: var(--radius-lg); padding: 1.5rem; display: flex; flex-direction: column;
}
.dash-hero-card-top { display: flex; align-items: center; justify-content: space-between; font-size: 0.9rem; opacity: 0.9; }
.dash-hero-pill { background: rgba(255,255,255,0.2); border-radius: 999px; padding: 0.15rem 0.6rem; font-size: 0.7rem; font-weight: 700; }
.dash-hero-time { font-size: 2rem; font-weight: 700; margin-top: 0.75rem; }
.dash-hero-title { font-weight: 600; margin-top: 0.4rem; }
.dash-hero-sub { font-size: 0.85rem; opacity: 0.85; margin-top: 0.2rem; }
.dash-hero-btn {
    margin-top: auto; padding-top: 1.25rem; color: white; text-decoration: none; font-weight: 600; font-size: 0.85rem;
}
.dash-hero-map { border-radius: var(--radius-lg); overflow: hidden; min-height: 260px; box-shadow: var(--shadow-card); }
.dash-hero-map-disabled { display: flex; align-items: center; justify-content: center; background: var(--color-surface); color: var(--color-muted); font-size: 0.85rem; }

.dash-panel { background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 1.25rem; }
.dash-tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--color-border); margin-bottom: 1rem; }
.dash-tab {
    background: none; border: none; padding: 0.6rem 0; font-size: 0.9rem; color: var(--color-muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; display: flex; align-items: center; gap: 0.4rem;
}
.dash-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }
.dash-tab-count { background: var(--color-bg); border-radius: 999px; padding: 0.05rem 0.45rem; font-size: 0.72rem; }
.dash-order-list { display: flex; flex-direction: column; gap: 0.5rem; }
.dash-order-row {
    display: flex; align-items: center; gap: 1rem; padding: 0.85rem 1rem; border-radius: 14px;
    text-decoration: none; color: var(--color-text); background: var(--color-bg);
}
.dash-order-row:hover { background: var(--color-primary-tint); }
.dash-order-time { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; font-weight: 700; width: 90px; flex-shrink: 0; }
.dash-order-status { font-size: 0.68rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 999px; }
.dash-order-main { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.dash-order-main span { color: var(--color-muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-order-side { display: flex; flex-direction: column; align-items: flex-end; font-size: 0.8rem; color: var(--color-muted); flex-shrink: 0; }

.dash-greeting-card {
    background: linear-gradient(160deg, var(--color-primary), var(--sidebar-bg-to));
    color: white; border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow-card);
}
.dash-greeting-label { font-size: 0.85rem; opacity: 0.85; }
.dash-greeting-name { font-size: 1.4rem; font-weight: 700; margin-top: 0.2rem; }

.dash-quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.dash-quick-tile {
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px;
    padding: 1rem 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start;
    font-size: 0.85rem; font-weight: 600; color: var(--color-text); text-decoration: none; cursor: pointer;
    box-shadow: var(--shadow-card);
}
.dash-quick-icon {
    width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary-tint); color: var(--color-primary);
    display: flex; align-items: center; justify-content: center; font-size: 1rem;
}

.dash-stats-card { background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 1.25rem; }
.dash-stats-title { font-weight: 600; margin-bottom: 0.75rem; font-size: 0.9rem; }
.dash-stats-row { display: flex; justify-content: space-between; }
.dash-stats-row div { display: flex; flex-direction: column; align-items: center; }
.dash-stats-row strong { font-size: 1.4rem; color: var(--color-primary); }
.dash-stats-row span { font-size: 0.75rem; color: var(--color-muted); }

.dash-warning-card {
    display: block; background: #fef3c7; color: #92400e; border-radius: var(--radius-lg);
    padding: 1rem 1.25rem; font-size: 0.85rem; text-decoration: none;
}

.dash-cta-btn {
    display: block; text-align: center; background: var(--color-primary); color: white; font-weight: 700;
    padding: 1rem; border-radius: 999px; text-decoration: none; box-shadow: var(--shadow-card);
}
.dash-cta-btn:hover { background: var(--color-primary-hover); }

/* ============================================================
   Aus der Referenz-Bilddatei übernommene Bausteine
   ============================================================ */
.dash-mini-avatar {
    width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}

/* Sekundär-Button (Kupfer/Braun) - z.B. "Navigation" */
.btn-secondary {
    background: var(--color-accent); color: white; border: none; padding: 0.6rem 1.3rem;
    border-radius: 999px; cursor: pointer; font-size: 0.9rem; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-secondary:hover { background: var(--color-accent-hover); }

/* Rundes Icon-Button (z.B. "+") */
.btn-round {
    width: 44px; height: 44px; border-radius: 50%; background: var(--color-primary); color: white;
    border: none; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; cursor: pointer; text-decoration: none;
}
.btn-round:hover { background: var(--color-primary-hover); }

/* Benachrichtigungs-/Hinweis-Karten mit farbigem linkem Rand */
.notice-card { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; border-radius: 12px; border-left: 4px solid; background: var(--color-surface); box-shadow: var(--shadow-card); font-size: 0.85rem; }
.notice-card-success { border-left-color: var(--color-success); }
.notice-card-info { border-left-color: var(--color-info); }
.notice-card-warning { border-left-color: var(--color-accent-tan); }
.notice-card-danger { border-left-color: var(--color-danger); }
.notice-card-time { margin-left: auto; color: var(--color-muted); font-size: 0.78rem; flex-shrink: 0; }

/* Optionale, vom Superadmin hochgeladene Illustration unten in der Seitenleiste */
.sidebar-illustration { padding: 0 1rem; margin-top: 0.5rem; }
.sidebar-illustration img { width: 100%; max-height: 130px; object-fit: contain; opacity: 0.9; }

/* --- Anklickbare Stunden-Auswahlleiste (00-23) für die Auftragsplanung --- */
.hour-range-picker {
    display: flex; background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: 999px; overflow: hidden; font-size: 0.72rem;
}
.hour-range-cell {
    background: none; border: none; border-right: 1px solid var(--color-border);
    padding: 0.5rem 0.4rem; color: var(--color-muted); cursor: pointer; font-family: inherit;
}
.hour-range-cell:last-child { border-right: none; }
.hour-range-cell.in-range { background: var(--color-primary); color: white; }
.hour-range-cell.range-edge { background: var(--color-primary-hover); color: white; font-weight: 700; }

.order-card-icon-btn {
    background: none; border: 1px solid var(--color-border); border-radius: 6px;
    width: 26px; height: 26px; font-size: 0.8rem; cursor: pointer; display: inline-flex;
    align-items: center; justify-content: center; text-decoration: none; margin-left: 0.2rem;
}

/* --- Zoom-Regler für die Auftragsplanung --- */
.zoom-control { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; font-weight: 600; color: var(--color-muted); }

/* --- Blocker (Pause/Werkstatt/Urlaub etc.) in der Auftragsplanung --- */
.hplanner-blocker {
    position: absolute; top: 8px; bottom: 8px; border-radius: 6px; color: white; font-size: 0.72rem;
    font-weight: 600; display: flex; align-items: center; padding: 0 0.4rem; overflow: hidden;
    white-space: nowrap; text-overflow: ellipsis; cursor: pointer; z-index: 2; opacity: 0.9;
}

/* --- Chat: Bildergalerie, Dateikarten, Anhang-Optionen --- */
.chat-image-grid { display: grid; grid-template-columns: repeat(2, 90px); gap: 4px; margin: 0.3rem 0; }
.chat-image-thumb { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; cursor: pointer; }
.chat-image-more { position: relative; width: 90px; height: 90px; border-radius: 8px; overflow: hidden; cursor: pointer; }
.chat-image-more img { width: 100%; height: 100%; object-fit: cover; filter: blur(3px) brightness(0.6); }
.chat-image-more span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 1.4rem; font-weight: 700; }
.chat-file-card {
    display: flex; flex-direction: column; gap: 0.15rem; padding: 0.5rem 0.75rem; border-radius: 8px;
    background: rgba(0,0,0,0.05); cursor: pointer; text-decoration: none; color: inherit; font-size: 0.85rem; margin: 0.3rem 0;
}
.chat-file-hint { font-size: 0.7rem; color: var(--color-muted); }
.chat-file-external { cursor: pointer; }
.chat-attachment-expired { font-size: 0.8rem; color: var(--color-muted); font-style: italic; }
.chat-attachment-options {
    display: flex; gap: 1.5rem; padding: 0.5rem 0.75rem; background: var(--color-bg);
    border-radius: 8px; margin-top: 0.4rem; font-size: 0.8rem; flex-wrap: wrap;
}
.chat-attachment-options label { display: flex; align-items: center; gap: 0.4rem; }

/* --- Gruppierte Formular-Abschnitte (z.B. "Neuer Auftrag") --- */
.form-section { margin-bottom: 1.25rem; }
.form-section h3 {
    font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted);
    margin: 0 0 0.6rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--color-border); font-weight: 700;
}
.form-section h3 .hint { text-transform: none; letter-spacing: normal; font-weight: 400; }

/* --- Warn-Badge bei Zeit-Abweichung vom Wunschtermin --- */
.hplanner-deviation-badge {
    display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px;
    background: #fbbf24; color: #78350f; border-radius: 50%; font-weight: 800; font-size: 0.65rem;
    margin-right: 0.2rem; flex-shrink: 0;
}

/* --- Graue Live-Vorschau beim Ziehen eines Termins/Blockers --- */
.hplanner-drag-ghost {
    position: absolute; top: 8px; bottom: 8px; background: rgba(148,163,184,0.5);
    border: 2px dashed #64748b; border-radius: 6px; z-index: 6; pointer-events: none;
}
