:root {
    --primary: #0891b2;
    --primary-dark: #0e7490;
    --primary-light: #22d3ee;
    --secondary: #6366f1;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --purple: #8b5cf6;
    --pink: #ec4899;
    --orange: #f97316;
    --teal: #14b8a6;

    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-white: #ffffff;
    --bg-dark: #1e293b;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, var(--bg-dark) 0%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-nav span,
.sidebar.collapsed .sidebar-footer {
    opacity: 0;
    visibility: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo i {
    font-size: 1.75rem;
    color: var(--primary-light);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: white;
    background: rgba(8, 145, 178, 0.2);
    border-left-color: var(--primary);
}

.nav-item i {
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
}

.nav-section {
    padding: 1rem 1.25rem 0.5rem;
}

.nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 1rem 1.25rem;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
}

.user-role {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
    margin-left: 260px;
    transition: var(--transition);
}

.sidebar.collapsed ~ .main-wrapper {
    margin-left: 70px;
}

/* ===== TOP HEADER ===== */
.top-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 0.625rem 1rem;
    gap: 0.75rem;
    flex: 1;
    max-width: 400px;
    transition: var(--transition);
}

.search-box:focus-within {
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.search-box i {
    color: var(--text-muted);
}

.search-box input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 0.875rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--border);
    background: var(--bg-white);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.header-btn:hover {
    background: var(--bg-secondary);
}

.header-btn.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.header-btn.btn-primary:hover {
    background: var(--primary-dark);
}

.header-btn .badge {
    position: relative;
    top: -8px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 2rem;
}

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.blue { border-left: 4px solid var(--primary); }
.stat-card.pink { border-left: 4px solid var(--pink); }
.stat-card.teal { border-left: 4px solid var(--teal); }
.stat-card.orange { border-left: 4px solid var(--orange); }

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.blue .stat-icon { background: rgba(8, 145, 178, 0.1); color: var(--primary); }
.pink .stat-icon { background: rgba(236, 72, 153, 0.1); color: var(--pink); }
.teal .stat-icon { background: rgba(20, 184, 166, 0.1); color: var(--teal); }
.orange .stat-icon { background: rgba(249, 115, 22, 0.1); color: var(--orange); }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== ACTIONS BAR ===== */
.actions-bar {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-select {
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

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

.btn-outline {
    background: var(--bg-white);
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

/* ===== TABLE CARD ===== */
.table-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.table-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-header i {
    color: var(--primary);
}

.record-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-secondary);
}

.data-table th {
    padding: 0.75rem 0.75rem;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody:hover tr {
    background: var(--bg-secondary);
}

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

.loading-state {
    text-align: center;
    padding: 3rem !important;
    color: var(--text-secondary);
}

.loading-state span {
    display: block;
    margin-top: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.gender-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.gender-male {
    background: rgba(20, 184, 166, 0.15);
    color: var(--teal);
}

.gender-female {
    background: rgba(236, 72, 153, 0.15);
    color: var(--pink);
}

.gender-other {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-secondary);
}

/* ===== TABLE FOOTER ===== */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.page-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination {
    display: flex;
    gap: 0.5rem;
}

.pagination button {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border);
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
}

.pagination button:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
}

.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

/* ===== FORMS ===== */
.form-section {
    margin-bottom: 1.5rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-section > h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--bg-white);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

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

/* ===== DETAILS VIEW ===== */
.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.detail-item {
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
}

.detail-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
}

.detail-full {
    grid-column: 1 / -1;
}

/* ===== RTL SUPPORT ===== */
[dir="rtl"] body { font-family: 'Segoe UI', 'Tahoma', 'Arial', sans-serif; }
[dir="rtl"] .sidebar { left:auto;right:0; }
[dir="rtl"] .sidebar.collapsed { width:70px; }
[dir="rtl"] .main-wrapper { margin-left:0;margin-right:260px; }
[dir="rtl"] .sidebar.collapsed ~ .main-wrapper { margin-left:0;margin-right:70px; }
[dir="rtl"] .sidebar-toggle i { transform:scaleX(-1); }
[dir="rtl"] .nav-item { text-align:right; }
[dir="rtl"] .nav-item i { margin-left:.75rem;margin-right:0; }
[dir="rtl"] .sidebar-footer .user-info a[href*="logout"] { margin-left:0;margin-right:auto; }
[dir="rtl"] .top-header { direction:rtl; }
[dir="rtl"] .data-table { direction:rtl; }
[dir="rtl"] .data-table th, [dir="rtl"] .data-table td { text-align:right; }
[dir="rtl"] .stat-card { direction:rtl; }
[dir="rtl"] .stat-card .stat-icon { margin-left:.75rem;margin-right:0; }
[dir="rtl"] .btn-group { direction:rtl; }
[dir="rtl"] .details-grid { direction:rtl; }
[dir="rtl"] .card-header { direction:rtl; }
[dir="rtl"] input, [dir="rtl"] select, [dir="rtl"] textarea { direction:rtl; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 70px;
    }

    .sidebar .sidebar-header span,
    .sidebar .sidebar-nav span,
    .sidebar .sidebar-footer,
    .sidebar .lang-switch {
        opacity: 0;
        visibility: hidden;
    }

    .main-wrapper {
        margin-left: 70px;
    }
    [dir="rtl"] .main-wrapper { margin-left:0;margin-right:70px; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    [dir="rtl"] .sidebar { transform:translateX(100%); }

    .sidebar.mobile-open {
        transform: translateX(0);
        width: 260px;
    }

    .sidebar.mobile-open .sidebar-header span,
    .sidebar.mobile-open .sidebar-nav span,
    .sidebar.mobile-open .sidebar-footer,
    .sidebar.mobile-open .lang-switch {
        opacity: 1;
        visibility: visible;
    }

    .main-wrapper {
        margin-left: 0;
    }
    [dir="rtl"] .main-wrapper { margin-left:0;margin-right:0; }

    .menu-toggle {
        display: block;
    }

    .top-header {
        padding: 1rem;
    }

    .header-left {
        gap: 0.75rem;
    }

    .search-box {
        max-width: 100%;
    }

    .header-btn span {
        display: none;
    }

    .page-content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .actions-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group,
    .action-buttons {
        width: 100%;
    }

    .filter-select {
        flex: 1;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 1rem;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== ADDITIONAL RESPONSIVE — TABLET (768px – 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .page-content {
        padding: 1.5rem;
    }

    .top-header {
        padding: 0.875rem 1.5rem;
    }

    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-container {
        max-width: 90vw;
    }

    .modal-lg {
        max-width: 95vw;
    }

    .table-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .table-footer {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

/* ===== ADDITIONAL RESPONSIVE — MOBILE (< 768px) ===== */
@media (max-width: 768px) {
    /* ----- Tables: enforce horizontal scroll ----- */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Ensure bare .data-table not inside .table-responsive also scrolls */
    .table-card > .data-table,
    .page-content > .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 540px;
    }

    /* ----- Table header / footer ----- */
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 1rem;
    }

    .table-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.875rem 1rem;
    }

    .pagination {
        flex-wrap: wrap;
    }

    /* ----- Modals: full-width on mobile ----- */
    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .modal-container {
        max-width: 100%;
        width: 100%;
        max-height: 92vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }

    .modal-lg {
        max-width: 100%;
    }

    .modal-header {
        padding: 1.25rem 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 1rem;
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        flex: 1;
        justify-content: center;
    }

    /* ----- Forms: single-column on mobile ----- */
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 1rem; /* prevent iOS auto-zoom */
    }

    /* ----- Create / detail cards ----- */
    .create-card {
        padding: 1rem;
        border-radius: var(--radius-lg);
    }

    /* ----- Filter bar: wrap and stack ----- */
    .filter-bar {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .filter-group {
        flex-wrap: wrap;
        width: 100%;
    }

    .filter-select {
        width: 100%;
    }

    .action-buttons {
        width: 100%;
        flex-wrap: wrap;
    }

    .action-buttons .btn {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }

    /* ----- Stat cards: readable on small screens ----- */
    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.625rem;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

    /* ----- Details grid already set to 1-col above; reinforce ----- */
    .details-grid {
        gap: 0.75rem;
    }

    .detail-full {
        grid-column: 1;
    }

    /* ----- Typography adjustments ----- */
    .page-title,
    h1 {
        font-size: 1.375rem;
    }

    .table-header h2 {
        font-size: 1rem;
    }

    /* ----- Sidebar overlay backdrop when mobile-open ----- */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 999;
    }

    .sidebar-backdrop.active {
        display: block;
    }
}
