/* ========================================================
   AIRFAREX PRESENTATION UI (FASTAPI STANDALONE EDITION)
   Replicating the exact Streamlit look, feel and visual design.
   ======================================================== */

:root {
    --bg: #f9f1f0;
    --text-main: #172033;
    --text-muted: #657386;
    --sidebar-bg: #eef2f7;
    --sidebar-border: #dbe2ea;
    --border-color: #dfe5ec;
    --card-bg: #ffffff;
    --airfarex-bg: url('/airfarex-aircraft.png');
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 310px;
    min-width: 310px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    padding: 1.5rem 1.1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 1.18rem;
    line-height: 1.2;
    font-weight: 800;
    color: #16243a;
    padding: 0.25rem 0 0.4rem 0;
    white-space: nowrap;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid #dbe2ea;
    margin: 0.2rem 0;
}

.sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-label {
    color: #344257;
    font-weight: 600;
    font-size: 0.82rem;
}

.date-range-container {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.date-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-input-sublabel {
    font-size: 0.75rem;
    color: #657386;
    width: 38px;
}

.sidebar-input, .sidebar-select {
    width: 100%;
    background: #fff;
    border: 1px solid #dce3ec;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.84rem;
    color: #1e293b;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

.sidebar-input:focus, .sidebar-select:focus {
    border-color: #4d83b5;
}

/* Custom Multiselect */
.multi-select-box {
    position: relative;
}

.multi-select-toggle {
    min-height: 36px;
    background: #fff;
    border: 1px solid #dce3ec;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.82rem;
    color: #1e293b;
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    user-select: none;
}

.multi-select-toggle:hover {
    border-color: #cbd5e1;
}

.multi-select-placeholder {
    color: #94a3b8;
    padding: 2px 4px;
}

.chip {
    background: #edf2f7;
    border: 1px solid #cbd5e1;
    color: #334155;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.74rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.chip-remove {
    cursor: pointer;
    color: #64748b;
    font-weight: bold;
}

.chip-remove:hover {
    color: #dc2626;
}

.multi-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    padding: 4px 0;
}

.multi-select-dropdown.open {
    display: block;
}

.multi-select-search {
    width: calc(100% - 12px);
    margin: 4px 6px 6px;
    padding: 5px 8px;
    font-size: 0.8rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    box-sizing: border-box;
}

.multi-select-option {
    padding: 6px 12px;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.multi-select-option:hover {
    background: #f1f5f9;
}

.multi-select-option input {
    margin: 0;
}

.sidebar-caption {
    color: #657386;
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 0.4rem 0;
}

.btn-refresh {
    width: 100%;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.15s ease;
}

.btn-refresh:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

.block-container {
    max-width: 1500px;
    padding: 1.0rem 2rem 2.5rem;
    margin: 0 auto;
}

/* ========================================================
   AIRFAREX GLASS HEADER
   Exact replica of Streamlit header
   ======================================================== */
.top-shell {
    position: relative;
    margin: 0 0 1.1rem 0;
    padding: 0.85rem 0.9rem 1rem;
    border-radius: 18px;
    overflow: hidden;
    isolation: isolate;
    color: #fff;
    border: 1px solid rgba(255,255,255,.18);
    box-shadow: 0 12px 32px rgba(20,55,85,.18);
    background-image: var(--airfarex-bg);
    background-size: cover;
    background-position: center 48%;
    background-repeat: no-repeat;
}

.top-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background: linear-gradient(180deg, rgba(7,42,68,.38) 0%, rgba(10,50,77,.28) 45%, rgba(6,31,52,.48) 100%);
}

.top-shell::after {
    content: "";
    position: absolute;
    inset: -18px;
    z-index: -1;
    background: inherit;
    filter: blur(7px);
    transform: scale(1.025);
    opacity: .22;
}

.hero {
    position: relative;
    min-height: 125px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.35rem 2rem 1.15rem;
    margin: 0 0 .8rem 0;
    border-radius: 14px;
    overflow: hidden;
    color: #fff;
    background: transparent;
}

.hero h1 {
    margin: 0;
    font-size: 3.15rem;
    line-height: 1.08;
    letter-spacing: -.035em;
    text-align: center;
    width: 100%;
    font-weight: 800;
    text-shadow: 0 2px 14px rgba(0,0,0,.28);
}

.judge-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .72rem;
    margin: 0;
}

.judge-card {
    min-height: 78px;
    padding: .78rem .9rem;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 12px;
    background: rgba(255,255,255,.16);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.20),
        0 5px 16px rgba(7,35,56,.13);
    backdrop-filter: blur(12px) saturate(125%);
    -webkit-backdrop-filter: blur(12px) saturate(125%);
}

.judge-card .label {
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .075em;
    color: rgba(255,255,255,.86);
    font-weight: 700;
    text-shadow: 0 1px 5px rgba(0,0,0,.22);
}

.judge-card .value {
    font-size: 1.18rem;
    font-weight: 750;
    color: #fff;
    margin-top: .2rem;
    text-shadow: 0 2px 8px rgba(0,0,0,.28);
}

/* ========================================================
   NAVIGATION: Streamlit st.segmented_control Replica
   ======================================================== */
.nav-segmented {
    display: flex;
    background: #eef2f7;
    border: 1px solid #dbe2ea;
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    gap: 3px;
}

.nav-item {
    border: none;
    background: transparent;
    padding: 0.5rem 0.9rem;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    font-family: inherit;
}

.nav-item:hover {
    color: #1e293b;
    background: rgba(255,255,255,0.5);
}

.nav-item.active {
    background: #fce6e5;
    color: #26344a;
    box-shadow: inset 0 0 0 1px #f49b9a;
    font-weight: 700;
}

/* Headings */
h3.st-subheader {
    font-size: 1.35rem;
    font-weight: 700;
    color: #16243a;
    margin: 1.4rem 0 0.5rem 0;
}

h4.st-heading {
    font-size: 1.1rem;
    font-weight: 650;
    color: #16243a;
    margin: 1.1rem 0 0.45rem 0;
}

.section-note {
    color: #657386;
    font-size: 0.86rem;
    margin-bottom: 1rem;
}

.st-caption {
    color: #657386;
    font-size: 0.8rem;
    margin-top: 0.4rem;
    margin-bottom: 0.8rem;
}

.st-divider {
    border: none;
    border-top: 1px solid #dfe5ec;
    margin: 1.3rem 0;
}

/* ========================================================
   KPI CARDS: Streamlit st.metric Replica
   ======================================================== */
.grid-cols-6 {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.grid-cols-5 {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.grid-cols-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.grid-cols-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.grid-cols-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
    margin-bottom: 1rem;
}

.grid-cols-split {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1.2rem;
    margin-bottom: 1rem;
}

.grid-cols-split-sources {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 1.2rem;
    margin-bottom: 1rem;
}

.st-metric {
    background: #fff;
    border: 1px solid #dfe5ec;
    border-radius: 11px;
    padding: .72rem .85rem;
    box-shadow: 0 2px 8px rgba(20,38,60,.035);
    min-height: 92px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.st-metric-label {
    color: #69778a;
    font-size: .78rem;
    margin-bottom: 2px;
}

.st-metric-value {
    color: #16243a;
    font-size: 1.85rem;
    line-height: 1.1;
    font-weight: 700;
}

.st-metric-delta {
    font-size: .82rem;
    line-height: 1.15;
    white-space: nowrap;
    margin-top: 4px;
    font-weight: 600;
}

.st-metric-delta.positive {
    color: #168853;
}

.st-metric-delta.negative {
    color: #d9383a;
}

/* First card alignment */
.latest-index-card {
    padding-right: 5.8rem !important;
}

.latest-index-card .st-metric-delta {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    text-align: right;
}

/* Callouts */
.callout {
    padding: .78rem 1rem;
    border-left: 3px solid #4d83b5;
    border-radius: 8px;
    background: #edf5fc;
    color: #3d5268;
    margin: .8rem 0 1rem 0;
    font-size: .82rem;
}

.movement-callout {
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.5;
    padding: .9rem 1.05rem;
}

/* Streamlit Alerts */
.st-alert {
    padding: .85rem 1.1rem;
    border-radius: 8px;
    margin: .8rem 0;
    font-size: .88rem;
    line-height: 1.45;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.st-alert-success {
    background: #eaf5ea;
    border: 1px solid #c7e6c7;
    color: #1e5a27;
}

.st-alert-warning {
    background: #fef7e7;
    border: 1px solid #fae1a2;
    color: #7f5800;
}

.st-alert-error {
    background: #fdf0f0;
    border: 1px solid #f9c6c6;
    color: #9c2727;
}

.st-alert-info {
    background: #edf5fc;
    border: 1px solid #cce3f5;
    color: #1d5583;
}

/* ========================================================
   TABLES: Streamlit st.dataframe Replica
   ======================================================== */
.st-dataframe-container {
    border: 1px solid #dfe5ec;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    margin: 0.6rem 0 1.2rem 0;
    box-shadow: 0 1px 4px rgba(20,38,60,.03);
}

.st-dataframe-scroll {
    max-height: 440px;
    overflow: auto;
}

.st-dataframe {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    text-align: left;
}

.st-dataframe th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.st-dataframe td {
    padding: 7px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    white-space: nowrap;
}

.st-dataframe tr:last-child td {
    border-bottom: none;
}

.st-dataframe tr:hover td {
    background: #f8fafc;
}

/* Chart container */
.chart-container {
    width: 100%;
    margin-bottom: 0.8rem;
    min-height: 250px;
}

/* Form Controls */
.filter-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.form-select {
    background: #fff;
    border: 1px solid #dce3ec;
    border-radius: 7px;
    padding: 6px 12px;
    font-size: 0.84rem;
    color: #1e293b;
    font-family: inherit;
    outline: none;
}

.form-select:focus {
    border-color: #4d83b5;
}

.form-number {
    background: #fff;
    border: 1px solid #dce3ec;
    border-radius: 7px;
    padding: 6px 10px;
    font-size: 0.84rem;
    color: #1e293b;
    font-family: inherit;
    width: 80px;
    outline: none;
}

.pager-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.85rem;
    color: #64748b;
}

.pager-btn {
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: inherit;
}

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

/* JSON display */
.json-box {
    background: #fff;
    border: 1px solid #dfe5ec;
    border-radius: 10px;
    padding: 1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #334155;
    max-height: 380px;
    overflow: auto;
    margin: 0.6rem 0 1.2rem;
}

/* Pipeline stages */
.pipeline-stage-row {
    display: grid;
    grid-template-columns: 0.55fr 2.8fr 1.4fr;
    align-items: center;
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.86rem;
}

.pipeline-stage-row:last-child {
    border-bottom: none;
}

.pipeline-status-chip {
    display: inline-block;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
}

.status-implemented {
    background: #eaf5ea;
    color: #1e5a27;
    border: 1px solid #c7e6c7;
}

.status-current {
    background: #edf5fc;
    color: #1d5583;
    border: 1px solid #cce3f5;
}

.status-service {
    background: #fef7e7;
    color: #7f5800;
    border: 1px solid #fae1a2;
}

/* Tab pages */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Loading spinner */
.loading-overlay {
    position: fixed;
    top: 12px;
    right: 20px;
    background: #1e293b;
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 1000;
}

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

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

@media (max-width: 1100px) {
    .judge-strip { grid-template-columns: repeat(2, 1fr); }
    .hero h1 { font-size: 2.2rem; }
    .grid-cols-6 { grid-template-columns: repeat(3, 1fr); }
    .grid-cols-5 { grid-template-columns: repeat(3, 1fr); }
    .grid-cols-split { grid-template-columns: 1fr; }
    .grid-cols-split-sources { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .judge-strip { grid-template-columns: 1fr; }
    .grid-cols-6, .grid-cols-5, .grid-cols-4, .grid-cols-3, .grid-cols-2 { grid-template-columns: 1fr; }
}



/* ========================================================
   AIRFAREX INTRO TRANSITION
   Navy-blue intro with smooth aircraft flight.
   ======================================================== */

.airfarex-intro {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(ellipse at 50% 48%, rgba(44, 105, 151, .24), transparent 43%),
        linear-gradient(135deg, #0b2036 0%, #102b46 54%, #0a1d31 100%);
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition:
        opacity 1100ms cubic-bezier(.22, 1, .36, 1),
        transform 1100ms cubic-bezier(.22, 1, .36, 1),
        visibility 1100ms;
}

.airfarex-intro::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .16;
    background-image:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 72px 72px;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
    pointer-events: none;
}

.airfarex-intro.is-leaving {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.025);
    pointer-events: none;
}

.airfarex-intro-copy {
    position: relative;
    z-index: 2;
    width: min(92vw, 720px);
    padding: 30px 20px;
    text-align: center;
    opacity: 0;
    transform: translateY(12px);
    animation: airfarex-copy-enter 1100ms cubic-bezier(.22, 1, .36, 1) 350ms forwards;
}

.airfarex-intro-eyebrow {
    margin: 0 0 20px;
    color: #a9c5dc;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .24em;
    text-transform: uppercase;
}

.airfarex-intro-brand {
    margin: 0;
    color: #fff;
    font-size: clamp(48px, 8vw, 78px);
    font-weight: 760;
    line-height: 1;
    letter-spacing: -.065em;
}

.airfarex-intro-brand span {
    color: #fff;
}

.airfarex-intro-system-name {
    margin: 17px 0 0;
    color: #e1ebf3;
    font-size: clamp(16px, 2.5vw, 21px);
    font-weight: 500;
    letter-spacing: .015em;
}

.airfarex-intro-department {
    margin: 9px 0 0;
    color: #a9c1d5;
    font-size: 13px;
    letter-spacing: .08em;
}

.airfarex-intro-progress {
    width: min(250px, 62vw);
    height: 2px;
    margin: 34px auto 13px;
    overflow: hidden;
    background: rgba(210, 231, 246, .2);
}

.airfarex-intro-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: #8dc4e8;
    animation: airfarex-progress 4.5s cubic-bezier(.22, .61, .36, 1) 350ms forwards;
}

.airfarex-intro-loading-label {
    margin: 0;
    color: #8faac0;
    font-size: 10px;
    letter-spacing: .2em;
    text-transform: uppercase;
}



/* Restored AirFareX intro animations — aircraft intentionally excluded. */

@keyframes airfarex-copy-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes airfarex-progress {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Intro aircraft image and flight animation intentionally disabled. */
.airfarex-intro-aircraft-wrap,
.airfarex-intro-aircraft {
    display: none !important;
}

@media (max-width: 680px) {
    .airfarex-intro-aircraft {
        width: 52vw;
    }
}

@media (prefers-reduced-motion: reduce) {
    .airfarex-intro-aircraft,
    .airfarex-intro-progress span,
    .airfarex-intro-copy {
        animation-duration: .01ms !important;
        animation-delay: 0ms !important;
    }

    .airfarex-intro {
        transition-duration: 150ms;
    }
}



/* AirFareX layout corrections */
.sidebar {
    display: none !important;
}

.app-layout {
    display: block !important;
    width: 100%;
    min-height: 100vh;
}

.main-wrapper {
    width: 100% !important;
    min-width: 0;
    max-width: none !important;
}

/* Restore the aircraft photograph in the main dashboard header */
.top-shell {
    background-image:
        linear-gradient(
            180deg,
            rgba(7, 42, 68, .28),
            rgba(10, 50, 77, .38)
        ),
        url('/airfarex-aircraft.png') !important;
    background-size: cover !important;
    background-position: center 48% !important;
    background-repeat: no-repeat !important;
}


/* ========================================================
   AIRFAREX FINAL LAYOUT SAFEGUARDS
   Keeps the existing visual design while preventing overflow
   and chart/grid distortion at common desktop and laptop widths.
   ======================================================== */

html,
body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

.app-layout,
.main-wrapper,
.block-container {
    min-width: 0;
    max-width: 100%;
}

.block-container {
    width: 100%;
    max-width: 1500px;
    margin-left: auto;
    margin-right: auto;
}

.top-shell {
    background-image:
        linear-gradient(
            180deg,
            rgba(7, 42, 68, .24) 0%,
            rgba(10, 50, 77, .34) 55%,
            rgba(6, 31, 52, .48) 100%
        ),
        url('/airfarex-aircraft.png') !important;
    background-size: cover !important;
    background-position: center 54% !important;
    background-repeat: no-repeat !important;
}

.top-shell::after {
    display: none;
}

.grid-cols-6,
.grid-cols-5,
.grid-cols-4,
.grid-cols-3,
.grid-cols-2,
.grid-cols-split,
.grid-cols-split-sources,
.judge-strip {
    min-width: 0;
}

.grid-cols-6 > *,
.grid-cols-5 > *,
.grid-cols-4 > *,
.grid-cols-3 > *,
.grid-cols-2 > *,
.grid-cols-split > *,
.grid-cols-split-sources > *,
.judge-strip > * {
    min-width: 0;
}

.chart-container {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.chart-container .js-plotly-plot,
.chart-container .plot-container,
.chart-container .svg-container {
    max-width: 100%;
}

.st-dataframe-container,
.st-dataframe-scroll {
    max-width: 100%;
    min-width: 0;
}

@media (max-width: 1200px) {
    .block-container {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .grid-cols-6 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .grid-cols-5,
    .grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-cols-split,
    .grid-cols-split-sources {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 820px) {
    .block-container {
        padding: .85rem .85rem 2rem;
    }

    .hero {
        min-height: 105px;
        padding: 1.1rem 1rem;
    }

    .hero h1 {
        font-size: clamp(2rem, 8vw, 2.6rem);
    }

    .judge-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-cols-6,
    .grid-cols-5,
    .grid-cols-4,
    .grid-cols-3,
    .grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nav-segmented {
        max-width: 100%;
    }
}

@media (max-width: 520px) {
    .judge-strip,
    .grid-cols-6,
    .grid-cols-5,
    .grid-cols-4,
    .grid-cols-3,
    .grid-cols-2 {
        grid-template-columns: minmax(0, 1fr);
    }

    .top-shell {
        padding: .7rem;
        border-radius: 14px;
    }

    .judge-card {
        min-height: 68px;
    }

    .st-metric-value {
        font-size: 1.55rem;
    }
}



/* ==========================================
   AIRFAREX — REMOVE LEFT FILTER SIDEBAR
   ========================================== */

/* Hide the left sidebar and filter panel */
aside,
#sidebar,
.sidebar,
.sidebar-container,
.filter-sidebar,
.filters-sidebar,
.dashboard-sidebar,
[class*="sidebar"],
[id*="sidebar"],
[class*="filter-panel"],
[id*="filter-panel"] {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
}

/* Expand the dashboard content */
main,
.main-content,
#main-content,
.dashboard-main,
.main-area,
.content-area {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    padding-left: 20px !important;
    grid-column: 1 / -1 !important;
    flex: 1 1 100% !important;
}

/* Remove empty sidebar column from common layouts */
.app-layout,
.dashboard-layout,
.dashboard-container,
.app-container {
    grid-template-columns: minmax(0, 1fr) !important;
    column-gap: 0 !important;
}

/* Prevent horizontal overflow */
html,
body {
    overflow-x: hidden;
}


/* AIRFAREX: PERMANENTLY HIDE LEFT SIDEBAR */

html body .app-layout > aside.sidebar {
    display: none !important;
}

/* Expand the dashboard to full available width */
html body .app-layout {
    display: flex !important;
    width: 100% !important;
    min-height: 100vh;
}

html body .app-layout > main.main-wrapper {
    display: block !important;
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
}

/* Remove leftover sidebar spacing */
html body .app-layout > main.main-wrapper .block-container {
    width: 100% !important;
    max-width: 100% !important;
}


/* ---------------------------------------------------------
   AirFareX India Route Map — isolated map styles
   --------------------------------------------------------- */

.afx-map-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.afx-map-route-control {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 230px;
}

.afx-map-route-control label {
    color: #344257;
    font-size: 0.82rem;
    font-weight: 600;
}

.afx-map-route-control select {
    min-width: 230px;
}

.afx-map-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
    margin: 1rem 0;
}

.afx-map-stat {
    min-width: 0;
    padding: 0.9rem 1rem;
    border: 1px solid #dfe5ec;
    border-radius: 10px;
    background: #fff;
}

.afx-map-stat-label {
    display: block;
    margin-bottom: 0.35rem;
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 600;
}

.afx-map-stat strong {
    display: block;
    overflow-wrap: anywhere;
    color: #263440;
    font-size: 1.08rem;
}

.afx-map-shell {
    overflow: hidden;
    border: 1px solid #34414c;
    border-radius: 12px;
    background: #18232d;
}

#afx-india-route-map {
    width: 100%;
    height: 680px;
    min-height: 520px;
    background: #18232d;
    z-index: 1;
}

#afx-india-route-map .leaflet-control-zoom a {
    color: #263440;
}

#afx-india-route-map .leaflet-control-attribution {
    background: rgba(19, 30, 40, 0.88);
    color: #d6dde3;
}

#afx-india-route-map .leaflet-control-attribution a {
    color: #D8C3A5;
}

.afx-map-airport-label {
    border: 1px solid #D8C3A5 !important;
    border-radius: 4px !important;
    background: rgba(19, 30, 40, 0.94) !important;
    box-shadow: none !important;
    color: #F2E7D5 !important;
    font-size: 10px !important;
    font-weight: 700;
}

.afx-map-airport-label::before {
    display: none !important;
}

.afx-map-route-tooltip,
.afx-map-state-tooltip,
.afx-map-river-tooltip {
    border: 1px solid #657785 !important;
    border-radius: 5px !important;
    background: #18232d !important;
    box-shadow: none !important;
    color: #edf1f4 !important;
    font-size: 11px;
}

.afx-map-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem 1.4rem;
    padding: 0.9rem 0.2rem;
    color: #48576a;
    font-size: 0.8rem;
}

.afx-map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.afx-legend-line {
    display: inline-block;
    width: 27px;
    height: 0;
    border-top: 3px solid;
}

.afx-legend-selected {
    border-color: #D8C3A5;
}

.afx-legend-other {
    border-color: #659BB8;
    border-top-style: dashed;
}

.afx-legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border: 2px solid #D8C3A5;
    border-radius: 50%;
    background: #F2E7D5;
}

.afx-legend-river {
    display: inline-block;
    width: 27px;
    height: 0;
    border-top: 2px solid #8295A0;
}

.afx-legend-boundary {
    display: inline-block;
    width: 27px;
    height: 0;
    border-top: 1px solid #C9BBA8;
}

.afx-map-detail {
    padding: 0.9rem 1rem;
    border: 1px solid #dfe5ec;
    border-radius: 9px;
    background: #fff;
    color: #344257;
    font-size: 0.88rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.afx-map-attribution {
    margin-top: 0.8rem;
    line-height: 1.6;
}

@media (max-width: 760px) {
    .afx-map-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #afx-india-route-map {
        height: 540px;
        min-height: 440px;
    }

    .afx-map-route-control,
    .afx-map-route-control select {
        width: 100%;
    }
}


/* India Route Map — official outline and route intelligence panel */

.afx-map-shell {
    background: #18232d;
    border: 1px solid #34414c;
    border-radius: 12px;
    overflow: hidden;
}

#afx-india-route-map {
    width: 100%;
    height: 720px;
    min-height: 560px;
    background: #18232d;
    z-index: 1;
}

#afx-india-route-map .leaflet-control-attribution {
    background: rgba(19, 30, 40, 0.9);
    color: #d6dde3;
}

#afx-india-route-map .leaflet-control-attribution a {
    color: #D8C3A5;
}

.afx-map-loc-tooltip {
    border: 1px solid #D69B70 !important;
    border-radius: 5px !important;
    background: #18232d !important;
    color: #F2E7D5 !important;
    box-shadow: none !important;
}

.afx-legend-outline,
.afx-legend-loc {
    display: inline-block;
    width: 27px;
    height: 0;
}

.afx-legend-outline {
    border-top: 3px solid #E4D6C3;
}

.afx-legend-loc {
    border-top: 2px dotted #D69B70;
}

.afx-plane-marker-wrap {
    background: transparent;
    border: 0;
}

.afx-plane-glyph {
    display: flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    color: #F5E7CF;
    font-size: 25px;
    line-height: 1;
    transform-origin: center center;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8));
    text-shadow: 0 1px 3px #111;
    will-change: transform;
}

.afx-route-detail-panel {
    margin-top: 1.2rem;
    padding: 1.2rem;
    border: 1px solid #dfe5ec;
    border-radius: 12px;
    background: #fff;
}

.afx-route-detail-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.afx-route-detail-heading h3 {
    margin: 0.25rem 0;
    color: #263440;
    font-size: 1.35rem;
}

.afx-route-detail-heading p {
    margin: 0;
    color: #64748b;
    font-size: 0.85rem;
}

.afx-route-detail-eyebrow {
    color: #8a765b;
    font-size: 0.68rem;
    letter-spacing: 0.13em;
    font-weight: 700;
}

.afx-route-detail-date {
    padding: 0.42rem 0.7rem;
    border: 1px solid #e2d8c9;
    border-radius: 6px;
    color: #665743;
    background: #faf7f2;
    font-size: 0.78rem;
    font-weight: 600;
}

.afx-airport-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
    align-items: center;
    gap: 0.7rem;
    margin: 1rem 0;
}

.afx-airport-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.32rem;
    padding: 0.9rem 1rem;
    border: 1px solid #e2e7ec;
    border-radius: 9px;
    background: #fbfcfd;
}

.afx-detail-label {
    color: #82909d;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.afx-airport-card strong {
    color: #263440;
    font-size: 1.25rem;
}

.afx-airport-card span:not(.afx-detail-label) {
    color: #435365;
    font-size: 0.83rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.afx-airport-card small {
    color: #82909d;
    font-size: 0.72rem;
}

.afx-airport-direction {
    color: #B39A77;
    font-size: 1.8rem;
    font-weight: 600;
    text-align: center;
}

.afx-detail-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
    margin: 1rem 0 1.4rem;
}

.afx-detail-metric {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid #e2e7ec;
    border-radius: 8px;
    background: #fff;
}

.afx-detail-metric span {
    color: #758393;
    font-size: 0.73rem;
    font-weight: 600;
}

.afx-detail-metric strong {
    color: #263440;
    font-size: 1.06rem;
    overflow-wrap: anywhere;
}

.afx-route-detail-panel .st-heading {
    margin-top: 1.4rem;
}

.afx-map-summary .afx-map-stat {
    background: #fff;
}

@media (max-width: 850px) {
    .afx-detail-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #afx-india-route-map {
        height: 620px;
        min-height: 480px;
    }
}

@media (max-width: 560px) {
    .afx-airport-pair {
        grid-template-columns: minmax(0, 1fr);
    }

    .afx-airport-direction {
        transform: rotate(90deg);
        font-size: 1.4rem;
    }

    .afx-detail-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .afx-route-detail-panel {
        padding: 0.8rem;
    }

    #afx-india-route-map {
        height: 520px;
        min-height: 430px;
    }
}

/* AirFareX India route map — visual hierarchy refinements */
.afx-map-shell {
    border: 1px solid #465968;
    border-radius: 14px;
    background: #18232d;
    box-shadow: 0 12px 32px rgba(21, 34, 45, 0.13);
}

#afx-india-route-map {
    width: 100%;
    height: 760px;
    min-height: 660px;
    background: #18232d;
}

#afx-india-route-map .leaflet-control-zoom a {
    width: 36px;
    height: 36px;
    line-height: 34px;
    border-color: #506170;
    background: #F4EEE5;
    color: #263440;
    font-size: 20px;
    font-weight: 700;
}

.afx-map-airport-label {
    padding: 3px 6px !important;
    border: 1px solid #E4D0B1 !important;
    border-radius: 5px !important;
    background: rgba(19, 30, 40, 0.97) !important;
    color: #FFF3E1 !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: 0.025em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28) !important;
}

.afx-map-route-tooltip {
    border-color: #D8C3A5 !important;
    background: #18232d !important;
    color: #FFF3E1 !important;
    font-size: 12px !important;
    font-weight: 700;
}

.afx-plane-glyph {
    color: #FFF0D5;
    font-size: 29px;
    filter: drop-shadow(0 0 5px rgba(240, 214, 172, 0.8))
            drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9));
}

@media (max-width: 760px) {
    #afx-india-route-map {
        height: 620px;
        min-height: 540px;
    }
}

/* Prominent route-selection control */
.afx-map-route-control {
    display: flex;
    flex: 0 0 350px;
    flex-direction: column;
    gap: 8px;
    width: 350px;
    max-width: 100%;
    padding: 15px 16px;
    border: 1px solid #D8C3A5;
    border-left: 5px solid #B89462;
    border-radius: 11px;
    background: linear-gradient(135deg, #FFFDF9 0%, #F5EBDD 100%);
    box-shadow: 0 5px 18px rgba(62, 51, 37, 0.12);
}

.afx-route-select-kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #85663F;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.afx-route-select-indicator {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: #B58B52;
    box-shadow: 0 0 0 4px rgba(181, 139, 82, 0.16);
}

.afx-map-route-control label {
    margin: 1px 0 0;
    color: #263440;
    font-size: 0.94rem;
    font-weight: 800;
}

#afx-map-route-select {
    width: 100%;
    min-height: 49px;
    padding: 0.7rem 2.5rem 0.7rem 0.9rem;
    border: 1.7px solid #B89462;
    border-radius: 7px;
    background-color: #FFFFFF;
    color: #263440;
    font-size: 1rem;
    font-weight: 750;
    box-shadow: 0 2px 6px rgba(38, 52, 64, 0.08);
    cursor: pointer;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

#afx-map-route-select:hover {
    border-color: #89683F;
    box-shadow: 0 3px 11px rgba(137, 104, 63, 0.16);
}

#afx-map-route-select:focus {
    outline: 3px solid rgba(184, 148, 98, 0.24);
    outline-offset: 2px;
    border-color: #89683F;
}

.afx-route-select-hint {
    color: #667585;
    font-size: 0.73rem;
    line-height: 1.5;
}

@media (max-width: 760px) {
    .afx-map-route-control {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
    }
}

/* Keep the route selector below the map heading */
.afx-map-route-control {
    margin: 1rem 0 1.25rem;
    align-self: flex-start;
}



/* =========================================================
   AIRFAREX — LATEST AUDIT SUMMARY CARD
   ========================================================= */

.audit-summary-card {
    background: #ffffff;
    border: 1px solid #dfe5ec;
    border-radius: 14px;
    padding: 1.25rem;
    margin: 0.65rem 0 1.2rem;
    box-shadow: 0 3px 14px rgba(20, 38, 60, 0.045);
}

.audit-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
}

.audit-summary-eyebrow {
    color: #718096;
    font-size: 0.70rem;
    font-weight: 750;
    letter-spacing: 0.12em;
    margin-bottom: 0.35rem;
}

.audit-summary-date {
    color: #172b46;
    font-size: 1.15rem;
    font-weight: 700;
}

.audit-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 30px;
    padding: 0.48rem 0.85rem;
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.045em;
}

.audit-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.audit-status-publishable {
    color: #147d50;
    background: #e9f7ef;
    border: 1px solid #c8ead5;
}

.audit-status-hold {
    color: #a56508;
    background: #fff5df;
    border: 1px solid #f0dfb5;
}

.audit-status-unavailable {
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #dfe5ec;
}

.audit-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
    padding: 1rem 0;
    border-top: 1px solid #edf0f4;
    border-bottom: 1px solid #edf0f4;
}

.audit-summary-metric {
    min-width: 0;
    padding: 0.8rem;
    background: #f8fafc;
    border: 1px solid #edf0f4;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.55rem;
}

.audit-summary-label {
    color: #718096;
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.4;
}

.audit-summary-value {
    color: #172b46;
    font-size: clamp(1.2rem, 2vw, 1.75rem);
    font-weight: 750;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.audit-summary-value.audit-positive {
    color: #168853;
}

.audit-summary-value.audit-negative {
    color: #d9383a;
}

.audit-full-details {
    margin-top: 1rem;
}

.audit-full-details summary {
    color: #315d91;
    font-size: 0.84rem;
    font-weight: 650;
    cursor: pointer;
    padding: 0.4rem 0;
}

.audit-full-details summary:hover {
    color: #173f70;
}

.audit-full-details pre {
    background: #f8fafc;
    border: 1px solid #e5eaf0;
    border-radius: 9px;
    padding: 1rem;
    margin-top: 0.65rem;
    color: #334155;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 380px;
    overflow: auto;
}

@media (max-width: 850px) {
    .audit-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .audit-summary-card {
        padding: 0.85rem;
    }

    .audit-summary-grid {
        gap: 0.55rem;
    }

    .audit-summary-metric {
        padding: 0.7rem;
    }
}
