:root {
    --mlt-navy: #1e3a5f;
    --mlt-navy-hover: #2d4f7a;
    --mlt-orange: #f97316;
    --mlt-orange-dark: #ea580c;
    --mlt-slate: #4b5563;
    --mlt-bg: #f1f5f9;
    --mlt-card-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
    --mlt-radius: 12px;
    --bs-primary: #1e3a5f;
    --bs-primary-rgb: 30, 58, 95;
    --bs-link-color: #1e3a5f;
    --bs-link-hover-color: #2d4f7a;
    --bs-border-radius: 0.5rem;
    --bs-border-radius-lg: var(--mlt-radius);
}

body {
    background-color: var(--mlt-bg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1e293b;
}

/* Logo */
.app-logo-bar {
    background: #000;
    text-align: center;
    padding: 0.5rem 1rem;
    line-height: 0;
}
.app-logo-link { display: inline-block; text-decoration: none; }
.app-logo-img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.app-logo-bar--default .app-logo-img { max-height: 48px; width: auto; }
.app-logo-bar--large { padding: 1rem; }
.app-logo-bar--large .app-logo-img { max-height: 80px; width: auto; }
.app-logo-bar--compact { padding: 0.35rem 0.75rem; }
.app-logo-bar--compact .app-logo-img { max-height: 36px; width: auto; }
.home-dashboard-logo .app-logo-bar,
.auth-card .app-logo-bar,
.card .app-logo-bar {
    background: transparent;
    padding: 0;
}
.home-dashboard-logo .app-logo-img { max-height: 72px; }
.auth-card .app-logo-img { max-height: 64px; }

/* Navbar */
.app-navbar {
    background: var(--mlt-navy) !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}
.app-navbar .navbar-brand { padding: 0; }
.app-navbar .navbar-brand-logo { max-height: 36px; width: auto; }
.app-navbar .nav-link {
    color: rgba(255, 255, 255, 0.88);
    font-weight: 500;
    padding: 0.5rem 0.75rem !important;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus { color: #fff; background: rgba(255, 255, 255, 0.1); }
.app-navbar .nav-link.active {
    color: #111827;
    background: var(--mlt-orange);
    font-weight: 600;
}
.app-navbar .navbar-text { color: rgba(255, 255, 255, 0.75); font-size: 0.875rem; }
.app-navbar .btn-logout {
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}
.app-navbar .btn-logout:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #fff;
    color: #fff;
}

/* Main layout */
.app-main {
    padding-top: 1.25rem;
    padding-bottom: 2rem;
}
.app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}
.inspection-main { max-width: none; padding-left: 0; padding-right: 0; }

/* Page header */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.page-header-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--mlt-navy);
    margin: 0;
    line-height: 1.3;
}
.page-header-subtitle {
    color: #64748b;
    font-size: 0.95rem;
    margin: 0.25rem 0 0;
}
.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Cards */
.app-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--mlt-radius);
    box-shadow: var(--mlt-card-shadow);
    overflow: hidden;
}
.app-card-header {
    padding: 0.85rem 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    color: var(--mlt-navy);
}
.app-card-header-primary {
    background: var(--mlt-navy);
    color: #fff;
    border-bottom: none;
}
.app-card-body { padding: 1.25rem; }

/* Buttons */
.btn-primary {
    background-color: var(--mlt-navy);
    border-color: var(--mlt-navy);
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--mlt-navy-hover);
    border-color: var(--mlt-navy-hover);
}
.btn-accent {
    background: var(--mlt-orange);
    border-color: var(--mlt-orange);
    color: #111827;
    font-weight: 600;
}
.btn-accent:hover {
    background: var(--mlt-orange-dark);
    border-color: var(--mlt-orange-dark);
    color: #111827;
}
.btn-touch {
    min-height: 44px;
    padding: 0.6rem 1rem;
}

/* Forms */
.form-label { font-weight: 600; color: #334155; font-size: 0.9rem; }
.form-control:focus,
.form-select:focus {
    border-color: var(--mlt-navy);
    box-shadow: 0 0 0 0.2rem rgba(30, 58, 95, 0.15);
}
.input-hint { font-size: 0.8rem; color: #64748b; margin-top: 0.25rem; }

/* Alerts */
.alert { border: none; border-radius: 10px; }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger { background: #fef2f2; color: #991b1b; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: #64748b;
}
.empty-state i {
    font-size: 2.5rem;
    color: #cbd5e1;
    display: block;
    margin-bottom: 0.75rem;
}
.empty-state a { font-weight: 600; }

/* Customer / list tiles */
.customer-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}
.customer-tile:last-child { border-bottom: none; }
.customer-tile:hover { background: #f8fafc; color: inherit; }
.customer-tile-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #e0f2fe;
    color: var(--mlt-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.25rem;
}
.customer-tile-body { flex: 1; min-width: 0; }
.customer-tile-title { font-weight: 600; color: #0f172a; margin: 0; }
.customer-tile-meta { font-size: 0.85rem; color: #64748b; margin: 0.15rem 0 0; }

/* Tables */
.table-app thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    font-weight: 600;
    border-bottom-width: 1px;
    background: #f8fafc;
}
.table-app tbody tr { transition: background 0.12s; }
.table-app tbody tr:hover { background: #f8fafc; }
.table-actions { white-space: nowrap; }
@media (max-width: 767.98px) {
    .table-actions .btn { margin-bottom: 0.25rem; }
}

/* Auth page */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(165deg, #e2e8f0 0%, #f1f5f9 50%, #fff 100%);
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: var(--mlt-radius);
    box-shadow: var(--mlt-card-shadow);
    padding: 2rem 1.75rem;
    border: 1px solid #e2e8f0;
}
.auth-card h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--mlt-navy);
    text-align: center;
    margin-bottom: 1.25rem;
}

/* Home dashboard */
.home-dashboard-page .app-main { padding: 0; max-width: none; }
.home-dashboard {
    min-height: calc(100vh - 2rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(165deg, #e2e8f0 0%, #f1f5f9 45%, #fff 100%);
}
.home-dashboard-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--mlt-card-shadow);
    padding: 2.5rem 2rem;
    max-width: 440px;
    width: 100%;
    border: 1px solid #e2e8f0;
}
.home-dashboard-logo { text-align: center; margin-bottom: 1.75rem; }
.home-dashboard-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--mlt-navy);
    margin: 0.5rem 0 0;
}
.home-dashboard-tagline {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0.35rem 0 0;
}
.home-dashboard-actions { display: flex; flex-direction: column; gap: 0.65rem; }
.home-action-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.15rem;
    background: var(--mlt-navy);
    color: #fff;
    text-decoration: none;
    border-radius: var(--mlt-radius);
    font-weight: 600;
    transition: background 0.2s, transform 0.12s, box-shadow 0.2s;
    border: none;
}
.home-action-btn:hover {
    background: var(--mlt-navy-hover);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 58, 95, 0.25);
}
.home-action-btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.home-action-btn-text { flex: 1; text-align: left; }
.home-action-btn-text strong { display: block; font-size: 1rem; }
.home-action-btn-text small {
    display: block;
    font-weight: 400;
    opacity: 0.85;
    font-size: 0.8rem;
    margin-top: 0.1rem;
}
.home-action-btn--accent { background: var(--mlt-orange); color: #111827; }
.home-action-btn--accent:hover {
    background: var(--mlt-orange-dark);
    color: #111827;
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.35);
}
.home-action-btn--accent .home-action-btn-icon { background: rgba(0, 0, 0, 0.08); }
.home-dashboard-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}
.home-dashboard-footer a {
    color: #64748b;
    font-size: 0.875rem;
    text-decoration: none;
}
.home-dashboard-footer a:hover { color: var(--mlt-navy); }

/* Inspection layout */
.inspection-page-header {
    background: var(--mlt-navy);
    color: #fff;
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 1020;
}
.inspection-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
}
.inspection-header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    flex-shrink: 0;
    min-width: 90px;
}
.inspection-header-datetime { font-size: 0.78rem; opacity: 0.92; }
.inspection-header-close {
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    margin-top: 0.2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.12);
}
.inspection-header-close:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.inspection-page-title {
    font-size: 1.05rem;
    font-weight: 600;
    flex: 1;
    text-align: center;
    margin: 0;
}
.inspection-header-right { flex-shrink: 0; display: flex; gap: 0.5rem; }
.inspection-header-spacer { width: 72px; }

.inspection-layout {
    display: flex;
    min-height: calc(100vh - 100px);
}
.inspection-sidebar {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 64px;
    background: var(--mlt-slate);
    border-right: 1px solid #374151;
    padding: 0.5rem 0;
}
.inspection-sidebar .sidebar-nav-section-title {
    padding: 0 0.5rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 0.35rem;
    text-align: center;
}
.inspection-sidebar .sidebar-nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 0.5rem;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 0.8rem;
    border-radius: 0;
}
.inspection-sidebar .sidebar-nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}
.inspection-sidebar .sidebar-nav-text { display: none; }
.inspection-sidebar .sidebar-nav-link.active {
    background: var(--mlt-orange);
    color: #111827;
    font-weight: 600;
}
.inspection-sidebar .sidebar-logo-watermark {
    margin-top: auto;
    padding: 0.75rem;
    text-align: center;
    opacity: 0.35;
}
.inspection-sidebar .sidebar-logo-watermark img {
    max-width: 100%;
    max-height: 32px;
    filter: brightness(1.2);
}
.inspection-content {
    flex: 1;
    min-width: 0;
    padding: 1rem;
    background: #fff;
}

.customer-card-block {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: #f8fafc;
    border-radius: var(--mlt-radius);
    border: 1px solid #e2e8f0;
    margin-bottom: 1rem;
}
.customer-logo-box {
    width: 72px;
    height: 72px;
    min-width: 72px;
    background: #dbeafe;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--mlt-navy);
}
.customer-logo-box i { font-size: 1.75rem; }
.customer-logo-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 0.2rem;
}
.customer-details .customer-name { font-weight: 700; font-size: 1.1rem; }
.customer-details div { font-size: 0.9rem; color: #475569; line-height: 1.5; }

.info-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--mlt-radius);
    padding: 1rem 1rem 1rem 2.75rem;
    position: relative;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: #78350f;
}
.info-box .info-box-icon {
    position: absolute;
    left: 1rem;
    top: 1rem;
    color: var(--mlt-orange);
    font-size: 1.2rem;
}

.pdf-config-card {
    background: #fff;
    border-radius: var(--mlt-radius);
    border: 1px solid #e2e8f0;
    padding: 1rem;
    margin-bottom: 1rem;
}
.pdf-filename-display {
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
    background: #f8fafc;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    word-break: break-all;
}

.tablet-row { cursor: pointer; }
.tablet-row:hover { background-color: #f0f9ff; }
.status-buttons .btn { min-width: 80px; }

.form-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid #e2e8f0;
}
.form-section-title:first-child { margin-top: 0; }

.search-box {
    position: relative;
    margin-bottom: 1rem;
}
.search-box i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}
.search-box input { padding-left: 2.5rem; }

/* Inspection edit tabs */
.inspection-tabs .nav-link {
    font-weight: 600;
    color: #475569;
}
.inspection-tabs .nav-link.active {
    color: var(--mlt-navy);
    border-bottom-color: var(--mlt-orange);
}
.status-buttons .btn-check:checked + .btn-outline-secondary {
    background-color: var(--mlt-navy);
    border-color: var(--mlt-navy);
    color: #fff;
}

/* Checklist (Prüfprotokolle) – MLT colors + G / O / R */
.checklist-meta-item { display: flex; flex-direction: column; gap: 0.15rem; }
.checklist-meta-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}
.checklist-meta-label i { margin-right: 0.2rem; color: var(--mlt-navy); }
.checklist-meta-value { font-weight: 600; color: var(--mlt-navy); font-size: 0.95rem; }
.checklist-stats { display: flex; gap: 0.35rem; margin-top: 0.15rem; }
.checklist-stat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
}
/* G = Grün, O = Orange, R = Rot (wie PDF Gefahrenstufen) */
.checklist-stat-ok { background: #dcfce7; color: #2e7d32; border: 1px solid #86efac; }
.checklist-stat-mangel { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.checklist-stat-offen { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.checklist-stat-hint { margin-top: 0.25rem; text-align: center; }
.checklist-title { color: var(--mlt-navy); }
.checklist-add-header {
    cursor: pointer;
    user-select: none;
}
.checklist-add-header:hover { filter: brightness(1.08); }
.checklist-add-chevron { transition: transform 0.2s ease; font-size: 0.85rem; color: rgba(255, 255, 255, 0.85); }
.checklist-add-header[aria-expanded="false"] .checklist-add-chevron { transform: rotate(-90deg); }
.checklist-table-card { overflow: hidden; }
/* Table header: same as rest of app (table-app light grey) */
.checklist-table thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.65rem 0.85rem;
}
.checklist-category-row td {
    background: linear-gradient(90deg, rgba(30, 58, 95, 0.08) 0%, #f8fafc 100%);
    color: var(--mlt-navy);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.5rem 0.85rem;
    border-top: 2px solid var(--mlt-orange);
    border-bottom: 1px solid #e2e8f0;
}
.checklist-category-row .badge {
    background: var(--mlt-navy) !important;
    font-weight: 600;
}
.checklist-category-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.checklist-category-label {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.checklist-category-remove-btn {
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    white-space: nowrap;
}
.checklist-item-row td {
    vertical-align: top;
    padding: 0.75rem 0.85rem;
    border-color: #e2e8f0;
}
.checklist-item-row.row-status-ok { background: rgba(46, 125, 50, 0.04); }
.checklist-item-row.row-status-mangel { background: rgba(198, 40, 40, 0.04); }
.checklist-item-row.row-status-offen { background: rgba(230, 81, 0, 0.04); }
.checklist-item-row:hover { background: #f0f9ff !important; }
.checklist-cat-cell { color: transparent !important; font-size: 0 !important; }
.checklist-point-cell { color: #1e293b; }
.checklist-photo-link { color: var(--mlt-navy); text-decoration: none; }
.checklist-photo-link:hover { color: var(--mlt-orange-dark); text-decoration: underline; }
.checklist-photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.checklist-photo-actions .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}
.checklist-photo-name { word-break: break-all; }
.status-buttons-compact .btn { min-width: 4.5rem; font-size: 0.78rem; padding: 0.25rem 0.5rem; }
.checklist-panel .status-buttons .btn-check:checked + .btn-outline-secondary {
    background-color: var(--mlt-navy);
    border-color: var(--mlt-navy);
    color: #fff;
}
.checklist-form-actions {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

@media (min-width: 576px) {
    .inspection-sidebar {
        width: 210px;
        min-width: 210px;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    .inspection-sidebar .sidebar-nav-section-title { text-align: left; padding: 0 0.75rem; }
    .inspection-sidebar .sidebar-nav-link {
        justify-content: flex-start;
        padding: 0.5rem 0.75rem;
        border-radius: 8px;
        margin: 0 0.35rem;
    }
    .inspection-sidebar .sidebar-nav-text { display: inline; }
}

@media (min-width: 768px) {
    .inspection-sidebar { width: 240px; min-width: 240px; }
    .inspection-content { padding: 1.25rem 1.5rem; }
    .inspection-page-title { font-size: 1.2rem; }
}

@media (max-width: 767.98px) {
    .form-control, .form-select, .btn-touch { font-size: 1rem; padding: 0.75rem; }
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header-actions { width: 100%; }
    .page-header-actions .btn { flex: 1; }
}
