:root {
    --bg-1: #041822;
    --bg-2: #0d3449;
    --bg-3: #16607a;
    --panel: rgba(255, 255, 255, 0.92);
    --text: #133247;
    --muted: #577086;
    --line: #d6e3ec;
    --primary: #0077b6;
    --primary-dark: #005d8e;
    --accent: #f59f00;
    --accent-dark: #c97f00;
    --low: #118d57;
    --medium: #e38f01;
    --high: #cf2f2f;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow-y: auto;
    scroll-behavior: auto;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 22px 14px 40px;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background:
        radial-gradient(1000px 760px at 90% -8%, rgba(245, 159, 0, 0.35), transparent 60%),
        radial-gradient(900px 760px at -10% 110%, rgba(0, 119, 182, 0.35), transparent 55%),
        linear-gradient(145deg, var(--bg-1), var(--bg-2), var(--bg-3));
}

body[data-page="dashboard"] {
    overflow-anchor: none;
}

.app-shell {
    width: min(1200px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 16px;
}

.dashboard-shell {
    width: min(1260px, 100%);
    min-height: calc(100vh - 62px);
    overflow-anchor: none;
}

.hero {
    color: #f3f8fc;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.76rem;
    opacity: 0.9;
}

.hero h1 {
    margin: 10px 0 8px;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(1.7rem, 3.5vw, 2.4rem);
}

.subtitle {
    margin: 0;
    color: #d8e8f4;
    max-width: 760px;
}

.top-nav {
    display: flex;
    gap: 10px;
}

.nav-link {
    text-decoration: none;
    color: #f4fcff;
    font-weight: 700;
    font-size: 0.94rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    padding: 9px 12px;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.22);
}

.panel {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 18px;
    box-shadow: 0 16px 32px rgba(4, 24, 34, 0.2);
    padding: 16px;
    backdrop-filter: blur(5px);
}

.panel h2 {
    margin: 0 0 10px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.22rem;
}

.toolbar-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(280px, 2fr) minmax(180px, 1fr) minmax(220px, auto);
    align-items: end;
}

.dashboard-toolbar {
    grid-template-columns: minmax(260px, 1fr) auto;
}

label {
    display: inline-block;
    margin-bottom: 6px;
    font-weight: 700;
}

input[type="text"],
input[type="date"],
input[type="number"],
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    background: #fff;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 119, 182, 0.16);
}

.button-col {
    display: grid;
    gap: 8px;
}

.check-inline {
    font-size: 0.88rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 11px 14px;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.16s ease, filter 0.2s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-accent {
    background: var(--accent);
    color: #261700;
}

.btn-accent:hover:not(:disabled) {
    background: var(--accent-dark);
}

.autocomplete {
    position: relative;
}

.dropdown {
    position: absolute;
    inset: calc(100% + 6px) 0 auto 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 30;
    box-shadow: 0 14px 26px rgba(19, 50, 71, 0.16);
}

.dropdown-item {
    width: 100%;
    border: none;
    border-bottom: 1px solid #edf3f8;
    background: transparent;
    padding: 10px 11px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: #eff8ff;
}

.selected-airport {
    margin-top: 10px;
    font-weight: 700;
}

.status {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.92rem;
}

.status[data-type="success"] {
    color: var(--low);
}

.status[data-type="error"] {
    color: var(--high);
}

.summary-banner {
    margin-top: 8px;
    border: 1px solid #cce5f5;
    background: #eef7fd;
    color: #1b4f72;
    border-radius: 10px;
    padding: 8px 11px;
    font-weight: 700;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.panel-head.compact {
    margin-bottom: 8px;
}

.tiny-note {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.table-wrap {
    border: 1px solid var(--line);
    border-radius: 13px;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    border-bottom: 1px solid #edf3f7;
    padding: 10px;
    text-align: left;
    font-size: 0.9rem;
    vertical-align: middle;
}

th {
    background: #f2f7fb;
    font-weight: 800;
}

tr.selected {
    background: #e8f5ff;
}

.placeholder {
    text-align: center;
    color: var(--muted);
}

.row-select {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 6px 10px;
    font-weight: 700;
    cursor: pointer;
}

.airline-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.airline-logo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #d7e4ee;
}

.risk-badge {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    border: 1px solid transparent;
}

.risk-badge.low {
    background: #e9f8ef;
    color: var(--low);
    border-color: #b8e7c8;
}

.risk-badge.medium {
    background: #fff6e6;
    color: var(--medium);
    border-color: #f4d79b;
}

.risk-badge.high {
    background: #fdeaea;
    color: var(--high);
    border-color: #f5c2c2;
}

.warning-icon {
    font-size: 0.95rem;
    margin-right: 4px;
}

.split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.map {
    height: 340px;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.meta-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.meta-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px;
    background: #fff;
}

.meta-item span {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
}

.meta-item strong {
    display: block;
    margin-top: 3px;
    font-size: 0.93rem;
}

.result-panel {
    display: grid;
    gap: 8px;
    align-content: start;
}

.result-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.result-badge,
.risk-chip,
.alert-pill {
    display: inline-block;
    border-radius: 10px;
    font-weight: 800;
    padding: 6px 10px;
}

.result-badge {
    background: #ecf8ef;
    color: var(--low);
}

.result-badge.delayed {
    background: #fdeaea;
    color: var(--high);
}

.risk-chip.low {
    background: #e9f8ef;
    color: var(--low);
}

.risk-chip.medium {
    background: #fff6e6;
    color: var(--medium);
}

.risk-chip.high {
    background: #fdeaea;
    color: var(--high);
}

.alert-pill {
    background: #cf2f2f;
    color: #fff;
}

.probability {
    margin: 0;
    font-weight: 700;
}

.progress-wrap {
    margin-top: 2px;
}

.progress-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: #dce7ef;
    overflow: hidden;
}

.progress-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #118d57, #f59f00, #cf2f2f);
    transition: width 0.35s ease;
}

.explanation {
    margin: 2px 0 0;
    color: #23465f;
    font-size: 0.92rem;
}

.weather-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.weather-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}

.weather-card h3 {
    margin: 0 0 6px;
    font-size: 0.92rem;
    font-family: "Space Grotesk", sans-serif;
}

.weather-body {
    font-size: 0.86rem;
    color: #29465d;
    line-height: 1.45;
}

.subhead {
    margin: 4px 0 0;
    font-size: 0.98rem;
    font-family: "Space Grotesk", sans-serif;
}

.importance-list {
    margin: 4px 0 0;
    padding-left: 18px;
    font-size: 0.86rem;
    color: #27495f;
    max-height: 140px;
    overflow: auto;
}

.feature-preview {
    margin: 0;
    border-radius: 10px;
    background: #0f2534;
    color: #e1f1ff;
    padding: 10px;
    font-size: 0.77rem;
    max-height: 180px;
    overflow: auto;
}

.future-form {
    display: grid;
    gap: 10px;
}

.future-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.future-result {
    margin-top: 10px;
    border: 1px dashed #bdd7e8;
    border-radius: 10px;
    padding: 10px;
    color: #26485f;
    font-weight: 700;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.metric-card {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 12px 24px rgba(4, 24, 34, 0.18);
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.82rem;
}

.metric-card strong {
    display: block;
    margin-top: 6px;
    font-size: 1.46rem;
    font-family: "Space Grotesk", sans-serif;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: stretch;
}

.chart-panel canvas {
    width: 100%;
    min-height: 280px;
}

body[data-page="dashboard"] #dashboard-banner {
    min-height: 44px;
    display: flex;
    align-items: center;
}

body[data-page="dashboard"] .chart-panel {
    height: 360px;
    overflow: hidden;
}

body[data-page="dashboard"] .chart-panel canvas {
    width: 100% !important;
    height: 300px !important;
    min-height: 300px;
    display: block;
}

body[data-page="dashboard"] .panel .table-wrap {
    height: 360px;
    overflow-x: auto;
    overflow-y: auto;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 21, 31, 0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 100;
    color: #fff;
    font-weight: 700;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

@media (max-width: 1080px) {
    .split-grid {
        grid-template-columns: 1fr;
    }

    .toolbar-grid {
        grid-template-columns: 1fr;
    }

    .meta-grid {
        grid-template-columns: 1fr 1fr;
    }

    .future-row {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    .hero {
        flex-direction: column;
    }

    .top-nav {
        width: 100%;
    }

    .nav-link {
        flex: 1;
        text-align: center;
    }

    .weather-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }
}
