/* ════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════ */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

html, body {
    height: 100%;
    background: #020202; 
    color: #fff;
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    text-transform: uppercase;
}

/* ÉP FONT TIẾNG VIỆT CHO CÁC KHỐI */
html[lang="vi"] .top-dashboard,
html[lang="vi"] .top-dashboard *:not(.col-std):not(.col-dest):not(.col-term):not(.col-flight):not(.col-reg):not(.col-airline):not(.col-gate):not(.col-remark):not(.col-status):not(.airline-logo):not(.date-divider),
html[lang="vi"] .modal-card,
html[lang="vi"] .modal-overlay {
    font-family: 'Be Vietnam Pro', 'Share Tech Mono', sans-serif;
}

html[lang="vi"] .clock,
html[lang="vi"] .airport-titles h2,
html[lang="vi"] .fd-flight-number,
html[lang="vi"] .fd-airport-iata,
html[lang="vi"] .fd-time-value,
html[lang="vi"] .ap-stat-value,
html[lang="vi"] .m-time,
html[lang="vi"] .logo-iata {
    font-family: 'Orbitron', monospace;
}

/* popup buttons (☆ FAV FLIGHT · CHIA SẺ · THẺ · LỊCH): Share Tech Mono has no Vietnamese
   letters, so a word came out in two fonts */
html[lang="vi"] .fd-btn {
    font-family: 'Be Vietnam Pro', sans-serif;
    letter-spacing: .04em;
}

html[lang="vi"] .col-status,
html[lang="vi"] .m-status-text,
html[lang="vi"] .fd-status-badge,
html[lang="vi"] .ap-fl-status {
    font-family: 'Be Vietnam Pro', Arial, sans-serif;
    letter-spacing: 0px;
}

html[lang="vi"] .fids-table thead th {
    font-family: 'Be Vietnam Pro', 'Share Tech Mono', sans-serif;
    letter-spacing: 1px;
    font-weight: 600;
}

@media (min-width: 769px) {
    html, body { 
        overflow: hidden; 
    }
}

/* ════════════════════════════════════════
   LAYOUT
════════════════════════════════════════ */
.app-wrapper { 
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
}

.top-dashboard { 
    flex-shrink: 0; 
    padding: 8px 20px 0; 
    background: #020202; 
    border-bottom: 2px solid #181818; 
}

/* ════════════════════════════════════════
   LANGUAGE SWITCHER
════════════════════════════════════════ */
.lang-switcher {
    display: flex; 
    gap: 6px; 
    justify-content: flex-end;
    padding-bottom: 6px; 
    border-bottom: 1px solid #111;
    margin-bottom: 8px;
}

.lang-btn {
    font-family: 'Share Tech Mono'; 
    font-size: 11px; 
    letter-spacing: 1px;
    color: #444; 
    cursor: pointer; 
    padding: 3px 8px;
    border: 1px solid #1e1e1e; 
    display: flex; 
    align-items: center; 
    gap: 4px;
    transition: all .2s;
}

.lang-btn img { 
    width: 16px; 
    height: 11px; 
    object-fit: cover; 
}

.lang-btn:hover { 
    color: #aaa; 
    border-color: #444; 
}

.lang-btn.active { 
    color: #00e5ff; 
    border-color: #00e5ff; 
    background: rgba(0,229,255,.06); 
}

.stats-top-btn {
    margin-right: 6px;
    padding: 4px 10px;
    background: #0a3d4d;
    border: 1px solid #00d8f0;
    border-radius: 4px;
    color: #00d8f0;
    cursor: pointer;
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    line-height: 1.1;
}

/* ════════════════════════════════════════
   HEADER
════════════════════════════════════════ */
.fids-header {
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start;
    padding-bottom: 8px; 
    margin-bottom: 8px;
    gap: 16px;
}

.header-left { 
    display: flex; 
    align-items: flex-start; 
    gap: 14px; 
    flex: 1 1 auto;
    min-width: 0;
}

.airport-logo-wrap { 
    display: flex; 
    align-items: center; 
}

.logo-fallback { 
    display: flex;
    flex-direction: column; 
    align-items: center; 
    border: 2px solid #2a2a2a; 
    padding: 4px 10px; 
    gap: 1px; 
}

.logo-iata { 
    font-family: 'Orbitron'; 
    font-size: 20px; 
    font-weight: 900; 
    color: #fff; 
    letter-spacing: 3px; 
}

.logo-sub { 
    font-size: 8px; 
    color: #555; 
    letter-spacing: 2px; 
}

.airport-titles { 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    flex: 1 1 auto;
    min-width: 0;
}

.airport-titles h1 { 
    font-size: 11px; 
    color: #555; 
    letter-spacing: 3px; 
}

.airport-titles h2 { 
    font-family: 'Orbitron'; 
    font-size: 26px; 
    margin-top: 3px; 
    letter-spacing: 5px; 
    font-weight: 900; 
}

.departures-title { 
    color: #f1c40f; 
    text-shadow: 0 0 20px rgba(241,196,15,.25); 
}

.arrivals-title { 
    color: #2ecc71; 
    text-shadow: 0 0 20px rgba(46,204,113,.25); 
}

.top-weather {
    font-size: clamp(10px, 0.9vw, 13px); 
    color: #00d8f0; 
    margin-top: 6px;
    font-family: 'Share Tech Mono', monospace; 
    letter-spacing: .5px; 
    text-transform: none;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: clip;
}

html[lang="vi"] .top-weather { 
    font-family: 'Be Vietnam Pro', sans-serif; 
    font-size: 12px; 
    letter-spacing: 0; 
}

.header-right { 
    text-align: right; 
    display: flex; 
    flex-direction: column; 
    align-items: flex-end; 
    justify-content: flex-start; 
    flex: 0 0 auto;
}

.clock { 
    font-family: 'Orbitron'; 
    font-size: 32px; 
    font-weight: 700; 
    color: #fff; 
    letter-spacing: 3px; 
    text-shadow: 0 0 12px rgba(255,255,255,.2); 
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mode-switch { 
    display: flex; 
    flex-wrap: nowrap; 
    align-items: center; 
    gap: 5px; 
}

.mode-switch button {
    font-family: 'Share Tech Mono'; 
    background: #0d0d0d; 
    color: #555;
    border: 1px solid #222; 
    padding: 5px 14px; 
    cursor: pointer;
    font-size: 13px; 
    margin-left: 0; 
    letter-spacing: 1px; 
    transition: all .2s;
    white-space: nowrap;
}

.mode-switch button.active { 
    background: #00e5ff; 
    color: #000; 
    font-weight: bold; 
    border-color: #00e5ff; 
    box-shadow: 0 0 10px rgba(0,229,255,.3); 
}

.mode-switch .btn-now { 
    background: transparent; 
    color: #c0392b; 
    border-color: #c0392b; 
}

html[lang="vi"] .mode-switch .btn-now {
    font-family: 'Be Vietnam Pro', sans-serif;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ════════════════════════════════════════
   FILTERS
════════════════════════════════════════ */
.top-filters { 
    display: flex; 
    justify-content: space-between; 
    padding-bottom: 8px; 
    align-items: center; 
    gap: 8px; 
}

.search-box, .dropdowns select, .select-box {
    font-family: 'Share Tech Mono'; 
    background: #060606; 
    color: #00d8f0;
    border: 1px solid #1c1c1c; 
    padding: 7px 12px; 
    font-size: 13px;
    outline: none; 
    border-radius: 0; 
    transition: border-color .2s;
    white-space: nowrap;
}

.dropdowns { 
    display: flex; 
    gap: 6px; 
    align-items: center; 
    flex-wrap: wrap; 
    justify-content: flex-end; 
}

.dropdowns select { 
    width: auto; 
    min-width: 100px; 
}

.search-box:focus, .dropdowns select:focus { 
    border-color: #00e5ff; 
}

.search-box { 
    width: 440px; 
}

.search-wrap { 
    position: relative; 
    display: inline-flex; 
    align-items: center; 
    width: 440px; 
}

.search-wrap .search-box { 
    width: 100%; 
    padding-right: 32px; 
}

.search-clear {
    position: absolute; 
    right: 0; 
    top: 0; 
    bottom: 0;
    width: 32px; 
    background: none; 
    border: none;
    color: #444; 
    font-size: 14px; 
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center;
    transition: color .2s;
    opacity: 0; 
    pointer-events: none;
}

.search-clear:hover { 
    color: #fff; 
}

.multi-select { 
    position: relative; 
    display: inline-block; 
}

.select-box { 
    cursor: pointer; 
    min-width: 130px; 
    text-align: center; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.dropdown-content {
    display: none; 
    position: absolute; 
    right: 0; 
    top: calc(100% + 4px);
    background: #050505; 
    width: 380px;          
    border: 1px solid #00e5ff;
    max-height: 60vh;      
    overflow-y: auto; 
    z-index: 200;
    box-shadow: 0 8px 30px rgba(0,0,0,.8);
}

.dropdown-content.show { 
    display: block; 
}

.dropdown-actions {
    display: flex; 
    justify-content: space-between; 
    padding: 8px;
    position: sticky; 
    top: 0; 
    background: #050505; 
    border-bottom: 1px solid #111; 
    z-index: 5;
}

.btn-apply { 
    background: #00e5ff; 
    color: #000; 
    padding: 6px 14px; 
    cursor: pointer; 
    border: none; 
    font-weight: bold; 
    font-family: inherit; 
    font-size: 13px; 
    flex: 1; 
    margin-right: 4px; 
}

.btn-clear { 
    background: #922b21; 
    color: #fff; 
    padding: 6px 14px; 
    cursor: pointer; 
    border: none; 
    font-family: inherit; 
    font-size: 13px; 
    flex: 1; 
}

.airline-cb-container {
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 9px 12px;
    border-bottom: 1px solid #0d0d0d; 
    cursor: pointer; 
    font-size: 13px; 
    color: #aaa; 
    transition: background .15s;
}

.airline-name-text {
    white-space: normal; 
    line-height: 1.4;
    flex: 1;
    word-break: break-word;
}

.airline-cb-container:hover { 
    background: #0a0a0a; 
    color: #e0e0e0; 
}

.airline-cb-container input { 
    cursor: pointer; 
    accent-color: #00e5ff; 
    flex-shrink: 0; 
    width: 14px; 
    height: 14px; 
}

.airline-filter-logo { 
    width: 28px; 
    height: 28px; 
    object-fit: contain; 
    background: #fff; 
    padding: 2px; 
    flex-shrink: 0; 
    border-radius: 4px; 
    box-shadow: 0 1px 4px rgba(0,0,0,.5); 
}

.airline-filter-iata { 
    width: 26px; 
    height: 26px; 
    background: #111; 
    border: 1px solid #222; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 9px; 
    color: #555; 
    flex-shrink: 0; 
}

/* ════════════════════════════════════════
   DESKTOP TABLE
════════════════════════════════════════ */
.table-container {
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 0 20px;
    scrollbar-gutter: stable;
    will-change: scroll-position;
    transform: translateZ(0); 
}

.table-container::-webkit-scrollbar { 
    width: 5px; 
}

.table-container::-webkit-scrollbar-track { 
    background: #040404; 
}

.table-container::-webkit-scrollbar-thumb { 
    background: #1e1e1e; 
    border-radius: 3px; 
}

.fids-table { 
    width: 100%; 
    border-collapse: collapse; 
    table-layout: fixed; 
}

.fids-table thead th {
    position: sticky; 
    top: 0; 
    z-index: 10;
    background: #020202; 
    color: #606060;
    font-size: 12px; 
    font-weight: normal; 
    letter-spacing: 3px;
    border-bottom: 2px solid #1e1e1e; 
    padding: 14px 6px 10px;
    white-space: nowrap;
}

/* 🔥 KHÓA CHIỀU CAO CỘT DESKTOP CHỐNG THÒ THỤT */
.fids-table td {
    padding: 6px; 
    border-bottom: 1px solid #0e0e0e;
    vertical-align: middle; 
    height: 72px !important;
    max-height: 72px !important;
    overflow: hidden;
}

.w-std    { width: 6%;  }
.w-dest   { width: 14%; }
.w-term   { width: 9%;  }
.w-flight { width: 11%; }
.w-reg    { width: 8%;  }
.w-airline{ width: 17%; }
.w-gate   { width: 7%;  }
.w-remark { width: 11%; }
.w-status { width: 17%; }

.col-std { 
    color: #888; 
    font-size: 26px; 
    white-space: nowrap; 
}

.col-dest { 
    color: #e8e8e8; 
    font-size: 22px; 
    white-space: normal; 
    line-height: 1.2; 
    word-break: break-word; 
}

.col-term { 
    color: #00e5ff; 
    font-size: 20px; 
    font-weight: bold; 
    white-space: normal; 
    line-height: 1.2; 
    word-break: keep-all; 
}

.col-flight { 
    color: #fff; 
    font-size: 28px; 
    font-weight: bold; 
    letter-spacing: 2px; 
    text-shadow: 0 0 4px rgba(255,255,255,.3); 
    white-space: normal; 
    line-height: 1.2; 
} 

.col-reg { 
    color: #d4a820; 
    font-size: 18px; 
    letter-spacing: 1px; 
    white-space: nowrap; 
}

.col-airline { 
    color: #909090; 
    font-size: 16px; 
    white-space: nowrap; 
    line-height: 1.2; 
    vertical-align: middle; 
}

.col-airline .airline-name { 
    display: inline-block; 
    vertical-align: middle; 
    white-space: normal; 
    word-break: break-word; 
    max-width: calc(100% - 36px); 
    cursor: pointer; 
    transition: color .15s; 
}

.col-airline .airline-name:hover { 
    color: #00e5ff; 
}

.airline-logo { 
    display: inline-block; 
    vertical-align: middle; 
    margin-right: 8px; 
    width: 26px; 
    height: 26px; 
    object-fit: contain; 
    background: #fff; 
    padding: 2px; 
    flex-shrink: 0; 
    border-radius: 5px; 
    box-shadow: 0 1px 4px rgba(0,0,0,.5); 
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.airline-logo.logo-wide {
    width: 42px;
    height: 22px;
    padding: 1px 2px;
    border-radius: 4px;
}

.col-gate { 
    white-space: nowrap; 
    padding-right: 10px; 
}

.col-gate span {
    display: inline-block;
    color: #00e5ff;
    font-size: 22px;
    vertical-align: baseline;
}

/* Gate changed: old gate crossed out in a fixed slot before the new one (empty on rows
   without a change), so the current gates line up */
.col-gate span.gate-prev {
    width: 2.6em;
    padding-right: 6px;
    text-align: right;
    color: #6b6b6b;
    font-size: 13px;
    text-decoration: line-through;
    box-sizing: border-box;
}
.col-gate span.gate-changed {
    color: #f1c40f;
}
.fd-gate-prev {
    color: #6b6b6b;
    text-decoration: line-through;
    margin-right: 8px;
    font-size: .8em;
}

.col-remark { 
    font-size: 17px; 
    letter-spacing: 1px; 
    font-weight: bold; 
    white-space: normal; 
    line-height: 1.3; 
    word-break: break-word; 
}

.col-status { 
    font-size: 19px; 
    white-space: normal; 
    line-height: 1.3; 
    word-break: break-word; 
}

/* 🔥 TÁI CẤU TRÚC STATUS CHỐNG ĐÈ CHỮ VÀ KHÓA CHẤM TRÒN */
.col-status-cell { 
    display: flex !important; 
    align-items: center !important; 
    justify-content: flex-start !important;
    gap: 8px !important; 
    width: 100%;
}
.col-status-cell > div:nth-child(1) {
    flex-shrink: 0 !important;
}
.col-status-cell > div:nth-child(2) {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    word-break: keep-all !important;
}
.col-status-cell > div:nth-child(3) {
    flex-shrink: 0 !important;
    margin-left: auto !important;
}

/* ĐỒNG BỘ CỘT REMARK */
.col-remark > div {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}
.col-remark > div > div:nth-child(1) {
    flex-shrink: 0 !important;
}

/* 🔥 KHÓA CHIỀU CAO DÒNG BẢNG ĐIỆN DESKTOP CHỐNG THÒ THỤT */
.fids-table tbody tr { 
    height: 72px !important;
    max-height: 72px !important;
    will-change: background-color; 
}

.fids-table tbody tr[data-timestamp] { 
    cursor: pointer; 
    transition: background .12s; 
}

.fids-table tbody tr[data-timestamp]:nth-child(even) { 
    background-color: #0b0b0b; 
}

.fids-table tbody tr[data-timestamp]:nth-child(odd) { 
    background-color: #020202; 
}

.fids-table tbody tr[data-timestamp]:hover { 
    background: #1a1a1a !important; 
}

.highlight-now { 
    background: rgba(0,229,255,.08) !important; 
    border-left: 3px solid #00e5ff; 
}

.date-divider td {
    background: #060d13 !important; 
    color: #00e5ff; 
    text-align: center;
    font-size: 14px; 
    font-weight: bold; 
    letter-spacing: 5px;
    padding: 8px 0; 
    border-top: 1px solid #005566; 
    border-bottom: 1px solid #005566;
}

.cargo-badge { 
    display: inline-block; 
    font-size: 9px; 
    background: rgba(241,196,15,.08); 
    color: #b8860b; 
    border: 1px solid rgba(241,196,15,.2); 
    padding: 1px 4px; 
    margin-left: 4px; 
    vertical-align: middle; 
}

.status-default   { color: #3a3a3a; }
.status-scheduled { color: #585858; }
.status-estimated { color: #4a80a8; }
.status-landed    { color: #707070; } 
.status-departed  { color: #707070; } 
.status-gateclose { color: #c0392b; }
.status-delayed   { color: #d4ac0d; }
.status-cancelled { color: #c0392b; }
.status-boarding  { color: #2ecc71; }
.status-gotogate  { color: #3fa9e0; }
.status-closed    { color: #c98a2b; }
.status-terminal  { color: #5fb3a1; }
/* last call: the text pulses so it catches the eye on the board */
.status-gateclose { animation: statusPulse 1.2s ease-in-out infinite; }
@keyframes statusPulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .status-gateclose { animation: none; } } 

.delay-dot { 
    display: inline-block; 
    width: 9px; 
    height: 9px; 
    border-radius: 50%; 
    flex-shrink: 0; 
}

.delay-dot.green  { background: #27ae60; box-shadow: 0 0 5px #27ae60; }
.delay-dot.yellow { background: #d4ac0d; box-shadow: 0 0 5px #d4ac0d; }
.delay-dot.red    { background: #c0392b; box-shadow: 0 0 5px #c0392b; }
.delay-dot.gray   { background: #707070; box-shadow: none; } 

.live-badge {
    display: inline-flex; 
    align-items: center;
    background: #8b1e1e; 
    color: #ff8080; 
    border: 1px solid #c0392b;
    font-size: 10px; 
    font-weight: bold; 
    letter-spacing: 2px;
    padding: 1px 6px; 
    flex-shrink: 0;
}

.remark-green  { color: #27ae60; }
.remark-yellow { color: #d4ac0d; }
.remark-red    { color: #c0392b; }
.remark-muted  { color: #888; }

.loading-text { 
    text-align: center !important; 
    color: #383838; 
    padding: 50px 0 !important; 
    font-size: 14px; 
    letter-spacing: 4px; 
    background: #020202 !important; 
}

html[lang="vi"] .loading-text {
    font-family: 'Be Vietnam Pro', Arial, sans-serif;
    letter-spacing: 0.8px;
}

/* ════════════════════════════════════════
   MODAL BASE (ĐÃ KHÔI PHỤC NGUYÊN TRẠNG)
════════════════════════════════════════ */
.modal-overlay {
    display: none; 
    position: fixed; 
    inset: 0;
    background: rgba(0,0,0,.88); 
    z-index: 500;
    align-items: center; 
    justify-content: center;
    backdrop-filter: blur(6px);
    overscroll-behavior: contain;
}

.modal-overlay.show { 
    display: flex; 
    animation: mFadeIn .2s ease; 
}

@keyframes mFadeIn  { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}

@keyframes mSlideUp {
    from { transform: translateY(32px) scale(0.98); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.modal-card {
    position: relative; 
    background: #060606;
    border: 1px solid #1e1e1e;
    width: min(860px, 96vw); 
    max-height: 92vh;
    overflow-y: auto; 
    padding: 26px 30px;
    box-shadow: 0 24px 70px rgba(0,0,0,.9);
    animation: mSlideUp .28s cubic-bezier(0.34, 1.1, 0.64, 1);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform-origin: top center;
    will-change: transform, opacity;
    contain: paint;
    isolation: isolate;
}

.modal-card::-webkit-scrollbar { 
    width: 4px; 
}

.modal-card::-webkit-scrollbar-thumb { 
    background: #1e1e1e; 
}

.modal-card-airline { 
    width: min(580px, 96vw); 
}

.modal-close {
    position: absolute; 
    top: 14px; 
    right: 16px;
    background: none; 
    border: 1px solid #333; 
    color: #555;
    font-size: 16px; 
    width: 30px; 
    height: 30px; 
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center;
    transition: all .2s; 
    font-family: inherit; 
    z-index: 10;
}

.modal-close:hover { 
    color: #fff; 
    border-color: #666; 
}

/* ════════════════════════════════════════
   FLIGHT DETAIL MODAL (ĐÃ KHÔI PHỤC NGUYÊN TRẠNG)
════════════════════════════════════════ */
.fd-header {
    display: flex; 
    justify-content: space-between;
    align-items: flex-start; 
    margin-bottom: 20px;
    padding-bottom: 18px; 
    border-bottom: 1px solid #111; 
    gap: 14px;
}

.fd-airline-block { 
    display: flex; 
    align-items: center; 
    gap: 14px; 
}

.fd-airline-logo { 
    width: 54px; 
    height: 54px; 
    object-fit: contain; 
    background: #fff; 
    padding: 4px; 
    border-radius: 10px; 
    box-shadow: 0 2px 10px rgba(0,0,0,.6); 
}

.fd-airline-logo.logo-wide {
    width: 100px;
    height: 42px;
    padding: 2px 4px;
    border-radius: 8px;
}

.fd-flight-number { 
    font-family: 'Orbitron'; 
    font-size: 36px; 
    font-weight: 900; 
    color: #fff; 
    letter-spacing: 3px; 
    line-height: 1; 
}

.fd-airline-name { 
    font-size: 11px; 
    color: #606060; 
    margin-top: 5px; 
    letter-spacing: 2px; 
}

.fd-reg-line {
    font-size: 12px;
    color: #d4a820;
    margin-top: 4px;
    letter-spacing: 2px;
}

/* ── Aircraft page (click a registration) ── */
.reg-link,
.fd-reg-link {
    cursor: pointer;
    text-decoration: underline dotted rgba(212,168,32,.5);
    text-underline-offset: 3px;
}
.reg-link:hover,
.fd-reg-link:hover { color: #f1c40f; }
.m-reg.reg-link { color: #6b5a1e; }
.ac-type {
    color: #9aa;
    font-size: 13px;
    letter-spacing: 1px;
    margin-top: 4px;
}
.ac-where {
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid #0a3d4d;
    background: rgba(0,229,255,.04);
    color: #00e5ff;
    font-size: 13px;
    letter-spacing: 1px;
    line-height: 1.5;
}
.ac-ground {
    margin: 2px 0 2px 24px;
    padding: 4px 10px;
    border-left: 2px dashed #2a2a2a;
    color: #6b6b6b;
    font-size: 11px;
    letter-spacing: 2px;
}
.ac-ground-tight { color: #e67e22; border-left-color: #e67e22; }
.ap-flight-row.ac-current {
    border-left-color: #f1c40f;
    background: rgba(241,196,15,.06);
}
/* Aircraft history is long: let it flow and scroll with the modal itself */
.ap-flight-list.ac-list,
#aircraft-modal .ap-flight-list.ac-list {
    max-height: none;
    overflow: visible;
}
.ac-leg.ac-phantom { opacity: .4; }

.ac-note {
    margin: 4px 0 10px;
    color: #4f5f66;
    font-size: 11px;
    letter-spacing: 1px;
    text-align: center;
}
.ac-note-warn { color: #b9770e; }

/* One leg of the full history: flight | origin | destination | status */
.ac-leg {
    display: grid;
    grid-template-columns: 90px 1fr 1fr 150px;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #080808;
    border-left: 2px solid transparent;
    cursor: pointer;
    transition: background .15s;
}
.ac-leg:hover { background: #0e0e0e; }
.ac-leg.ac-nrt { border-left-color: #00a8c0; background: rgba(0,229,255,.03); }
.ac-leg.ac-current { border-left-color: #f1c40f; background: rgba(241,196,15,.06); }
.ac-leg.ac-live .ac-leg-num { color: #00e5ff; }
.ac-leg-num {
    color: #f0f0f0;
    font-size: 15px;
    letter-spacing: 1px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-start;
}
.ac-leg-num .live-badge { font-size: 9px; }
.ac-leg-ap { min-width: 0; line-height: 1.3; }
.ac-leg-ap b {
    font-family: 'Orbitron';
    font-size: 16px;
    color: #ddd;
    letter-spacing: 1px;
}
.ac-leg-t { color: #9aa; font-size: 14px; margin-left: 4px; }
.ac-leg-ap small {
    display: block;
    color: #666;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ac-day { color: #d4ac0d; font-size: 10px; margin-left: 1px; }
.ac-leg-status {
    font-size: 12px;
    letter-spacing: 1px;
    text-align: right;
}
.ac-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 5px;
}
.ac-ground-nrt { color: #00a8c0; border-left-color: #00a8c0; }
.ac-ground-gap { color: #444; border-left-style: dotted; }
@media (max-width: 768px) {
    .ac-leg { grid-template-columns: 64px 1fr 1fr; gap: 6px; padding: 8px 6px; }
    .ac-leg-status { grid-column: 1 / -1; text-align: left; font-size: 11px; }
    .ac-leg-num { font-size: 12px; }
    .ac-leg-ap b { font-size: 13px; }
    .ac-leg-t { font-size: 12px; }
    .ac-leg-ap small { font-size: 10px; }
}

.ac-est {
    display: block;
    font-size: 11px;
    color: #d4ac0d;
    font-family: 'Share Tech Mono', monospace;
}

.fd-status-badge {
    font-family: 'Orbitron'; 
    font-size: 13px; 
    letter-spacing: 2px;
    padding: 8px 16px; 
    border: 1px solid; 
    display: flex; 
    align-items: center; 
    gap: 8px;
    white-space: nowrap; 
    align-self: flex-start; 
    margin-top: 4px;
}

.fd-route {
    display: flex; 
    align-items: center;
    background: #090909; 
    border: 1px solid #161616;
    padding: 16px 22px; 
    margin-bottom: 16px;
}

.fd-airport { 
    flex: 1; 
}

.fd-airport-iata { 
    font-family: 'Orbitron'; 
    font-size: 34px; 
    font-weight: 900; 
    color: #fff; 
    letter-spacing: 5px; 
    line-height: 1; 
}

.fd-airport-name { 
    font-size: 11px; 
    color: #505050; 
    letter-spacing: 2px; 
    margin-top: 4px; 
}

.fd-route-mid { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 4px; 
}

.fd-route-plane { 
    font-size: 22px; 
    color: #404040; 
}

.fd-route-line { 
    width: 100%; 
    height: 1px; 
    background: linear-gradient(90deg,transparent,#252525,#252525,transparent); 
}

.fd-route-duration { 
    font-size: 11px; 
    color: #505050; 
    letter-spacing: 2px; 
    margin-top: 1px; 
}

.fd-times {
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1px; 
    background: #131313; 
    border: 1px solid #131313; 
    margin-bottom: 16px;
}

.fd-time-col { 
    background: #080808; 
    padding: 13px 15px; 
}

.fd-time-label { 
    font-size: 10px; 
    color: #686868; 
    letter-spacing: 2px; 
    margin-bottom: 6px; 
}

.fd-time-tz { 
    font-size: 10px; 
    color: #404040; 
    letter-spacing: 2px; 
    margin-top: 3px; 
}

.fd-time-value { 
    font-family: 'Orbitron'; 
    font-size: 26px; 
    font-weight: 700; 
    color: #cccccc; 
    line-height: 1; 
}

.fd-time-value.v-on { 
    color: #2ecc71; 
}

.fd-time-value.v-warn { 
    color: #e6bc1a; 
}

.fd-time-value.v-late { 
    color: #e74c3c; 
}

.fd-time-value.v-hi { 
    color: #f0f0f0; 
}

.fd-time-date { 
    font-size: 11px; 
    color: #585858; 
    margin-top: 4px; 
}

.fd-time-delay { 
    font-size: 11px; 
    margin-top: 3px; 
    letter-spacing: 1px; 
    font-weight: bold; 
}

.fd-time-delay.v-on { 
    color: #2ecc71; 
}

.fd-time-delay.v-warn { 
    color: #e6bc1a; 
}

.fd-time-delay.v-late { 
    color: #e74c3c; 
}

.fd-info-grid {
    display: grid; 
    grid-template-columns: repeat(3, 1fr);
    gap: 1px; 
    background: #111; 
    border: 1px solid #111; 
    margin-bottom: 20px;
}

.fd-info-item { 
    background: #080808; 
    padding: 12px 15px; 
}

.fd-info-label { 
    font-size: 10px; 
    color: #686868; 
    letter-spacing: 2px; 
    margin-bottom: 5px; 
}

.fd-info-value { 
    font-size: 19px; 
    color: #d8d8d8; 
    letter-spacing: 1px; 
}

.fd-info-value.cyan { 
    color: #00d8f0; 
}

.fd-info-value.gold { 
    color: #e0aa20; 
}

.fd-info-value.green { 
    color: #2ecc71; 
}

.fd-info-value.dim { 
    color: #484848; 
}

.fd-aircraft-photo {
    margin-bottom: 20px; 
    background: #060606; 
    border: 1px solid #111;
    overflow: hidden; 
    text-align: center;
}

.fd-aircraft-photo img {
    width: 100%;
    max-height: 280px;      
    object-fit: contain;    
    object-position: center;
    display: block;
    background: #060606;    
}

.fd-photo-caption { 
    font-size: 10px; 
    color: #303030; 
    padding: 4px 10px; 
    letter-spacing: 2px; 
}

/* ── Flight Progress Bar ────────────────────────────── */
.fd-progress-wrap {
    padding: 14px 20px 10px;
    border-bottom: 1px solid #1a1a1a;
}

.fd-mini-timeline {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px 12px;
    border-bottom: 1px solid #121212;
    background: rgba(255,255,255,0.01);
}

.fd-mini-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.fd-mini-step {
    min-width: 90px;
    text-align: center;
    padding: 6px 8px;
    border: 1px solid #1b1b1b;
    background: #0a0a0a;
    border-radius: 6px;
    transition: border-color .2s, background .2s;
}

/* ── Cascade states ── */
/* step1/step2 reached: soft green glow */
.fd-mini-step.reached {
    border-color: rgba(34,197,94,0.5);
    background: rgba(34,197,94,0.06);
}
.fd-mini-step.reached .fd-mini-label { color: rgba(34,197,94,0.7); }
.fd-mini-step.reached .fd-mini-value { color: #22c55e; }

/* step2 active (ETD/ETA confirmed, no actual yet) – on-time */
.fd-mini-step.active {
    border-color: rgba(34,197,94,0.55);
    background: rgba(34,197,94,0.08);
}
.fd-mini-step.active .fd-mini-label { color: rgba(34,197,94,0.8); }
.fd-mini-step.active .fd-mini-value { color: #4ade80; }

/* step2 active but delayed */
.fd-mini-step.active-late {
    border-color: rgba(239,68,68,0.55);
    background: rgba(239,68,68,0.06);
}
.fd-mini-step.active-late .fd-mini-label { color: rgba(239,68,68,0.7); }
.fd-mini-step.active-late .fd-mini-value { color: #f87171; }

/* step3 done: bright blue */
.fd-mini-step.done {
    border-color: rgba(59,130,246,0.6);
    background: rgba(59,130,246,0.08);
}
.fd-mini-step.done .fd-mini-label { color: rgba(59,130,246,0.8); }
.fd-mini-step.done .fd-mini-value { color: #60a5fa; }

/* not yet reached */
.fd-mini-step.dim { opacity: 0.45; }

.fd-mini-label {
    font-size: 9px;
    color: #6d6d6d;
    letter-spacing: 1px;
    margin-bottom: 3px;
}

.fd-mini-value {
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    color: #d7d7d7;
    letter-spacing: 1px;
}

.fd-mini-arrow {
    color: #2b2b2b;
    font-size: 13px;
    line-height: 1;
    transition: color .2s;
}
.fd-mini-arrow.lit { color: rgba(34,197,94,0.55); }

.fd-progress-bar-bg {
    position: relative;
    height: 3px;
    background: #252525;
    border-radius: 2px;
    margin-bottom: 14px;
}

.fd-progress-bar-fill {
    position: absolute;
    top: 0; 
    left: 0;
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

.fd-progress-plane {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: left 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.fd-progress-plane .prog-plane-icon {
    display: block;
    font-size: 18px;
    line-height: 1;
    color: #ffffff !important;
    text-shadow: 0 0 4px rgba(0,0,0,0.8);
}

.fd-progress-labels {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 11px;
    letter-spacing: 1px;
}

.fd-prog-origin { 
    text-align: left; 
}

.fd-prog-dest { 
    text-align: right; 
}

.fd-prog-time { 
    color: #888; 
    font-size: 11px; 
}

.fd-prog-rel { 
    color: #555; 
    font-size: 10px; 
    margin-top: 2px; 
    letter-spacing: 1.5px; 
}

.fd-prog-eta { 
    color: #3b82f6 !important; 
}

.fd-prog-duration {
    text-align: center;
    color: #606060;
    font-size: 11px;
    letter-spacing: 2px;
    white-space: nowrap;
}

.fd-footer { 
    display: flex; 
    flex-direction: row;
    flex-wrap: nowrap; 
    gap: 8px;
    margin-top: 18px;
    margin-bottom: 8px;
}

.fd-btn {
    font-family: 'Share Tech Mono'; 
    font-size: 12px; 
    letter-spacing: 2px;
    padding: 9px 16px; 
    cursor: pointer; 
    transition: all .2s;
    text-decoration: none; 
    display: inline-flex; 
    align-items: center; 
    gap: 7px;
    background: transparent; 
    border: 1px solid #2a2a2a; 
    color: #666;
}

.fd-btn:hover { 
    border-color: #666; 
    color: #bbb; 
}

.fd-btn.primary { 
    border-color: #00e5ff; 
    color: #00e5ff; 
}

.fd-btn.primary:hover { 
    background: rgba(0,229,255,.07); 
}

/* ════════════════════════════════════════
   AIRLINE PROFILE MODAL (ĐÃ KHÔI PHỤC NGUYÊN TRẠNG)
════════════════════════════════════════ */
.ap-header { 
    text-align: center; 
    padding-bottom: 18px; 
    border-bottom: 1px solid #111; 
    margin-bottom: 18px; 
}

.ap-logo { 
    width: 80px; 
    height: 80px; 
    object-fit: contain; 
    background: #fff; 
    padding: 6px; 
    margin: 0 auto 12px; 
    display: block; 
    border-radius: 14px; 
    box-shadow: 0 4px 16px rgba(0,0,0,.6); 
}

.ap-logo.logo-wide {
    width: 150px;
    height: 64px;
    padding: 3px 5px;
    border-radius: 10px;
}

.ap-name { 
    font-family: 'Orbitron'; 
    font-size: 16px; 
    font-weight: 700; 
    letter-spacing: 3px; 
    color: #f0f0f0; 
    margin-bottom: 10px; 
}

.ap-codes { 
    display: flex; 
    justify-content: center; 
    gap: 14px; 
    margin-bottom: 10px; 
}

.ap-code { 
    font-size: 12px; 
    color: #686868; 
    letter-spacing: 2px; 
    background: #0a0a0a; 
    border: 1px solid #222; 
    padding: 4px 14px; 
}

.ap-code span { 
    color: #00d8f0; 
    margin-left: 6px; 
    font-size: 16px; 
}

.alliance-badge { 
    display: inline-block; 
    font-size: 11px; 
    letter-spacing: 2px; 
    padding: 3px 14px; 
    border: 1px solid; 
    margin-top: 6px; 
}

.alliance-skyteam { 
    border-color: #1a3a80; 
    color: #5599dd; 
}

.alliance-staralliance { 
    border-color: #777; 
    color: #aaa; 
}

.alliance-oneworld { 
    border-color: #7a1525; 
    color: #cc7080; 
}

.ap-stats { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 1px; 
    background: #111; 
    margin-bottom: 18px; 
}

.ap-stat { 
    background: #080808; 
    padding: 14px; 
    text-align: center; 
}

.ap-stat-value { 
    font-family: 'Orbitron'; 
    font-size: 28px; 
    font-weight: 700; 
    color: #00d8f0; 
}

.ap-stat-label { 
    font-size: 10px; 
    color: #585858; 
    letter-spacing: 2px; 
    margin-top: 5px; 
}

.ap-section { 
    margin-bottom: 16px; 
}

.ap-section-title { 
    font-size: 11px; 
    color: #585858; 
    letter-spacing: 4px; 
    margin-bottom: 8px; 
    padding-bottom: 5px; 
    border-bottom: 1px solid #111; 
}

.ap-flight-list { 
    display: flex; 
    flex-direction: column; 
    gap: 2px; 
    max-height: 180px; 
    overflow-y: auto; 
}

.ap-flight-list::-webkit-scrollbar { 
    width: 3px; 
}

.ap-flight-list::-webkit-scrollbar-thumb { 
    background: #1a1a1a; 
}

.ap-flight-row {
    display: grid; 
    grid-template-columns: 75px 100px 1fr 100px;
    align-items: center; 
    gap: 8px; 
    padding: 8px 10px;
    background: #080808; 
    border-left: 2px solid transparent; 
    transition: all .15s;
}

.ap-flight-row:hover { 
    border-left-color: #2a2a2a; 
    background: #0a0a0a; 
}

.ap-fl-time { 
    font-family: 'Orbitron'; 
    font-size: 18px; 
    color: #bbb; 
    font-weight: 700; 
}

.ap-fl-num { 
    color: #f0f0f0; 
    font-size: 16px; 
    letter-spacing: 1px; 
}

.ap-fl-op {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 5px;
    border: 1px solid #2a2a2a;
    border-radius: 3px;
    color: #9aa0a6;
    font-size: 10px;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.ap-fl-city { 
    color: #888; 
    font-size: 15px; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
    text-align: left; 
}

.ap-fl-status { 
    font-size: 13px; 
    text-align: right; 
}

.ap-footer { 
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap; 
    margin-top: 4px; 
}

/* ════════════════════════════════════════
   MOBILE — ≤ 768px
════════════════════════════════════════ */
#mobile-list { 
    display: none; 
}

@media (max-width: 768px) {

    html, body { 
        overflow: auto; 
        height: auto; 
        background: #020202;
        overscroll-behavior-y: none;
    }
    
    .app-wrapper { 
        height: auto; 
        min-height: 100vh; 
    }

    .top-dashboard {
        position: fixed;
        top: 0; 
        left: 0; 
        right: 0;
        z-index: 100;
        padding: calc(6px + env(safe-area-inset-top)) 12px 0;
        border-bottom: 2px solid #1e1e1e;
        background: #020202;
        box-shadow: 0 4px 24px rgba(0,0,0,.95);
    }

    .table-container {
        padding: 0;
        overflow-y: visible;
        scrollbar-gutter: auto;
        margin-top: 178px;
        overscroll-behavior-y: contain;
    }

    .lang-switcher { 
        padding-bottom: 4px; 
        margin-bottom: 5px; 
    }
    
    .lang-btn { 
        font-size: 10px; 
        padding: 2px 6px; 
    }

    .stats-top-btn {
        margin-right: 2px;
        padding: 3px 7px;
        font-size: 10px;
        letter-spacing: 0.5px;
    }
    
    .lang-btn img { 
        width: 14px; 
        height: 10px; 
    }

    .fids-header { 
        flex-direction: column; 
        align-items: center; 
        gap: 10px; 
        padding-bottom: 10px; 
        margin-bottom: 10px; 
    }
    
    .header-left { 
        align-items: center; 
        width: 100%; 
        justify-content: center; 
    }
    
    .airport-titles { 
        width: 100%; 
        text-align: center; 
        overflow: visible; 
        display: flex; 
        flex-direction: column; 
        align-items: center; 
    }
    
    .airport-titles h1 { 
        display: none; 
    } 
    
    .airport-titles h2 {
        font-size: 18px; 
        letter-spacing: 2px; 
        margin-top: 0;
        white-space: normal; 
        overflow: visible; 
        text-overflow: clip;
        width: 100%; 
        line-height: 1.3;
    }
    
    html[lang="vi"] .airport-titles h2 { 
        font-size: 15px; 
        letter-spacing: 1px; 
    }
    
    html[lang="ja"] .airport-titles h2 { 
        font-size: 16px; 
        letter-spacing: 1px; 
    }
    
    .top-weather { 
        font-size: clamp(9px, 2.6vw, 11px); 
        margin-top: 4px; 
        text-align: center; 
        width: 100%; 
        line-height: 1.3;
        letter-spacing: 0;
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
    }

    .header-right {
        display: flex; 
        flex-direction: row; 
        justify-content: space-between;
        align-items: center; 
        width: 100%; 
        gap: 5px; 
        flex-shrink: 0; 
        padding: 0 5px;
        flex-wrap: nowrap; 
    }
    
    .clock { 
        font-size: 20px; 
        letter-spacing: 1px; 
        margin-bottom: 0; 
        line-height: 1; 
        font-variant-numeric: tabular-nums; 
        white-space: nowrap; 
        flex-shrink: 0; 
    }
    
    .mode-switch { 
        display: flex; 
        gap: 3px; 
        flex-wrap: nowrap; 
        flex-shrink: 0; 
        align-items: center; 
    }
    
    .mode-switch button { 
        padding: 4px 8px; 
        font-size: 11px; 
        margin-left: 0; 
        white-space: nowrap; 
    }
    
    #btn-fav-filter { 
        font-size: 11px; 
        padding: 4px 8px; 
    }

    .top-filters { 
        flex-direction: column; 
        gap: 6px; 
        padding-bottom: 8px; 
    }
    
    .search-box { 
        width: 100%; 
        font-size: 14px; 
        padding: 8px 40px 8px 12px; 
    }
    
    .search-wrap { 
        width: 100%; 
    }
    
    .dropdowns { 
        display: grid; 
        grid-template-columns: repeat(2, 1fr); 
        gap: 5px; 
        width: 100%; 
    }
    
    .dropdowns select {
        width: 100%; 
        min-width: 0; 
        font-size: 12px; 
        padding: 8px 6px; 
        box-sizing: border-box;
        white-space: nowrap; 
        overflow: hidden; 
        text-overflow: ellipsis;
    }
    
    #routeFilter { 
        grid-column: span 1; 
    }
    
    .multi-select { 
        grid-column: span 1; 
        width: 100%; 
    }
    
    .select-box {
        width: 100%; 
        font-size: 12px; 
        padding: 8px 6px; 
        text-align: center; 
        box-sizing: border-box;
        white-space: nowrap; 
        overflow: hidden; 
        text-overflow: ellipsis;
    }
    
    .multi-select { 
        position: static; 
        width: 100%; 
    }
    
    .dropdown-content {
        position: fixed; 
        left: 12px !important; 
        right: 12px !important;
        width: calc(100vw - 24px) !important; 
        top: auto !important; 
        max-height: 45vh; 
        z-index: 300;
    }

    .fids-table { 
        display: none; 
    }
    
    #mobile-list { 
        display: flex; 
        flex-direction: column; 
        gap: 0; 
        padding-bottom: calc(70px + env(safe-area-inset-bottom)); 
    }

    .m-date-divider {
        background: #060d13 !important; 
        color: #00e5ff; 
        font-size: 13px; 
        font-weight: bold;
        letter-spacing: 4px; 
        padding: 8px 12px;
        border-top: 1px solid #005566; 
        border-bottom: 1px solid #005566; 
        margin-top: 4px; 
        text-align: center;
    }

    /* 🔥 KHÓA CHIỀU CAO CARD TRÊN MOBILE CHO VUÔNG VẮN VÀ ĐỒNG BỘ */
    .m-card {
        background: #080808;
        border-left: 3px solid #111;
        padding: 9px 12px 9px 10px;
        height: 110px !important; 
        min-height: 110px !important;
        max-height: 110px !important;
        overflow: hidden;
        cursor: pointer;
        display: grid;
        grid-template-columns: 65px 1fr auto;
        grid-template-rows: 32px auto 1fr;
        grid-template-areas:
            "airline airline airline"
            "time    flight  status "
            "term    city    gate   ";
        column-gap: 8px; 
        row-gap: 4px;
        transition: background .12s, border-color .12s;
        border-bottom: 1px solid #181818;
    }
    
    .m-card:nth-child(even) { background-color: #0b0b0b; }
    .m-card:nth-child(odd)  { background-color: #020202; }
    .m-card:active   { background: #0d0d0d; }
    .m-card.m-highlight { border-left-color: #00e5ff; background: rgba(0,229,255,.08) !important; }

    .m-row-airline   { grid-area: airline; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
    .m-airline-block { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; overflow: hidden; }
    .m-airline-logo  { width: 20px; height: 20px; object-fit: contain; background: #fff; padding: 1px; flex-shrink: 0; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.5); image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; }
    .m-airline-logo.logo-wide { width: 34px; height: 18px; padding: 1px 2px; border-radius: 3px; }
    .m-airline-name  { font-size: 11px; color: #606060; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .m-reg           { font-size: 10px; color: #303030; flex-shrink: 0; white-space: nowrap; }
    
    /* 🔥 Tối ưu lại Status block trên Mobile để chấm tròn độc lập, ko bị đè */
    .m-status-block  { 
        display: flex !important; 
        align-items: center !important; 
        gap: 6px !important; 
        justify-content: flex-end; 
        flex-shrink: 0; 
        max-width: 60%; 
    }
    
    .m-delay-dot { 
        display: inline-block; 
        width: 8px; 
        height: 8px; 
        border-radius: 50%; 
        flex-shrink: 0 !important; 
    }
    
    .m-delay-dot.green  { background: #27ae60; box-shadow: 0 0 4px #27ae60; }
    .m-delay-dot.yellow { background: #d4ac0d; box-shadow: 0 0 4px #d4ac0d; }
    .m-delay-dot.red    { background: #c0392b; box-shadow: 0 0 4px #c0392b; }
    .m-delay-dot.gray   { background: #707070; box-shadow: none; }
    
    .m-status-text { 
        font-size: 13px; 
        font-weight: bold; 
        white-space: normal; 
        text-align: right; 
        line-height: 1.3; 
        min-width: 0 !important; 
        word-break: keep-all !important; 
    }
    
    .m-live-badge { 
        background: #8b1e1e; 
        color: #ff8080; 
        border: 1px solid #c0392b; 
        font-size: 9px; 
        letter-spacing: 2px; 
        padding: 1px 5px; 
        font-weight: bold; 
        flex-shrink: 0 !important; 
    }

    .m-time-wrap  { grid-area: time; align-self: center; }
    .m-time       { font-family: 'Orbitron'; font-size: 17px; font-weight: 700; color: #888; line-height: 1; }
    .m-time-label { display: none; }

    .m-flight-num {
        grid-area: flight; align-self: center;
        font-size: 27px; font-weight: bold; color: #fff;
        letter-spacing: 1px; line-height: 1;
        text-shadow: 0 0 8px rgba(255,255,255,.3);
        display: flex; align-items: center; gap: 5px;
    }

    .m-status-remark { grid-area: status; display: flex; align-items: center; justify-content: flex-end; gap: 5px; align-self: center; }
    .m-status-row    { display: flex; align-items: center; gap: 5px; }
    .m-remark        { font-size: 11px; font-weight: bold; letter-spacing: 1px; text-align: right; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }

    .m-term-wrap, .m-city, .m-gate-wrap { border-top: 1px solid #111; padding-top: 4px; }

    .m-term-wrap  { grid-area: term; align-self: start; }
    .m-term-badge { font-size: 11px; font-weight: bold; color: #00e5ff; letter-spacing: 1px; }

    .m-city {
        grid-area: city; align-self: start;
        font-size: 14px; color: #c8c8c8; letter-spacing: 1px;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }

    .m-gate-wrap  { grid-area: gate; align-self: start; text-align: right; }
    .m-gate-val   { font-size: 12px; color: #00e5ff; letter-spacing: 1px; font-weight: bold; white-space: nowrap; }
    .m-gate-val.m-gate-changed { color: #f1c40f; }
    .m-gate-prev  { color: #6b6b6b; text-decoration: line-through; margin-right: 4px; font-weight: normal; }
    .m-cargo-badge { font-size: 9px; color: #b8860b; border: 1px solid rgba(241,196,15,.2); padding: 1px 4px; }

    .modal-overlay { 
        align-items: stretch;
        justify-content: flex-end;
        padding: 0;
    }
    
    .modal-card {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        height: 100dvh;
        min-height: 100vh;
        min-height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        border: none; 
        padding: calc(14px + env(safe-area-inset-top)) 14px calc(42px + env(safe-area-inset-bottom));
    }
    
    .modal-card-airline { 
        max-height: 100vh;
        max-height: 100dvh;
    }

    .modal-close {
        top: calc(10px + env(safe-area-inset-top));
    }

    .fd-header { flex-direction: column; gap: 10px; }
    .fd-flight-number { font-size: 28px; }
    .fd-status-badge { align-self: flex-start; font-size: 11px; padding: 6px 12px; }
    .fd-mini-timeline { gap: 4px; padding: 8px 6px 10px; }
    .fd-mini-row { gap: 3px; }
    .fd-mini-step { min-width: 60px; padding: 4px 5px; }
    .fd-mini-value { font-size: 9px; letter-spacing: 0.5px; }
    .fd-airport-iata { font-size: 26px; }
    .fd-route { padding: 12px 14px; }
    .fd-times { grid-template-columns: repeat(2, 1fr); }
    .fd-time-value { font-size: 22px; }
    .fd-info-grid { grid-template-columns: repeat(2, 1fr); }
    .fd-info-label { font-size: 9px; letter-spacing: 1px; }
    html[lang="vi"] .fd-info-label { letter-spacing: 0px; font-size: 9px; }
    html[lang="vi"] .fd-info-value { font-size: 15px; }
    .fd-info-value { font-size: 16px; }
    .fd-footer {
        flex-direction: column;
        position: static;
        margin-top: 18px;
        margin-bottom: 8px;
        padding-top: 0;
        padding-bottom: 0;
        background: transparent;
    }
    .fd-btn {
        width: 100%;
        justify-content: center;
    }

    .ap-stats { grid-template-columns: repeat(3, 1fr); }
    .ap-stat-value { font-size: 22px; }
    .ap-flight-row { grid-template-columns: 70px 95px 1fr 95px; }
}

/* ════════════════════════════════════════
   LIVE MAP
════════════════════════════════════════ */
.map-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: #080808;
    border: 1px solid #1e1e1e;
    border-radius: 6px;
    margin-bottom: 16px;
    overflow: hidden;
}

.leaflet-container {
    background: #0a0a0a;
    font-family: 'Share Tech Mono', monospace;
}

.leaflet-tile,
.leaflet-layer {
    filter: brightness(0.8) contrast(1.1);
}

.flight-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #00d8f0;
    border: 2px solid #fff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    cursor: pointer;
    transition: all .2s;
    font-size: 16px;
}

.flight-marker:hover {
    width: 36px;
    height: 36px;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.6);
}

.flight-marker.delayed {
    background: #e74c3c;
    border-color: #fff;
}

.flight-marker.on-time {
    background: #27ae60;
    border-color: #fff;
}
    .ap-fl-city    { font-size: 10px; color: #585858; }

    .mob-now-btn {
        position: fixed; 
        bottom: calc(16px + env(safe-area-inset-bottom)); 
        right: 14px;
        background: #8b1e1e; 
        color: #ff9090;
        border: 1px solid #c0392b; 
        font-family: 'Share Tech Mono';
        font-size: 12px; 
        letter-spacing: 2px;
        padding: 10px 18px; 
        cursor: pointer; 
        z-index: 100;
        box-shadow: 0 4px 20px rgba(0,0,0,.7);
    }

    html[lang="vi"] .mob-now-btn {
        font-family: 'Be Vietnam Pro', sans-serif;
        letter-spacing: 1px;
        font-weight: 600;
    }

/* 🔥 NỚI CỘT CHO MÀN DỌC DESKTOP & CĂN CHỈNH LAYOUT STATUS */
@media (min-width: 769px) and (max-width: 1250px) {
    #mobile-list { display: none; }
    
    .fids-header { flex-wrap: wrap; row-gap: 12px; }
    .header-left { flex: 1; min-width: 50%; }
    
    .search-wrap { width: 300px; }
    .search-wrap .search-box { width: 100%; }

    .airport-titles h2 { font-size: 20px; }
    .clock { font-size: 24px; }
    
    .col-flight { font-size: 17px; } 
    .col-std    { font-size: 19px; font-weight: bold; } 
    .col-status { font-size: 13px; line-height: 1.2; } 
    .col-remark { font-size: 12px; line-height: 1.2; } 
    .col-reg    { font-size: 13px; } 
    .col-term   { font-size: 14px; } 
        .col-dest   { font-size: 15px; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    
    /* Phân bổ tỷ lệ chuẩn */
    .w-std    { width: 7%;  }
    .w-dest   { width: 12%; }
    .w-term   { width: 8%;  }
    .w-flight { width: 11.5%; }
    .w-reg    { width: 7.5%;  }
    .w-airline{ width: 17%; }
    /* the gate as plain text with the old-gate slot; the status keeps "ĐÃ KHỞI HÀNH" clear of LIVE */
    .w-gate   { width: 9%; }
    .w-remark { width: 9%; }
    .w-status { width: 19%; }

    .col-airline { align-items: flex-start; } 
    .col-airline .airline-name {
        display: -webkit-inline-box;
        -webkit-line-clamp: 3;
        line-clamp: 3; /* Fix cảnh báo VScode */
        -webkit-box-orient: vertical;
        overflow: hidden;
        max-width: calc(100% - 36px); 
    }
}

@media (min-width: 769px) {
    #mobile-list { display: none; }
    .mob-now-btn { display: none !important; }
}

/* Các thành phần Modal */
.ap-info-grid { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 6px 12px; 
    justify-content: center; 
    margin: 10px 0 4px; 
}

.ap-info-item { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 2px; 
}

.ap-info-wide { 
    width: 100%; 
    flex-direction: row; 
    justify-content: center; 
    gap: 8px; 
}

.ap-info-empty {
    border: 1px dashed #1f2a2d;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(0, 216, 240, 0.04);
}

.ap-info-empty .ap-info-val {
    color: #7faab3;
    letter-spacing: 2px;
}

.ap-about {
    margin: 12px auto 2px; max-width: 520px;
    font-family: 'Be Vietnam Pro', sans-serif; font-size: 13px; line-height: 1.55;
    color: #9fb0b8; text-align: left; text-transform: none;
    border-left: 2px solid #1d4a52; padding: 2px 0 2px 12px;
}
.ap-about-loading { color: #4d6a72; font-style: italic; border-left-color: #1f2a2d; }
.ap-links { display: flex; gap: 14px; margin-top: 8px; }
.ap-links a {
    font-family: 'Share Tech Mono', monospace; font-size: 11px; letter-spacing: 1.5px;
    color: #00d8f0; text-decoration: none;
}
.ap-links a:hover { text-decoration: underline; }

.ap-info-label { 
    font-size: 12px; 
    letter-spacing: 1.5px; 
    color: #707070; 
    font-weight: 600;
}

.ap-info-val { 
    font-size: 17px; 
    font-weight: 700; 
    color: #ffffff; 
    letter-spacing: 0.5px; 
}

.ap-tab-bar { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 1px; 
    background: #111; 
    margin-bottom: 0; 
}

.ap-tab-btn { 
    background: #060606; 
    border: none; 
    color: #404040; 
    font-size: 10px; 
    letter-spacing: 2px; 
    padding: 10px 6px; 
    cursor: pointer; 
    transition: color .15s, background .15s; 
    font-family: inherit; 
}

.ap-tab-btn.active { 
    color: #00d8f0; 
    background: #070f11; 
    border-bottom: 1px solid #00d8f0; 
}

.ap-tab-btn:hover { 
    color: #888; 
}

.ap-flight-list { 
    display: flex; 
    flex-direction: column; 
    gap: 0; 
    max-height: 280px; 
    overflow-y: auto; 
    margin-bottom: 14px; 
}

.ap-date-div { 
    font-size: 12px; 
    color: #3a3a3a; 
    letter-spacing: 2px; 
    padding: 8px 10px 6px; 
    text-align: center; 
    font-weight: 500;
}

.ap-empty { 
    color: #3a3a3a; 
    font-size: 15px; 
    padding: 16px; 
    text-align: center; 
    letter-spacing: 1px; 
    font-weight: 500;
}

@media (min-width: 1024px) {
    .modal-card-airline {
        width: min(760px, 94vw);
        max-height: 90vh;
        padding: 32px 36px;
    }

    .ap-logo {
        width: 110px;
        height: 110px;
        padding: 8px;
        margin: 0 auto 16px;
    }

    .ap-logo.logo-wide {
        width: 190px;
        height: 76px;
        padding: 4px 8px;
    }

    .ap-name {
        font-size: 28px;
        letter-spacing: 2px;
        line-height: 1.15;
        margin-bottom: 12px;
    }

    .ap-info-grid {
        gap: 10px 20px;
        margin: 14px 0 10px;
    }

    .ap-info-label {
        font-size: 16px;
    }

    .ap-info-val {
        font-size: 24px;
    }

    .ap-stat {
        padding: 16px;
    }

    .ap-stat-value {
        font-size: 34px;
    }

    .ap-stat-label {
        font-size: 11px;
    }

    .ap-tab-btn {
        font-size: 12px;
        padding: 12px 8px;
    }

    .ap-flight-list {
        max-height: 360px;
    }

    .ap-fl-time {
        font-size: 20px;
    }

    .ap-fl-num {
        font-size: 18px;
    }

    .ap-fl-op {
        font-size: 9px;
        margin-left: 5px;
        padding: 1px 4px;
    }

    .ap-fl-city {
        font-size: 17px;
        color: #a0a0a0;
    }

    .ap-fl-status {
        font-size: 15px;
    }

    .ap-date-div {
        font-size: 14px;
        padding: 10px 10px 8px;
    }
}

.ap-flight-row:hover { 
    background: #0d0d0d; 
    border-left-color: #00d8f0 !important; 
}

.ap-flight-row:active { 
    background: #111; 
}

.btn-back-ap { 
    border-color: #333 !important; 
    color: #888 !important; 
}

.btn-back-ap:hover { 
    border-color: #555 !important; 
    color: #bbb !important; 
}

.fd-back-bar { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    margin-bottom: 16px; 
    padding-bottom: 12px; 
    border-bottom: 1px solid #111; 
}

.fd-back-hint { 
    font-size: 10px; 
    color: #2a2a2a; 
    letter-spacing: 1px; 
}

.table-container.modal-locked, #mobile-list.modal-locked { 
    overflow: hidden !important; 
    pointer-events: none !important; 
    touch-action: none !important; 
}

.modal-card { 
    transform-origin: top center; 
}

.modal-overlay.show .modal-card { 
    animation: mSlideUp .22s cubic-bezier(0.25,0.46,0.45,0.94); 
}

.modal-overlay.show ~ .app-wrapper .table-container::-webkit-scrollbar { 
    display: none; 
}

html.modal-open, body.modal-open { 
    overflow: hidden !important; 
    overscroll-behavior: none !important; 
    height: 100vh !important; 
    height: 100dvh !important; 
    width: 100vw !important; 
    position: fixed !important; 
    inset: 0 !important; 
}

html.modal-open::-webkit-scrollbar, body.modal-open::-webkit-scrollbar { 
    display: none !important; 
    width: 0 !important; 
    height: 0 !important; 
    opacity: 0 !important; 
}

body.modal-open .table-container, body.modal-open #mobile-list { 
    overflow: hidden !important; 
    touch-action: none !important; 
}

body.modal-open .modal-overlay { 
    pointer-events: auto !important; 
    touch-action: auto !important; 
    overscroll-behavior: contain !important; 
}

.remark-blue { 
    color: #3b82f6; 
}

.main-logo-container { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    height: 100%; 
    margin-right: 15px; 
}

.narita-main-logo { 
    height: 38px; 
    width: auto; 
    object-fit: contain; 
}

#btn-stats {
    transition: all 0.2s ease;
}

#btn-stats:hover {
    background: #0d5568 !important;
    box-shadow: 0 0 12px rgba(0, 216, 240, 0.4);
}

/* ── In-app notifications (showToast) ── */
.nt-stack {
    position: fixed; z-index: 99999; right: 16px; bottom: 16px; width: min(380px, calc(100vw - 32px));
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.nt-card {
    --nt-accent: #00d8f0;
    position: relative; overflow: hidden; pointer-events: auto; box-sizing: border-box;
    background: #11171d; color: #e6edf3; border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
    padding: 10px 14px 14px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; text-transform: none; letter-spacing: normal;
    opacity: 0; transform: translateY(14px) scale(.98);
    transition: opacity .24s ease, transform .24s cubic-bezier(.2, .8, .2, 1);
}
.nt-card.nt-in { opacity: 1; transform: none; }
.nt-card.nt-out { opacity: 0 !important; transform: translateY(8px) scale(.98); }
.nt-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #8593a0; margin-bottom: 8px; }
.nt-app { color: #c9d4de; font-weight: 600; letter-spacing: .02em; }
.nt-dot { opacity: .6; }
.nt-x {
    margin-left: auto; width: 26px; height: 26px; border-radius: 8px; border: 0; background: transparent;
    color: #8593a0; font-size: 13px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.nt-x:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nt-main { display: flex; gap: 12px; align-items: flex-start; }
.nt-icon {
    flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
    font-size: 21px; font-weight: 700; color: var(--nt-accent);
    background: color-mix(in srgb, var(--nt-accent) 16%, #11171d);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nt-accent) 35%, transparent);
}
.nt-text { min-width: 0; flex: 1; }
.nt-title { font-size: 15px; font-weight: 650; line-height: 1.3; color: #fff; overflow-wrap: anywhere; }
.nt-body { font-size: 13.5px; line-height: 1.45; color: #a9b6c2; margin-top: 3px; overflow-wrap: anywhere; }
.nt-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .05); }
.nt-bar i { display: block; height: 100%; background: var(--nt-accent); transform-origin: left center; opacity: .85; }
@media (max-width: 760px) {
    .nt-stack {
        right: auto; bottom: auto; left: 50%; transform: translateX(-50%);
        top: calc(env(safe-area-inset-top, 0px) + 10px); width: calc(100vw - 20px);
    }
    .nt-card { transform: translateY(-14px) scale(.98); }
    .nt-card.nt-out { transform: translateY(-10px) scale(.98); }
}
@media (prefers-reduced-motion: reduce) {
    .nt-card, .nt-card.nt-in, .nt-card.nt-out { transition: opacity .15s linear; transform: none; }
}

a.stats-top-btn { text-decoration: none; display: inline-flex; box-sizing: border-box; vertical-align: middle; }
