/* ============================================
   APPLE DESIGN SYSTEM - SIDEBAR LAYOUT
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1,300..900&display=swap');

:root {
    /* Semantic Colors */
    --system-background: #050505;
    /* Slightly darker than pure black if desired, or keep #000 */
    --sidebar-background: #0f0f10;
    /* Darker sidebar */
    --content-background: #050505;

    --system-blue: #A44EE6;
    /* Tery Purple */
    --system-green: #30D158;
    --system-gray: #8E8E93;
    --system-gray2: #636366;
    --system-gray3: #48484A;
    --system-gray4: #3A3A3C;
    --system-gray5: #2C2C2E;

    /* Text */
    --label-primary: #FFFFFF;
    --label-secondary: rgba(235, 235, 245, 0.6);

    /* Layout */
    --sidebar-width: 320px;
    --spacing-s: 8px;
    --spacing-m: 16px;
    --spacing-l: 24px;

    /* Tery Design Tokens */
    --radius-s: 12px;
    --radius-m: 24px;
    --radius-pill: 100px;
}

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

body {
    background-color: var(--system-background);
    color: var(--label-primary);
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    /* Slightly larger base */
    /* Smaller default for sidebar apps */
    height: 100vh;
    overflow: hidden;
    /* App-like feel */
    -webkit-font-smoothing: antialiased;
}

/* Hide spin buttons for all numeric inputs */
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* App Layout */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: calc(100vh - 60px);
    /* Subtract header height and spacing */
    padding: 0 var(--spacing-m) var(--spacing-m);
    gap: var(--spacing-m);
}

/* Sidebar */
/* Sidebar Column */
.sidebar-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    gap: 12px;
}

/* Sidebar */
.sidebar {
    background-color: var(--content-background);
    border: 1px solid var(--system-gray5);
    border-radius: var(--radius-m);
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.project-header {
    padding: 0 4px;
    margin-bottom: 4px;
}

.project-header .project-name-input {
    background: transparent;
    border: none;
    font-size: 18px;
    font-weight: 700;
    color: var(--label-primary);
    width: 100%;
    padding: 0;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
    font-family: inherit;
    outline: none;
    transition: color 0.2s;
}

.project-header .project-name-input:focus {
    color: var(--system-blue);
}

.project-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    /* Space between name and button */
}

.project-header .project-name-input::placeholder {
    color: var(--system-gray);
}

.project-header .project-date {
    font-size: 12px;
    color: var(--system-gray);
    font-weight: 500;
}

.sidebar-content {
    padding: 0 var(--spacing-m);
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    /* Firefox */
}

.sidebar-content::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}



/* Config Groups */


/* Tariff Frame (Small Frame) - COMPACT */
.sidebar-frame {
    background-color: var(--content-background);
    border: 1px solid var(--system-gray5);
    border-radius: var(--radius-m);
    margin-bottom: 4px;
    /* Reduced to match layout */
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}



.frame-header {
    padding: 8px 16px;
    /* 16px to align with sidebar content */
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: transparent;
    user-select: none;
    /* No hover background change requested */
}

.frame-title {
    font-size: 11px;
    /* Match Simulation Header */
    font-weight: 700;
    color: var(--system-gray);
    letter-spacing: 0.05em;
    line-height: 1;
    margin: 0;
    margin-top: 8px;
    /* Push text down visually */
}

/* Icon removed from HTML, so no style needed for toggle-icon or rotation */

/* Content Animation */
.collapsible-content {
    display: block !important;
    /* Override inline styles if any */
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, padding 0.3s ease;
    padding: 0 12px;
    /* Smoother horizontal padding */
    padding-top: 0;
    padding-bottom: 0;
}

.sidebar-frame.expanded .collapsible-content {
    max-height: 500px;
    /* Sufficiently large */
    opacity: 1;
    padding-bottom: 12px;
    /* Compact padding */
}

.config-box.no-border {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
}

/* Compact Inputs for Tariffs */
#tariffsContent .input-row {
    margin-bottom: 4px;
    /* "Heel weinig ruimte" */
    padding-left: 8px;
    /* Shift to the right - adjusted again */
}

#tariffsContent .input-row input {
    padding: 4px 8px;
    /* Compact input */
    height: 28px;
    font-size: 12px;
    width: 80px;
}

#tariffsContent .input-row label {
    font-size: 12px;
}




/* Smooth Collapsible Animation */
.collapsible-wrapper {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    opacity: 1;
}

.collapsible-wrapper.collapsed {
    grid-template-rows: 0fr;
    opacity: 0;
    margin: 0;
}

.collapsible-inner {
    overflow: hidden;
    min-height: 0;
    /* Needed for grid item sizing */
    /* Add padding/margin here if needed inside the transition */
}

/* Base config group style */
.config-group {
    margin-bottom: 12px;
    /* Reduced from 32px */
}

.config-group h3 {
    font-size: 13px;
    /* text-transform: uppercase; Removed for friendlier look */
    color: var(--system-gray);
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

/* Simulation Cards */
/* Simulation Cards */
.simulation-section-header {
    margin-top: 24px;
    margin-bottom: 12px;
    /* padding-left: var(--spacing-m); Removed to fix alignment */
    /* padding-right: var(--spacing-m); Removed to fix alignment */
    font-size: 11px;
    /* text-transform: uppercase; Removed per user request */
    color: var(--system-gray);
    font-weight: 700;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.simulation-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0;
    /* Removed extra padding (was double padding with sidebar-content) */
    margin-bottom: 24px;
}

/* Animation from Landing Page */
/* Animation from Landing Page (Removed per user request) */
/* @keyframes gradient-dance ... */

.simulation-card {
    background: var(--system-gray5);
    border: 1px solid transparent;
    border-radius: var(--radius-s);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 80px;
    position: relative;
    z-index: 1;
}

.simulation-card:hover {
    background: var(--system-gray4);
}

.simulation-card.active {
    background: rgba(164, 78, 230, 0.15);
    /* Reverted to purple tint */
    border-color: var(--system-blue);
    /* Solid border */
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.2),
        0 8px 24px -4px rgba(164, 78, 230, 0.4);
    /* Kept Alpha Glow */
}

.simulation-card-icon {
    font-size: 22px;
    color: var(--system-gray);
    transition: color 0.2s;
    /* Gradient text fallback if needed, but SVG fill is better.
       For now assume text/emoji or simpler icon font.
       User mentioned "klein icoontje", I will use emoji or simple SVGs inline HTML.
    */
}

.simulation-card.active .simulation-card-icon {
    color: var(--system-blue);
    /* For SVGs */
    fill: var(--system-blue);
    stroke: var(--system-blue);
}

.simulation-card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--label-secondary);
    text-align: center;
}

.simulation-card.active .simulation-card-label {
    color: var(--label-primary);
}

/* Collapsible sections (hide everything except header when collapsed) */
.config-group.collapsible h3 {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    transition: color 0.2s ease;
}

.config-group.collapsible h3:hover {
    color: var(--label-primary);
}

.config-group.collapsible h3::after {
    content: "\2212";
    /* Unicode minus sign − */
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    transition: all 0.25s ease;
    color: var(--system-blue);
    opacity: 0.8;
}

.config-group.collapsible.collapsed>*:not(h3) {
    display: none;
}

.config-group.collapsible.collapsed h3::after {
    /* content: "+";  <-- Removed generic plus sign */
    content: none;
}

/* Toggle Text Logic */
.toggle-text {
    font-size: 11px;
    color: var(--label-secondary);
    /* White/Gray */
    cursor: pointer;
    font-weight: 500;
    margin-left: auto;
    /* Push to right */
    transition: color 0.2s;
}

.toggle-text:hover {
    color: var(--label-primary);
}

.config-group.collapsible.collapsed .toggle-text::after {
    content: "Toon instellingen";
}

.config-group.collapsible:not(.collapsed) .toggle-text::after {
    content: "Verberg instellingen";
}

/* Specific overrides for simulations to remove plus/minus and align toggles right */
#batterySection h3::after,
#solarSection h3::after,
#heatpumpSection h3::after {
    content: none;
}

/* Header toggle styling when placed in h3 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.section-sub {
    font-size: 10px;
    color: var(--system-blue);
    /* Highlight simulation tag */
    background: rgba(164, 78, 230, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
}

.header-toggle {
    margin-left: 12px;
}

.header-toggle .toggle-slider {
    width: 38px;
    height: 22px;
}

.header-toggle .toggle-slider::after {
    width: 16px;
    height: 16px;
    top: 3px;
    left: 3px;
}

.config-group.collapsible.collapsed>*:not(.section-header):not(h3) {
    display: none;
}

.separator {
    display: none;
    /* Removed as requested */
}

/* Inputs & Rows */
.input-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.input-row label {
    color: var(--label-secondary);
}

.input-row input {
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    /* Reserve space for hover line */
    border-radius: 0;
    color: var(--label-primary);
    padding: 6px 0;
    /* Remove horizontal padding */
    text-align: right;
    width: 90px;
    font-family: inherit;
    font-size: 14px;
    /* Slightly larger for readability */
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    transition: all 0.2s ease;
}

.input-row input:hover {
    border-bottom-color: var(--system-gray4);
}

.input-row input:focus {
    background: transparent;
    border-bottom-color: var(--system-blue);
    box-shadow: none;
    outline: none;
    color: var(--system-blue);
}

/* Toggle Switch */
.toggle-row {
    margin-bottom: var(--spacing-m);
}

.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.toggle-label input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    /* Slightly wider */
    height: 26px;
    background-color: var(--system-gray4);
    border-radius: 999px;
    transition: background-color 0.3s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: white;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-label input:checked+.toggle-slider {
    background-color: var(--system-blue);
    /* Purple */
}

.toggle-label input:checked+.toggle-slider::after {
    transform: translateX(18px);
}

/* Help Text */
.help-text {
    font-size: 12px;
    color: var(--system-gray);
    margin-top: 8px;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Main Content */
.main-content {
    background-color: var(--content-background);
    padding: var(--spacing-l);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--system-gray5);
    border-radius: var(--radius-m);
    scrollbar-width: none;
    /* Firefox */
}

.main-content::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--system-gray);
    text-align: center;
}

.empty-state h2 {
    font-size: 24px;
    color: var(--label-primary);
    margin-bottom: var(--spacing-s);
}

/* Daily Stats Summary */
.stats-summary {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-m);
    /* Removed margin/padding/border as per request for separate card */
}

.stats-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stats-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--system-gray);
    margin-bottom: 2px;
}

.stats-row {
    font-size: 12px;
    color: var(--label-secondary);
    font-variant-numeric: tabular-nums;
}

.stats-highlight {
    font-size: 12px;
    font-weight: 600;
    color: var(--system-green);
    margin-top: 2px;
}

/* Charts Section */
.charts-section {
    margin-bottom: 40px;
}

.date-controls-container {
    display: flex;
    justify-content: center;
    margin-bottom: var(--spacing-l);
}

.date-controls {
    display: flex;
    gap: var(--spacing-m);
    align-items: center;
    background: var(--system-gray5);
    padding: 6px;
    border-radius: var(--radius-pill);
    /* Pill shape container */
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.date-controls input[type="date"] {
    background: transparent;
    border: none;
    color: var(--label-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.date-controls input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.chart-header {
    display: none;
    justify-content: flex-end;
    /* Only view controls remaining */
    margin-bottom: var(--spacing-m);
    align-items: center;
}

.chart-card {
    background: var(--sidebar-background);
    border-radius: var(--radius-m);
    /* Larger radius */
    padding: var(--spacing-l);
    margin-bottom: var(--spacing-m);
    border: 1px solid var(--system-gray5);
    position: relative;
}

.chart-wrapper {
    position: relative;
    height: 400px;
    width: 100%;
}

.chart-no-data-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--system-gray);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    pointer-events: none;
    z-index: 10;
    background: rgba(28, 28, 30, 0.8);
    padding: 12px 24px;
    border-radius: 8px;
    border: 1px solid var(--system-gray5);
}

.chart-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-m);
    position: relative;
    /* For absolute centering of title */
}

.chart-header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    white-space: nowrap;
}

.chart-header-period {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.chart-header-description {
    font-size: 13px;
    font-weight: 500;
    color: #a0a0b0;
    line-height: 1.2;
}

.custom-chart-legend {
    display: flex;
    gap: 16px;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #a0a0b0;
    cursor: pointer;
    transition: opacity 0.2s;
}

.legend-item:hover {
    opacity: 0.8;
}

.legend-item.hidden {
    text-decoration: line-through;
    opacity: 0.5;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    /* display: inline-block; */
}

/* Controls */
.nav-btn,
.secondary-btn {
    background: var(--system-gray5);
    border: 1px solid transparent;
    color: var(--label-primary);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

/* .view-controls-container {
    display: flex;
    justify-content: center;
    margin-bottom: var(--spacing-m);
} */

.view-controls {
    display: flex;
    gap: 4px;
    background: var(--system-gray5);
    padding: 4px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.view-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--label-primary);
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-btn:hover,
.view-btn:hover {
    background: var(--system-gray4);
    border-color: rgba(255, 255, 255, 0.1);
}

.view-btn.active {
    background: var(--label-primary);
    /* White active state like generic tabs, or use Tery Purple? Let's use Tery Style */
    color: black;
    font-weight: 600;
}

.primary-btn {
    background: var(--system-blue);
    color: white;
    border: none;
    padding: 12px 20px;
    /* Bigger touch target */
    border-radius: var(--radius-pill);
    width: 100%;
    font-weight: 600;
    cursor: pointer;
    margin-top: var(--spacing-m);
    font-size: 14px;
    transition: transform 0.1s, background 0.2s;
}

.primary-btn:hover {
    background: #8e44ad;
    /* Slightly darker purple or filter */
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.primary-btn:active {
    transform: translateY(0);
}

/* Results */
.results-section {
    margin-bottom: 40px;
    /* More space below results section */
}

.results-section h3,
.monthly-section h3 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--spacing-m);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-m);
    margin-bottom: var(--spacing-l);
}

.kpi-card {
    background: var(--sidebar-background);
    padding: var(--spacing-l);
    border-radius: var(--radius-m);
    border: 1px solid var(--system-gray5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}

.kpi-label {
    display: block;
    font-size: 11px;
    color: var(--system-gray);
    text-transform: uppercase;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.kpi-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--label-primary);
    line-height: 1.1;
}

.kpi-unit {
    font-size: 13px;
    color: var(--system-gray);
    margin-top: 4px;
}

/* Financial Summary */
.financial-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    background: #1C1C1E;
    /* Keep distinct slightly lighter bg */
    border: 1px solid var(--system-gray5);
    border-radius: var(--radius-m);
    padding: 24px;
    gap: 24px;
}

.fin-col {
    text-align: center;
    border-right: 1px solid var(--system-gray5);
}

.fin-col:last-child {
    border-right: none;
}

.fin-label {
    display: block;
    font-size: 12px;
    color: var(--system-gray);
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

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

.fin-col.highlight .fin-value {
    color: var(--system-blue);
    /* Purple */
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    background: var(--sidebar-background);
    border-radius: var(--radius-m);
    overflow: hidden;
    border: 1px solid var(--system-gray5);
}

.data-table th {
    text-align: left;
    color: var(--system-gray);
    padding: 16px;
    border-bottom: 1px solid var(--system-gray5);
    background: rgba(255, 255, 255, 0.02);
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 600;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--system-gray5);
    color: var(--label-secondary);
}

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

/* Select Dropdowns */
.input-row select {
    background: var(--system-gray5);
    border: none;
    border-radius: 6px;
    color: var(--label-primary);
    padding: 6px 8px;
    text-align: right;
    width: 140px;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.input-row select:focus {
    background: var(--system-gray4);
    box-shadow: 0 0 0 1px var(--system-blue);
}

/* Heatpump Summary */
.heatpump-summary {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-s);
    padding: 16px;
    margin-top: 16px;
}

.heatpump-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
}

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

.heatpump-summary .summary-row span {
    color: var(--label-secondary);
}

.heatpump-summary .summary-row strong {
    color: var(--label-primary);
}

/* Warning Text */
.warning-text {
    background: rgba(255, 159, 10, 0.1);
    border-left: 3px solid #FF9F0A;
    padding: 12px;
    margin-top: 16px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
    color: #FF9F0A;
}

/* Cost Comparison Section */
.cost-comparison {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-s);
    padding: 16px;
    margin-top: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cost-comparison h4 {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--system-gray);
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: 0.05em;
}

.cost-comparison .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
}

.cost-comparison .summary-row:last-child {
    border-bottom: none;
}

.cost-comparison .summary-row span {
    color: var(--label-secondary);
}

.cost-comparison .summary-row strong {
    color: var(--label-primary);
}

.cost-comparison .summary-row.dimmed {
    opacity: 0.5;
    font-size: 12px;
}

.cost-comparison .summary-row.dimmed span {
    font-style: italic;
}

.cost-comparison .summary-row.highlight strong {
    color: var(--system-blue);
    /* Purple */
    font-size: 15px;
}

.cost-comparison .summary-row.highlight.negative strong {
    color: #FF453A;
}

/* Battery Details Expandable */
.kpi-card-expandable {
    cursor: pointer;
}

.kpi-card-expandable summary {
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Left align */
    text-align: left;
    /* Left align */
    width: 100%;
}

.kpi-card-expandable summary::-webkit-details-marker {
    display: none;
}

.kpi-card-expandable .kpi-label {
    cursor: pointer;
}

.kpi-card-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--system-gray5);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--label-secondary);
    margin-bottom: 6px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.kpi-card-expandable[open] .kpi-label {
    color: var(--system-blue);
}

/* Scrollable Config Sections */
/* Scrollable Config Sections */
.config-box,
#solarConfig,
#heatpumpConfig {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
    margin-top: 12px;
    padding: 16px;
    background: var(--sidebar-background);
    border-radius: var(--radius-s);
    border: 1px solid var(--system-gray5);
}

/* Custom Scrollbar for Config Sections */
.config-box::-webkit-scrollbar,
#solarConfig::-webkit-scrollbar,
#heatpumpConfig::-webkit-scrollbar {
    width: 6px;
}

.config-box::-webkit-scrollbar-track,
#solarConfig::-webkit-scrollbar-track,
#heatpumpConfig::-webkit-scrollbar-track {
    background: transparent;
}

.config-box::-webkit-scrollbar-thumb,
#solarConfig::-webkit-scrollbar-thumb,
#heatpumpConfig::-webkit-scrollbar-thumb {
    background-color: var(--system-gray4);
    border-radius: 3px;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.modal-content {
    background-color: #151516;
    width: 90%;
    max-width: 650px;
    border-radius: 24px;
    border: 1px solid var(--system-gray5);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--system-gray5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(21, 21, 22, 0.95);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--label-primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--system-gray);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--label-primary);
}

.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Clickable Stats */
.clickable-stat {
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
}

.clickable-stat:hover {
    transform: translateY(-2px);
    border-color: var(--system-blue);
    background-color: #2c2c2e;
}

.clickable-stat::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 14px;
    height: 14px;
    background-color: var(--system-gray);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") no-repeat center;
    opacity: 0.4;
    transition: opacity 0.2s, background-color 0.2s;
}

.clickable-stat:hover::after {
    opacity: 1;
    background-color: var(--system-blue);
}

/* Heatmap Styles */
.heatmap-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.heatmap-year {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.heatmap-week {
    display: flex;
    gap: 4px;
}

.heatmap-day {
    width: 14px;
    height: 14px;
    background-color: var(--system-gray5);
    border-radius: 2px;
    position: relative;
}

.heatmap-day.active {
    background-color: var(--system-green);
}

.heatmap-day:hover {
    outline: 2px solid white;
    z-index: 10;
}

/* Tooltip */
.heatmap-day::before {
    content: attr(data-date);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 4px;
}

.heatmap-day:hover::before {
    opacity: 1;
}

.heatmap-legend {
    display: flex;
    gap: 16px;
    margin-top: 20px;
    justify-content: flex-end;
    font-size: 12px;
    color: var(--label-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* ============================================
   Stats Card Modernization (Tery Design)
   ============================================ */
.stats-modern-grid {
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
    /* Space from chart above */
}

/* New Single Card Style */
.stat-card-single {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--system-gray5);
    border-radius: 16px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 80px;
    flex: 1;
    /* Expand to fill width */
}

/* Savings card specific style (Highlight) */
.stat-card-single.highlight {
    background: rgba(164, 78, 230, 0.1);
    border: 1px solid rgba(164, 78, 230, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    /* margin-left: auto; Removed auto margin as flex:1 handles spacing */
    align-items: flex-end;
    /* Align content to right inside card */
    text-align: right;
    min-width: 140px;
}

.stat-label-modern {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--system-gray);
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.stat-value-primary {
    font-size: 18px;
    font-weight: 700;
    color: var(--label-primary);
    line-height: 1.1;
}

.stat-sub-row {
    font-size: 10px;
    color: var(--label-secondary);
    margin-top: 2px;
}

.stat-sub-row.dimmed {
    color: var(--system-gray2);
}

.calendar-nav-btn {
    background: var(--system-gray5);
    border: none;
    color: var(--label-secondary);
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-right: -4px;
    /* Tighten gap with date input */
}

.calendar-nav-btn:hover {
    background: var(--system-gray4);
    color: var(--label-primary);
    transform: translateY(-1px);
}

.calendar-nav-btn:active {
    transform: translateY(0);
}

.heatmap-day.selected {
    outline: 2px solid var(--system-blue);
    outline-offset: 1px;
    z-index: 5;
}

/* Hide native browser calendar icon */
input[type="date"]::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}

/* ============================================
   HEADER / NAV STYLES (Adapted for Dark Mode)
   ============================================ */

.nav {
    padding: 12px 0;
    margin-bottom: 8px;
    position: relative;
    z-index: 10001;
}

.nav-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    max-width: none;
    margin: 0;
    width: 100%;
    padding: 0 var(--spacing-m);
}

.nav-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.logo img {
    /* Invert logo for dark mode (black -> white) */
    filter: invert(1);
    opacity: 0.9;
}

.nav-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--label-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
    padding: 4px 0;
}

.nav-link:hover {
    color: var(--label-primary);
}

.nav-link.active {
    color: var(--label-primary);
    font-weight: 600;
}

/* Underline for active link (white in dark mode) */
.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--label-primary);
    border-radius: 2px;
}

.nav-right {
    display: flex;
    justify-content: flex-end;
}

.btn-dark-pill {
    background-color: var(--label-primary);
    /* White button */
    color: black;
    /* Black text */
    padding: 10px 20px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-dark-pill:hover {
    background-color: #e5e5e5;
    /* Slightly darker white on hover */
    transform: translateY(-1px);
}



/* Monthly Table Column Hiding */
#monthlyTable.battery-hidden th:nth-child(4),
#monthlyTable.battery-hidden td:nth-child(4),
#monthlyTable.battery-hidden th:nth-child(5),
#monthlyTable.battery-hidden td:nth-child(5) {
    display: none;
}

/* ============================================
   CUSTOM CHART TOOLTIP (Glassmorphism)
   ============================================ */

#chartjs-tooltip {
    opacity: 0;
    position: absolute;
    background: rgba(15, 15, 16, 0.65);
    /* Semi-transparent darker background */
    backdrop-filter: blur(12px);
    /* Glassmorphism blur */
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Subtle border */
    border-radius: 16px;
    /* Rounded corners */
    pointer-events: none;
    /* Let mouse pass through */
    transform: translate(-50%, -100%);
    /* Position above the caret */
    margin-top: -12px;
    /* Small gap from the point */
    transition: opacity 0.2s ease, transform 0.2s ease, left 0.1s ease, top 0.1s ease;
    z-index: 100;
    font-family: 'Figtree', sans-serif;
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 200px;
}

.tooltip-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
}

.tooltip-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tooltip-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tooltip-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    gap: 12px;
}

.tooltip-label-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tooltip-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tooltip-icon svg {
    width: 100%;
    height: 100%;
}

.tooltip-label {
    color: rgba(235, 235, 245, 0.6);
    font-weight: 500;
}

.tooltip-value {
    color: #ffffff;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   WHEEL DATE PICKER STYLES (iOS Style)
   ============================================ */

.wheel-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, backdrop-filter 0.25s ease;
    display: flex;
    /* JS toggles flex/block, but flex is better for centering */
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.wheel-picker-content {
    background: rgba(21, 21, 22, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-m);
    width: 320px;
    padding: 0;
    overflow: hidden;
    position: absolute;
    /* Changed to absolute for precise positioning */
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
    transform-origin: center center;
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

/* Class to fade out the controls behind */
.date-controls {
    transition: opacity 0.4s ease;
}

.date-controls.faded-out {
    opacity: 0;
    pointer-events: none;
}

.wheel-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.wheel-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--label-primary);
    margin: 0;
}

.wheel-btn {
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px;
    transition: opacity 0.2s;
}

.wheel-btn.primary {
    color: var(--system-blue);
    font-weight: 700;
}

.wheel-btn.secondary {
    color: var(--system-gray);
}

.wheel-btn:hover {
    opacity: 0.7;
}

.wheel-picker-body {
    position: relative;
    height: 200px;
    overflow: hidden;
    padding: 0 16px;
    background: linear-gradient(to bottom,
            rgba(21, 21, 22, 0.9) 0%,
            rgba(21, 21, 22, 0) 25%,
            rgba(21, 21, 22, 0) 75%,
            rgba(21, 21, 22, 0.9) 100%);
}

.wheel-columns {
    display: flex;
    height: 100%;
    perspective: 1000px;
}

.wheel-column {
    flex: 1;
    height: 100%;
    position: relative;
    overflow-y: scroll;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    scroll-snap-type: y mandatory;
}

.wheel-column::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.wheel-scroller {
    padding: 80px 0;
    /* Padding to allow top items to reach center */
}

.wheel-item {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: var(--label-secondary);
    scroll-snap-align: center;
    transition: color 0.2s, transform 0.2s, opacity 0.2s;
    user-select: none;
    white-space: nowrap;
}

.wheel-item.selected {
    color: var(--label-primary);
    font-weight: 600;
    font-size: 20px;
}

.wheel-selection-indicator {
    position: absolute;
    top: 50%;
    left: 16px;
    right: 16px;
    height: 40px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    pointer-events: none;
}

/* Modal active state */
.wheel-picker-overlay.active {
    opacity: 1;
    pointer-events: auto;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.wheel-picker-overlay.active .wheel-picker-content {
    transform: scale(1);
    opacity: 1;
}

/* Peak List in Heatmap Modal */
.peak-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.peak-list-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--system-gray5);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.peak-date {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    color: var(--system-gray);
}

.peak-month {
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.peak-day {
    color: var(--label-secondary);
}

.peak-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--label-primary);
    margin-top: 4px;
}

.peak-value .unit {
    font-size: 12px;
    font-weight: 500;
    color: var(--system-gray);
    margin-left: 2px;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

.main-content {
    position: relative;
}

#loadingOverlay {
    /* Position is handled by JS (fixed) */
    background-color: #050506;
    z-index: 9999;

    /* Initially hidden, JS sets to flex */
    display: none;

    overflow: hidden;
    border-radius: var(--radius-m);
}

/* Fluid Blobs Container */
.loading-blobs {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: 1;
    overflow: hidden;
    filter: blur(80px);
}

/* Individual Blobs */
.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.8;
    mix-blend-mode: normal;
}

/* Purple Orb 1 */
.blob-purple-1 {
    width: 40%;
    height: 40%;
    background: #A44EE6;
    top: 10%;
    left: 10%;
    animation: move-1 25s infinite alternate ease-in-out;
}

@keyframes move-1 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(80%, 20%) scale(1.2);
    }

    66% {
        transform: translate(20%, 80%) scale(0.9);
    }

    100% {
        transform: translate(60%, 60%) scale(1.1);
    }
}

/* Purple Orb 2 */
.blob-purple-2 {
    width: 35%;
    height: 35%;
    background: #694ED7;
    bottom: 20%;
    right: 20%;
    animation: move-2 30s infinite alternate ease-in-out;
}

@keyframes move-2 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(-60%, -20%) scale(1.1);
    }

    66% {
        transform: translate(-20%, -60%) scale(0.9);
    }

    100% {
        transform: translate(-80%, -40%) scale(1.2);
    }
}

/* Purple Orb 3 */
.blob-purple-3 {
    width: 30%;
    height: 30%;
    background: #A44EE6;
    top: 40%;
    left: 40%;
    opacity: 0.6;
    animation: move-3 22s infinite alternate ease-in-out;
}

@keyframes move-3 {
    0% {
        transform: translate(-20%, -20%);
    }

    50% {
        transform: translate(40%, 40%);
    }

    100% {
        transform: translate(-30%, 30%);
    }
}

/* Black Voids */
.blob-black-1 {
    width: 45%;
    height: 45%;
    background: #0f0f11;
    top: 0;
    left: 50%;
    z-index: 2;
    animation: void-move-1 18s infinite linear;
}

@keyframes void-move-1 {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(-30%, 50%) rotate(120deg);
    }

    66% {
        transform: translate(30%, 80%) rotate(240deg);
    }

    100% {
        transform: translate(0, 0) rotate(360deg);
    }
}

.blob-black-2 {
    width: 50%;
    height: 50%;
    background: #0f0f11;
    bottom: 0;
    right: 50%;
    z-index: 2;
    animation: void-move-2 24s infinite linear;
}

@keyframes void-move-2 {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    40% {
        transform: translate(40%, -60%) rotate(-100deg);
    }

    80% {
        transform: translate(-40%, -20%) rotate(-200deg);
    }

    100% {
        transform: translate(0, 0) rotate(-360deg);
    }
}


/* Dot Pattern Overlay */
.loading-dots-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1.5px, transparent 1.5px);
    background-size: 32px 32px;
    opacity: 0.4;
    animation: dots-drift 120s linear infinite;
}



/* Loading Content */
.loading-content {
    position: relative;
    z-index: 4;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

.loading-logo {
    width: auto;
    height: 18px;
    filter: drop-shadow(0 0 12px rgba(164, 78, 230, 0.7));
    opacity: 0.95;
    margin-right: 8px;
}

.loading-text {
    color: var(--label-primary, #fff);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

@keyframes logo-pulse {

    0%,
    100% {
        transform: scale(1);
        filter: invert(1) drop-shadow(0 0 8px rgba(164, 78, 230, 0.5));
    }

    50% {
        transform: scale(1.05);
        filter: invert(1) drop-shadow(0 0 20px rgba(164, 78, 230, 0.9));
    }
}

@keyframes text-fade {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }
}

/* Info Card (Warning/Alert) */
.info-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(164, 78, 230, 0.1);
    border-radius: var(--radius-s);
    padding: 12px;
    margin-top: 16px;
    /* No border */
}

/* Info content styling */
.info-content {
    font-size: 12px;
    line-height: 1.5;
    color: var(--label-secondary);
    font-weight: 500;
}

/* ============================================
   INITIAL PROJECT LOADER (FULL SCREEN)
   ============================================ */

#initial-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #050506;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.spinner-circle {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--system-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-message {
    color: var(--label-primary, #fff);
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    animation: text-fade 2s infinite ease-in-out;
}

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

/* ============================================
   ACCOUNT OVERLAY
   ============================================ */

.account-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.account-overlay.show {
    display: block;
    opacity: 1;
}

.account-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    bottom: 16px;
    width: 400px;
    background: var(--sidebar-background);
    border: 1px solid var(--system-gray5);
    border-radius: var(--radius-m);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
    transform: translateX(110%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.account-overlay.show .account-panel {
    transform: translateX(0);
}

.account-header {
    padding: 24px;
    border-bottom: 1px solid var(--system-gray5);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.account-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--label-primary);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--system-gray);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: var(--system-gray5);
    color: var(--label-primary);
}

.account-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.profile-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--system-blue), #694ED7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.profile-info h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.profile-info p {
    color: var(--system-gray);
    font-size: 14px;
}

.credits-card {
    background: linear-gradient(135deg, rgba(164, 78, 230, 0.1), rgba(105, 78, 215, 0.05));
    border: 1px solid rgba(164, 78, 230, 0.2);
    border-radius: var(--radius-s);
    padding: 20px;
    margin-bottom: 32px;
}

.credits-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.credits-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--system-blue);
}

.credits-amount {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--label-primary);
}

.credits-helper {
    font-size: 13px;
    color: var(--label-secondary);
    line-height: 1.4;
}

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

.settings-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-s);
    color: var(--label-primary);
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
}

.settings-item:hover {
    background: var(--system-gray5);
}

.settings-icon {
    width: 20px;
    height: 20px;
    color: var(--system-gray);
}

.settings-item:hover .settings-icon {
    color: var(--label-primary);
}

.settings-label {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
}

.settings-arrow {
    color: var(--system-gray4);
}

.logout-btn {
    margin-top: auto;
    padding: 24px;
    border-top: 1px solid var(--system-gray5);
}

.btn-logout {
    width: 100%;
    padding: 12px;
    background: rgba(255, 69, 58, 0.1);
    color: #FF453A;
    border: none;
    border-radius: var(--radius-pill);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-logout:hover {
    background: rgba(255, 69, 58, 0.2);
}

/* Account Overlay */
.account-overlay-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.account-overlay-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

.account-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 90vw;
    background-color: var(--sidebar-background);
    border-left: 1px solid var(--system-gray5);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.account-overlay.open {
    transform: translateX(0);
}

.account-header {
    padding: 24px;
    border-bottom: 1px solid var(--system-gray5);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.account-header h2 {
    font-size: 20px;
    margin: 0;
    color: var(--label-primary);
}

.account-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--system-gray);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.account-close-btn:hover {
    color: var(--label-primary);
}

.account-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.account-section {
    margin-bottom: 32px;
}

.account-section h3 {
    font-size: 13px;
    text-transform: uppercase;
    color: var(--system-gray);
    margin-bottom: 16px;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.account-content .input-group {
    margin-bottom: 16px;
}

.account-content .input-group label {
    display: block;
    font-size: 13px;
    color: var(--label-secondary);
    margin-bottom: 8px;
}

.account-content .input-group input {
    width: 100%;
    padding: 10px 12px;
    background: var(--system-gray5);
    border: 1px solid transparent;
    border-radius: var(--radius-s);
    color: var(--label-primary);
    font-size: 14px;
}

.account-content .input-group input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--system-gray5);
}

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

.setting-row span {
    font-size: 15px;
    color: var(--label-primary);
}

.account-footer {
    margin-top: auto;
    padding-top: 24px;
}