/* ═══════════ Light Theme — Warm, Comfortable, Not Blinding ═══════════ */
html[data-theme="light"],
body.light-theme {
    --bg: #eef2f7;
    --bg-content: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #f8fafc;
    --bg-topnav: #ffffff;
    --border: #e2e8f0;
    --border-color: #e2e8f0;
    --text: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-heading: #020617;
}

html[data-theme="light"] .main-content {
    background: #eef2f7;
    color: #0f172a;
}

html[data-theme="light"] .card {
    background: #fff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}

html[data-theme="light"] .card__header {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

html[data-theme="light"] .card__title {
    color: #020617;
    font-weight: 700;
}

html[data-theme="light"] .page-header__title {
    color: #020617;
    font-weight: 800;
}

html[data-theme="light"] .page-header__subtitle {
    color: #334155;
    font-weight: 500;
}

html[data-theme="light"] .data-table thead th {
    background: #e2e8f0;
    color: #020617;
    border-color: #cbd5e1;
    font-weight: 700;
}

html[data-theme="light"] .data-table tbody td {
    border-color: #e2e8f0;
    color: #1e293b;
    font-weight: 500;
}

html[data-theme="light"] .data-table tbody tr:hover {
    background: #e2e8f0;
}

html[data-theme="light"] .data-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
}

html[data-theme="light"] .form-control {
    background: #fff;
    border: 1.5px solid #94a3b8;
    color: #0f172a;
    font-weight: 500;
}

html[data-theme="light"] .form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .2);
}

html[data-theme="light"] .form-control::placeholder {
    color: #94a3b8;
}

html[data-theme="light"] .form-label {
    color: #334155;
    font-weight: 600;
}

html[data-theme="light"] .topnav {
    background: #fff;
    border-bottom: 1px solid #cbd5e1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}

html[data-theme="light"] .topnav__user-name,
html[data-theme="light"] .topnav__dropdown-btn,
html[data-theme="light"] #themeToggle {
    color: #1e293b;
    font-weight: 600;
}

html[data-theme="light"] .topnav__brand {
    color: #0f172a;
}

html[data-theme="light"] .topnav__search input {
    background: #f1f5f9;
    border: 1.5px solid #94a3b8;
    color: #0f172a;
}

html[data-theme="light"] .stat-card {
    border-color: #cbd5e1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}

html[data-theme="light"] .stat-card__value {
    color: #020617;
    font-weight: 800;
}

html[data-theme="light"] .stat-card__label {
    color: #334155;
    font-weight: 600;
}

html[data-theme="light"] .stat-card__detail {
    color: #64748b;
    font-weight: 500;
}

html[data-theme="light"] .badge {
    border: 1px solid #cbd5e1;
    font-weight: 600;
}

html[data-theme="light"] .timeline__date {
    color: #64748b;
    font-weight: 500;
}

html[data-theme="light"] .timeline__title {
    color: #0f172a;
    font-weight: 700;
}

html[data-theme="light"] .timeline__text {
    color: #334155;
}

html[data-theme="light"] .detail-label {
    color: #64748b;
    font-weight: 600;
}

html[data-theme="light"] .detail-value {
    color: #0f172a;
    font-weight: 600;
}

html[data-theme="light"] .dropdown__menu {
    background: #fff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

html[data-theme="light"] .dropdown__item {
    color: #1e293b;
    font-weight: 500;
}

html[data-theme="light"] .dropdown__item:hover {
    background: #e2e8f0;
}

html[data-theme="light"] .dropdown__header {
    color: #020617;
    font-weight: 700;
}

html[data-theme="light"] .dropdown__sub {
    color: #64748b;
}

html[data-theme="light"] .empty-state__text {
    color: #64748b;
    font-weight: 500;
}

html[data-theme="light"] .btn--secondary {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
    font-weight: 600;
}

html[data-theme="light"] .btn--secondary:hover {
    background: #cbd5e1;
}

html[data-theme="light"] .btn--ghost {
    color: #334155;
    font-weight: 600;
}

html[data-theme="light"] .btn--ghost:hover {
    background: #e2e8f0;
}

html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] h4,
html[data-theme="light"] h5,
html[data-theme="light"] h6 {
    color: #020617;
    font-weight: 700;
}

html[data-theme="light"] p,
html[data-theme="light"] span,
html[data-theme="light"] div,
html[data-theme="light"] td,
html[data-theme="light"] li,
html[data-theme="light"] label {
    color: #1e293b;
}

html[data-theme="light"] a {
    color: #2563eb;
}

html[data-theme="light"] strong {
    color: #020617;
    font-weight: 800;
}

/* Kanban / Gantt cards in light mode */
html[data-theme="light"] .kanban-card,
html[data-theme="light"] .chat-msg {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

/* ═══════════ Responsive Polish ═══════════ */
@media (max-width: 768px) {
    .stat-cards {
        grid-template-columns: 1fr 1fr !important;
        gap: .5rem !important;
    }

    .stat-card__icon {
        font-size: 1.2rem !important;
    }

    .stat-card__value {
        font-size: 1.2rem !important;
    }

    .stat-card__label {
        font-size: .7rem !important;
    }

    .stat-card__detail {
        font-size: .65rem !important;
    }

    .detail-grid {
        grid-template-columns: 1fr !important;
    }

    .form-row,
    .form-row--2 {
        grid-template-columns: 1fr !important;
    }

    .page-header {
        flex-direction: column !important;
        gap: .75rem !important;
        align-items: flex-start !important;
    }

    .btn-group {
        flex-wrap: wrap;
        gap: .25rem;
    }

    .btn-group .btn {
        font-size: .75rem !important;
        padding: .3rem .5rem !important;
    }

    div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    .sidebar {
        z-index: 999;
    }

    .topnav__user-name {
        display: none !important;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 600px;
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr !important;
    }

    .page-header__title {
        font-size: 1.1rem !important;
    }

    .card {
        border-radius: 6px !important;
    }

    #bimContainer {
        height: 300px !important;
    }
}

/* ═══════════ Print Styles ═══════════ */
@media print {

    .sidebar,
    .topnav,
    .sidebar-expand-btn,
    .sidebar-overlay,
    .btn,
    button,
    form,
    .dropdown,
    #themeToggle,
    #aiChatBtn,
    #aiChatPanel {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 1rem !important;
        background: #fff !important;
        color: #000 !important;
    }

    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        background: #fff !important;
        page-break-inside: avoid;
    }
}