:root {
    --bg-main: #0B0F19;
    --bg-card: rgba(17, 24, 39, 0.7);
    --border-glow: rgba(59, 130, 246, 0.2);
    --border-active: rgba(59, 130, 246, 0.6);
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --primary: #3B82F6;
    --primary-hover: #2563EB;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --purple: #8B5CF6;
    --font-header: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
    display: flex;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   SIDEBAR PANEL
   ========================================================================== */
.sidebar {
    width: 360px;
    height: 100%;
    background-color: rgba(13, 18, 30, 0.85);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 10;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 28px;
    color: var(--success);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.logo span {
    font-family: var(--font-header);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #FFF 30%, #10B981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label i {
    color: var(--primary);
}

.group-label {
    margin-bottom: 4px;
}

/* Mode Toggle buttons */
.toggle-container {
    display: flex;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 3px;
}

.toggle-container input[type="radio"] {
    display: none;
}

.toggle-button {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.25s ease;
    display: block;
}

.toggle-container input[type="radio"]:checked + label {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Inputs grids */
.coords-grid, .dates-grid {
    display: flex;
    gap: 12px;
}

.input-with-sub {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-with-sub input {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px;
    color: white;
    font-family: var(--font-body);
    font-size: 13px;
    transition: all 0.25s ease;
}

.input-with-sub input:focus {
    outline: none;
    border-color: var(--primary);
    background-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-with-sub span {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: 4px;
}

.help-text {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
    padding-left: 2px;
}

/* File Drop Zone */
.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.01);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background-color: rgba(59, 130, 246, 0.03);
}

.drop-zone i {
    font-size: 28px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.drop-zone span {
    font-size: 13px;
    font-weight: 600;
}

.drop-zone .sub-text {
    font-size: 10px;
    color: var(--text-secondary);
}

.file-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
}

.file-badge i {
    color: var(--success);
}

.file-badge span {
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.file-badge button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.file-badge button:hover {
    color: var(--danger);
}

/* Sliders */
.range-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.range-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.range-header span:first-child {
    color: var(--text-secondary);
}

.range-header .range-val {
    font-weight: 700;
    color: var(--primary);
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border: none;
    border-radius: 8px;
    color: white;
    padding: 12px;
    font-family: var(--font-header);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    transition: background 0.2s ease;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 10px;
    color: var(--text-secondary);
    text-align: center;
}

.sidebar-footer span {
    display: block;
    margin-top: 4px;
    opacity: 0.6;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-content {
    flex-grow: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Map Section — split: left Leaflet map, right RGB gallery */
.map-section {
    display: flex;
    height: min(500px, 56vh);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}
/* Fullscreen map toggle */
.map-section.map-fullscreen {
    position: fixed;
    inset: 0;
    height: 100vh !important;
    z-index: 3000;
    border: none;
}
.map-fullscreen-btn {
    position: absolute;
    bottom: 30px;
    right: 12px;
    z-index: 1001;
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    padding: 6px 9px;
    cursor: pointer;
    font-size: 13px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.map-left {
    flex: 1;
    position: relative;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 0;
}

#map {
    height: 100%;
    width: 100%;
    background-color: #1a1e2a;
}

.map-overlay-card {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 14px;
    z-index: 999;
    max-width: 240px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.map-overlay-card h4 {
    font-family: var(--font-header);
    font-size: 13px;
    color: white;
}

.map-overlay-card p {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 3px;
    line-height: 1.4;
}

/* Dark-styled select popups: native <option> lists default to white bg, which
   made date text invisible (white on white). Force dark options everywhere. */
select option {
    background: #1a1e2a;
    color: #ffffff;
}

/* NDVI / EVI index toggle on the vegetation charts */
.vi-idx-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.vi-idx-btn.active {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.5);
    color: #10B981;
}

/* RGB Gallery Panel (right side) */
.rgb-panel {
    width: 360px;
    flex-shrink: 0;
    overflow-y: auto;
    background: #0b0f1a;
    padding: 10px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.rgb-panel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255,255,255,0.3);
    font-size: 12px;
    text-align: center;
    padding: 20px;
    gap: 8px;
}

.rgb-gallery-title {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 8px 2px;
}

.rgb-season-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.rgb-season-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    padding: 5px 8px;
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Scrollable row of date columns inside each season card */
.rgb-scene-scroll {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding: 6px 4px 6px 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.rgb-scene-col {
    flex-shrink: 0;
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 4px;
    padding: 2px 1px;
    transition: background 0.12s;
}

.rgb-scene-col:hover {
    background: rgba(255,255,255,0.05);
}

.rgb-scene-date {
    font-size: 8px;
    color: rgba(255,255,255,0.4);
    text-align: center;
    margin-bottom: 2px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.rgb-img {
    width: 78px;
    height: 55px;
    display: block;
    object-fit: cover;
    border-radius: 3px;
    background: #111827;
    margin-bottom: 1px;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: border-color 0.12s;
}

.rgb-img:hover {
    border-color: rgba(255,255,255,0.25);
}

.rgb-img.rgb-selected {
    border-color: #10B981;
    box-shadow: 0 0 0 1px #10B981;
}

.rgb-img-label {
    font-size: 7.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.28);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    margin-bottom: 1px;
}

.rgb-image-caption {
    font-size: 8px;
    color: rgba(255,255,255,0.22);
    text-align: center;
    margin-top: 1px;
}

.rgb-count {
    font-size: 9px;
    font-weight: 400;
    color: rgba(255,255,255,0.28);
}

/* Data status panel in sidebar */
.data-status-panel {
    padding: 10px 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 8px;
}
.dsp-title {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.28);
    margin-bottom: 8px;
}
.dsp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 7px;
}
.dsp-info { display: flex; flex-direction: column; gap: 1px; }
.dsp-label { font-size: 10px; color: rgba(255,255,255,0.4); font-weight: 500; }
.dsp-value { font-size: 10px; color: rgba(255,255,255,0.75); font-weight: 600; }
.btn-trigger {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 5px;
    color: rgba(255,255,255,0.5);
    width: 26px;
    height: 26px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.btn-trigger:hover { border-color: rgba(255,255,255,0.25); color: #fff; }
.btn-trigger:disabled { opacity: 0.45; cursor: default; }

/* Climate range toggle buttons */
.climate-range-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 5px;
    color: rgba(255,255,255,0.55);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    cursor: pointer;
    transition: all 0.15s;
}
.climate-range-btn:hover { border-color: rgba(255,255,255,0.25); color: rgba(255,255,255,0.85); }
.climate-range-btn.active { background: rgba(16,185,129,0.18); border-color: #10B981; color: #10B981; }

/* Leaflet layer control — dark theme */
.leaflet-control-layers {
    background: rgba(13, 17, 28, 0.95) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6) !important;
    color: #e5e7eb !important;
}
.leaflet-control-layers-list { padding: 4px 10px 8px; }
.leaflet-control-layers label { color: #d1d5db !important; font-size: 11.5px !important; display: flex; align-items: center; gap: 4px; margin: 3px 0; }
.leaflet-control-layers-separator { border-top: 1px solid rgba(255,255,255,0.12) !important; margin: 5px -10px !important; }
.leaflet-control-layers optgroup { color: rgba(255,255,255,0.5); font-size: 10px; }

/* Results section dashboard */
.results-section {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-header h2 {
    font-family: var(--font-header);
    font-size: 20px;
    font-weight: 700;
}

.results-header h2 i {
    color: var(--success);
}

.badge {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: monospace;
    font-weight: 700;
}

/* Metrics Dashboard Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.metric-card {
    background-color: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: border-color 0.2s ease;
}

.metric-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.metric-icon.green { background-color: rgba(16, 185, 129, 0.1); color: var(--success); }
.metric-icon.orange { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.metric-icon.purple { background-color: rgba(139, 92, 246, 0.1); color: var(--purple); }
.metric-icon.red { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); }

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-info .label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-info h3 {
    font-size: 14px;
    font-weight: 700;
    margin-top: 2px;
}

/* Tabs layout */
.tabs-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-color: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
}

.tabs-nav {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 8px;
}

.tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 12px 18px;
    font-family: var(--font-header);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    min-height: 300px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Plots cards gallery */
.plots-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.plot-card {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.plot-card.wide {
    grid-column: span 2;
}

.plot-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.plot-header h4 {
    font-family: var(--font-header);
    font-size: 15px;
    font-weight: 700;
}

.plot-header p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.img-wrapper {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-wrapper img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Downloads Card */
.downloads-card {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border: 1px dashed rgba(59, 130, 246, 0.25);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.downloads-text h4 {
    font-family: var(--font-header);
    font-size: 15px;
    font-weight: 700;
}

.downloads-text p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.downloads-actions {
    display: flex;
    gap: 12px;
}

.btn-download {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    padding: 10px 18px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-download:hover {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
}

.btn-download.dl-disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: default;
}

/* Harvest forecast card */
.harvest-card {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.07), rgba(59, 130, 246, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.22);
}
.harvest-card .hv-head {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 7px;
}
.harvest-card .hv-date {
    font-family: var(--font-header);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 4px 0 2px;
}
.harvest-card .hv-range { font-size: 12px; color: var(--text-secondary); }
.harvest-card .hv-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}
.harvest-card .hv-note {
    margin-top: 8px;
    font-size: 10px;
    line-height: 1.5;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* Season history table */
.seasons-table {
    margin-top: 12px;
    max-height: 260px;
    overflow: auto;
}
.seasons-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.seasons-table th {
    position: sticky;
    top: 0;
    background: #131c2e;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 6px 8px;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.seasons-table td {
    padding: 5px 8px;
    color: var(--text-primary);
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.seasons-table tr.sn-row-live td { background: rgba(56, 189, 248, 0.06); }
.seasons-table tr.sn-row-weak td { opacity: 0.62; }
.seasons-table .sn-live { color: #38bdf8; font-weight: 700; }
.seasons-table .sn-weak,
.seasons-table .sn-gap {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 9px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: help;
}
.seasons-table .sn-weak { background: rgba(148, 163, 184, 0.16); color: #94a3b8; }
.seasons-table .sn-gap { background: rgba(245, 158, 11, 0.14); color: #f59e0b; }
.seasons-table .sn-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: middle;
}

/* Weather forecast day strip */
.forecast-table {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}
.fc-day {
    flex: 1 0 84px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 6px 4px;
    text-align: center;
    font-size: 11px;
}
.fc-day .fc-date { color: var(--text-secondary); font-weight: 600; margin-bottom: 3px; }
.fc-day .fc-precip { color: #60a5fa; font-weight: 700; }
.fc-day .fc-precip .fc-mm { font-size: 9px; font-weight: 400; margin-left: 1px; }
.fc-day .fc-prob { color: var(--text-secondary); font-size: 10px; }
.fc-day .fc-temp { margin-top: 2px; }
.fc-day .fc-tmax { color: #ef4444; font-weight: 700; }
.fc-day .fc-tmin { color: #60a5fa; }

/* Welcome Splash */
.welcome-splash {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.splash-content {
    text-align: center;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.splash-icon {
    font-size: 54px;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.splash-content h1 {
    font-family: var(--font-header);
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #FFF 30%, #3B82F6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.splash-content p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.steps-hints {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 20px;
}

.hint-step {
    background-color: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
}

.step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hint-step p {
    font-size: 11px;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
}

/* ==========================================================================
   LOADING MODAL
   ========================================================================== */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-card {
    background-color: rgba(17, 24, 39, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 40px;
    width: 450px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loader-spinner {
    font-size: 48px;
    color: var(--success);
    margin-bottom: 8px;
}

.modal-card h3 {
    font-family: var(--font-header);
    font-size: 18px;
    font-weight: 700;
}

.modal-card p {
    font-size: 13px;
    color: var(--text-secondary);
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    width: 15%;
    height: 100%;
    background-color: var(--success);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.loader-sub {
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Helpers */
.hidden {
    display: none !important;
}

/* Map PM Drawing overrides */
.leaflet-pm-toolbar {
    background-color: var(--bg-card) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Interactive Charts & Static Toggle Panel Styles */
.chart-container {
    margin: 15px 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 10px;
    box-sizing: border-box;
}

.static-toggle {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.btn-toggle-static {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    outline: none;
}

.btn-toggle-static:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.static-img-wrapper {
    width: 100%;
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 15px;
}

.season-select {
    transition: border-color 0.2s ease, background-color 0.2s;
}
.season-select:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Sleek Dark Mode Overrides for Leaflet Controls */
.leaflet-control-layers {
    background: rgba(17, 24, 39, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 8px !important;
    color: #fff !important;
    font-family: 'Inter', sans-serif !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(8px);
    padding: 10px !important;
}

.leaflet-control-layers-list {
    font-size: 11px !important;
}

.leaflet-control-layers label {
    margin-bottom: 5px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.9);
}

.leaflet-control-layers label span {
    font-weight: 500;
}

.leaflet-control-layers input[type="checkbox"],
.leaflet-control-layers input[type="radio"] {
    cursor: pointer;
    accent-color: #3b82f6;
    width: 14px;
    height: 14px;
}

.map-season-control select {
    transition: all 0.2s ease;
}

.map-season-control select:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Phenology summary strip under the NDVI curves chart */
.phenology-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.phenology-summary.hidden { display: none; }
.pheno-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 4px 9px;
    font-size: 11px;
}
.pheno-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pheno-label { color: rgba(255, 255, 255, 0.55); }
.pheno-val { color: rgba(255, 255, 255, 0.9); font-weight: 600; }
.pheno-badge {
    display: flex;
    align-items: center;
    background: rgba(167, 139, 250, 0.15);
    border: 1px solid rgba(167, 139, 250, 0.4);
    color: #a78bfa;
    border-radius: 6px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 600;
}

/* ---- Condition synthesis card ---- */
.synthesis-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 18px;
}
.synthesis-card.hidden { display: none; }
.synthesis-main {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.condition-badge {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.3px;
    white-space: nowrap;
    border: 1px solid transparent;
}
.condition-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.condition-badge.cond-favourable { background: rgba(16,185,129,0.14); border-color: rgba(16,185,129,0.45); color: #34d399; }
.condition-badge.cond-favourable .condition-dot { background: #34d399; }
.condition-badge.cond-normal { background: rgba(20,184,166,0.12); border-color: rgba(20,184,166,0.4); color: #2dd4bf; }
.condition-badge.cond-normal .condition-dot { background: #2dd4bf; }
.condition-badge.cond-watch { background: rgba(245,158,11,0.13); border-color: rgba(245,158,11,0.45); color: #fbbf24; }
.condition-badge.cond-watch .condition-dot { background: #fbbf24; }
.condition-badge.cond-poor { background: rgba(239,68,68,0.13); border-color: rgba(239,68,68,0.45); color: #f87171; }
.condition-badge.cond-poor .condition-dot { background: #f87171; }
.condition-badge.cond-unknown { background: rgba(148,163,184,0.12); border-color: rgba(148,163,184,0.35); color: #94a3b8; }
.condition-badge.cond-unknown .condition-dot { background: #94a3b8; }
.synthesis-text { flex: 1 1 240px; min-width: 200px; }
.synthesis-title {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255,255,255,0.45);
    margin-bottom: 3px;
}
.synthesis-reason { margin: 0; font-size: 13px; color: rgba(255,255,255,0.82); line-height: 1.45; }
.synthesis-metrics { display: flex; gap: 20px; flex-wrap: wrap; }
.syn-metric { display: flex; flex-direction: column; align-items: center; min-width: 58px; }
.syn-metric-val { font-size: 18px; font-weight: 700; color: rgba(255,255,255,0.92); }
.syn-metric-val.pos { color: #34d399; }
.syn-metric-val.neg { color: #f87171; }
.syn-metric-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; color: rgba(255,255,255,0.45); margin-top: 2px; }

/* Grouped section sub-headers inside tabs */
.group-subhead {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255, 255, 255, 0.5);
    margin: 6px 2px 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.group-subhead:not(:first-child) { margin-top: 26px; }
.group-subhead i { color: var(--accent, #10B981); }

/* Crop-calendar strip */
.crop-calendar { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.08); }
.crop-calendar.hidden { display: none; }
.calendar-track {
    display: flex;
    height: 30px;
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
}
.calendar-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.92);
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
}
.calendar-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.cal-leg-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: rgba(255,255,255,0.6); }
.cal-leg-dot { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }

/* ============================================================= */
/* Mobile-friendly layout (<=768px). Desktop rules above are     */
/* untouched; everything here only applies on small screens.     */
/* ============================================================= */

/* Hidden on desktop */
.mobile-menu-btn { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 768px) {
    /* Shell: stack, sidebar becomes a left slide-in drawer */
    .app-container { flex-direction: column; }

    .mobile-menu-btn {
        display: flex; align-items: center; justify-content: center;
        position: fixed; top: 10px; left: 10px; z-index: 4001;
        width: 42px; height: 42px; border-radius: 10px;
        background: rgba(13, 18, 30, 0.92); color: #fff;
        border: 1px solid rgba(255,255,255,0.15); font-size: 18px; cursor: pointer;
        box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    }

    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        width: min(86vw, 340px); height: 100%;
        transform: translateX(-100%); transition: transform 0.25s ease;
        z-index: 4000; overflow-y: auto;
        box-shadow: 4px 0 24px rgba(0,0,0,0.6);
    }
    .app-container.drawer-open .sidebar { transform: translateX(0); }

    .sidebar-backdrop {
        display: block; position: fixed; inset: 0; z-index: 3999;
        background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .app-container.drawer-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }

    /* Main content takes the full width */
    .main-content { width: 100%; height: auto; overflow: visible; }
    .map-section { height: 52vh; min-height: 300px; }
    .map-left { border-right: none; }

    /* Give the map controls room from the hamburger */
    .map-overlay-card { left: 60px; max-width: calc(100vw - 130px); }

    /* Region imagery overlay control: compact + wrap so it fits */
    .map-season-control { max-width: 46vw; font-size: 11px; }
    .map-season-control select,
    #map-region-date, #map-landcover-year { width: 100% !important; }

    /* Results dashboard: comfortable padding, natural scroll */
    .results-section { padding: 16px 12px; overflow: visible; }

    /* Grids collapse to single/double column */
    .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .plots-grid { grid-template-columns: 1fr; gap: 14px; }
    .s1-charts-grid { grid-template-columns: 1fr !important; }

    /* Condition card stacks */
    .synthesis-main { flex-direction: column; align-items: flex-start; gap: 10px; }
    .synthesis-metrics { flex-wrap: wrap; }

    /* Tabs: horizontal scroll instead of overflow */
    .tabs-nav { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .tab-btn { flex: 0 0 auto; white-space: nowrap; }

    /* Bigger tap targets */
    .toggle-button, .tab-btn, .region-prod-btn, .vi-idx-btn { min-height: 40px; }

    /* Charts a touch shorter so two fit a screen */
    .chart-container { height: 280px !important; }
}

/* Landscape phones: keep the map from eating the whole viewport */
@media (max-width: 900px) and (orientation: landscape) {
    .map-section { height: 62vh; }
}



/* Condition card — how-it-is-computed methodology note */
.condition-method {
    font-size: 10.5px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Season-history footnote (Falha / low-vigour explainer) */
.sn-footnote {
    font-size: 10.5px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.sn-footnote b { color: var(--text-primary); font-weight: 600; }

/* Chart legend interaction hint */
.legend-hint {
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: 6px;
    text-align: center;
}
