:root {
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #16213e;
    --sidebar-active: #0f3460;
    --primary-color: #0d6efd;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f6fa;
}

.sidebar {
    background: var(--sidebar-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: var(--sidebar-hover);
    border-left-color: var(--primary-color);
}

.sidebar .nav-link.active {
    color: #fff;
    background: var(--sidebar-active);
    border-left-color: var(--primary-color);
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar-header {
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-header img {
    max-height: 50px;
    filter: brightness(0) invert(1);
}

@media print {
    .d-print-block {
        display: block !important;
    }
    .d-print-none {
        display: none !important;
    }
}

.sidebar-footer {
    margin-top: auto;
}

.main-content {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
    min-height: 100vh;
}

.card-dashboard {
    transition: transform 0.2s, box-shadow 0.2s;
    border-width: 2px;
}

.card-dashboard:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.table > thead {
    background: #f8f9fa;
}

.table > thead th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
}

.badge {
    font-weight: 500;
    padding: 0.4em 0.7em;
}

.cursor-pointer {
    cursor: pointer;
}

.text-nowrap {
    white-space: nowrap;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
}

.flash-alert {
    animation: fadeInDown 0.3s;
}

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

@media print {
    .sidebar {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .btn, .no-print {
        display: none !important;
    }
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
}

@media (max-width: 767.98px) {
    .sidebar-toggle {
        width: 42px;
        height: 42px;
        padding: 0;
        line-height: 1;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        transition: left 0.3s ease;
        min-height: 100vh;
        overflow-y: auto;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1049;
        cursor: pointer;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding-top: 3.5rem;
    }

    .container-fluid > .row {
        flex-wrap: nowrap;
    }

    .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem;
    }

    .page-header .btn {
        width: 100%;
    }

    .page-header h2 {
        font-size: 1.25rem;
    }
}

@media (max-width: 575.98px) {
    .page-header h2 {
        font-size: 1.1rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    .form-control, .form-select, .btn {
        font-size: 0.9rem;
    }

    .btn-sm {
        padding: 0.3rem 0.5rem;
        font-size: 0.85rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }
}

@media (min-width: 768px) {
    .sidebar-overlay {
        display: none !important;
    }

    .main-content {
        padding-top: 1.5rem;
    }
}

@media (max-width: 767.98px) and (display: standalone) {
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

.table-card tbody td .td-actions {
    display: flex;
    gap: 0.25rem;
}

@media (max-width: 575.98px) {
    .table-card thead {
        display: none;
    }

    .table-card,
    .table-card tbody,
    .table-card tbody tr {
        display: block;
    }

    .table-card tbody tr {
        margin-bottom: 0.75rem;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        padding: 0.5rem 0.75rem;
        background: #fff;
    }

    .table-card tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.4rem 0;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        text-align: right;
        gap: 0.5rem;
    }

    .table-card tbody td:last-child {
        border-bottom: none;
    }

    .table-card tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.8rem;
        color: #495057;
        text-align: left;
        flex-shrink: 0;
    }

    .table-card tbody td .badge {
        font-size: 0.75rem;
    }
}

.card {
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.card-header {
    background: #f8f9fa;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    font-weight: 600;
}

.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #495057;
}

.btn {
    border-radius: 6px;
    font-weight: 500;
}

.modal-header {
    background: #f8f9fa;
}

.pagination {
    margin-bottom: 0;
}

.chart-container {
    position: relative;
    width: 100%;
}

canvas {
    max-width: 100%;
}
