:root {
    /* Holguines Corporate Palette */
    --bg-page: #F0F2F7;
    --bg-white: #FFFFFF;
    --bg-subtle: #F7F8FC;

    /* Brand Colors */
    --brand-navy: #2D3B8C;
    --brand-navy-dark: #1F2A6B;
    --brand-navy-light: #3D4FA3;
    --brand-orange: #F5A623;
    --brand-orange-dark: #E09010;
    --brand-orange-light: #FDB944;

    /* Card / Glass surfaces (light) */
    --glass-bg: rgba(255, 255, 255, 0.92);
    --glass-bg-hover: rgba(255, 255, 255, 1);
    --glass-border: rgba(45, 59, 140, 0.12);
    --glass-border-hover: rgba(45, 59, 140, 0.25);

    /* Semantic accent aliases (kept for backward compat) */
    --primary-purple: #2D3B8C;
    --primary-purple-glow: rgba(45, 59, 140, 0.12);
    --primary-cyan: #2D3B8C;
    --primary-cyan-glow: rgba(45, 59, 140, 0.10);
    --accent-green: #1A9E5C;
    --accent-green-glow: rgba(26, 158, 92, 0.12);
    --accent-orange: #F5A623;
    --accent-orange-glow: rgba(245, 166, 35, 0.15);

    /* Text */
    --text-white: #FFFFFF;
    --text-main: #1E2A4A;
    --text-muted: #6B7A9F;
    --text-dark: #0F1733;

    /* Layout */
    --sidebar-width: 280px;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
    outline: none;
}

html {
    scroll-behavior: smooth;
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
    max-width: 100vw;
    overflow-x: hidden;
}

/* --- ELEGANT SLIM SCROLLBARS --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(45, 59, 140, 0.03);
    border-radius: 8px;
}
::-webkit-scrollbar-thumb {
    background: rgba(45, 59, 140, 0.20);
    border-radius: 8px;
    transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--brand-navy);
}
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(45, 59, 140, 0.22) transparent;
}


/* Subtle brand ambient blobs */
.glow-bg {
    position: absolute;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(45, 59, 140, 0.06) 0%, transparent 70%);
    top: -200px;
    left: -200px;
    pointer-events: none;
    z-index: 0;
    filter: blur(60px);
}

.glow-bg-secondary {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(245, 166, 35, 0.07) 0%, transparent 70%);
    bottom: -100px;
    right: -100px;
    pointer-events: none;
    z-index: 0;
    filter: blur(60px);
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* --- SIDEBAR NAVIGATION --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--brand-navy);
    border-right: none;
    box-shadow: 4px 0 24px rgba(45, 59, 140, 0.15);
    display: flex;
    flex-direction: column;
    padding: 0 0 24px;
    z-index: 10;
    flex-shrink: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 24px 24px;
    gap: 0;
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    margin-bottom: 12px;
    flex-direction: column;
}

.logo-glow { display: none; }

.logo-icon {
    display: none;
}

.logo-img {
    width: 130px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    margin-bottom: 2px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 0;
    line-height: 0;
    visibility: hidden;
    height: 0;
}

.brand-sub {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 3px;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    margin-top: 4px;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 20px;
    text-decoration: none;
    color: rgba(255,255,255,0.60);
    border-radius: var(--border-radius-md);
    transition: var(--transition-smooth);
    font-weight: 500;
    font-size: 14px;
    border: 1px solid transparent;
    margin: 2px 0;
}

.nav-item:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255,255,255,0.10);
    transform: translateX(3px);
}

.nav-item.active {
    color: var(--text-white);
    background: rgba(245, 166, 35, 0.18);
    border-color: rgba(245, 166, 35, 0.30);
    box-shadow: 0 2px 12px rgba(245, 166, 35, 0.15);
}

.nav-item .icon {
    font-size: 20px;
}

/* User Profile Widget */
.user-profile {
    margin: auto 16px 0;
    padding: 16px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
    color: var(--text-white);
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 2px 10px rgba(245, 166, 35, 0.3);
}

.pulse {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #34d399;
    border: 2px solid var(--brand-navy);
    border-radius: 50%;
    top: 0;
    right: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
}

.user-role {
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.5px;
}


/* --- MAIN CONTENT AREA --- */
.main-content {
    flex: 1;
    padding: 40px 48px;
    max-height: 100vh;
    overflow-y: auto;
    position: relative;
}

/* View transition defaults */
.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.subtitle {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--brand-orange);
    display: block;
    margin-bottom: 6px;
}

.section-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--brand-navy);
    letter-spacing: -0.5px;
}

/* Corporate Cards */
.glass-card {
    background: var(--bg-white);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 2px 16px rgba(45, 59, 140, 0.07);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(45, 59, 140, 0.20);
    box-shadow: 0 6px 28px rgba(45, 59, 140, 0.11);
}


/* --- DASHBOARD METRICS --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.metric-card {
    padding: 28px 24px;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    width: 4px;
    height: 100%;
    left: 0;
    top: 0;
}

.purple-glow::before { background: var(--primary-purple); }
.cyan-glow::before { background: var(--primary-cyan); }
.green-glow::before { background: var(--accent-green); }
.orange-glow::before { background: var(--accent-orange); }

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.card-icon {
    font-size: 18px;
}

.card-value {
    font-family: 'Outfit', sans-serif;
    font-size: 40px;
    font-weight: 800;
    color: var(--brand-navy);
    line-height: 1;
    margin-bottom: 12px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.card-value .unit {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-muted);
}

.card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.footer-trend {
    padding: 2px 8px;
    border-radius: 12px;
}

.footer-trend.positive {
    background: rgba(0, 230, 118, 0.1);
    color: var(--accent-green);
}


/* --- DASHBOARD DETAILS & CHARTS --- */
.dashboard-details {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.table-card {
    padding: 32px;
}

.card-details-header {
    margin-bottom: 28px;
}

.card-details-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-navy);
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Custom CSS Bar Chart */
.chart-container {
    min-height: 250px;
    display: flex;
    align-items: flex-end;
}

.bar-chart {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 20px;
    min-height: 240px;
    border-bottom: 2px solid var(--glass-border);
    padding-bottom: 10px;
    overflow-x: auto;
}

.chart-placeholder-msg {
    width: 100%;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding-bottom: 80px;
}

.chart-bar-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    height: 200px;
    min-width: 50px;
    flex: 1;
    max-width: 80px;
}

.chart-bar-fill {
    width: 100%;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, var(--primary-cyan) 0%, rgba(0, 245, 255, 0.2) 100%);
    position: relative;
    transition: height 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    justify-content: center;
    cursor: pointer;
}

.chart-bar-fill:hover {
    filter: brightness(1.15);
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.4);
}

.bar-tooltip {
    position: absolute;
    background: var(--text-dark);
    color: var(--text-white);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    top: -30px;
    opacity: 0;
    transition: var(--transition-smooth);
    pointer-events: none;
    white-space: nowrap;
}

.chart-bar-fill:hover .bar-tooltip {
    opacity: 1;
    top: -35px;
}

.bar-label {
    margin-top: 8px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Info Summary Card */
.summary-infocard {
    padding: 32px;
    display: flex;
    flex-direction: column;
}

.infocard-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-navy);
    margin-bottom: 24px;
}

.infocard-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 30px;
}

/* Stunning Radial Progress */
.status-circle-container {
    position: relative;
}

.status-radial-progress {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(var(--primary-purple) calc(var(--percent) * 1%), var(--glass-border) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 20px rgba(157, 78, 221, 0.15);
    transition: var(--transition-smooth);
}

.inner-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #0d0f1e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
}

.inner-circle .percentage {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--text-white);
}

.inner-circle .label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.infocard-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    align-items: center;
    font-size: 13px;
}

.info-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 12px;
}

.dot-cyan { background-color: var(--primary-cyan); box-shadow: 0 0 8px var(--primary-cyan); }
.dot-purple { background-color: var(--primary-purple); box-shadow: 0 0 8px var(--primary-purple); }
.dot-green { background-color: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }

.info-label {
    color: var(--text-muted);
    flex: 1;
}

.info-val {
    color: var(--text-white);
    font-weight: 700;
}


/* --- VISUALIZER PAGE & INTERACTIVE STACK --- */
#view-map {
    position: relative;
    min-height: calc(100vh - 200px);
}

.visualizer-container {
    display: flex;
    gap: 24px;
    position: relative;
    min-height: calc(100vh - 180px);
}

.building-stack-view {
    flex: 1;
    background: var(--bg-white);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 28px;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    min-height: calc(100vh - 250px);
    max-height: calc(100vh - 210px);
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-behavior: smooth;
    position: relative;
    box-shadow: 0 2px 16px rgba(45, 59, 140, 0.06);
}

.stack-info {
    text-align: center;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin: auto;
}

.building-isometric-icon {
    font-size: 64px;
    animation: pulseIcon 2s infinite ease-in-out;
}

.stack-info h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    color: var(--brand-navy);
}

.stack-info p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Floor stack styling (gorgeous list of floor cards) */
.building-stack {
    width: 100%;
    display: flex;
    flex-direction: column-reverse; /* Bottom floors first */
    gap: 16px;
}

.floor-panel {
    background: #FFFFFF;
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    border-left: 4px solid var(--brand-navy);
    padding: 20px 24px;
    position: relative;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(45, 59, 140, 0.06);
}

.floor-panel:hover {
    border-color: rgba(45, 59, 140, 0.25);
    border-left-color: var(--brand-orange);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(45, 59, 140, 0.12);
}

.floor-header-visual {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 12px;
}

.floor-header-visual h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--brand-navy);
    display: flex;
    align-items: center;
    gap: 8px;
}

.floor-stats-visual {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    background: rgba(45, 59, 140, 0.05);
    border: 1px solid rgba(45, 59, 140, 0.10);
    border-radius: 20px;
    padding: 3px 12px;
}

.btn-delete-floor-quick {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    color: #ef4444;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.7;
    padding: 4px 10px;
    transition: var(--transition-smooth);
}

.btn-delete-floor-quick:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.08);
    transform: scale(1.05);
}

.offices-grid-visual {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 14px;
}

.office-box-visual {
    padding: 14px 15px;
    border-radius: var(--border-radius-md);
    background: var(--bg-subtle);
    border: 1px solid var(--glass-border);
    border-top: 3.5px solid var(--color-code, var(--brand-navy));
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 96px;
    gap: 8px;
}

.office-box-visual:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(45, 59, 140, 0.12);
    background: #FFFFFF;
    border-color: rgba(45, 59, 140, 0.22);
}

.office-box-visual.inactive {
    opacity: 0.55;
    border-style: dashed;
}

.office-box-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    gap: 8px;
}

.office-box-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
    word-break: break-word;
    overflow-wrap: anywhere;
    flex: 1;
}

.office-box-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: auto;
    padding-top: 4px;
}

.office-box-area {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.office-box-status {
    font-size: 9.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(26, 158, 92, 0.10);
    color: #1A9E5C;
    border: 1px solid rgba(26, 158, 92, 0.20);
    white-space: nowrap;
}

.office-box-visual.inactive .office-box-status {
    background: rgba(100,100,100, 0.07);
    color: var(--text-muted);
    border-color: rgba(100,100,100, 0.15);
}



.btn-close-drawer {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-close-drawer:hover {
    color: var(--brand-navy);
    transform: rotate(90deg);
}

.drawer-title {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    color: var(--brand-navy);
    font-weight: 700;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 12px;
}


/* --- ADMIN CONFIGURATION CRUD PAGE --- */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

.form-card {
    padding: 32px;
}

.form-colspan-2 {
    grid-column: span 2;
}

.card-header-accented {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.header-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    color: var(--text-white);
}

.header-badge.bg-purple { background-color: var(--primary-purple); box-shadow: 0 0 10px rgba(157, 78, 221, 0.4); }
.header-badge.bg-cyan { background-color: var(--primary-cyan); color: var(--text-dark); box-shadow: 0 0 10px rgba(0, 245, 255, 0.4); }
.header-badge.bg-green { background-color: var(--accent-green); color: var(--text-dark); box-shadow: 0 0 10px rgba(0, 230, 118, 0.4); }

.card-header-accented h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    color: var(--text-white);
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions-full {
    grid-column: span 2;
    margin-top: 10px;
}

/* Glass Inputs & Selects */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-group-inline label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.glass-input, .glass-select {
    background: #FFFFFF;
    border: 1px solid rgba(45, 59, 140, 0.18);
    border-radius: var(--border-radius-md);
    padding: 12px 16px;
    color: var(--text-main);
    font-size: 13px;
    transition: var(--transition-smooth);
}

.glass-input::placeholder {
    color: var(--text-muted);
}

.glass-input:focus, .glass-select:focus {
    background: #FFFFFF;
    border-color: var(--brand-navy);
    box-shadow: 0 0 0 3px rgba(45, 59, 140, 0.10);
}

.glass-select option {
    background-color: #FFFFFF;
    color: var(--text-main);
}

.glass-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Custom color picker styles */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 40px;
    height: 40px;
    background-color: transparent;
    border: none;
    cursor: pointer;
}

.color-picker-input::-webkit-color-swatch {
    border-radius: 50%;
    border: 2px solid var(--glass-border);
}

.color-picker-input::-moz-color-swatch {
    border-radius: 50%;
    border: 2px solid var(--glass-border);
}

.color-val-hex {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand-navy);
    background: rgba(45, 59, 140, 0.06);
    padding: 4px 10px;
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(45, 59, 140, 0.15);
}

/* Custom premium buttons */
.btn {
    padding: 12px 24px;
    border-radius: var(--border-radius-md);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--brand-navy);
    color: var(--text-white);
    box-shadow: 0 3px 14px rgba(45, 59, 140, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: var(--brand-navy-dark);
    box-shadow: 0 6px 22px rgba(45, 59, 140, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(45, 59, 140, 0.05);
    border-color: rgba(45, 59, 140, 0.18);
    color: var(--brand-navy);
}

.btn-secondary:hover {
    background: rgba(45, 59, 140, 0.10);
    border-color: rgba(45, 59, 140, 0.30);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.btn-danger:hover {
    background: #ef4444;
    color: var(--text-white);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
}

/* Tree view summary card */
.tree-card {
    padding: 32px;
}

.flex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.infrastructure-tree-container {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    margin-top: 24px;
}

.tree-root {
    list-style: none;
}

.tree-root li > ul {
    transition: all 0.3s ease;
}

.tree-root li.collapsed > ul {
    display: none;
}

.tree-chevron {
    display: inline-block;
    margin-right: 8px;
    font-size: 10px;
    transition: transform 0.2s ease;
    user-select: none;
    color: inherit;
}

.collapsed > .tree-item-local .tree-chevron,
.collapsed > .tree-item-floor .tree-chevron {
    transform: rotate(-90deg);
}

.tree-toggle-btn {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.tree-item-local {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-white);
    padding: 10px 14px;
    background: rgba(157, 78, 221, 0.08);
    border-left: 3px solid var(--primary-purple);
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tree-item-local:not(:first-child) {
    margin-top: 20px;
}

.tree-item-floor {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    padding: 8px 12px;
    background: rgba(0, 245, 255, 0.05);
    border-left: 3px solid var(--primary-cyan);
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    margin: 8px 0 8px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tree-item-office {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    margin: 4px 0 4px 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tree-item-office:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.02);
}

.tree-meta {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-delete-tree {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 12px;
    opacity: 0.6;
    transition: var(--transition-smooth);
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-delete-tree:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

.empty-tree-message {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 40px;
}

.mt-4 { margin-top: 24px; }


/* --- TOAST NOTIFICATIONS --- */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 420px;
}

.toast {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(12px);
    padding: 14px 18px;
    border-radius: var(--border-radius-md);
    color: #f8fafc;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.25);
    animation: slideIn 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    border-left: 4.5px solid var(--primary-cyan);
    pointer-events: auto;
}

.toast.success { 
    border-left-color: #10b981; 
    background: #064e3b;
    border-color: rgba(16, 185, 129, 0.4);
}
.toast.error { 
    border-left-color: #ef4444; 
    background: #450a0a;
    border-color: rgba(239, 68, 68, 0.4);
}

/* Custom Drawer Actions */
.form-actions-drawer {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.form-actions-drawer .btn {
    flex: 1;
}

/* Animations Definitions */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 5px var(--primary-purple-glow)); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 20px rgba(157, 78, 221, 0.4)); }
}

.animate-fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }


/* --- ENERGY MANAGEMENT SYSTEM --- */
.energy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.import-card, .filter-card {
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.csv-upload-dropzone {
    border: 2px dashed rgba(157, 78, 221, 0.3);
    background: rgba(157, 78, 221, 0.02);
    border-radius: var(--border-radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.csv-upload-dropzone:hover, .csv-upload-dropzone.dragover {
    border-color: var(--primary-purple);
    background: rgba(157, 78, 221, 0.08);
    box-shadow: 0 0 20px rgba(157, 78, 221, 0.2);
    transform: translateY(-2px);
}

.dropzone-icon {
    font-size: 40px;
    filter: drop-shadow(0 0 10px rgba(157, 78, 221, 0.4));
    transition: var(--transition-smooth);
}

.csv-upload-dropzone:hover .dropzone-icon {
    transform: translateY(-4px) scale(1.1);
}

.dropzone-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.dropzone-text .highlight {
    color: var(--primary-purple);
    font-weight: 700;
    text-decoration: underline;
}

.dropzone-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.upload-status-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0, 230, 118, 0.08);
    border: 1px solid rgba(0, 230, 118, 0.25);
    padding: 16px 20px;
    border-radius: var(--border-radius-md);
    margin-top: 20px;
    animation: fadeIn 0.4s ease;
}

.upload-status-card.error {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
}

.upload-status-card .status-icon {
    font-size: 24px;
}

.upload-status-card .status-details h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-white);
}

.upload-status-card .status-details p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.energy-filter-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 12px;
}

.form-row-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.quick-date-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.btn-xs {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
}

/* Combobox helper for selecting and typing */
.combobox-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.combobox-wrapper select {
    width: 100%;
}

.mt-2 { margin-top: 8px; }

/* Tree view additions */
.tree-node-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-edit-tree {
    background: transparent;
    border: none;
    color: var(--primary-cyan);
    cursor: pointer;
    font-size: 12px;
    opacity: 0.6;
    transition: var(--transition-smooth);
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-edit-tree:hover {
    opacity: 1;
    background: rgba(0, 245, 255, 0.1);
}

/* --- PREMIUM GLASS MODALS --- */
.glass-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 42, 74, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    animation: fadeInOverlay 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.glass-modal {
    width: 100%;
    max-width: 480px;
    padding: 36px;
    position: relative;
    box-shadow: 0 20px 50px rgba(45, 59, 140, 0.20), 0 0 0 1px rgba(45, 59, 140, 0.10);
    border: 1px solid rgba(45, 59, 140, 0.12) !important;
    background: #FFFFFF !important;
}

.btn-close-modal {
    position: absolute;
    top: 24px;
    right: 24px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-close-modal:hover {
    color: var(--brand-navy);
    transform: rotate(90deg);
}

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--brand-navy);
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}

@keyframes fadeInOverlay {
    from { background: rgba(30, 42, 74, 0); }
    to   { background: rgba(30, 42, 74, 0.45); }
}

@keyframes zoomIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.animate-zoom-in {
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Nested table row styling for prorated office calculations */
.table-row-office td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.02) !important;
    font-size: 12px;
}
.table-row-floor td {
    border-bottom: 2px solid rgba(157, 78, 221, 0.15) !important;
}

/* Weekly Calendar Grid Styles */
.weekly-calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.day-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.day-card:hover {
    background: rgba(0, 245, 255, 0.05);
    border-color: var(--primary-cyan);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 245, 255, 0.1);
}

.day-card.closed {
    opacity: 0.6;
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.01);
}

.day-card.closed:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
}

.day-card .day-name {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-white);
}

.day-card .day-hours {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-card.closed .day-hours {
    color: #f87171;
}

/* Day Interval Row Editor Styles */
.interval-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    animation: fadeIn 0.3s ease;
}

.interval-row input[type="time"] {
    background: rgba(13, 15, 30, 0.8) !important;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    color: var(--text-white);
    padding: 6px 10px;
    font-size: 12px;
    flex: 1;
    width: 90px;
}

.interval-row input[type="time"]:focus {
    border-color: var(--primary-cyan);
}

.interval-row span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.btn-delete-interval {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.7;
    transition: var(--transition-smooth);
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-interval:hover {
    opacity: 1;
    color: #f87171;
    transform: scale(1.1);
}

/* =============================================
   SCHEDULE MODAL: TABS
   ============================================= */
.schedule-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 12px;
}

.schedule-tab-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    transition: var(--transition-smooth);
}

.schedule-tab-btn:hover {
    background: rgba(0, 245, 255, 0.05);
    border-color: var(--primary-cyan);
    color: var(--text-white);
}

.schedule-tab-btn.active {
    background: rgba(0, 245, 255, 0.08);
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
}

.schedule-tab-content {
    animation: fadeIn 0.25s ease;
}

/* =============================================
   SCHEDULE MODAL: MONTHLY CALENDAR
   ============================================= */
.month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 8px 4px;
}

.btn-month-nav {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-white);
    cursor: pointer;
    font-size: 14px;
    padding: 6px 14px;
    transition: var(--transition-smooth);
}

.btn-month-nav:hover {
    background: rgba(0, 245, 255, 0.08);
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
}

.month-weekday-headers {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 6px;
    text-align: center;
}

.month-weekday-headers span {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 0;
}

.month-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 14px;
}

.month-day-cell {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    transition: var(--transition-smooth);
    position: relative;
    min-height: 40px;
}

.month-day-cell:hover {
    background: rgba(0, 245, 255, 0.06);
    border-color: var(--primary-cyan);
    color: var(--text-white);
}

.month-day-cell.empty {
    cursor: default;
    background: transparent;
    border-color: transparent;
}

.month-day-cell.empty:hover {
    background: transparent;
    border-color: transparent;
}

.month-day-cell.today {
    border-color: rgba(0, 245, 255, 0.4);
    color: var(--primary-cyan);
}

/* Has a custom override with open hours */
.month-day-cell.has-override-open {
    background: rgba(0, 245, 255, 0.07);
    border-color: rgba(0, 245, 255, 0.3);
}

.month-day-cell.has-override-open::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary-cyan);
}

/* Has a custom override that marks day as CLOSED */
.month-day-cell.has-override-closed {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.month-day-cell.has-override-closed::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ef4444;
}

/* Legend */
.month-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
    flex-wrap: wrap;
}

.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot.override-open   { background: var(--brand-navy); }
.legend-dot.override-closed { background: #ef4444; }
.legend-dot.override-none   { background: rgba(45,59,140,0.15); border: 1px solid rgba(45,59,140,0.15); }

/* ==============================================
   CORPORATE LIGHT THEME — Global Overrides
   ============================================== */

/* Card labels and subtitles */
.card-subtitle {
    color: var(--text-muted) !important;
}

/* Form labels */
.form-group label {
    color: var(--text-main);
}

/* Drawer panel — light theme override (already set above) */
.drawer-title {
    color: var(--brand-navy);
}

/* Energy section table */
.energy-table th {
    background: rgba(45, 59, 140, 0.06);
    color: var(--brand-navy);
    border-bottom: 2px solid rgba(45, 59, 140, 0.12);
}

.energy-table td {
    color: var(--text-main);
    border-bottom: 1px solid rgba(45, 59, 140, 0.06);
}

.energy-table tr:hover td {
    background: rgba(45, 59, 140, 0.03);
}

/* Floor rows in energy results */
.floor-row td {
    background: rgba(45, 59, 140, 0.04);
    font-weight: 600;
    color: var(--brand-navy);
}

/* Office sub-rows */
.office-row td {
    color: var(--text-muted);
}

/* Section badge chip */
.section-badge {
    background: rgba(245, 166, 35, 0.12);
    color: var(--brand-orange-dark);
    border: 1px solid rgba(245, 166, 35, 0.25);
}

/* Day cards in schedule modal */
.day-card {
    background: rgba(45, 59, 140, 0.04);
    border-color: rgba(45, 59, 140, 0.12);
    color: var(--text-main);
}

.day-card:hover {
    background: rgba(45, 59, 140, 0.08);
    border-color: var(--brand-navy);
}

.day-card .day-name {
    color: var(--brand-navy);
}

.day-card .day-hours {
    color: var(--text-muted);
}

.day-card.closed {
    background: rgba(239, 68, 68, 0.04);
    border-color: rgba(239, 68, 68, 0.15);
}

.day-card.closed .day-name {
    color: #ef4444;
}

/* Schedule modal tabs on light bg */
.schedule-tab-btn {
    color: var(--text-muted);
    border-color: rgba(45, 59, 140, 0.15);
}

.schedule-tab-btn.active {
    background: rgba(45, 59, 140, 0.07);
    border-color: var(--brand-navy);
    color: var(--brand-navy);
}

/* Month nav */
.btn-month-nav {
    background: rgba(45, 59, 140, 0.05);
    border-color: rgba(45, 59, 140, 0.15);
    color: var(--brand-navy);
}

.btn-month-nav:hover {
    background: var(--brand-navy);
    border-color: var(--brand-navy);
    color: #FFFFFF;
}

/* Month day cells */
.month-day-cell {
    background: rgba(45, 59, 140, 0.03);
    color: var(--text-main);
}

.month-day-cell:hover {
    background: rgba(45, 59, 140, 0.08);
    border-color: var(--brand-navy);
    color: var(--brand-navy);
}

.month-day-cell.today {
    border-color: var(--brand-orange);
    color: var(--brand-orange-dark);
    font-weight: 700;
}

.month-day-cell.has-override-open {
    background: rgba(45, 59, 140, 0.06);
    border-color: rgba(45, 59, 140, 0.25);
}

.month-day-cell.has-override-open::after {
    background: var(--brand-navy);
}

/* Interval rows in day editor */
.interval-row {
    background: rgba(45, 59, 140, 0.03);
    border: 1px solid rgba(45, 59, 140, 0.10);
    border-radius: var(--border-radius-sm);
    padding: 8px 10px;
}

/* Building stack offices */
.office-cell {
    border: 1px solid rgba(255,255,255,0.25);
}

/* Main content area */
.main-content {
    background: var(--bg-page);
}

/* Tags / badges in building visualizer */
.floor-label {
    color: var(--brand-navy);
    font-weight: 700;
}

/* Toast */
.toast {
    background: var(--brand-navy);
    border: 1px solid rgba(255,255,255,0.15);
}


.toast.error {
    background: #dc2626;
}

/* ==============================================
   ENERGY RESULTS TABLE — Professional Design
   ============================================== */

.energy-table-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 28px 32px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.energy-table-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--brand-navy);
    margin-bottom: 4px;
}

.mobile-table-hint {
    display: none;
    font-size: 11.5px;
    color: var(--brand-orange);
    font-weight: 600;
    margin-top: 6px;
    align-items: center;
    gap: 4px;
}

/* --- RESPONSIVE TABLE WRAPPER --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--glass-border);
    background: #FFFFFF;
    margin-top: 16px;
    position: relative;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: rgba(45, 59, 140, 0.03);
    border-radius: 6px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(45, 59, 140, 0.22);
    border-radius: 6px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--brand-navy);
}

.energy-results-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    font-size: 13px;
}

.energy-results-table thead tr {
    border-bottom: 2px solid rgba(45, 59, 140, 0.12);
}

.energy-results-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    white-space: nowrap;
    background: rgba(45, 59, 140, 0.03);
}

.energy-results-table th.col-numeric,
.energy-results-table td.col-numeric {
    text-align: right;
}

/* ── FLOOR ROWS ── */
.et-row-floor {
    border-bottom: 1px solid rgba(45, 59, 140, 0.08);
    background: #FFFFFF;
    transition: background 0.18s ease;
}

.et-row-floor:hover { background: rgba(45, 59, 140, 0.025); }

.et-row-floor td {
    padding: 14px 16px;
    vertical-align: middle;
}

.et-row-floor td.et-local {
    border-left: 3px solid var(--brand-navy);
    color: var(--text-muted);
    font-size: 12px;
}

.et-floor-name {
    font-weight: 700;
    color: var(--brand-navy);
    font-size: 13px;
}

.et-meter-badge {
    display: inline-block;
    background: rgba(45, 59, 140, 0.06);
    border: 1px solid rgba(45, 59, 140, 0.14);
    border-radius: 4px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    color: var(--brand-navy);
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.et-num {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--text-main);
}

.et-unit {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.et-null {
    font-style: italic;
    color: var(--text-muted);
    font-size: 12px;
}

.et-consumption {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 800;
    color: var(--brand-navy);
}

.et-total .et-unit {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

/* ── OFFICE ROWS ── */
.et-row-office {
    border-bottom: 1px solid rgba(45, 59, 140, 0.05);
    background: rgba(45, 59, 140, 0.012);
    transition: background 0.18s ease;
}

.et-row-office:hover { background: rgba(45, 59, 140, 0.04); }

.et-row-office td {
    padding: 10px 16px;
    vertical-align: middle;
}

.et-office-name-cell {
    padding-left: 20px !important;
}

.et-last-child.et-office-name-cell {
    /* visual cue for last office in a floor group */
    border-bottom: none;
}

.et-tree-connector {
    color: rgba(45, 59, 140, 0.28);
    font-size: 13px;
    font-weight: 700;
    margin-right: 8px;
    font-family: monospace;
}

.et-office-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    display: block;
}

.et-office-meta {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 400;
}

.et-area {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.et-proportion {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.et-prorated {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand-navy);
}

.et-prorated-cost {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #1A9E5C;
}

/* Status badges — pure CSS, no emoji */
.et-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.et-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.et-status--active {
    background: rgba(26, 158, 92, 0.09);
    color: #1A9E5C;
    border: 1px solid rgba(26, 158, 92, 0.20);
}

.et-status--active::before  { background: #1A9E5C; }

.et-status--inactive {
    background: rgba(100, 100, 100, 0.07);
    color: var(--text-muted);
    border: 1px solid rgba(100, 100, 100, 0.15);
}

.et-status--inactive::before { background: #94a3b8; }

/* Empty / Error state */
.empty-table-cell,
.empty-table-msg {
    text-align: center;
    padding: 52px 24px !important;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

.empty-table-cell.et-error,
.empty-table-msg.et-error {
    color: #dc2626;
    font-style: normal;
    font-weight: 500;
}

/* =========================================================================
   NEW INFRASTRUCTURE MANAGEMENT STYLES (FAB & INLINE CRUD)
   ========================================================================= */

/* Floating Action Button Group */
.fab-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 12px;
    z-index: 99;
}

.fab-main {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand-navy);
    box-shadow: 0 4px 20px rgba(45, 59, 140, 0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(255, 255, 255, 0.20);
}

.fab-main:hover {
    transform: rotate(90deg) scale(1.1);
    background: var(--brand-navy-dark);
    box-shadow: 0 6px 28px rgba(45, 59, 140, 0.55);
}

.fab-options {
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 8px;
}

.fab-container.active .fab-options {
    display: flex;
    animation: slideUpFade 0.3s forwards;
}

.fab-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 220px;
    background: var(--bg-white);
    border: 1px solid var(--glass-border);
    padding: 10px 16px;
    border-radius: 10px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(45, 59, 140, 0.08);
    transition: all 0.2s ease-in-out;
}

.fab-item:hover {
    background: rgba(45, 59, 140, 0.06);
    border-color: var(--brand-navy);
    color: var(--brand-navy);
    transform: translateX(-4px);
    box-shadow: 0 6px 20px rgba(45, 59, 140, 0.14);
}

.fab-icon {
    font-size: 15px;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Quick Edit/Delete Local Buttons Next to Selector Dropdown */
.form-group-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-edit-local-quick, .btn-delete-local-quick, .btn-edit-floor-quick {
    background: var(--bg-white);
    border: 1px solid var(--glass-border);
    padding: 8px 10px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-edit-local-quick:hover, .btn-edit-floor-quick:hover {
    background: var(--primary-purple-glow);
    border-color: var(--brand-navy-light);
    transform: translateY(-1px);
}

.btn-delete-local-quick:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: #fca5a5;
    color: #ef4444;
    transform: translateY(-1px);
}

/* Inline Edit/Delete Floor header adjustments */
.floor-header-visual .btn-edit-floor-quick {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
    font-size: 12px;
    padding: 4px 10px;
}

.floor-header-visual .btn-edit-floor-quick:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

.floor-header-visual .btn-delete-floor-quick {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--border-radius-sm);
    color: #ef4444;
    font-size: 12px;
    padding: 4px 10px;
    opacity: 0.8;
}

.floor-header-visual .btn-delete-floor-quick:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

/* Office Card Actions */
.office-box-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.office-box-visual:hover .office-box-actions {
    opacity: 1;
}

.btn-edit-office-quick, .btn-delete-office-quick {
    background: rgba(45, 59, 140, 0.08);
    border: 1px solid rgba(45, 59, 140, 0.15);
    border-radius: 4px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition-smooth);
    color: var(--text-muted);
}

.btn-edit-office-quick:hover {
    background: var(--brand-navy);
    border-color: var(--brand-navy);
    color: #FFFFFF;
}

.btn-delete-office-quick:hover {
    background: rgba(239, 68, 68, 0.85);
    border-color: #ef4444;
    color: #FFFFFF;
}

/* =========================================
   LOGIN & USERS STYLES
   ========================================= */

.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(10px);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 245, 255, 0.2);
}

.login-header {
    position: relative;
    margin-bottom: 30px;
}

.login-header .logo-glow {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    opacity: 0.8;
}

.login-header .logo-img {
    width: 80px;
    height: 80px;
    position: relative;
    z-index: 1;
}

.login-header .brand-name {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-white);
    margin-top: 15px;
    margin-bottom: 5px;
}

.login-header .brand-sub {
    font-size: 12px;
    color: var(--primary-cyan);
    letter-spacing: 2px;
}

#login-form .form-group {
    text-align: left;
}

#users-table-body td {
    vertical-align: middle;
}

.role-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.role-badge.admin {
    background: rgba(0, 245, 255, 0.15);
    color: var(--primary-cyan);
    border: 1px solid rgba(0, 245, 255, 0.3);
}

/* =========================================
   LOGIN & USERS STYLES
   ========================================= */

.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(10px);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 245, 255, 0.2);
}

.login-header {
    position: relative;
    margin-bottom: 30px;
}

.login-header .logo-glow {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    opacity: 0.8;
}

.login-header .logo-img {
    width: 80px;
    height: 80px;
    position: relative;
    z-index: 1;
}

.login-header .brand-name {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-white);
    margin-top: 15px;
    margin-bottom: 5px;
}

.login-header .brand-sub {
    font-size: 12px;
    color: var(--primary-cyan);
    letter-spacing: 2px;
}

#login-form .form-group {
    text-align: left;
}

#users-table-body td {
    vertical-align: middle;
}

.role-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.role-badge.admin {
    background: rgba(0, 245, 255, 0.15);
    color: var(--primary-cyan);
    border: 1px solid rgba(0, 245, 255, 0.3);
}

.role-badge.viewer {
    background: rgba(160, 174, 192, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(160, 174, 192, 0.3);
}

/* =========================================
   USERS VIEW — Premium Redesign
   ========================================= */

/* Stats Row */
.users-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.user-stat-card {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px 24px;
    transition: var(--transition-smooth);
}

.user-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(45, 59, 140, 0.13);
}

.user-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.user-stat-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.user-stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: var(--brand-navy);
    line-height: 1;
}

.user-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* Users Table Card */
.users-table-card {
    overflow: hidden;
}

.users-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 32px 20px;
    border-bottom: 1px solid var(--glass-border);
    gap: 20px;
    flex-wrap: wrap;
}

.users-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--brand-navy);
    margin-bottom: 3px;
}

/* Search bar */
.users-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.users-search-icon {
    position: absolute;
    left: 12px;
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
}

.users-search-input {
    background: rgba(45, 59, 140, 0.04);
    border: 1px solid rgba(45, 59, 140, 0.15);
    border-radius: 10px;
    padding: 10px 16px 10px 38px;
    font-size: 13px;
    color: var(--text-main);
    width: 220px;
    transition: var(--transition-smooth);
}

.users-search-input::placeholder { color: var(--text-muted); }

.users-search-input:focus {
    border-color: var(--brand-navy);
    box-shadow: 0 0 0 3px rgba(45, 59, 140, 0.10);
    background: #FFFFFF;
    outline: none;
    width: 260px;
}

/* Users Table */
.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.users-table thead tr {
    border-bottom: 2px solid rgba(45, 59, 140, 0.10);
}

.users-table th {
    padding: 12px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    background: rgba(45, 59, 140, 0.025);
    white-space: nowrap;
}

.users-table th.col-id { width: 60px; }
.users-table th.col-actions { text-align: right; width: 120px; padding-right: 24px; }

.users-table tbody tr {
    border-bottom: 1px solid rgba(45, 59, 140, 0.06);
    transition: background 0.18s ease;
}

.users-table tbody tr:last-child { border-bottom: none; }

.users-table tbody tr:hover {
    background: rgba(45, 59, 140, 0.025);
}

.users-table td {
    padding: 14px 20px;
    vertical-align: middle;
    color: var(--text-main);
}

.users-table td.col-id {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.users-table td.col-actions {
    text-align: right;
    padding-right: 20px;
}

/* User cell with avatar */
.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-navy), var(--brand-navy-light));
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 2px 8px rgba(45, 59, 140, 0.20);
}

.user-avatar.avatar-admin {
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
    box-shadow: 0 2px 8px rgba(245, 166, 35, 0.30);
}

.user-cell-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-cell-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
}

.user-cell-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.user-you-tag {
    display: inline-block;
    background: rgba(45, 59, 140, 0.10);
    color: var(--brand-navy);
    border: 1px solid rgba(45, 59, 140, 0.20);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    letter-spacing: 0.3px;
    margin-left: 4px;
    vertical-align: middle;
}

/* Role badges — override to match brand */
.role-badge.admin {
    background: rgba(245, 166, 35, 0.12);
    color: var(--brand-orange-dark);
    border: 1px solid rgba(245, 166, 35, 0.30);
}

/* Action buttons in table */
.users-action-btn {
    background: transparent;
    border: 1px solid rgba(45, 59, 140, 0.15);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-smooth);
    color: var(--text-muted);
}

.users-action-btn:hover.edit-btn {
    background: rgba(45, 59, 140, 0.10);
    border-color: var(--brand-navy);
    color: var(--brand-navy);
    transform: translateY(-1px);
}

.users-action-btn:hover.del-btn {
    background: rgba(239, 68, 68, 0.10);
    border-color: #ef4444;
    color: #ef4444;
    transform: translateY(-1px);
}

.user-actions-group {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* Empty / loading states */
.users-empty-cell {
    text-align: center;
    padding: 60px 24px !important;
    color: var(--text-muted);
    font-size: 13px;
}

.users-loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
}

.users-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.users-empty-state .empty-icon {
    font-size: 40px;
    opacity: 0.4;
}

.users-empty-state p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Loading spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(45, 59, 140, 0.15);
    border-top-color: var(--brand-navy);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

/* =========================================
   CUSTOM CONFIRM DIALOG
   ========================================= */
.confirm-icon-wrap {
    font-size: 44px;
    margin-bottom: 8px;
    display: block;
}

.confirm-message {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
    line-height: 1.6;
    padding: 0 8px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-actions .btn {
    min-width: 120px;
}

/* =========================================
   MOBILE RESPONSIVE SYSTEM
   ========================================= */

/* Desktop defaults for mobile-only elements */
.mobile-header {
    display: none;
}

.btn-close-sidebar {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

/* Base mobile navigation elements */
.btn-mobile-menu {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 28px;
    height: 22px;
    padding: 0;
}

.hamburger-bar {
    width: 100%;
    height: 2.5px;
    background-color: #FFFFFF;
    border-radius: 2px;
    transition: var(--transition-smooth);
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-logo-img {
    height: 26px;
    filter: brightness(0) invert(1);
}

.mobile-brand-title {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: 0.5px;
}

.btn-mobile-action {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #FFFFFF;
    font-size: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

/* =========================================================================
   TABLET & MOBILE RESPONSIVE SYSTEM (< 992px)
   ========================================================================= */
@media (max-width: 992px) {
    html, body {
        height: 100%;
        height: 100dvh;
        overflow: hidden;
        width: 100%;
        max-width: 100vw;
    }

    .app-container {
        flex-direction: column;
        height: 100%;
        height: 100dvh;
        width: 100%;
        max-width: 100vw;
        overflow: hidden;
    }

    /* Mobile Header */
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 16px;
        background: var(--brand-navy);
        color: #FFFFFF;
        box-shadow: 0 4px 16px rgba(45, 59, 140, 0.25);
        z-index: 100;
        flex-shrink: 0;
        height: 56px;
    }

    /* Sidebar Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 290px;
        max-width: 85vw;
        height: 100%;
        height: 100dvh;
        z-index: 10000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 12px 0 35px rgba(0, 0, 0, 0.35);
        overflow-y: auto;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .btn-close-sidebar {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 18px;
        right: 18px;
        width: 32px;
        height: 32px;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        color: #FFFFFF;
        font-size: 20px;
        cursor: pointer;
        z-index: 11;
        transition: var(--transition-smooth);
    }

    .btn-close-sidebar:hover {
        background: rgba(239, 68, 68, 0.8);
        border-color: #ef4444;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.65);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 9999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Main Content: The single smooth scroll container on mobile */
    .main-content {
        flex: 1;
        height: calc(100dvh - 56px);
        padding: 16px 14px 85px 14px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: bounce;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    /* Section Headers */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 18px;
    }

    .section-header .header-actions {
        width: 100%;
    }

    .section-header h1 {
        font-size: 24px;
    }

    .form-group-inline {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
    }

    .form-group-inline select {
        width: 100%;
    }

    .btn-edit-local-quick, .btn-delete-local-quick {
        width: 100%;
        justify-content: center;
        padding: 8px 12px;
        min-height: 38px;
    }

    /* Metrics Grid */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 20px;
    }

    .metric-card {
        padding: 18px 14px;
    }

    .card-value {
        font-size: 28px;
    }

    /* ── 3D VISUALIZER / BUILDING STACK: ELIMINATE NESTED SCROLL ── */
    #view-map {
        min-height: auto;
    }

    .building-stack-view {
        padding: 4px 0;
        height: auto;
        min-height: unset;
        max-height: unset;
        overflow-y: visible;
        background: transparent;
        border: none;
        box-shadow: none;
        width: 100%;
    }

    .building-stack {
        gap: 12px;
        width: 100%;
    }

    .floor-panel {
        padding: 16px 14px;
        margin-bottom: 12px;
        border-radius: var(--border-radius-md);
        box-shadow: 0 2px 10px rgba(45, 59, 140, 0.05);
    }

    .floor-header-visual {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .floor-header-visual > div {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
        align-items: center;
    }

    .floor-stats-visual {
        width: 100%;
        font-size: 11.5px;
        text-align: center;
        padding: 4px 8px;
    }

    .btn-edit-floor-quick, 
    .btn-delete-floor-quick {
        flex: 1;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
    }

    .offices-grid-visual {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .office-box-visual {
        padding: 12px;
        min-height: 86px;
    }

    .office-box-actions button {
        min-width: 30px;
        min-height: 30px;
        font-size: 13px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ── ENERGY MANAGEMENT RESPONSIVENESS ── */
    .energy-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        width: 100%;
        margin-bottom: 16px;
    }

    .import-card, .filter-card {
        padding: 20px 16px;
        width: 100%;
        box-sizing: border-box;
    }

    .form-row-dates {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .form-row-dates input[type="datetime-local"] {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .quick-date-buttons {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .quick-date-buttons .btn {
        width: 100%;
        padding: 8px 4px;
        font-size: 11px;
        text-align: center;
        min-height: 36px;
    }

    #btn-calculate-energy {
        white-space: normal;
        padding: 12px 14px;
        line-height: 1.3;
        font-size: 13px;
        min-height: 44px;
    }

    /* Table & Results Card */
    .table-card {
        padding: 20px 16px;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .energy-table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .energy-table-title {
        font-size: 17px;
    }

    .mobile-table-hint {
        display: inline-flex;
    }

    .report-actions {
        display: flex;
        width: 100%;
        gap: 8px;
    }

    .report-actions .btn {
        flex: 1;
        justify-content: center;
        font-size: 12px;
        padding: 8px 10px;
        min-height: 38px;
    }

    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-top: 14px;
        border-radius: var(--border-radius-md);
        box-shadow: inset 0 0 6px rgba(45, 59, 140, 0.04);
    }

    .energy-results-table {
        min-width: 660px;
    }

    .energy-results-table th, 
    .energy-results-table td {
        padding: 10px 12px;
        font-size: 12px;
    }

    /* FAB */
    .fab-container {
        bottom: 20px;
        right: 18px;
        z-index: 900;
    }

    .fab-options {
        right: 0;
        bottom: 60px;
    }

    /* Modals Responsive */
    .glass-modal-overlay {
        padding: 12px;
        align-items: center;
    }

    .glass-modal {
        width: 100% !important;
        max-width: 95vw !important;
        max-height: 88vh;
        padding: 22px 16px;
        overflow-y: auto;
        border-radius: var(--border-radius-lg);
    }

    .weekly-calendar-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .schedule-tabs {
        flex-wrap: wrap;
        gap: 6px;
    }

    .schedule-tab-btn {
        flex: 1;
        min-width: 120px;
        text-align: center;
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* =========================================================================
   SMARTPHONE PORTRAIT (< 540px)
   ========================================================================= */
@media (max-width: 540px) {
    .main-content {
        padding: 12px 10px 85px 10px;
    }

    .section-header h1 {
        font-size: 20px;
    }

    .section-header .subtitle {
        font-size: 10.5px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .table-card, .import-card, .filter-card {
        padding: 16px 12px;
        border-radius: var(--border-radius-md);
    }

    /* 2-column clean offices grid on small phone screens */
    .offices-grid-visual {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .office-box-visual {
        padding: 10px 10px;
        min-height: 82px;
        gap: 6px;
    }

    .office-box-name {
        font-size: 11.5px;
        max-width: 90px;
    }

    .office-box-area {
        font-size: 10.5px;
    }

    .office-box-status {
        font-size: 8px;
        padding: 2px 5px;
    }

    .floor-panel {
        padding: 14px 10px;
    }

    .floor-header-visual h3 {
        font-size: 14px;
    }

    .floor-stats-visual {
        font-size: 10.5px;
        padding: 3px 8px;
    }

    .btn-edit-floor-quick, .btn-delete-floor-quick {
        font-size: 11px;
        padding: 5px 8px;
        min-height: 34px;
    }

    /* Full-bleed table swipe container on small phone screens */
    .table-responsive {
        margin: 10px -12px 0 -12px;
        width: calc(100% + 24px);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .energy-results-table {
        min-width: 620px;
    }

    .energy-results-table th, 
    .energy-results-table td {
        padding: 9px 8px;
        font-size: 11px;
    }

    .empty-table-cell,
    .empty-table-msg {
        padding: 36px 16px !important;
        font-size: 12px;
    }

    .weekly-calendar-grid {
        grid-template-columns: 1fr;
    }

    .interval-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .interval-row input[type="time"] {
        width: 100%;
    }

    .interval-row span {
        text-align: center;
    }

    .btn-delete-interval {
        align-self: flex-end;
    }

    /* Month Calendar inside schedule modal */
    .month-calendar-header {
        font-size: 11px;
    }

    .month-calendar-grid {
        gap: 3px;
    }

    .calendar-day-cell {
        min-height: 40px;
        padding: 4px 2px;
    }

    .calendar-day-cell .cal-num {
        font-size: 10.5px;
    }

    .calendar-day-cell .cal-badge {
        font-size: 7.5px;
        padding: 1px 2px;
    }

    /* Login Card */
    .login-card {
        padding: 24px 16px;
        width: 95%;
        margin: 0 auto;
    }

    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: calc(100vw - 20px);
    }

    .toast {
        padding: 12px 14px;
        font-size: 12.5px;
    }
}

