:root {
    --c-lime-400: #a3e635;
    --c-gray-100: #f3f4f6;
    --c-slate-600: #475569;
    --c-gray-300: #d1d5db;

    /* Extracted Text Colors */
    --c-slate-300: #cbd5e1;
    --c-slate-200: #e2e8f0;
    --c-slate-100: #f1f5f9;
    --c-slate-50: #f8fafc;
    --c-gray-400: #9ca3af;
    --c-gray-500: #6b7280;
    --c-gray-600: #4b5563;
    --c-slate-700: #334155;
    --c-neutral-500: #888888;
    --c-black: #000000;
    --c-white: #ffffff;
    --c-blue-400: #60a5fa;
    --c-sky-400: #38bdf8;
    --c-blue-300: #93c5fd;
    --c-blue-200: #bfdbfe;
    --c-sky-500: #0ea5e9;
    --c-lightblue: #a5d6ff;
    --c-emerald-400: #34d399;
    --c-emerald-300: #6ee7b7;
    --c-green-400: #4ade80;
    --c-green-600: #16a34a;
    --c-green-700: #15803d;
    --c-red-400: #f87171;
    --c-red-500: #ef4444;
    --c-red-300: #fca5a5;
    --c-red-200: #fecaca;
    --c-rose-400: #fb7185;
    --c-rose-300: #fda4af;
    --c-pink-400: #f472b6;
    --c-amber-300: #fcd34d;
    --c-amber-400: #fbbf24;
    --c-amber-500: #eab308;
    --c-yellow-300: #fde047;
    --c-orange-200: #fed7aa;
    --c-orange-400: #fb923c;
    --c-violet-400: #a78bfa;
    --c-violet-300: #c4b5fd;
    --c-purple-300: #d8b4fe;
    --c-purple-400: #c084fc;
    --c-violet-500: #8b5cf6;

    --bg-body: #0a0c10;
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-overlay: rgba(15, 23, 42, 0.9);
    --border-color: #334155;
    --border-light: rgba(255, 255, 255, 0.05);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-green: #10b981;
    --accent-red: #f43f5e;
    --accent-yellow: #f59e0b;
    --shadow-main: rgba(0,0,0,0.5);
    --shadow-light: rgba(0,0,0,0.2);
    --bg-panel: rgba(15, 23, 42, 0.4);
    --bg-input-transparent: rgba(15, 23, 42, 0.5);

    /* KPI Card Gradients & Borders (Dark Mode) */
    --kpi-rev-bg: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.02));
    --kpi-rev-border: rgba(16, 185, 129, 0.3);
    --kpi-rev-text: var(--accent-green);

    --kpi-profit-bg: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(56, 189, 248, 0.02));
    --kpi-profit-border: rgba(56, 189, 248, 0.3);
    --kpi-profit-text: var(--c-sky-400);

    --kpi-occ-bg: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.02));
    --kpi-occ-border: rgba(245, 158, 11, 0.3);
    --kpi-occ-text: var(--accent-yellow);

    --kpi-cost-bg: linear-gradient(135deg, rgba(244, 63, 94, 0.08), rgba(244, 63, 94, 0.01));
    --kpi-cost-border: rgba(244, 63, 94, 0.25);
    --kpi-cost-text: var(--accent-red);

    /* Building Health Alerts (Dark Mode) */
    --b-health-loss-bg: linear-gradient(135deg, rgba(244, 63, 94, 0.15), rgba(244, 63, 94, 0.03));
    --b-health-loss-border: rgba(244, 63, 94, 0.35);
}

[data-theme="light"] {
    --c-lime-400: #4d7c0f;
    --c-gray-100: #111827;
    --c-slate-600: #0f172a;
    --c-gray-300: #374151;

    /* Extracted Text Colors (Light) */
    --c-slate-300: #475569;
    --c-slate-200: #334155;
    --c-slate-100: #1e293b;
    --c-slate-50: #0f172a;
    --c-gray-400: #4b5563;
    --c-gray-500: #374151;
    --c-gray-600: #1f2937;
    --c-slate-700: #94a3b8;
    --c-neutral-500: #525252;
    --c-black: #000000;
    --c-white: #0f172a;
    --c-blue-400: #2563eb;
    --c-sky-400: #0284c7;
    --c-blue-300: #3b82f6;
    --c-blue-200: #60a5fa;
    --c-sky-500: #0369a1;
    --c-lightblue: #0284c7;
    --c-emerald-400: #059669;
    --c-emerald-300: #10b981;
    --c-green-400: #16a34a;
    --c-green-600: #15803d;
    --c-green-700: #166534;
    --c-red-400: #dc2626;
    --c-red-500: #b91c1c;
    --c-red-300: #ef4444;
    --c-red-200: #f87171;
    --c-rose-400: #e11d48;
    --c-rose-300: #f43f5e;
    --c-pink-400: #db2777;
    --c-amber-300: #d97706;
    --c-amber-400: #b45309;
    --c-amber-500: #92400e;
    --c-yellow-300: #ca8a04;
    --c-orange-200: #ea580c;
    --c-orange-400: #c2410c;
    --c-violet-400: #7c3aed;
    --c-violet-300: #8b5cf6;
    --c-purple-300: #9333ea;
    --c-purple-400: #7e22ce;
    --c-violet-500: #6d28d9;

    --bg-body: #f8fafc;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: rgba(0,0,0,0.02);
    --bg-overlay: rgba(255, 255, 255, 0.9);
    --border-color: #e2e8f0;
    --border-light: rgba(0,0,0,0.05);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: var(--text-secondary);
    --accent-blue: var(--accent-blue-hover);
    --accent-blue-hover: #1d4ed8;
    --accent-green: #059669;
    --accent-red: #e11d48;
    --accent-yellow: #d97706;
    --shadow-main: rgba(148,163,184,0.15);
    --shadow-light: rgba(148,163,184,0.05);
    --sidebar-bg: #ffffff;
    --bg-panel: var(--bg-main);
    --bg-input-transparent: var(--bg-main);

    /* KPI Card Gradients & Borders (Light Mode) */
    --kpi-rev-bg: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.01));
    --kpi-rev-border: rgba(16, 185, 129, 0.2);
    --kpi-rev-text: var(--accent-green);

    --kpi-profit-bg: linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(56, 189, 248, 0.01));
    --kpi-profit-border: rgba(56, 189, 248, 0.2);
    --kpi-profit-text: var(--c-sky-500);

    --kpi-occ-bg: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.01));
    --kpi-occ-border: rgba(245, 158, 11, 0.2);
    --kpi-occ-text: var(--accent-yellow);

    --kpi-cost-bg: linear-gradient(135deg, rgba(244, 63, 94, 0.05), rgba(244, 63, 94, 0.01));
    --kpi-cost-border: rgba(244, 63, 94, 0.15);
    --kpi-cost-text: var(--accent-red);

    /* Building Health Alerts (Light Mode) */
    --b-health-loss-bg: linear-gradient(135deg, rgba(244, 63, 94, 0.06), rgba(244, 63, 94, 0.01));
    --b-health-loss-border: rgba(244, 63, 94, 0.22);
}

/* Base Body Styles using Vars */
.mobile-only-close { display: none; }
body {
    background-color: var(--bg-body) !important;
    color: var(--text-primary) !important;
    transition: background-color 0.3s, color 0.3s;
}


/* Adjustments for global classes */
.stat-card { padding: 18px; background: var(--bg-card); border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 4px 12px var(--shadow-light); }
.filter-bar { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; background: var(--bg-card); padding: 12px; border-radius: 10px; margin-bottom: 15px; border: 1px solid var(--border-color); }
.filter-bar select { background: var(--bg-main); color: var(--text-primary); border: 1px solid var(--border-color); padding: 6px; border-radius: 6px; font-size: 11px; }
.debug-panel { background: var(--bg-card); color: var(--accent-green); padding: 15px; border-radius: 12px; margin-bottom: 20px; font-size: 11px; border: 1px solid var(--border-color); position: relative; }
.debug-panel b { color: var(--accent-red); }
.close-debug { position: absolute; top: 10px; right: 10px; cursor: pointer; color: #888; font-size: 14px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; margin-bottom: 20px; }

.table-container { width: 100%; overflow-x: auto; background: var(--bg-panel); backdrop-filter: blur(12px); border-radius: 12px; border: 1px solid var(--border-light); box-shadow: 0 8px 32px var(--shadow-light); max-height: 400px; overflow-y: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 1200px; }
.data-table th { background: var(--bg-card); padding: 12px 15px; text-align: left; color: var(--text-secondary); font-size: 10px; text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; border-bottom: 1px solid var(--border-light); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(5px); }
.data-table td { padding: 10px 15px; border-bottom: 1px solid var(--border-light); color: var(--text-primary); font-size: 12px; transition: background 0.2s ease, color 0.2s ease; }
.data-table tbody tr { transition: background 0.2s ease; }
.data-table tbody tr:hover { background: rgba(56, 189, 248, 0.05); }
.data-table tbody tr:hover td { color: var(--text-primary); }

.table-link { color: #38bdf8; font-weight: 600; text-decoration: none; position: relative; transition: color 0.2s; }
.table-link:hover { color: #bae6fd; text-shadow: 0 0 10px rgba(56, 189, 248, 0.4); }

.income { color: var(--accent-green) !important; font-weight: 600; }
.expense { color: var(--accent-red) !important; font-weight: 600; }

/* Map CSS */
.building-map { display: flex; flex-direction: column; gap: 15px; margin-bottom: 30px; }
.floor-row { display: flex; align-items: stretch; background: rgba(22, 27, 34, 0.6); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.1); backdrop-filter: blur(10px); }
.floor-label { width: 90px; background: rgba(59, 130, 246, 0.15); color: #bae6fd; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; border-right: 1px solid var(--border-light); text-align: center; }
.floor-rooms { flex: 1; padding: 15px; display: flex; flex-direction: column; gap: 10px; }

.room-card { width: 100%; padding: 15px 20px; border-radius: 10px; border: 1px solid #444; background: rgba(0,0,0,0.3); cursor: pointer; transition: 0.2s; position:relative; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.room-card:hover { transform: translateY(-4px); box-shadow: 0 8px 25px rgba(0,0,0,0.4); z-index: 10; }
.room-card .rc-name { font-size: 18px; font-weight: 800; color: var(--text-primary); margin-bottom: 2px; text-align: center; }
.room-card .rc-price { font-size: 12px; color: #9ca3af; text-align: center; font-weight: 500; }
.room-card .rc-status { font-size: 10px; text-align: center; font-weight: 700; margin-top: 8px; padding: 4px 0; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.5px; }

.room-card.empty { border-color: rgba(244, 63, 94, 0.5); background: rgba(244, 63, 94, 0.05); }
.room-card.empty .rc-status { background: rgba(244, 63, 94, 0.15); color: #fda4af; }

.room-card.rented { border-color: rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.05); }
.room-card.rented .rc-status { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }

.room-card.expiring { border-color: rgba(252, 211, 77, 0.4); background: rgba(252, 211, 77, 0.05); }
.room-card.expiring .rc-status { background: rgba(252, 211, 77, 0.15); color: #fde047; }
.room-card.blocked { border-color: rgba(156, 163, 175, 0.4); background: rgba(156, 163, 175, 0.05); opacity: 0.7; }
.room-card.blocked:hover { opacity: 1; border-color: rgba(156, 163, 175, 0.7); }
.room-card.blocked .rc-status { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }
.bulk-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.bulk-tab { padding: 10px 20px; background: var(--bg-card); border: 1px solid var(--border-color); color: #888; cursor: pointer; border-radius: 8px; font-size: 12px; font-weight: 600; transition: 0.2s; }
.bulk-tab.active { background: var(--accent-blue); color: var(--text-primary); border-color: var(--accent-blue); box-shadow: 0 4px 12px rgba(59,130,246,0.3); }
.import-guide { background: rgba(59, 130, 246, 0.05); border-left: 4px solid var(--accent-blue); padding: 15px; border-radius: 8px; margin-bottom: 15px; }
.column-tag { display: inline-block; padding: 2px 8px; background: var(--bg-main); border: 1px solid #333; border-radius: 4px; font-size: 10px; font-family: monospace; color: #34d399; margin: 2px; }

/* Bulk Action Styles */
.bulk-bar { display: none; background: var(--bg-card); border: 1px solid var(--accent-blue); padding: 12px 20px; border-radius: 12px; margin-bottom: 15px; align-items: center; gap: 15px; animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.bulk-count { font-size: 13px; font-weight: 700; color: var(--accent-blue); }
.btn-liquidate { background: var(--accent-red); color: var(--text-primary); border: none; padding: 8px 16px; border-radius: 8px; font-size: 12px; font-weight: 700; cursor: pointer; transition: 0.2s; }
.btn-liquidate:hover { background: #e11d48; box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3); }

.chk-col { width: 40px; text-align: center !important; }
input[type="checkbox"] { cursor: pointer; width: 16px; height: 16px; accent-color: var(--accent-blue); }

.status-badge { padding: 4px 8px; border-radius: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.status-liquidated { background: rgba(148, 163, 184, 0.1); color: var(--text-secondary); border: 1px solid rgba(148, 163, 184, 0.3); }

/* Modal Styles */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: var(--bg-card); border: 1px solid var(--border-color); padding: 30px; border-radius: 20px; width: 100%; max-width: 450px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); }
.modal-content h3 { margin: 0 0 20px 0; color: var(--text-primary); font-size: 18px; }
.modal-form { display: flex; flex-direction: column; gap: 15px; }
.modal-form label { font-size: 11px; color: var(--text-secondary); font-weight: 700; text-transform: uppercase; }
.modal-form input, .modal-form select, .modal-form textarea { background: var(--bg-main); border: 1px solid var(--border-color); padding: 12px; border-radius: 10px; color: var(--text-primary); font-family: inherit; font-size: 14px; outline: none; }
.modal-form input:focus { border-color: var(--accent-blue); }
.modal-actions { display: flex; gap: 10px; margin-top: 10px; }
.btn-save { flex: 1; background: var(--accent-blue); color: var(--text-primary); border: none; padding: 12px; border-radius: 10px; font-weight: 700; cursor: pointer; transition: 0.2s; }
.btn-cancel { background: var(--bg-card-hover); color: var(--text-secondary); border: none; padding: 12px 20px; border-radius: 10px; font-weight: 700; cursor: pointer; }

/* Auth Screen Styles */
.auth-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-main); display: flex; align-items: center; justify-content: center; z-index: 2000; background-image: radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.1) 0%, transparent 50%), radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.1) 0%, transparent 50%); }
.auth-card { background: var(--bg-card); border: 1px solid var(--border-color); padding: 40px; border-radius: 24px; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); text-align: center; }
.auth-card h2 { color: var(--text-primary); margin-bottom: 30px; font-weight: 800; font-size: 24px; }
.auth-input { width: 100%; background: var(--bg-main); border: 1px solid var(--border-color); padding: 15px; border-radius: 12px; color: var(--text-primary); margin-bottom: 15px; font-size: 14px; outline: none; }
.auth-input:focus { border-color: var(--accent-blue); }
.btn-auth { width: 100%; background: var(--accent-blue); color: var(--text-primary); border: none; padding: 15px; border-radius: 12px; font-weight: 700; cursor: pointer; font-size: 16px; margin-top: 10px; transition: 0.3s; }
.btn-auth:hover { background: var(--accent-blue-hover); transform: translateY(-2px); box-shadow: 0 10px 20px rgba(59,130,246,0.3); }
.auth-toggle { color: var(--text-secondary); font-size: 13px; margin-top: 20px; cursor: pointer; }
.auth-toggle span { color: var(--accent-blue); font-weight: 700; }
.wait-msg { color: #fcd34d; font-size: 14px; padding: 20px; background: rgba(252, 211, 77, 0.1); border-radius: 12px; border: 1px solid rgba(252, 211, 77, 0.2); line-height: 1.6; }

/* Period Selector Fixes */
.mode-btn { background: transparent; border: none; color: var(--text-secondary); padding: 10px 18px; border-radius: 10px; font-size: 12px; font-weight: 700; cursor: pointer; transition: 0.2s; white-space: nowrap; }
.mode-btn:hover { color: var(--text-primary); background: var(--border-light); }
.mode-btn.active { background: var(--accent-blue); color: var(--text-primary); box-shadow: 0 4px 15px rgba(59,130,246,0.4); }

.mode-control { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.mode-control label { font-size: 11px; color: #60a5fa; font-weight: 900; text-transform: uppercase; letter-spacing: 1.5px; opacity: 0.8; }
.period-select { background:var(--bg-main); color: var(--text-primary); border:2px solid var(--border-color); padding:8px 12px; border-radius:12px; font-weight:800; cursor:pointer; outline:none; font-family:inherit; min-width:140px; font-size:15px; transition: 0.2s; }
.period-select:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 4px rgba(59,130,246,0.1); }
.m-input { 
    background: var(--bg-card); 
    color: var(--text-primary); 
    border: 1px solid var(--border-color); 
    border-radius: 4px; 
    padding: 4px 6px; 
    font-size: 11px; 
    outline: none; 
    transition: 0.2s;
}
.m-input:focus { border-color: var(--accent-blue); background: var(--bg-main); }
.m-input::placeholder { color: #484f58; }
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
.pending-row:hover { background: rgba(59, 130, 246, 0.05) !important; }
/* Responsive Grid Framework */
.grid-main { display: grid; grid-template-columns: 1.8fr 1fr; gap: 15px; margin-bottom: 25px; }
.grid-alerts { display: grid; grid-template-columns: 2fr 1fr; gap: 15px; margin-bottom: 25px; }
.grid-even { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 25px; }
.grid-uneven { display: grid; grid-template-columns: 2fr 1fr; gap: 15px; margin-bottom: 25px; }

@media (max-width: 768px) {
    .grid-main, .grid-alerts, .grid-even, .grid-uneven {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }
    #dash-row1-container {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }
    h2, h3, .stat-value, .stat-label {
        word-wrap: break-word !important;
        word-break: break-word !important;
    }
    #dash-status-banner, .kpi-occ {
        grid-column: span 2 !important;
    }
    .kpi-rev, .kpi-profit {
        grid-column: span 1 !important;
    }
    .b-health-profit > div:nth-child(2) > div > div:first-child,
    .b-health-loss > div:nth-child(2) > div > div:first-child {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 2px !important;
    }
    .b-health-profit > div:nth-child(2) > div > div:first-child > span,
    .b-health-loss > div:nth-child(2) > div > div:first-child > span {
        font-size: 9px !important;
        line-height: 1 !important;
    }
    .b-health-profit > div:nth-child(2) > div > div:first-child > span:last-child,
    .b-health-loss > div:nth-child(2) > div > div:first-child > span:last-child {
        font-size: 11px !important;
        align-self: flex-end !important;
    }
    .stat-card {
        padding: 10px 8px !important;
        border-radius: 8px !important;
        min-width: 0 !important;
    }
    .stat-card .stat-label {
        font-size: 9px !important;
        margin-bottom: 4px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .stat-card .stat-value,
    .stat-card [style*="font-size: 26px"],
    .stat-card [style*="font-size:26px"],
    .stat-card [style*="font-size: 28px"],
    .stat-card [style*="font-size:28px"],
    .stat-card [style*="font-size: 30px"],
    .stat-card [style*="font-size:30px"],
    .stat-card [style*="font-size: 32px"],
    .stat-card [style*="font-size:32px"] {
        font-size: 14px !important;
    }
    .stat-card [style*="font-size: 16px"],
    .stat-card [style*="font-size:16px"] {
        font-size: 12px !important;
    }
    .stat-card [style*="font-size: 14px"],
    .stat-card [style*="font-size:14px"] {
        font-size: 10px !important;
    }
    .stat-card [style*="font-size: 13px"],
    .stat-card [style*="font-size:13px"] {
        font-size: 9px !important;
    }
    .occ-circular-progress {
        width: 36px !important;
        height: 36px !important;
    }
    .occ-circular-text {
        font-size: 9px !important;
    }
    .app-container { flex-direction: column; height: auto; position: relative; }
    
    /* Responsive Sidebar (Mobile Drawer) */
    .sidebar { 
        position: fixed !important; 
        top: 0 !important; 
        bottom: 0 !important;
        left: -100% !important; 
        width: 85% !important; 
        max-width: 320px !important;
        height: 100% !important; 
        z-index: 100005 !important; 
        background: var(--bg-main) !important; 
        border-right: 1px solid var(--border-color) !important; 
        border-bottom: none !important;
        overflow-y: auto !important;
        box-shadow: 20px 0 50px rgba(0,0,0,0.8) !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        padding-top: 10px !important;
        padding-bottom: 20px !important; /* safe area padding */
        display: flex !important;
        flex-direction: column !important;
        animation: none !important;
    }
    .sidebar.active { 
        left: 0 !important; 
    }
    .sidebar .logo { display: flex !important; margin-bottom: 20px !important; padding: 0 15px !important; }
    .mobile-only-close { display: block !important; }
    
    /* Mobile Top Bar activation */
    .mobile-header { display: flex !important; }
    
    .main-content { padding: 15px; overflow-y: visible; margin-top: 0; }
    body { overflow-y: auto !important; }
    
    /* Top bar adjustment for Header vs Filters */
    .top-bar { flex-direction: column !important; align-items: flex-start !important; gap: 15px; }
    .top-bar h1 { font-size: 18px !important; }
    
    /* Overlay */
    #mobile-overlay {
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 100000;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    #mobile-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Date Picker Panel Collapsing logic (Bottom Sheet) */
    #btn-toggle-filter { display: flex !important; }
    .filter-container { 
        position: fixed !important;
        bottom: -100% !important;
        left: 0 !important;
        width: 100% !important;
        z-index: 100001 !important;
        background: var(--bg-card) !important;
        border-radius: 20px 20px 0 0 !important;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.8) !important;
        padding: 20px 15px 40px 15px !important; /* Padding bottom for safe area */
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        animation: none !important;
    }
    .filter-container.active { 
        bottom: 0 !important; 
    }
    
    /* Loại bỏ dải phân cách dọc trên mobile */
    .filter-container > div[style*="width:1px;"] { display: none !important; }
    
    .mode-control { width: 100%; }
    .mode-control select, .mode-control div { width: 100%; box-sizing: border-box; }
    .mode-control button { width: 100%; justify-content: center; box-sizing: border-box; }
}

@keyframes slideDownMenu {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard KPI Card Enhancements */
.kpi-rev { background: var(--kpi-rev-bg) !important; border-color: var(--kpi-rev-border) !important; }
.kpi-profit { background: var(--kpi-profit-bg) !important; border-color: var(--kpi-profit-border) !important; }
.kpi-occ { background: var(--kpi-occ-bg) !important; border-color: var(--kpi-occ-border) !important; }
.kpi-cost { background: var(--kpi-cost-bg) !important; border-color: var(--kpi-cost-border) !important; }

/* Building Health Card Loss Style */
.b-health-loss {
    background: var(--b-health-loss-bg) !important;
    border-color: var(--b-health-loss-border) !important;
}

/* Building Health Card Profitable Style */
.b-health-profit {
    background: var(--kpi-rev-bg) !important;
    border-color: var(--kpi-rev-border) !important;
}

/* Parallel Compare Bars for Revenue vs Cost */
.financial-parallel-bar-container {
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.financial-parallel-bar-rev {
    height: 100%;
    background: var(--accent-green);
    border-radius: 3px;
    position: absolute;
    top: 0;
    left: 0;
    transition: width 0.3s ease;
}
.financial-parallel-bar-cost {
    height: 100%;
    background: var(--accent-red);
    border-radius: 3px;
    position: absolute;
    top: 0;
    left: 0;
    transition: width 0.3s ease;
}

/* Micro-interaction Hover Effects for Dashboard Cards */
.stat-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease !important;
}
.stat-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25), 0 0 15px rgba(59, 130, 246, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}
[data-theme="light"] .stat-card:hover {
    box-shadow: 0 12px 30px rgba(148, 163, 184, 0.15), 0 0 15px rgba(37, 99, 235, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
}

/* circular-progress class for OCC chart */
.occ-circular-progress {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.3s;
    flex-shrink: 0;
}
.occ-circular-progress::before {
    content: "";
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-card);
}
.occ-circular-progress-text {
    position: relative;
    font-size: 11px;
    font-weight: 950;
    color: var(--text-primary);
}

/* Small variant for listing card */
.occ-circular-progress.small {
    width: 42px;
    height: 42px;
    box-shadow: none;
}
.occ-circular-progress.small::before {
    width: 32px;
    height: 32px;
}
.occ-circular-progress.small .occ-circular-progress-text {
    font-size: 9px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}





@media (max-width: 768px) {
    /* COMPACT TEXT SCALING FOR MOBILE (FACEBOOK STYLE) */
    html, body {
        font-size: 13px !important;
    }
    .kpi-value { font-size: 16px !important; }
    .kpi-title { font-size: 10px !important; }
    .data-table th { font-size: 10px !important; padding: 8px 10px !important; }
    .data-table td { font-size: 11px !important; padding: 10px !important; }
    .top-bar h1 { font-size: 15px !important; }
    .nav-link { font-size: 12px !important; padding: 10px 12px !important; }
    button { font-size: 12px !important; }
    .filter-container label { font-size: 11px !important; }
    .stat-value { font-size: 14px !important; }
    .stat-label { font-size: 10px !important; }
    .building-card { padding: 12px !important; gap: 10px !important; }
    .building-card-title { font-size: 14px !important; }
    .card-title { font-size: 12px !important; }
    
    /* 2 columns for KPIs on mobile */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    /* Optimize trace modal table for small text */
    #drilldown-modal .data-table td, #drilldown-modal .data-table th {
        font-size: 10px !important;
        padding: 8px !important;
    }
}
