/* --- ZMIENNE KOLORÓW I MOTYWU --- */
:root {
    --bg-main: #0b111e;          /* Główny tło strony */
    --bg-card: #162032;          /* Tło kart i sekcji */
    --bg-card-inner: #1e2a3e;    /* Tło wewnętrznych elementów/kart */
    --bg-nav: #121a29;           /* Tło paska nawigacji */
    
    --text-primary: #ffffff;     /* Główny kolor tekstu */
    --text-secondary: #8a99ad;   /* Kolor etykiet i podtytułów */
    --text-muted: #5b6b7f;       /* Ciemniejszy tekst pomocniczy */
    
    --accent-blue: #2563eb;      /* Akcent niebieski */
    --accent-blue-hover: #1d4ed8;
    --accent-green: #10b981;     /* Status Zdolny / Aktywny */
    --accent-yellow: #f59e0b;    /* Warning / Ostrzeżenie */
    --accent-red: #ef4444;       /* Alert / Usterka / Wyloguj */
    
    --border-color: #233147;     /* Obramowania */
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;
}

/* --- RESET I PODSTAWY --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body {
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    color: #60a5fa;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* --- NAGŁÓWEK I NAWIGACJA (WYŚRODKOWANA ZAWARTOŚĆ) --- */
header, .navbar {
    width: 100%;
    background-color: var(--bg-nav);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    padding-left: calc((100% - 1200px) /2);
    padding-right: calc((100% - 1200px) /2);
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.brand:hover { color: var(--text-primary); text-decoration: none; }

.nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    list-style: none;
    margin-left: auto;
}

.nav-links a {
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-primary);
    background-color: var(--bg-card);
    text-decoration: none;
}

.btn-logout {
    background-color: var(--accent-red) !important;
    color: #ffffff !important;
    padding: 8px 16px !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-align: center;
}

.btn-logout:hover {
    opacity: 0.9;
}

/* --- GŁÓWNY KONTENER STRONY (ZAUWAŻALNIE WĘŻSZY I WYŚRODKOWANY) --- */
.container {
    width: 100%;
    max-width: 1400px; /* Zmniejszona szerokość maksymalna dla lepszego wyśrodkowania */
    margin: 2rem auto;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- KARTY PODSUMOWANIA (4 KOLUMNY W JEDNYM RZĘDZIE, WYŚRODKOWANE) --- */
.metrics-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}



.metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: center;
}

.metric-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.metric-sub {
    font-size: 0.8rem;
    font-weight: 600;
}

.metric-sub.green { color: var(--accent-green); }
.metric-sub.yellow { color: var(--accent-yellow); }
.metric-sub.red { color: var(--accent-red); }

.metric-icon {
    width: 40px;
    height: 40px;
    background-color: var(--bg-card-inner);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* --- KARTY I SEKCJE --- */
.card {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Wewnętrzne kafelki samolotów */
.inner-card {
    background-color: var(--bg-card-inner);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    text-align: center;
}

/* Pasek postępu HOBBS */
.progress-bar-bg {
    width: 100%;
    height: 6px;
    background-color: #121a29;
    border-radius: 3px;
    overflow: hidden;
    margin: 10px auto 0 auto;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--accent-blue);
    border-radius: 3px;
}

/* --- BADGE / ETYKIETY STATUSÓW --- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

.badge-zdolny, .badge-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-serwis, .badge-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-usterka, .badge-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- TABELE (WYŚRODKOWANY TEKST I ELEMENTY) --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 10px 12px;
    text-align: center; /* Wyśrodkowanie zawartości tabel */
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--bg-nav);
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

/* --- FORMULARZE I PRZYCISKI (WYŚRODKOWANE I UKIERUNKOWANE) --- */
.form-group {
    margin-bottom: 1.25rem;
    text-align: center;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-align: center;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-nav);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    text-align: center; /* Wyśrodkowany tekst w polach formularzy */
}

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    background-color: var(--accent-blue);
    color: #ffffff;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
}

/* Formularz logowania/rejestracji */
.auth-box {
    max-width: 420px;
    margin: 4rem auto;
    text-align: center;
}

/* --- INLINE FORMULARZ REZERWACJI --- */
.reservation-form-card {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* --- PASEK PLANÓWKI (WĘŻSZY) --- */
.timeline-row-interactive {
    cursor: pointer;
    position: relative;
    height: 50px; /* Zmniejszono z 70px dla węższego paska planówki */
}

.timeline-row-interactive:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.planner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
}

.planner-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
}

.planner-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.date-picker-group {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 0.9rem;
}

.date-picker-group input[type="date"] {
    background-color: #334155;
    border: 1px solid #475569;
    border-radius: 6px;
    color: #ffffff;
    padding: 8px 12px;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

.btn-new-res {
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-new-res:hover {
    background-color: #1d4ed8;
}

.timeline-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.timeline-table th, .timeline-table td {
    border: 1px solid var(--border-color, #374151);
    text-align: center;
}

.aircraft-col {
    width: 180px;
}

.hour-col {
    width: calc((100% - 180px) / <?= $total_hours ?>);
}

.timeline-grid-cell {
    position: relative;
    height: 65px;
    padding: 0;
    vertical-align: top;
}

.timeline-cell-interactive {
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.timeline-cell-interactive:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.reservation-block {
    position: absolute;
    top: 4px;
    bottom: 4px;
    background-color: #2563eb;
    color: #ffffff;
    border-radius: 4px;
    padding: 4px 6px;
    box-sizing: border-box;
    z-index: 10;
    overflow: hidden;
    font-size: 0.75rem;
    text-align: left;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 1px solid #60a5fa;
    cursor: pointer;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    color: #f8fafc;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #38bdf8;
}

.modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.25rem;
    cursor: pointer;
}

.details-box {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.details-row {
    display: flex;
    margin-bottom: 8px;
}

.details-label {
    font-weight: 600;
    width: 150px;
    color: #f8fafc;
}

.details-value {
    color: #cbd5e1;
}

.details-divider {
    border-top: 1px solid #1e293b;
    margin: 12px 0;
}

.badge-green {
    color: #4ade80;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-modal {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.btn-close { background: #475569; color: #fff; }
.btn-edit { background: #3b82f6; color: #fff; }
.btn-delete { background: #dc2626; color: #fff; }
.btn-add-flight { background: #16a34a; color: #fff; }

/* Wspólna oprawa okien modalnych */
.app-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(3, 7, 18, 0.78);
    backdrop-filter: blur(3px);
}

.app-modal-card {
    position: relative;
    width: min(100%, 760px);
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    color: var(--text-primary);
}

.app-modal-card--wide { max-width: 850px; }
.app-modal-card--compact { max-width: 500px; }

.app-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.app-modal-heading {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
}

.app-modal-close {
    display: inline-flex;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-nav);
    color: var(--text-secondary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.app-modal-close:hover {
    background: var(--bg-card-inner);
    color: var(--text-primary);
}

.app-modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.app-confirm-card { max-width: 440px; }
.app-confirm-message { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.app-confirm-cancel { background: #334155; color: #fff; }
.app-confirm-accept { background: var(--accent-red); color: #fff; }

.reservation-requirements-status.is-valid > strong { color: #34d399; }
.reservation-requirements-status.is-invalid > strong { color: #fca5a5; }

.mobile-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
}

.mobile-nav-icon,
.mobile-nav-icon::before,
.mobile-nav-icon::after {
    position: absolute;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 180ms ease, opacity 180ms ease;
}

.mobile-nav-icon::before,
.mobile-nav-icon::after {
    left: 0;
    content: "";
}

.mobile-nav-icon::before { transform: translateY(-6px); }
.mobile-nav-icon::after { transform: translateY(6px); }

.mobile-nav-backdrop { display: none; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.mobile-flights-toolbar,
.mobile-flight-summary,
.mobile-flight-list {
    display: none;
}

.aircraft-maintenance-remaining { display: none; }

.week-timeline .week-hour-column {
    position: sticky;
    left: 0;
    z-index: 30;
    align-self: stretch;
    box-shadow: 5px 0 8px rgba(0, 0, 0, 0.22);
}

@media (max-width: 600px) {
    .app-modal-overlay { padding: 0.75rem; }
    .app-modal-card { max-height: 94vh; padding: 18px; }
}

@media (max-width: 760px) {
    .navbar {
        height: auto;
        min-height: 64px;
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
        align-items: center;
    }

    .navbar .brand {
        flex: 1 1 auto;
        justify-content: flex-start;
        font-size: 1.05rem;
    }

    .navbar .nav-links {
        order: 3;
        flex: 1 0 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 4px;
        margin-left: 0;
    }

    .nav-links a { padding: 7px 9px; font-size: 13px; }
    .navbar > form { margin-left: auto !important; }

    .navbar.mobile-menu-ready { z-index: 1100; }
    .navbar.mobile-menu-ready > form { order: 1; }

    .navbar.mobile-menu-ready .mobile-nav-toggle {
        position: relative;
        z-index: 1102;
        display: inline-flex;
        order: 2;
        flex: 0 0 42px;
    }

    .navbar.mobile-menu-ready .mobile-nav-icon {
        position: relative;
    }

    .navbar.mobile-menu-open .mobile-nav-icon { background: transparent; }
    .navbar.mobile-menu-open .mobile-nav-icon::before { transform: rotate(45deg); }
    .navbar.mobile-menu-open .mobile-nav-icon::after { transform: rotate(-45deg); }

    .navbar.mobile-menu-ready .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 1101;
        display: flex;
        flex: none;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        justify-content: flex-start;
        gap: 6px;
        width: min(86vw, 320px);
        height: 100vh;
        height: 100dvh;
        margin: 0;
        padding: 76px 16px 20px;
        overflow-y: auto;
        border-left: 1px solid var(--border-color);
        background: var(--bg-nav);
        box-shadow: -16px 0 40px rgba(0, 0, 0, 0.3);
        transform: translateX(105%);
        visibility: hidden;
    }

    .navbar.mobile-menu-open .nav-links {
        transform: translateX(0);
        visibility: visible;
    }

    .navbar.mobile-menu-ready .nav-links li { width: 100%; }
    .navbar.mobile-menu-ready .nav-links a { display: block; text-align: left; }

    .mobile-nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1099;
        display: block;
        padding: 0;
        border: 0;
        background: rgba(3, 7, 18, 0.68);
        opacity: 0;
        visibility: hidden;
    }

    .mobile-nav-backdrop.is-visible { opacity: 1; visibility: visible; }
    body.mobile-nav-locked { overflow: hidden; }

    .container {
        width: 100%;
        max-width: 100%;
        margin: 16px auto;
        padding: 0 12px;
        align-items: stretch;
    }

    .container > *,
    .card,
    .metric-card,
    .form-card,
    .form-box {
        min-width: 0;
        max-width: 100%;
    }

    .card { padding: 16px; }
    .metrics-grid,
    .dashboard-grid,
    .admin-grid,
    .profile-grid,
    .form-grid,
    .form-grid-2,
    .form-grid-3,
    .form-grid-4,
    .form-row {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .container [style*="grid-template-columns"],
    .app-modal-card [style*="grid-template-columns"] {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .filters-panel { align-items: stretch; }
    .filter-group { min-width: min(100%, 180px); }
    .top-bar,
    .planner-header,
    .lib-header { align-items: stretch; }

    .details-row { flex-wrap: wrap; gap: 4px 8px; }
    .details-label { width: auto; min-width: 0 !important; flex: 0 0 100%; }
    .details-value { min-width: 0; width: 100%; }

    .container table:not(.timeline-table) {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .timeline-wrapper { max-width: 100%; }
    .timeline-table { display: table; width: 950px !important; min-width: 950px !important; }

    .day-timeline .timeline-table .aircraft-col {
        position: sticky;
        left: 0;
        z-index: 12;
        width: 180px !important;
        min-width: 180px !important;
        background: var(--bg-nav);
        box-shadow: 5px 0 8px rgba(0, 0, 0, 0.22);
    }

    .day-timeline .timeline-table thead .aircraft-col { z-index: 14; }

    .day-timeline.is-scrolled .timeline-table .aircraft-col {
        width: 76px !important;
        min-width: 76px !important;
        max-width: 76px;
        padding: 6px !important;
    }

    .day-timeline.is-scrolled .timeline-table thead .aircraft-col {
        overflow: hidden;
        font-size: 0;
    }

    .day-timeline.is-scrolled .timeline-table thead .aircraft-col::after {
        content: 'Rej.';
        color: var(--text-secondary);
        font-size: 11px;
    }

    .day-timeline.is-scrolled .aircraft-info-cell > :not(strong):not(.aircraft-maintenance-remaining) { display: none !important; }
    .day-timeline .aircraft-info-cell > strong { white-space: nowrap; }

    .day-timeline.is-scrolled .aircraft-maintenance-remaining {
        display: block;
        margin-top: 3px;
        color: var(--text-secondary);
        font-size: 10px;
        line-height: 1.15;
        white-space: normal;
    }

    .app-modal-overlay { align-items: flex-start; }
    .app-modal-card { width: 100%; max-height: calc(100dvh - 24px); }
    .app-modal-actions { justify-content: stretch; }
    .app-modal-actions > button,
    .app-modal-actions > form,
    .app-modal-actions > form > button { flex: 1 1 120px; }

    .form-card { padding: 18px; }
    .metric-card { padding: 16px; }
    .welcome-banner { padding: 16px; }

    body.flights-page { background: var(--bg-main); }
    body.flights-page .container { padding-right: 0; padding-left: 0; }
    body.flights-page .top-bar { display: none; }
    body.flights-page .table-responsive { display: none !important; }

    .mobile-flights-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin: 22px 16px 0;
        color: var(--text-primary);
    }

    .mobile-flights-toolbar h1 {
        margin: 0;
        font-size: 20px;
        font-weight: 600;
    }

    .mobile-filter-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border: 1px solid var(--border-color);
        border-radius: 50%;
        background: var(--bg-card);
        color: #60a5fa;
    }

    .mobile-filter-icon {
        display: block;
        width: 18px;
        height: 16px;
        background: currentColor;
        clip-path: polygon(0 0, 100% 0, 62% 45%, 62% 100%, 40% 100%, 40% 45%);
    }

    .mobile-flight-summary {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: center;
        gap: 4px;
        min-height: 132px;
        margin: 22px 16px 24px;
        padding: 20px 8px;
        border: 1px solid #233147;
        border-radius: 16px;
        background: #162032;
        color: #fff;
        text-align: center;
    }

    .mobile-flight-summary > div {
        display: flex;
        min-width: 0;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .mobile-flight-summary strong {
        font-size: 28px;
        font-weight: 400;
        line-height: 1.1;
        white-space: nowrap;
    }

    .mobile-flight-summary span {
        color: #aab5c5;
        font-size: 10px;
        line-height: 1.3;
    }

    .mobile-filters-toolbar + .filters-panel,
    .filters-panel:not(.mobile-filters-open) {
        display: none !important;
    }

    .filters-panel.mobile-filters-open {
        display: flex !important;
        margin: 0 16px 22px;
        width: auto;
        background: #162032;
    }

    .mobile-flight-list {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0 16px 28px;
        color: var(--text-primary);
    }

    .mobile-date-divider {
        display: flex;
        align-items: center;
        gap: 12px;
        margin: 10px 0 2px;
        color: var(--text-primary);
        font-size: 15px;
        font-weight: 600;
        white-space: nowrap;
    }

    .mobile-date-divider::before,
    .mobile-date-divider::after {
        height: 1px;
        flex: 1;
        background: var(--text-muted);
        content: "";
    }

    .mobile-flight-card {
        display: flex;
        min-width: 0;
        min-height: 190px;
        flex-direction: column;
        justify-content: space-between;
        gap: 18px;
        margin: 14px 0 24px;
        padding: 20px;
        border: 1px solid var(--border-color);
        border-radius: 17px;
        background: var(--bg-card);
        cursor: pointer;
    }

    .mobile-flight-card:focus-visible {
        outline: 2px solid #38bdf8;
        outline-offset: 3px;
    }

    .mobile-flight-preview {
        color: var(--text-primary);
    }

    .mobile-preview-route {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(90px, 1.15fr) minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        margin-bottom: 20px;
        padding: 14px 12px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        background: var(--bg-nav);
    }

    .mobile-preview-route > div {
        display: flex;
        min-width: 0;
        flex-direction: column;
        gap: 5px;
    }

    .mobile-preview-route > div:last-child { align-items: flex-end; text-align: right; }

    .mobile-preview-route strong {
        overflow: hidden;
        color: var(--text-primary);
        font-size: 21px;
        font-weight: 500;
        text-overflow: ellipsis;
    }

    .mobile-preview-route time { color: var(--text-secondary); font-size: 12px; }

    .mobile-preview-route .mobile-preview-route-center {
        align-items: center;
        text-align: center;
    }

    .mobile-preview-route-center strong { font-size: 16px; white-space: nowrap; }
    .mobile-preview-route-center span,
    .mobile-preview-route-center small { color: var(--text-secondary); font-size: 11px; white-space: nowrap; }

    .mobile-flight-detail-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 16px;
        margin: 0;
    }

    .mobile-flight-detail-grid > div {
        min-width: 0;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-color);
    }

    .mobile-flight-detail-grid dt {
        margin-bottom: 3px;
        color: var(--text-secondary);
        font-size: 11px;
    }

    .mobile-flight-detail-grid dd {
        margin: 0;
        overflow-wrap: anywhere;
        color: var(--text-primary);
        font-size: 13px;
    }

    .mobile-flight-detail-grid .mobile-flight-detail-wide { grid-column: 1 / -1; }

    .mobile-flight-preview-actions { justify-content: stretch; }
    .mobile-flight-preview-actions > button,
    .mobile-flight-preview-actions > a { flex: 1 1 120px; text-align: center; text-decoration: none; }

    .mobile-flight-meta {
        overflow: hidden;
        color: var(--text-primary);
        font-size: 14px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-flight-meta span { padding: 0 3px; color: var(--text-secondary); }

    .mobile-flight-route {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(82px, 1.3fr) minmax(0, 1fr);
        align-items: center;
        gap: 4px;
        min-width: 0;
    }

    .mobile-airport {
        display: flex;
        min-width: 0;
        flex-direction: column;
        gap: 8px;
    }

    .mobile-airport strong {
        overflow: hidden;
        color: var(--text-primary);
        font-size: 31px;
        font-weight: 400;
        line-height: 1;
        text-overflow: clip;
    }

    .mobile-airport time { color: var(--text-secondary); font-size: 15px; }
    .mobile-airport-arrival { align-items: flex-end; text-align: right; }

    .mobile-flight-middle {
        display: flex;
        min-width: 0;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        text-align: center;
    }

    .mobile-flight-stats {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        color: var(--text-primary);
        font-size: 15px;
        white-space: nowrap;
    }

    .mobile-landing-count { display: inline-flex; align-items: center; gap: 3px; }
    .mobile-landing-icon { color: #60a5fa; font-size: 17px; line-height: 1; }
    .mobile-flight-type { color: var(--text-secondary); font-size: 11px; white-space: nowrap; }

    .mobile-flight-actions {
        display: flex;
        justify-content: flex-end;
        gap: 16px;
        padding-top: 10px;
        border-top: 1px solid var(--border-color);
        font-size: 12px;
    }

    .mobile-flight-actions a { color: #60a5fa; }
    .mobile-flight-actions a:last-child { color: #ef4444; }
    .mobile-flights-empty { color: var(--text-secondary); text-align: center; }
    body.flights-page .pagination-bar { flex-direction: column; gap: 12px; }
}

@media (max-width: 420px) {
    .navbar .brand { font-size: 0.95rem; }
    .nav-links a { padding: 6px 7px; font-size: 12px; }
    .container { padding-right: 10px; padding-left: 10px; }
    .app-modal-overlay { padding: 8px; }
    .app-modal-card { padding: 14px; }
    .mobile-flight-summary { min-height: 118px; margin-right: 12px; margin-left: 12px; }
    .mobile-flight-summary strong { font-size: 24px; }
    .mobile-flight-summary span { font-size: 9px; }
    .mobile-flight-list { padding-right: 12px; padding-left: 12px; }
    .mobile-flight-card { padding: 16px; }
    .mobile-flight-route { grid-template-columns: minmax(0, 1fr) minmax(74px, 1.15fr) minmax(0, 1fr); }
    .mobile-airport strong { font-size: 27px; }
    .mobile-airport time { font-size: 13px; }
    .mobile-flight-stats { gap: 4px; font-size: 13px; }
    .mobile-preview-route { grid-template-columns: minmax(0, 1fr) minmax(78px, 1.1fr) minmax(0, 1fr); gap: 4px; padding: 12px 8px; }
    .mobile-preview-route strong { font-size: 18px; }
    .mobile-preview-route-center strong { font-size: 14px; }
    .mobile-flight-detail-grid { gap: 0 10px; }
    .login-card { padding: 24px; }
    .app-modal-actions > button,
    .app-modal-actions > form,
    .app-modal-actions > form > button { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-nav-icon,
    .mobile-nav-icon::before,
    .mobile-nav-icon::after,
    .navbar.mobile-menu-ready .nav-links,
    .mobile-nav-backdrop {
        transition-duration: 0.01ms;
    }
}