* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #e7e7e7;
    color: #333;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, #5a4654 0%, #6b5a64 30%, #5a4654 60%, #4a3a44 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    min-height: 56px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-crest-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
}

.header-center {
    text-align: center;
}

.header-logo {
    height: 48px;
    object-fit: contain;
}

.header-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand-name {
    font-size: 20px;
    font-weight: 300;
    letter-spacing: 2px;
}

.brand-name em {
    font-style: italic;
    font-size: 16px;
}

.brand-tagline {
    font-size: 11px;
    font-style: italic;
    opacity: 0.8;
}

.header-right {
    font-size: 13px;
    opacity: 0.9;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-logout {
    padding: 6px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
}

.btn-logout:hover {
    background: #c82333;
}

/* ===== NAV TABS ===== */
.nav-tabs {
    background: #4a4048;
    display: flex;
    padding: 0;
    overflow-x: auto;
    border-bottom: 2px solid #3a3038;
}

.nav-tab {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    padding: 10px 18px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    font-family: inherit;
}

.nav-tab:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.nav-tab.active {
    color: white;
    background: rgba(255,255,255,0.15);
    border-bottom-color: white;
    font-weight: 600;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.section { display: none; }
.section.active { display: block; }

/* ===== KPI CARDS ===== */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.kpi-card {
    border-radius: 8px;
    padding: 16px 20px;
    color: white;
    text-align: center;
}

.kpi-card .kpi-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    opacity: 0.9;
}

.kpi-card .kpi-value {
    font-size: 32px;
    font-weight: 700;
}

.kpi-blue { background: #6676f2; }
.kpi-gray { background: #58858c; }
.kpi-green { background: #0fa439; }

.kpi-row-stats {
    display: flex;
    gap: 40px;
    margin-bottom: 20px;
    padding: 12px 0;
}

.kpi-stat {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.kpi-stat-label {
    font-size: 14px;
    color: #555;
}

.kpi-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #222;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: #555;
    margin-bottom: 12px;
}

/* ===== GRIDS ===== */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.grid-3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.grid-airlines {
    display: grid;
    grid-template-columns: 200px 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

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

/* ===== CHART WRAPS ===== */
.chart-wrap {
    position: relative;
    height: 280px;
}

.chart-wrap.tall {
    height: 350px;
}

/* ===== STAT LIST (Airlines/Flights) ===== */
.stat-list {
    font-size: 13px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.stat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.stat-logo {
    width: 36px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.airline-logo {
    max-width: 36px;
    max-height: 28px;
    object-fit: contain;
}

.airline-logo-fallback {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: #6c757d;
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.stat-name {
    flex: 1;
    color: #333;
}

.stat-value {
    font-weight: 500;
    color: #666;
    white-space: nowrap;
}

/* ===== AIRLINE BANNER ===== */
.airline-banner {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding: 16px 20px;
}

.airline-banner-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 80px;
}

.airline-banner-logo {
    height: 36px;
    max-width: 100px;
    object-fit: contain;
}

.airline-banner-count {
    font-size: 11px;
    font-weight: 600;
    color: #555;
}

/* ===== TIMES LIST (Wait/Processing) ===== */
.times-list {
    font-size: 13px;
}

/* ===== COLOR-CODED TIME METRICS ===== */
.time-metrics-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.time-metric {
    border-radius: 8px;
    padding: 10px 12px;
    border-left: 4px solid #999;
    background: #f9f9f9;
    transition: border-color 0.3s;
}
.time-metric.sla-green { border-left-color: #28a745; background: #f0faf2; }
.time-metric.sla-yellow { border-left-color: #fd7e14; background: #fff9f0; }
.time-metric.sla-red { border-left-color: #dc3545; background: #fdf0f0; }
.time-metric.sla-none { border-left-color: #ccc; background: #f5f5f5; }

.time-metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.time-metric-label {
    font-size: 12px;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.time-metric-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #999;
}
.time-metric-indicator.sla-green { background: #28a745; box-shadow: 0 0 6px rgba(40,167,69,0.4); }
.time-metric-indicator.sla-yellow { background: #fd7e14; box-shadow: 0 0 6px rgba(253,126,20,0.4); }
.time-metric-indicator.sla-red { background: #dc3545; animation: pulse-red 1.5s infinite; box-shadow: 0 0 6px rgba(220,53,69,0.5); }

@keyframes pulse-red {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(220,53,69,0.5); }
    50% { opacity: 0.7; box-shadow: 0 0 12px rgba(220,53,69,0.8); }
}

.time-metric-values {
    display: flex;
    gap: 16px;
}

.time-metric-avg, .time-metric-med {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}
.time-metric-avg::before { content: ""; }
.time-metric-med {
    font-size: 14px;
    font-weight: 500;
    color: #777;
}
.time-metric-med::before { content: "| "; color: #ccc; }

.sla-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 10px;
    color: #888;
}

.sla-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.sla-dot.sla-green { background: #28a745; }
.sla-dot.sla-yellow { background: #fd7e14; }
.sla-dot.sla-red { background: #dc3545; }

.time-metrics-note {
    margin-left: auto;
    font-style: italic;
}

.mt-16 { margin-top: 16px; }

/* ===== COUNTRY PILLS ===== */
.country-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 8px 0;
}

.country-pill {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: white;
}

/* ===== COUNTRY SUMMARY ===== */
.country-summary {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.country-summary-card {
    flex: 1;
    min-width: 200px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.country-summary-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.country-summary-pct {
    font-size: 24px;
    font-weight: 700;
    color: #666;
}

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    min-width: 160px;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
}

.hint-text {
    font-size: 13px;
    color: #888;
    font-style: italic;
}

/* ===== BUTTONS ===== */
.btn-primary {
    padding: 8px 20px;
    background: #5a4654;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary:hover { background: #5c4a3a; }

.btn-secondary {
    padding: 8px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}

.btn-preset {
    padding: 4px 12px;
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.btn-preset:hover { background: #dee2e6; }

.btn-export {
    padding: 8px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.btn-export:hover { background: #218838; }

/* ===== DEMOGRAPHICS ===== */
.demo-header {
    text-align: center;
    padding: 16px;
    font-size: 18px;
    margin-bottom: 16px;
}

.demo-header strong {
    font-size: 28px;
    color: #222;
}

.region-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.region-card {
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    text-align: center;
    min-width: 160px;
    flex-shrink: 0;
}

.region-card-name {
    font-size: 13px;
    margin-bottom: 4px;
}

.region-card-pct {
    font-size: 20px;
    font-weight: 700;
}

/* ===== RESORT LIST ===== */
.resort-list {
    max-height: calc(100vh - 340px);
    min-height: 300px;
    overflow-y: auto;
}

.resort-list-header {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #ddd;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.resort-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 4px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.resort-name { color: #333; }
.resort-count { font-weight: 600; color: #555; }

.accom-sidebar { max-width: 300px; }

.accom-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===== CALENDAR ===== */
.calendar-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.cal-filter-btn {
    padding: 6px 16px;
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.cal-filter-btn.active {
    background: #5a4654;
    color: white;
    border-color: #4a3728;
}

.calendar-kpis {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.cal-kpi {
    padding: 12px 20px;
    border-radius: 8px;
    text-align: center;
    min-width: 140px;
}

.cal-kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.cal-kpi-value {
    font-size: 24px;
    font-weight: 700;
}

.cal-kpi.blue { background: #3b7ddd; color: white; }
.cal-kpi.orange { background: #fd7e14; color: white; }
.cal-kpi.green { background: #28a745; color: white; }
.cal-kpi.red { background: #dc3545; color: white; }

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 16px;
}

.cal-nav-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#cal-month-title {
    font-size: 22px;
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.cal-header {
    background: #5a4654;
    color: white;
    padding: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
}

.cal-day {
    background: white;
    padding: 6px 8px;
    min-height: 100px;
    font-size: 11px;
    position: relative;
}

.cal-day.empty { background: #f0f0f0; }

.cal-day-num {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.cal-day-net {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 13px;
    font-weight: 700;
}

.cal-day-net.positive { color: #28a745; }
.cal-day-net.negative { color: #dc3545; }

.cal-arrivals { color: #28a745; }
.cal-departures { color: #dc3545; }
.cal-total { color: #333; font-weight: 600; }

.cal-day.peak { background: #d4edda; }
.cal-day.low { background: #f8d7da; }

/* ===== EXPORT ===== */
.export-bar {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.preset-btns {
    min-width: 200px;
}

.preset-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.preset-label {
    font-size: 12px;
    color: #666;
    min-width: 60px;
}

.export-controls {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    flex: 1;
}

.export-meta {
    font-size: 13px;
    color: #555;
    padding-bottom: 12px;
}

/* ===== SETTINGS ===== */
.settings-card {
    max-width: 400px;
}

.settings-form {
    margin-top: 16px;
}

.settings-form .filter-group {
    margin-bottom: 16px;
}

.settings-form input {
    width: 100%;
}

.text-center { text-align: center; }
.subtitle { font-size: 12px; color: #888; margin-bottom: 8px; }
.big-number { font-size: 48px; font-weight: 700; color: #222; }

.map-toggle {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 13px;
}

.map-toggle label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

/* ===== TIME RANGE BUTTONS ===== */
.time-range-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.time-range-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    color: #555;
    transition: all 0.2s;
}

.time-range-btn:hover {
    border-color: #5a4654;
    color: #5a4654;
}

.time-range-btn.active {
    background: #5a4654;
    border-color: #5a4654;
    color: white;
    font-weight: 600;
}

/* ===== ACCOMMODATION RANGE BUTTONS ===== */
.accom-range-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.accom-range-btn {
    padding: 5px 10px;
    background: #f0f0f0;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    color: #555;
    transition: all 0.15s;
}

.accom-range-btn:hover {
    background: #e0e0e0;
    border-color: #aaa;
}

.accom-range-btn.active {
    background: #5a4654;
    border-color: #5a4654;
    color: white;
    font-weight: 600;
}

.accom-custom-dates {
    margin-bottom: 10px;
}

.accom-custom-dates .filter-group {
    margin-bottom: 6px;
}

.accom-range-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
    font-style: italic;
}

/* ===== RESORT SELECTION ===== */
.resort-item {
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 4px;
    padding: 10px 8px;
}

.resort-item:hover {
    background: #f0f7ff;
}

.resort-item.selected {
    background: #e3f0ff;
    border-left: 3px solid #3b7ddd;
    font-weight: 600;
}

/* ===== KPI COMPARISON TABLE ===== */
.kpi-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.kpi-compare-table th {
    background: #f8f9fa;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.kpi-compare-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
}

.kpi-compare-table tr:hover td {
    background: #f8f9fa;
}

.color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

/* ===== TOGGLE LOCALS BUTTON ===== */
.toggle-locals-btn {
    margin-left: auto;
    padding: 6px 14px;
    border: 2px solid #fff;
    border-radius: 20px;
    background: transparent;
    color: #ddd;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.toggle-locals-btn.active {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.toggle-locals-btn:not(.active) {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
}

.toggle-locals-btn:hover { opacity: 0.85; }

/* ===== COUNTRY FLAGS ===== */
.country-flag { border-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,0.15); }

.country-summary-card {
    background: white;
    border-radius: 10px;
    padding: 16px 20px;
    text-align: center;
    flex: 1;
    min-width: 140px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.country-summary-flag { margin-bottom: 8px; }
.country-summary-flag img { width: 48px; height: auto; border-radius: 3px; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.country-summary-name { font-weight: 600; font-size: 14px; color: #333; margin-bottom: 4px; }
.country-summary-pct { font-size: 24px; font-weight: 700; color: #5a4654; }
.country-summary-count { font-size: 12px; color: #888; margin-top: 2px; }

.country-flag-list { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }
.country-flag-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.country-flag-icon { flex-shrink: 0; width: 32px; text-align: center; }
.country-flag-icon img { border-radius: 2px; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.country-flag-name { flex-shrink: 0; width: 140px; font-size: 13px; font-weight: 500; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.country-flag-bar-wrap { flex: 1; height: 18px; background: #eee; border-radius: 9px; overflow: hidden; }
.country-flag-bar { height: 100%; background: linear-gradient(90deg, #3b7ddd 0%, #6fa8f5 100%); border-radius: 9px; min-width: 4px; transition: width 0.5s ease; }
.country-flag-val { flex-shrink: 0; width: 60px; text-align: right; font-size: 12px; font-weight: 600; color: #555; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .grid-3col { grid-template-columns: 1fr; }
    .grid-2col { grid-template-columns: 1fr; }
    .grid-airlines { grid-template-columns: 1fr 1fr; }
    .grid-accommodations { grid-template-columns: 1fr; }
    .kpi-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .header { flex-direction: column; gap: 8px; padding: 12px; }
    .nav-tabs { flex-wrap: wrap; }
    .main-content { padding: 12px; }
    .kpi-row-stats { flex-direction: column; gap: 12px; }
    .grid-airlines { grid-template-columns: 1fr; }
    .export-bar { flex-direction: column; }
}
