:root {
    --bg-app: #f1f5f9;
    --sidebar-bg: #0b1120;
    --sidebar-border: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --info: #0ea5e9;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.09);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --sidebar-width: 270px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* App Layout Grid: Sidebar + Main Content */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR LATERAL */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    border-right: 1px solid var(--sidebar-border);
    transition: transform 0.25s ease;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
}

.sidebar-brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

/* User Box in Sidebar */
.sidebar-user-box {
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.user-info-text {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    background: #1e3a8a;
    color: #93c5fd;
    text-transform: uppercase;
}

/* Sidebar Nav Menu */
.sidebar-nav {
    flex: 1;
    padding: 1.25rem 0.85rem;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    padding: 0 0.6rem 0.5rem;
    margin-top: 1rem;
}

.nav-section-title:first-child {
    margin-top: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
    transition: all 0.15s ease;
}

.sidebar-item:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.sidebar-item.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.2) 0%, rgba(37, 99, 235, 0.05) 100%);
    color: #38bdf8;
    border-left: 3px solid #38bdf8;
    font-weight: 600;
}

.sidebar-item-icon {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

/* Sidebar Footer & 10k Quota Meter */
.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--sidebar-border);
    background: rgba(0, 0, 0, 0.2);
}

.quota-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-md);
    padding: 0.85rem;
}

.quota-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    margin-bottom: 0.4rem;
    color: #94a3b8;
}

.quota-progress {
    height: 6px;
    background: #1e293b;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.quota-bar {
    height: 100%;
    background: #10b981;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.quota-bar.warning {
    background: #f59e0b;
}

.quota-bar.danger {
    background: #ef4444;
}

.quota-sub {
    font-size: 0.7rem;
    color: #64748b;
    display: flex;
    justify-content: space-between;
}

/* MAIN APP CONTENT */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.2s ease;
}

.main-content.no-sidebar {
    margin-left: 0;
}

/* Top App Header */
.top-header {
    background: #ffffff;
    border-bottom: 1px solid var(--card-border);
    padding: 0.85rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(8px);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.header-title-area h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.header-title-area p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.user-greeting-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
}

.user-avatar-mini {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
}

.user-greeting-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-greeting-name {
    font-size: 0.8rem;
    color: #0f172a;
}

.user-greeting-role {
    font-size: 0.68rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Page Body Container */
.page-body {
    padding: 1.75rem 2rem;
    flex: 1;
}

/* Hero Weather Banner */
.weather-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #1e1b4b 100%);
    border-radius: var(--radius-lg);
    color: #ffffff;
    padding: 2rem 2.25rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.weather-hero::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.hero-main-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    position: relative;
    z-index: 2;
}

.hero-location-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    margin-bottom: 0.6rem;
}

.hero-location-name {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.25rem;
}

.hero-coords {
    color: #94a3b8;
    font-size: 0.85rem;
}

.hero-temp-block {
    text-align: right;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.hero-temp-main {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}

.hero-temp-sub {
    font-size: 0.85rem;
    color: #cbd5e1;
    margin-top: 0.4rem;
}

/* Executive Filter Toolbar Overhaul */
.filter-toolbar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.04);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.filter-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.filter-row-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-label-inline {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.site-select-modern {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
    min-width: 260px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.site-select-modern:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Segmented Pill Selector (SaaS/macOS style) */
.segmented-pill-group {
    display: inline-flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.segmented-pill-group input[type="radio"] {
    display: none;
}

.pill-btn {
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.segmented-pill-group input[type="radio"]:checked+.pill-btn {
    background: #ffffff;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
    font-weight: 700;
}

.pill-btn:hover {
    color: #0f172a;
}

/* Date Range Modern Group */
.date-range-box {
    display: inline-flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.75rem;
    gap: 0.5rem;
}

.date-input-clean {
    border: none;
    background: transparent;
    font-size: 0.82rem;
    color: #0f172a;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}

.date-input-clean:focus {
    outline: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    text-decoration: none;
}

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

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

.btn-secondary {
    background: #e2e8f0;
    color: #334155;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-geo {
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.btn-geo:hover {
    background: linear-gradient(135deg, #0284c7, #1d4ed8);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
}

/* Alerts Banners */
.alert-box {
    margin-bottom: 1.25rem;
    border-radius: var(--radius-md);
    padding: 0.85rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    animation: fadeIn 0.25s ease;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.alert-close-btn {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    line-height: 1;
    padding: 0 0.25rem;
    transition: opacity 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.alert-close-btn:hover {
    opacity: 1;
    transform: scale(1.15);
}

.alert-danger {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-left: 5px solid var(--danger);
    color: #9f1239;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-left: 5px solid var(--warning);
    color: #92400e;
}

.alert-info {
    background: #f0f9ff;
    border: 1px solid #e0f2fe;
    border-left: 5px solid var(--info);
    color: #0369a1;
}

.alert-title {
    font-weight: 700;
    font-size: 0.92rem;
    margin-bottom: 0.2rem;
}

.alert-text {
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Reorganized Interactive KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.35rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.kpi-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.kpi-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.kpi-value {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-main);
    margin-bottom: 0.4rem;
}

.kpi-foot {
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid #f8fafc;
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

.kpi-range-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.35rem 0 0.45rem;
    flex-wrap: wrap;
}

.range-pill {
    font-size: 0.73rem;
    padding: 2px 7px;
    border-radius: 6px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.range-pill.min {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.range-pill.max {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.range-pill.crit {
    background: #fff1f2;
    color: #be123c;
    border: 1px solid #fecdd3;
}

/* Micro-Gauge Thermal Stress Meter */
.stress-meter {
    height: 6px;
    background: linear-gradient(90deg, #10b981 0%, #f59e0b 50%, #ef4444 100%);
    border-radius: 4px;
    position: relative;
    margin: 0.4rem 0 0.6rem;
}

.stress-pointer {
    position: absolute;
    top: -3px;
    width: 12px;
    height: 12px;
    background: #0f172a;
    border: 2px solid #ffffff;
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Alert KPI Card */
.kpi-alert-card {
    background: #ffffff;
    border: 1px solid #fed7aa;
    border-top: 4px solid var(--warning);
}

.kpi-alert-card.danger-state {
    border-color: #fecdd3;
    border-top-color: var(--danger);
}

.kpi-alert-card.ok-state {
    border-color: #bbf7d0;
    border-top-color: var(--success);
}

.alert-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 95px;
    overflow-y: auto;
    margin-top: 0.35rem;
}

.alert-card-item {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    background: #fff1f2;
    color: #9f1239;
    border-left: 3px solid var(--danger);
}

.alert-card-item.warning {
    background: #fffbeb;
    color: #92400e;
    border-left-color: var(--warning);
}

/* Executive Tab Navigation System */
.executive-tabs-nav {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    color: #64748b;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-btn:hover {
    color: #0f172a;
}

.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    font-weight: 700;
}

.tab-count-badge {
    background: #f1f5f9;
    color: #475569;
    font-size: 0.7rem;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 700;
}

.tab-btn.active .tab-count-badge {
    background: #dbeafe;
    color: #1e40af;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.2s ease;
}

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

/* Roomy Horizontally Scrollable Chart Widget */
.chart-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.chart-scroll-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.73rem;
    font-weight: 600;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.8rem;
    color: #475569;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.chart-svg-wrapper {
    position: relative;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.75rem;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    background: #fafcff;
    border: 1px solid #f1f5f9;
}

.chart-svg-wrapper::-webkit-scrollbar {
    height: 7px;
}

.chart-svg-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.chart-svg-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.chart-svg-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Weather Loader Overlay */
.weather-loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.weather-loader-overlay.active {
    display: flex;
    opacity: 1;
}

.weather-loader-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 2.2rem 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 420px;
    width: 90%;
    animation: loaderPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loaderPop {
    from {
        transform: scale(0.92);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.weather-spinner-ring {
    position: relative;
    width: 68px;
    height: 68px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    border-right-color: #38bdf8;
    border-radius: 50%;
    animation: spinRing 0.85s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.weather-spinner-core {
    font-size: 1.6rem;
    animation: pulseCore 1.5s ease-in-out infinite alternate;
}

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

@keyframes pulseCore {
    0% {
        transform: scale(0.85);
    }
    100% {
        transform: scale(1.15);
    }
}

.weather-loader-title {
    font-size: 1.12rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.35rem;
}

.weather-loader-sub {
    font-size: 0.82rem;
    color: #64748b;
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

.weather-loader-bar {
    width: 100%;
    height: 5px;
    background: #f1f5f9;
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.weather-loader-bar-fill {
    width: 45%;
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #0ea5e9, #38bdf8);
    border-radius: 9999px;
    position: absolute;
    animation: indeterminateBar 1.3s ease-in-out infinite;
}

@keyframes indeterminateBar {
    0% {
        left: -45%;
    }
    100% {
        left: 100%;
    }
}

.chart-svg-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.svg-hourly-chart {
    height: 195px;
    display: block;
}

.chart-bar {
    fill: #93c5fd;
    transition: fill 0.15s ease;
    cursor: pointer;
}

.chart-bar:hover {
    fill: #2563eb;
}

.chart-bar.high-rain {
    fill: #fca5a5;
}

.chart-bar.high-rain:hover {
    fill: #ef4444;
}

.chart-tooltip {
    position: absolute;
    display: none;
    background: #0f172a;
    color: #ffffff;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    pointer-events: none;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    margin-bottom: 0.4rem;
}

.kpi-foot {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Visual Hourly Projection Carousel/Scroller */
.hourly-scroller {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

.hourly-card {
    min-width: 110px;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 0.9rem 0.75rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hourly-card.active-hour {
    background: #f0fdf4;
    border-color: #86efac;
}

.hourly-time {
    font-size: 0.8rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.35rem;
}

.hourly-temp {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.hourly-prob {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Executive Panels & Tables */
.exec-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.75rem;
    overflow: hidden;
}

.panel-header {
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.exec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.exec-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}

.exec-table td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.exec-table tr:hover td {
    background: #f8fafc;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
}

.badge-rain-crit {
    background: #ffe4e6;
    color: #9f1239;
    border: 1px solid #fecdd3;
    animation: pulse 2s infinite;
}

.badge-rain-high {
    background: #fee2e2;
    color: #991b1b;
}

.badge-rain-med {
    background: #fef3c7;
    color: #92400e;
}

.badge-rain-low {
    background: #ecfdf5;
    color: #065f46;
}

.badge-impact-crit {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-impact-med {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #b45309;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-impact-low {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

/* ==========================================================================
   SISTEMA DE DISEÑO GENÉRICO: MODALES, FORMULARIOS Y CONTROLES REUTILIZABLES
   ========================================================================== */

/* 1. Modal Overlay & Container */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.25rem;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-content {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(226, 232, 240, 0.9);
    width: 100%;
    max-width: 560px;
    padding: 2rem 2.25rem;
    animation: modalPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-sizing: border-box;
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid #f1f5f9;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.modal-close {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* 2. Generic Form Elements & Inputs */
.form-layout {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.form-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.4rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.form-label {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    color: #334155 !important;
    display: block !important;
    margin: 0 !important;
}

.form-input {
    width: 100% !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 0.65rem 0.95rem !important;
    font-size: 0.875rem !important;
    font-family: inherit !important;
    color: #0f172a !important;
    transition: all 0.15s ease !important;
    display: block !important;
}

.form-input:focus {
    outline: none !important;
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14) !important;
    background: #ffffff !important;
}

.form-input:disabled,
.form-input[readonly] {
    background: #f8fafc !important;
    color: #64748b !important;
    border-color: #e2e8f0 !important;
    cursor: not-allowed !important;
}

textarea.form-input {
    resize: vertical !important;
    min-height: 85px !important;
    line-height: 1.5 !important;
}

/* 3. Reusable Form Grid & Cards */
.form-grid-2 {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.85rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.form-section-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.9rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.45rem;
}

/* 4. Modern Toggle Switches / Checkbox Cards */
.perm-check-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.perm-check-item:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.perm-check-item input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: #2563eb;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.perm-check-text {
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
    line-height: 1.3;
}

.perm-check-title {
    font-weight: 700;
    color: #1e293b;
}

.perm-check-sub {
    font-size: 0.72rem;
    color: #64748b;
}

/* 5. Modal Footer Action Buttons */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1.15rem;
    border-top: 1px solid #f1f5f9;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.04);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Botón para ocultar / mostrar el menú lateral */
.sidebar-toggle-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    margin-right: 0.85rem;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    background: #f8fafc;
    color: #334155;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.sidebar-toggle-btn:hover,
.sidebar-toggle-btn:focus-visible {
    background: #e0f2fe;
    border-color: #38bdf8;
    outline: none;
}

.top-header .header-title-area {
    flex: 1;
    min-width: 0;
}

/* Menú lateral colapsado (escritorio) */
.app-container.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

.app-container.sidebar-collapsed .main-content {
    margin-left: 0;
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .page-body {
        padding: 1rem;
    }
}

/* ==========================================================================
   Hero Site Selector (Direct Top Dropdown)
   ========================================================================== */
.hero-site-select {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    padding: 0.5rem 2.4rem 0.5rem 1rem;
    font-size: 1.25rem;
    font-weight: 800;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 100%;
}

.hero-site-select:hover, .hero-site-select:focus {
    border-color: #38bdf8;
    background-color: rgba(15, 23, 42, 0.9);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.hero-site-select option {
    background-color: #0f172a;
    color: #f8fafc;
    font-size: 0.95rem;
    font-weight: 500;
}

/* ==========================================================================
   Scrollable, Non-Squashed Executive Tables
   ========================================================================== */
.exec-panel {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}
.table-responsive::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.exec-table {
    width: 100%;
    min-width: 980px; /* Crucial: Prevents squashing, enables clean horizontal scrolling */
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.exec-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}

.exec-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.exec-table tr:last-child td {
    border-bottom: none;
}

.exec-table tr:hover td {
    background-color: #f8fafc;
}

.site-code-badge {
    background: #f1f5f9;
    color: #0f172a;
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

.site-badge-primary {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.status-pill {
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}
.status-active {
    color: #16a34a;
}
.status-inactive {
    color: #dc2626;
}

.site-desc-cell {
    max-width: 380px;
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.45;
}

.site-actions-cell {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    white-space: nowrap;
}