/* AmareViability - Main Stylesheet */

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    --primary: #1a365d;
    --primary-light: #2d5a87;
    --primary-lighter: #3d7ab5;
    --accent: #38a169;
    --accent-light: #48bb78;
    --danger: #e53e3e;
    --danger-light: #fc8181;
    --warning: #d69e2e;
    --warning-light: #f6e05e;
    --info: #3182ce;

    --bg: #f7fafc;
    --bg-white: #ffffff;
    --bg-dark: #1a202c;
    --bg-sidebar: #1a2332;

    --text: #2d3748;
    --text-light: #718096;
    --text-muted: #a0aec0;
    --text-white: #ffffff;

    --border: #e2e8f0;
    --border-light: #edf2f7;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);

    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;

    --transition: all 0.2s ease;
}

/* ========================================
   RESET & BASE
   ======================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

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

a { color: var(--primary-light); text-decoration: none; }
a:hover { color: var(--primary); }

img { max-width: 100%; height: auto; }

/* ========================================
   LOADING SCREEN
   ======================================== */
.loading-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--primary);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: white; z-index: 9999;
}
.loading-spinner {
    width: 50px; height: 50px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================
   LAYOUT - SIDEBAR + HEADER + MAIN
   ======================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-white);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow-x: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-brand {
    height: var(--header-height);
    display: flex; align-items: center;
    padding: 0 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 1.3rem; font-weight: 700;
    white-space: nowrap;
    gap: 10px;
}
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 0 8px; }
.sidebar-brand .brand-icon {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.sidebar.collapsed .brand-text { display: none; }

.sidebar-nav { flex: 1; padding: 15px 0; overflow-y: auto; }

.nav-section {
    padding: 10px 20px 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    white-space: nowrap;
}
.sidebar.collapsed .nav-section {
    text-align: center;
    padding: 8px 5px 4px;
    font-size: 0;
    height: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin: 0 10px;
}

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    border-left: 3px solid transparent;
    position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active {
    background: rgba(255,255,255,0.12);
    color: white;
    border-left-color: var(--accent);
}
.nav-item .nav-icon {
    width: 22px; text-align: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.sidebar.collapsed .nav-item {
    padding: 12px 0;
    justify-content: center;
    border-left-width: 0;
}
.sidebar.collapsed .nav-item.active {
    border-left-width: 0;
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
    margin: 2px 8px;
}
.sidebar.collapsed .nav-label { display: none; }

/* Tooltip on hover when collapsed */
.sidebar.collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(var(--sidebar-collapsed) + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-sidebar);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.sidebar.collapsed .nav-item:hover::after {
    opacity: 1;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
    color: var(--text-muted);
}
.sidebar.collapsed .sidebar-footer { padding: 10px; text-align: center; }
.sidebar.collapsed .sidebar-footer .brand-text { display: none; }

/* Sidebar mobile backdrop */
.sidebar-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* MAIN CONTENT */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.sidebar.collapsed ~ .main-wrapper { margin-left: var(--sidebar-collapsed); }

/* HEADER */
.header {
    height: var(--header-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 25px;
    position: sticky; top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
    justify-content: space-between;
}

.header-left { display: flex; align-items: center; gap: 15px; }

.btn-toggle-sidebar {
    background: var(--bg); border: 1px solid var(--border); cursor: pointer;
    font-size: 1.2rem; color: var(--text);
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    flex-shrink: 0;
}
.btn-toggle-sidebar:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* Collapse toggle inside sidebar */
.sidebar-collapse-btn {
    background: rgba(255,255,255,0.08); border: none; cursor: pointer;
    color: rgba(255,255,255,0.5);
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    margin-left: auto;
    flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.15); color: white; }
.sidebar.collapsed .sidebar-collapse-btn { margin: 0 auto; transform: rotate(180deg); }

.breadcrumbs { display: flex; align-items: center; gap: 8px; color: var(--text-light); font-size: 0.9rem; }
.breadcrumbs span { color: var(--text-muted); }

.header-right { display: flex; align-items: center; gap: 15px; }

.user-menu {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; padding: 5px 10px;
    border-radius: var(--radius); transition: var(--transition);
    position: relative;
}
.user-menu:hover { background: var(--bg); }
.user-avatar {
    width: 36px; height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; font-weight: 600;
}
.user-info { line-height: 1.3; }
.user-info .name { font-weight: 600; font-size: 0.85rem; }
.user-info .role { font-size: 0.75rem; color: var(--text-light); }

.user-dropdown {
    position: absolute; top: 100%; right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 200;
    display: none;
    padding: 5px 0;
}
.user-dropdown.show { display: block; }
.user-dropdown-item {
    padding: 8px 15px; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    color: var(--text); font-size: 0.85rem;
}
.user-dropdown-item:hover { background: var(--bg); }
.user-dropdown-divider { height: 1px; background: var(--border); margin: 5px 0; }

/* MAIN CONTENT AREA */
.main-content {
    flex: 1;
    padding: 25px;
    max-width: 1400px;
    width: 100%;
}

/* ========================================
   PAGE HEADER
   ======================================== */
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 25px;
}
.page-header h1 { font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.page-header p { color: var(--text-light); margin-top: 3px; font-size: 0.9rem; }
.page-actions { display: flex; gap: 10px; }

/* ========================================
   CARDS
   ======================================== */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg);
}
.card-header h2, .card-header h3 { font-size: 1rem; font-weight: 600; color: var(--primary); }
.card-body { padding: 20px; }
.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg);
}

/* KPI Cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 25px; }
.kpi-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border-top: 4px solid var(--primary-light);
    transition: var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-card.success { border-top-color: var(--accent); }
.kpi-card.danger { border-top-color: var(--danger); }
.kpi-card.warning { border-top-color: var(--warning); }
.kpi-card.info { border-top-color: var(--info); }

.kpi-label { font-size: 0.75rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin: 8px 0 4px; }
.kpi-sub { font-size: 0.8rem; color: var(--text-muted); }

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.85rem; font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-light); }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover:not(:disabled) { background: var(--accent-light); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: var(--danger-light); }

.btn-warning { background: var(--warning); color: white; }

.btn-outline {
    background: transparent; color: var(--primary);
    border-color: var(--border);
}
.btn-outline:hover:not(:disabled) { background: var(--bg); border-color: var(--primary-light); }

.btn-ghost { background: transparent; color: var(--text-light); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

.btn-group { display: flex; gap: 0; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

/* ========================================
   FORMS
   ======================================== */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 0.85rem; font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-label .tooltip-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--text-muted); color: white;
    font-size: 0.6rem; margin-left: 5px;
    cursor: help; position: relative;
}
.form-label .tooltip-icon:hover::after {
    content: attr(data-tip);
    position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%);
    background: var(--bg-dark); color: white;
    padding: 5px 10px; border-radius: var(--radius-sm);
    font-size: 0.75rem; white-space: nowrap; z-index: 100;
    font-weight: 400;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg-white);
    transition: var(--transition);
    outline: none;
}
.form-control:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(45,90,135,0.1); }
.form-control.error { border-color: var(--danger); }
.form-control.success { border-color: var(--accent); }

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23718096'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 35px; }

.form-text { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }

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

.input-group {
    display: flex;
}
.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); }
.input-group-append {
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex; align-items: center;
}

/* ========================================
   TABLES
   ======================================== */
.table-responsive { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.data-table th {
    background: var(--bg);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
.data-table tr:hover { background: var(--bg); }
.data-table .text-right { text-align: right; }
.data-table .text-center { text-align: center; }

/* ========================================
   TABS
   ======================================== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    gap: 0;
    overflow-x: auto;
}
.tab {
    padding: 10px 20px;
    cursor: pointer;
    color: var(--text-light);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    white-space: nowrap;
    font-size: 0.9rem;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ========================================
   BADGES & TAGS
   ======================================== */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-success { background: #c6f6d5; color: #22543d; }
.badge-danger { background: #fed7d7; color: #822727; }
.badge-warning { background: #fefcbf; color: #744210; }
.badge-info { background: #bee3f8; color: #1a365d; }
.badge-gray { background: #e2e8f0; color: #4a5568; }

/* Project type badges */
.type-residential { background: #e6fffa; color: #234e52; }
.type-commercial { background: #ebf4ff; color: #1a365d; }
.type-hotel { background: #faf5ff; color: #44337a; }
.type-mixed { background: #fffff0; color: #744210; }
.type-industrial { background: #fff5f5; color: #742a2a; }

/* ========================================
   MODAL
   ======================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}
.modal-overlay.hidden { display: none; }

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
}
.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { font-size: 1.1rem; color: var(--primary); }
.modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.5rem; color: var(--text-muted); line-height: 1;
    padding: 0 5px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 10px;
}
.modal-lg { max-width: 900px; }

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
    position: fixed; top: 20px; right: 20px;
    z-index: 9000;
    display: flex; flex-direction: column; gap: 10px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    display: flex; align-items: center; gap: 10px;
    animation: slideIn 0.3s ease;
    min-width: 280px;
    max-width: 400px;
}
.toast-success { background: var(--accent); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-warning { background: var(--warning); color: white; }
.toast-info { background: var(--info); color: white; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ========================================
   AUTH PAGES (Login/Register)
   ======================================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}
.auth-side {
    flex: 1;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    color: white; padding: 40px;
}
.auth-side h1 { font-size: 2.5rem; margin-bottom: 10px; }
.auth-side p { font-size: 1.1rem; opacity: 0.8; max-width: 400px; text-align: center; }

.auth-form-container {
    width: 100%; max-width: 450px;
    background: var(--bg-white);
    padding: 40px;
    display: flex; flex-direction: column;
    justify-content: center;
}
.auth-form-container h2 { font-size: 1.5rem; color: var(--primary); margin-bottom: 5px; }
.auth-form-container .subtitle { color: var(--text-light); margin-bottom: 30px; }

/* ========================================
   DASHBOARD
   ======================================== */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}
.chart-container canvas { max-height: 100%; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ========================================
   PROJECT CARDS (List View)
   ======================================== */
.project-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }

.project-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--primary-lighter); }

.project-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.project-card-header h3 { font-size: 1rem; color: var(--primary); margin-bottom: 4px; }
.project-card-meta { font-size: 0.8rem; color: var(--text-light); display: flex; flex-direction: column; gap: 4px; }
.project-card-metrics {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; padding-top: 12px;
    border-top: 1px solid var(--border-light);
    margin-top: 12px;
}
.project-card-metrics .metric { text-align: center; }
.project-card-metrics .metric-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.project-card-metrics .metric-value { font-size: 1rem; font-weight: 700; color: var(--primary); }

/* ========================================
   SCENARIO COMPARISON
   ======================================== */
.scenario-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.scenario-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}
.scenario-card.optimistic { border-color: var(--accent); }
.scenario-card.base { border-color: var(--primary-light); }
.scenario-card.pessimistic { border-color: var(--danger); }

.scenario-card h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}
.scenario-metrics { display: flex; flex-direction: column; gap: 12px; }
.scenario-metric-row { display: flex; justify-content: space-between; align-items: center; }
.scenario-metric-row .label { font-size: 0.85rem; color: var(--text-light); }
.scenario-metric-row .value { font-size: 1rem; font-weight: 700; }

/* ========================================
   EMPTY STATES
   ======================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 15px; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-light); margin-bottom: 8px; }
.empty-state p { max-width: 400px; margin: 0 auto 20px; font-size: 0.9rem; }

/* ========================================
   COMMENTS
   ======================================== */
.comment {
    display: flex; gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}
.comment-avatar {
    width: 36px; height: 36px;
    background: var(--primary-light); color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 600; flex-shrink: 0;
}
.comment-body { flex: 1; }
.comment-header { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.comment-author { font-weight: 600; font-size: 0.85rem; }
.comment-date { font-size: 0.75rem; color: var(--text-muted); }
.comment-text { font-size: 0.9rem; line-height: 1.5; }

/* ========================================
   UTILITY CLASSES
   ======================================== */
.hidden { display: none !important; }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-bold { font-weight: 700; }
.text-sm { font-size: 0.8rem; }
.text-lg { font-size: 1.2rem; }
.text-positive { color: var(--accent); }
.text-negative { color: var(--danger); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.w-100 { width: 100%; }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.collapsed { width: var(--sidebar-width); transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .sidebar.mobile-open .nav-label,
    .sidebar.mobile-open .brand-text,
    .sidebar.mobile-open .nav-section { display: inline; }
    /* Hide tooltips on mobile (full sidebar shown) */
    .sidebar .nav-item::after { display: none !important; }

    .main-wrapper { margin-left: 0 !important; }

    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }

    .page-header { flex-direction: column; align-items: flex-start; gap: 15px; }
    .auth-container { flex-direction: column; }
    .auth-side { padding: 30px; }
    .auth-side h1 { font-size: 1.8rem; }

    .modal-content { width: 95%; max-width: none; }
    .form-row { grid-template-columns: 1fr; }

    .main-content { padding: 15px; }
    .header { padding: 0 15px; }
    .project-list { grid-template-columns: 1fr; }
    .scenario-cards { grid-template-columns: 1fr; }
    .metric-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    html { font-size: 13px; }
    .auth-form-container { padding: 25px; }
}

/* ========================================
   TOWER / FLOOR CARDS (Construction Module)
   ======================================== */
.tower-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
}

.tower-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border-light);
}
.tower-header h3 {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 2px;
}

.tower-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg);
    border-top: 2px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-light);
}
.tower-subtotal strong {
    color: var(--primary);
    font-size: 1.05rem;
}

.floor-table {
    margin: 0;
}
.floor-table td,
.floor-table th {
    padding: 8px 12px;
    font-size: 0.82rem;
}

.cub-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #ebf4ff;
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Fluxo de Obra */
.fluxo-obra-table {
    max-height: 500px;
    overflow-y: auto;
}
.fluxo-obra-table table {
    margin: 0;
}
.fluxo-obra-table th,
.fluxo-obra-table td {
    font-size: 0.8rem;
    padding: 6px 10px;
    white-space: nowrap;
}

.evolution-input {
    width: 65px;
    padding: 4px 6px;
    font-size: 0.8rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
}
.evolution-input:focus {
    outline: none;
    border-color: var(--primary-lighter);
    box-shadow: 0 0 0 2px rgba(45, 90, 135, 0.15);
}

/* Tipologias table */
.tipologias-table th,
.tipologias-table td {
    white-space: nowrap;
}
.tipologias-table tfoot td {
    border-top: 2px solid var(--border);
}

/* ========================================
   FAN CHART LEGEND
   ======================================== */
.fan-chart-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    font-size: 0.78rem;
    color: var(--text-light);
}

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

.fan-chart-legend-box {
    width: 20px;
    height: 12px;
    border-radius: 2px;
}

/* ========================================
   COMPARISON TABLE HIGHLIGHTS
   ======================================== */
.comparison-table .positive-diff {
    color: var(--accent);
    font-weight: 600;
}

.comparison-table .negative-diff {
    color: var(--danger);
    font-weight: 600;
}

/* ========================================
   KPI GRID 8 (Two rows of 4)
   ======================================== */
.kpi-grid-8 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 1200px) {
    .kpi-grid-8 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .kpi-grid-8 {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   LOADING OVERLAY
   ======================================== */
.loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(3px);
}
.loading-overlay.hidden { display: none; }
.loading-overlay-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 2rem 3rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.loading-overlay-content .spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}
.loading-overlay-content p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .sidebar, .header, .btn, .toast-container, .modal-overlay, .loading-overlay { display: none !important; }
    .main-wrapper { margin-left: 0; }
    .main-content { padding: 0; max-width: none; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
