:root {
    --fleet-bg: #f4f6f9;
    --fleet-card: #ffffff;
    --fleet-text: #111827;
    --fleet-muted: #6b7280;
    --fleet-border: #e5e7eb;
    --fleet-radius: 16px;
}

/* Basis */
body {
    background: var(--fleet-bg);
    color: var(--fleet-text);
}

.card {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.alert {
    border-radius: 14px;
}

.table {
    margin-bottom: 0;
}

.table td,
.table th {
    vertical-align: middle;
}

.table th {
    white-space: nowrap;
}

/* Einheitliche Controls */
.btn,
.form-control,
.form-select {
    border-radius: 12px;
    min-height: 40px;
}

.btn {
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-sm,
.table .btn,
.table form .btn {
    min-height: 32px;
    height: 32px;
    padding: 4px 10px;
    font-size: 0.875rem;
    line-height: 1;
}

.btn-lg {
    min-height: 46px;
    padding: 10px 16px;
    font-size: 1.05rem;
}

.card form .btn,
.card form .form-control,
.card form .form-select {
    height: 42px;
}

.table form {
    margin: 0;
    display: inline-flex;
    align-items: center;
}

/* Navbar */
.fleet-navbar {
    min-height: 58px;
}

.fleet-navbar .container-fluid {
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
}

.fleet-brand {
    font-size: 1.15rem;
    white-space: nowrap;
}

.fleet-nav-search {
    display: flex;
    gap: 8px;
    margin-left: 20px;
    max-width: 230px;
    width: 230px;
    flex: 0 0 230px;
}

.fleet-nav-input {
    height: 34px;
    min-height: 34px;
    font-size: 0.9rem;
    padding: 5px 10px;
    border-radius: 10px;
}

.fleet-nav-btn,
.fleet-nav-small-btn {
    height: 34px;
    min-height: 34px;
    padding: 5px 10px;
    font-size: 0.9rem;
    border-radius: 10px;
    line-height: 1;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fleet-nav-links {
    gap: 4px;
}

.fleet-nav-links .nav-link {
    font-size: 0.95rem;
    padding: 7px 9px;
}

/* Dashboard */
.dashboard-menu-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 92px;
    padding: 16px;
    background: #ffffff;
    border-radius: 18px;
    text-decoration: none;
    color: #111827;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    transition: 0.15s ease-in-out;
}

.dashboard-menu-card:hover {
    transform: translateY(-2px);
    color: #111827;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
}

.dashboard-menu-card strong {
    display: block;
    font-size: 1.08rem;
}

.dashboard-menu-card span {
    color: #6b7280;
}

.menu-icon {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    background: #eef5ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
}

/* Scan / Fahrer */
.driver-simple-wrapper {
    max-width: 980px;
    margin: 0 auto;
}

.driver-card {
    min-height: 120px;
    font-size: 1.35rem;
    font-weight: 800;
    border: 3px solid #e5e7eb;
    border-radius: 18px;
    background: #ffffff;
}

.driver-card:hover {
    border-color: #0d6efd;
    background: #eef5ff;
}

.driver-card.active-driver {
    border-color: #198754;
    background: #e9f8ef;
    color: #0f5132;
}

.pin-input {
    font-size: 2rem !important;
    letter-spacing: 8px;
    font-weight: 800;
}

.big-driver-action {
    min-height: 74px;
    font-size: 1.35rem;
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
    touch-action: manipulation;
}

.pin-key {
    min-height: 70px;
    border: 0;
    border-radius: 16px;
    background: #e9f2ff;
    color: #0d6efd;
    font-size: 2rem;
    font-weight: 900;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.pin-key:active {
    transform: scale(.97);
}

html {
    touch-action: manipulation;
}

/* QR */
.qr-print-card {
    min-height: 100%;
}

/* Dark Mode */
body.dark-mode {
    background: #0f172a;
    color: #e5e7eb;
}

body.dark-mode .card,
body.dark-mode .dashboard-menu-card {
    background: #111827;
    color: #e5e7eb;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
}

body.dark-mode .dashboard-menu-card:hover {
    color: #ffffff;
}

body.dark-mode .dashboard-menu-card span,
body.dark-mode .text-muted {
    color: #9ca3af !important;
}

body.dark-mode .menu-icon {
    background: #1f2937;
}

body.dark-mode .table {
    --bs-table-bg: #111827;
    --bs-table-color: #e5e7eb;
    --bs-table-border-color: #374151;
    --bs-table-striped-bg: #182235;
    --bs-table-striped-color: #e5e7eb;
    --bs-table-hover-bg: #1f2937;
    color: #e5e7eb;
    border-color: #374151;
}

body.dark-mode .table thead th {
    background: #0f172a;
    color: #f9fafb;
    border-color: #374151;
}

body.dark-mode .table tbody td {
    border-color: #374151;
}

body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .fleet-nav-input {
    background: #1f2937;
    border-color: #475569;
    color: #f9fafb;
}

body.dark-mode .form-control::placeholder,
body.dark-mode .fleet-nav-input::placeholder {
    color: #94a3b8;
}

body.dark-mode .fleet-nav-btn {
    background: #334155;
    border-color: #475569;
    color: #f9fafb;
}

body.dark-mode .fleet-nav-btn:hover {
    background: #475569;
    color: #ffffff;
}

body.dark-mode .border,
body.dark-mode .bg-light {
    border-color: #374151 !important;
    background-color: #1f2937 !important;
}

body.dark-mode .alert-light {
    background: #1f2937;
    color: #e5e7eb;
    border-color: #374151;
}

body.dark-mode .alert-success {
    background: #052e16;
    color: #bbf7d0;
    border-color: #166534;
}

body.dark-mode .alert-info {
    background: #082f49;
    color: #bae6fd;
    border-color: #0369a1;
}

body.dark-mode .alert-warning {
    background: #451a03;
    color: #fed7aa;
    border-color: #c2410c;
}

body.dark-mode .pin-key {
    background: #1e3a5f;
    color: #bfdbfe;
}

/* Tablet / Mobile */
@media (max-width: 1199px) {
    .fleet-nav-search {
        margin-left: 0;
        margin-top: 14px;
        max-width: 100%;
        width: 100%;
        flex: 1 1 auto;
    }

    .fleet-nav-links {
        margin-top: 12px;
        align-items: stretch !important;
    }

    .fleet-nav-links .nav-link,
    .fleet-nav-small-btn {
        width: 100%;
        justify-content: flex-start;
        margin-bottom: 6px;
    }

    .fleet-nav-small-btn {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.7rem;
    }

    .display-5,
    .display-6 {
        font-size: 2rem;
    }

    .card {
        padding: 18px !important;
        border-radius: 16px;
    }

    .btn-lg {
        width: 100%;
        min-height: 44px;
        padding: 8px 14px;
        font-size: 1rem;
        margin-bottom: 8px;
    }

    .dashboard-menu-card {
        min-height: 78px;
        padding: 14px;
    }

    .dashboard-menu-card strong {
        font-size: 1rem;
    }

    .dashboard-menu-card span {
        font-size: .9rem;
    }

    .menu-icon {
        width: 42px;
        height: 42px;
        font-size: 1.35rem;
    }

    .driver-card {
        min-height: 95px;
        font-size: 1.15rem;
    }

    .pin-input {
        font-size: 1.7rem !important;
    }

    .big-driver-action {
        min-height: 70px;
        font-size: 1.25rem;
    }

    .table-responsive {
        border-radius: 12px;
    }

    .fleet-brand {
        font-size: 1rem;
        max-width: 240px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.admin-password-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-password-form .form-control {
    min-width: 190px;
    height: 36px;
}

@media (max-width: 768px) {
    .admin-password-form {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .admin-password-form .form-control,
    .admin-password-form .btn {
        width: 100%;
        height: 44px;
        min-height: 44px;
    }
}

.table .d-flex.flex-wrap.gap-2 {
    align-items: center;
}

.table .btn-sm,
.table a.btn-sm,
.table button.btn-sm {
    height: 34px;
    min-height: 34px;
    padding: 0 12px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.table form {
    margin: 0;
    display: inline-flex;
    align-items: center;
}

body.dark-mode .btn-outline-dark {
    color: #facc15;
    border-color: #facc15;
    background: rgba(250, 204, 21, 0.08);
}

body.dark-mode .btn-outline-dark:hover {
    color: #111827;
    background: #facc15;
    border-color: #facc15;
}

body.dark-mode .btn-outline-secondary {
    color: #cbd5e1;
    border-color: #64748b;
    background: rgba(148, 163, 184, 0.08);
}

body.dark-mode .btn-outline-secondary:hover {
    color: #ffffff;
    background: #475569;
    border-color: #64748b;
}

body.dark-mode .btn-outline-danger {
    color: #fca5a5;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.10);
}

body.dark-mode .btn-outline-danger:hover {
    color: #ffffff;
    background: #dc2626;
    border-color: #dc2626;
}

body.dark-mode .btn-warning {
    color: #111827;
    background: #facc15;
    border-color: #facc15;
}

body.dark-mode .btn-secondary {
    color: #ffffff;
    background: #475569;
    border-color: #64748b;
}

body.dark-mode .btn-success {
    color: #ffffff;
    background: #16a34a;
    border-color: #16a34a;
}

body.dark-mode .btn-danger {
    color: #ffffff;
    background: #dc2626;
    border-color: #dc2626;
}

@media (max-width: 768px) {
    .row.g-3.mb-4 > .col-6 .card {
        padding: 14px !important;
        min-height: 110px;
    }

    .row.g-3.mb-4 > .col-6 .text-muted {
        font-size: 0.85rem;
        line-height: 1.2;
    }

    .row.g-3.mb-4 > .col-6 .display-5 {
        font-size: 1.75rem;
    }
}

/* Dashboard-Menü auf Handy: 2 nebeneinander, Icon/Titel/Text untereinander */
@media (max-width: 768px) {
    /* Nur Dashboard-Menü-Karten, nicht Statistik-Karten */
    .dashboard-menu-card {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        gap: 8px;
        min-height: 128px;
        height: 100%;
        padding: 12px 8px;
    }

    .dashboard-menu-card .menu-icon {
        width: 44px;
        height: 44px;
        font-size: 1.45rem;
        border-radius: 14px;
        flex: 0 0 auto;
    }

    .dashboard-menu-card strong {
        font-size: 0.95rem;
        line-height: 1.15;
    }

	.dashboard-menu-card span {
		display: block;
		font-size: 0.78rem;
		line-height: 1.2;
		max-width: 100%;
		text-align: center;
	}

    /* Dashboard-Menü-Spalten auf 2 pro Reihe */
    .dashboard-menu-card-wrapper,
    .row.g-3.mb-4 > div:has(.dashboard-menu-card) {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Dashboard-Menü: Text wirklich mittig */
@media (max-width: 768px) {
    .dashboard-menu-card > div:not(.menu-icon) {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .dashboard-menu-card strong,
    .dashboard-menu-card span {
        width: 100%;
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }

    .dashboard-menu-card span {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .dashboard-kpi-extra {
        display: none !important;
    }
}