:root {
    --bg-color: #F7F9FC;
    --card-bg: #FFFFFF;
    --sidebar-bg: #1C2A42;
    --sidebar-soft: #26375A;
    --sidebar-muted: #4C5E80;
    --text-main: #1C2A42;
    --text-muted: #64748b;
    --text-muted-soft: #66748F;
    --border-color: #e2e8f0;
    --border-strong: #D3DAE6;
    --color-good: #259E8A;
    --color-good-soft: #E3F0EC;
    --color-bad: #E4574C;
    --color-warn: #E3A008;
    --color-info: #2F5D8A;
    --font-ui: 'Space Grotesk', sans-serif;
    --font-data: 'IBM Plex Mono', monospace;
    --header-gradient: linear-gradient(135deg, #1C2A42 0%, #2F6F5E 50%, #2F5D8A 100%);
}

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted-soft); }

body {
    font-family: var(--font-ui);
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 248px;
    background: var(--sidebar-bg);
    color: #CBD5E6;
    display: flex;
    flex-direction: column;
    padding: 0;
    flex-shrink: 0;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 20;
}

.sidebar-header {
    padding: 20px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: contain;
    background: linear-gradient(145deg, var(--color-good), #1C4B3E);
    padding: 4px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-text h2 {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.2px;
    color: #F2F5F9;
    line-height: 1.15;
}

.brand-subtitle {
    font-size: 0.68rem;
    color: #8DA0BE;
    opacity: 1;
    font-family: var(--font-data);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 2px;
}

.project-selector-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 16px 12px 20px 12px;
    position: relative;
    overflow: visible;
    z-index: 200;
}

.project-selector-container label {
    font-size: 0.65rem;
    color: #5D6E8C;
    font-family: var(--font-data);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0 4px;
}

/* Custom Dropdown */
.custom-dropdown {
    position: relative;
    width: 100%;
    z-index: 300;
}

.dropdown-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #ffffff;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    gap: 8px;
    min-height: 40px;
}

.dropdown-selected:hover,
.dropdown-selected.active {
    border-color: var(--color-good);
}

.dropdown-selected.active {
    box-shadow: 0 0 0 2px rgba(47, 182, 163, 0.2);
}

.dropdown-selected-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #94a3b8;
}

.dropdown-selected-text.selected {
    color: #ffffff;
}

.dropdown-arrow {
    font-size: 0.75rem;
    color: #94a3b8;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.dropdown-selected.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: max-height 0.35s ease, opacity 0.25s ease, border-color 0.3s ease, transform 0.35s ease;
    z-index: 400;
}

.dropdown-options.open {
    max-height: 240px;
    opacity: 1;
    transform: translateY(0);
    border-color: var(--color-good);
    overflow-y: auto;
}

.dropdown-options::-webkit-scrollbar {
    width: 4px;
}

.dropdown-options::-webkit-scrollbar-track {
    background: transparent;
}

.dropdown-options::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 2px;
}

.dropdown-option {
    padding: 10px 12px;
    color: #cbd5e1;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-option:hover {
    background: #334155;
    color: #ffffff;
}

.dropdown-option.selected {
    background: rgba(47, 182, 163, 0.15);
    color: var(--color-good);
    font-weight: 600;
}

/* Sidebar Dropdown - Dark Theme Variant */
.sidebar-dropdown {
    width: 100%;
    z-index: 300;
}

.sidebar-dropdown-selected {
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #ffffff;
    min-height: 40px;
}

.sidebar-dropdown-selected:hover,
.sidebar-dropdown-selected.active {
    border-color: var(--color-good);
}

.sidebar-dropdown-selected.active {
    box-shadow: 0 0 0 2px rgba(37, 158, 138, 0.2);
}

.sidebar-dropdown-text {
    color: #94a3b8;
}

.sidebar-dropdown-text.selected {
    color: #ffffff;
}

.sidebar-dropdown-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease, border-color 0.3s ease;
    z-index: 400;
}

.sidebar-dropdown-options.open {
    max-height: 240px;
    opacity: 1;
    border-color: var(--color-good);
    overflow-y: auto;
}

.sidebar-dropdown-options::-webkit-scrollbar {
    width: 4px;
}

.sidebar-dropdown-options::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-dropdown-options::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 2px;
}

.sidebar-dropdown-options .dropdown-option {
    padding: 10px 12px;
    color: #cbd5e1;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-dropdown-options .dropdown-option:hover {
    background: #334155;
    color: #ffffff;
}

.sidebar-dropdown-options .dropdown-option.selected {
    background: rgba(37, 158, 138, 0.15);
    color: var(--color-good);
    font-weight: 600;
}

.nav-item {
    text-decoration: none;
    color: #cbd5e1;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
    background: #334155;
    color: #ffffff;
}

/* Sidebar Spacer - pushes user profile to bottom */
.sidebar-spacer {
    flex: 1;
}

/* User Profile Section */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 8px;
    flex-wrap: wrap;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(145deg, #FFD700, #FF8C00);
    color: #1C2A42;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.8rem;
    font-family: var(--font-data);
}

.user-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #F2F5F9;
    line-height: 1.2;
}

.user-role {
    font-size: 0.65rem;
    color: #8DA0BE;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--font-data);
    margin-top: 1px;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-top: 8px;
    justify-content: center;
}

.logout-btn:hover {
    background: #334155;
    color: #ffffff;
    border-color: #E4574C;
}

.logout-btn svg {
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
}

/* ---------- Header Zone (grid to align capsule under header-mid) ---------- */
.header-zone {
    display: grid;
    grid-template-columns: 1fr;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    background: var(--bg-color);
}

.header-zone .top-bar {
    grid-column: 1;
}

.header-zone .nav-capsule {
    grid-column: 1;
    justify-self: center;
}

/* ---------- Top Bar (gradient header, full-width edge to edge) ---------- */
.top-bar {
    background: var(--header-gradient);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 24px;
    gap: 20px;
    box-shadow: 0 2px 16px rgba(28, 42, 66, 0.15);
    width: 100%;
    min-height: 64px;
    margin: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    justify-self: start;
}

.page-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.1px;
    white-space: nowrap;
    color: #FFFFFF;
    line-height: 1.2;
}

.page-crumb {
    font-family: var(--font-data);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
    white-space: nowrap;
    line-height: 1.3;
    margin-top: 1px;
}

/* ---------- Page Header (TDO + project dropdown, below the bar) ---------- */
.page-header {
    background: transparent;
    border: none;
    padding: 10px 24px 4px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    box-shadow: none;
}

.page-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.page-header-left h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    line-height: 1.2;
    letter-spacing: 0.1px;
}

.page-crumb {
    font-family: var(--font-ui);
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 2px;
}

.page-crumb .project-sub-id {
    color: var(--text-muted);
    font-weight: 500;
    font-family: var(--font-data);
    margin-right: 4px;
}

.page-crumb .project-desc-text {
    color: var(--text-muted-soft);
    font-weight: 500;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-style: italic;
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Header horizontal project dropdown (light card on the page area) */
.header-project-dropdown {
    position: relative;
    min-width: 240px;
    max-width: 340px;
    z-index: 300;
}

.hdr-dropdown-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    gap: 8px;
    min-height: 42px;
}

.hdr-dropdown-selected:hover,
.hdr-dropdown-selected.active {
    border-color: var(--color-good);
}

.hdr-dropdown-selected.active {
    box-shadow: 0 0 0 2px rgba(37, 158, 138, 0.2);
}

.hdr-dropdown-selected .dropdown-selected-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.hdr-dropdown-selected .dropdown-selected-text.selected {
    color: var(--text-main);
    font-weight: 600;
}

.hdr-dropdown-selected .dropdown-arrow {
    color: var(--text-muted);
}

.hdr-dropdown-options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: max-height 0.35s ease, opacity 0.25s ease, border-color 0.3s ease, transform 0.35s ease;
    z-index: 400;
    box-shadow: 0 12px 28px rgba(28, 42, 66, 0.12);
}

.hdr-dropdown-options.open {
    max-height: 280px;
    opacity: 1;
    transform: translateY(0);
    border-color: var(--color-good);
    overflow-y: auto;
}

.hdr-dropdown-options::-webkit-scrollbar {
    width: 4px;
}

.hdr-dropdown-options::-webkit-scrollbar-track {
    background: transparent;
}

.hdr-dropdown-options::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.hdr-dropdown-options .dropdown-option {
    padding: 10px 14px;
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.hdr-dropdown-options .dropdown-option:hover {
    background: var(--color-good-soft);
    color: var(--color-good);
}

.hdr-dropdown-options .dropdown-option.selected {
    background: var(--color-good-soft);
    color: var(--color-good);
    font-weight: 600;
}


/* ---------- Header mid (chips) ---------- */
.header-mid {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    justify-self: center;
}

.chip {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 6px 12px;
    border-radius: 20px;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--font-data);
    font-size: 0.75rem;
    letter-spacing: 0.2px;
}

.chip strong {
    color: #ffffff;
    font-weight: 600;
}

.chip .icon {
    width: 14px;
    height: 14px;
    stroke-width: 2;
    flex-shrink: 0;
}

.chip .weather-icon {
    width: 16px;
    height: 16px;
}

.chip span {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.72rem;
    font-family: var(--font-data);
}

/* ---------- Nav capsule (centered under header-mid chips) ---------- */
.nav-capsule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 20px;
    margin: 10px auto 6px;
    width: fit-content;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 40px;
    box-shadow: 0 2px 8px rgba(28, 42, 66, 0.06);
}

.nav-capsule-btn {
    padding: 7px 26px;
    border-radius: 28px;
    text-decoration: none;
    white-space: nowrap;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    background: transparent;
    border: 1.5px solid transparent;
    transition: all 0.25s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.nav-capsule-btn:hover {
    color: var(--text-main);
    background: var(--bg-color);
    border-color: var(--border-color);
}

.nav-capsule-btn.active {
    color: #ffffff;
    background: var(--color-good);
    border-color: var(--color-good);
    box-shadow: 0 2px 10px rgba(37, 158, 138, 0.35);
    font-weight: 600;
}

/* ---------- Header right (weather chip aligned to rightmost) ---------- */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    justify-self: end;
}

/* Enhanced Weather Chip - Glassmorphism style */
.weather-chip-enhanced {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.08) 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    padding: 7px 16px 7px 14px;
    border-radius: 24px;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-data);
    font-size: 0.75rem;
    letter-spacing: 0.2px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    cursor: default;
}

.weather-chip-enhanced:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.12) 100%);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.weather-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.weather-left strong {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.85rem;
}

.weather-divider {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.weather-right {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    line-height: 1.2;
}

.weather-location {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--font-ui);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.weather-humidity {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-data);
}

.humidity-icon {
    width: 11px;
    height: 11px;
    stroke-width: 2;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.6);
}

.weather-chip-enhanced .weather-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    flex-shrink: 0;
    color: #FFD700;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.3));
}

/* Dashboard content padding (since main-content no longer has horizontal padding) */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px 24px 0 24px;
}

/* ---------- Main Scroll area (scrollable content below header zone) ---------- */
.main-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    color: var(--text-main);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.kpi-card {
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kpi-card h3 {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    font-weight: 600;
}

.kpi-card .value {
    font-family: var(--font-data);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.metric-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border-color);
}

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

.metric-row span {
    color: var(--text-muted);
    font-weight: 500;
}

.metric-row strong {
    font-family: var(--font-data);
    font-size: 1rem;
}

/* Status Colors */
.text-good {
    color: var(--color-good) !important;
}

.text-bad {
    color: var(--color-bad) !important;
}

.text-warn {
    color: var(--color-warn) !important;
}

/* Gauge Bars */
.gauge-bars {
    margin-top: 10px;
}

.gauge-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.gauge-label {
    width: 28px;
    font-weight: 600;
    color: var(--text-muted);
}

.gauge-track {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.gauge-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.fill-good {
    background: var(--color-good);
}

.fill-warn {
    background: var(--color-warn);
}

.fill-bad {
    background: var(--color-bad);
}

/* Charts */
.chart-container {
    width: 100%;
}

/* Expandable Chart Cards - Swap Interaction */
.chart-expandable {
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.chart-expandable:hover {
    border-color: var(--color-good);
    box-shadow: 0 4px 12px rgba(47, 182, 163, 0.15);
    transform: translateY(-2px);
}

/* When a trend chart is expanded (takes S-Curve position) */
.chart-expanded {
    border-color: var(--color-good) !important;
    box-shadow: 0 4px 20px rgba(47, 182, 163, 0.2) !important;
    animation: swapIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* When S-Curve is minimized (moved to grid position) */
.chart-minimized {
    border-color: #cbd5e1;
    opacity: 0.7;
    animation: swapOut 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.chart-minimized:hover {
    opacity: 0.9;
    border-color: var(--color-good);
}

@keyframes swapIn {
    from {
        opacity: 0.5;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes swapOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0.7;
        transform: scale(0.98) translateY(5px);
    }
}

/* Chart wrapper transition for height animation */
.chart-wrapper {
    transition: height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

/* Chart header */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.chart-header .section-title {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

/* View Toggle Bar - Top Right */
.view-toggle-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.toggle-bar-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 2px;
}

/* Toggle Switch */
.toggle-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 22px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--color-good);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Tables */
.tables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.table-scroll {
    overflow-x: auto;
    max-height: 280px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th,
td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

#resourceTable th:last-child,
#resourceTable td:last-child {
    text-align: center;
    padding-left: 24px;
}

th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 5;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

td {
    font-family: var(--font-ui);
    color: var(--text-main);
    font-weight: 500;
}

th.num-col,
td.num-col {
    text-align: right;
    font-family: var(--font-data);
}

/* Status Badges */
.status-badge {
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-good {
    background: rgba(47, 182, 163, 0.15);
    color: var(--color-good);
}

.badge-bad {
    background: rgba(228, 87, 76, 0.15);
    color: var(--color-bad);
}
