:root {
    --primary: #0B7075;
    --primary-dark: #085A5E;
    --primary-darker: #032F30;
    --primary-light: #0C969C;
    --primary-rgb: 11, 112, 117;
    --success: #198754;
    --warning: #FFC107;
    --danger: #DC3545;
    --sidebar-bg: #032F30;
    --sidebar-width: 280px;
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #1a2332;
    --muted: #6c757d;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(var(--primary-rgb), 0.1);
    --bs-primary: #0B7075;
    --bs-primary-rgb: 11, 112, 117;
    --bs-link-color: #0B7075;
    --bs-link-hover-color: #085A5E;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }

.btn-primary,
.btn-primary:focus {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-darker);
    --bs-btn-active-border-color: var(--primary-darker);
}
.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
}
.alert-info {
    --bs-alert-color: var(--primary-darker);
    --bs-alert-bg: rgba(var(--primary-rgb), 0.1);
    --bs-alert-border-color: rgba(var(--primary-rgb), 0.25);
}
.page-link.active, .active > .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}
.page-link { color: var(--primary); }

.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg) center/cover no-repeat fixed; padding: 24px; position: relative; }
.login-page::before { content: ''; position: fixed; inset: 0; background: rgba(3, 47, 48, 0.58); z-index: 0; }
.login-page .login-card { position: relative; z-index: 1; }
.login-card { display: flex; max-width: 960px; width: 100%; background: var(--card); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); min-height: 520px; }
.login-form-side { flex: 1; padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; position: relative; }
.login-brand-side { flex: 1; background: linear-gradient(180deg, var(--primary-darker) 0%, var(--primary) 55%, var(--primary-light) 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; padding: 40px; text-align: center; }
.login-brand-logo { width: 160px; max-width: 80%; height: auto; object-fit: contain; margin-bottom: 24px; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2)); }
.login-brand-side .brand-icon { width: 88px; height: 88px; border-radius: 20px; background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; margin-bottom: 24px; }
.app-logo, .sidebar-brand-logo { object-fit: contain; }
.sidebar-brand-logo { width: 48px; height: 48px; flex-shrink: 0; }
.top-bar-logo { height: 36px; width: auto; object-fit: contain; }
.month-badge { display: inline-flex; align-items: center; gap: 6px; background: rgba(var(--primary-rgb), 0.1); color: var(--primary); padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; margin-left: 12px; }
.login-form-side h2 { font-size: 1.75rem; margin-bottom: 8px; color: var(--primary-darker); }
.login-form-side .subtitle { color: var(--muted); margin-bottom: 16px; }
.login-back-btn-bottom { width: 100%; margin-top: 14px; text-decoration: none; }
.login-back-btn-bottom:hover { color: var(--text); }
.login-role-hints { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; font-size: 0.85rem; color: var(--muted); }
.login-role-hints span { display: flex; align-items: center; gap: 8px; }
.login-role-hints i { color: var(--primary); width: 16px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; }
.form-control { width: 100%; padding: 12px 16px; border: 1px solid #dee2e6; border-radius: var(--radius); font-size: 1rem; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border: none; border-radius: var(--radius); font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: #e9ecef; color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #212529; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-danger { background: #f8d7da; color: var(--danger); }

.app-wrapper { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--sidebar-bg); color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 1000; transition: transform 0.3s; }
.main-content { flex: 1; margin-left: var(--sidebar-width); min-height: 100vh; }
.sidebar-brand { padding: 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.brand-icon { width: 44px; height: 44px; background: var(--primary); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-brand small { display: block; opacity: 0.75; font-size: 0.72rem; }
.sidebar-user { padding: 20px; display: flex; gap: 14px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.user-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info strong { display: block; font-size: 0.95rem; }
.user-info span { font-size: 0.8rem; opacity: 0.75; display: block; }
.badge-role { display: inline-block !important; background: rgba(var(--primary-rgb), 0.35); color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; margin: 4px 0; }
.alert-info { border-left: 4px solid var(--primary); }

.report-toolbar-card { margin-bottom: 24px; border: 1px solid #dee2e6; }
.report-toolbar-card .card-body { padding: 20px 24px; }
.report-toolbar-header h3 { font-size: 1.05rem; margin: 0 0 4px; color: var(--primary-darker); display: flex; align-items: center; gap: 10px; }
.report-toolbar-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-top: 16px; }
.report-period-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.report-period-label { font-size: 0.85rem; font-weight: 600; color: #64748b; margin-right: 4px; }
.report-field label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.report-field .form-control { min-width: 160px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-bottom: 2px; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: rgba(255,255,255,0.8); border-radius: var(--radius); margin-bottom: 4px; }
.nav-link:hover, .nav-link.active { background: var(--primary); color: #fff; }
.nav-arrow { margin-left: auto; font-size: 0.7rem; transition: transform 0.2s; }
.nav-group.open .nav-arrow { transform: rotate(180deg); }
.nav-submenu { display: none; padding-left: 16px; margin-bottom: 8px; }
.nav-group.open .nav-submenu { display: block; }
.nav-sublink { display: block; padding: 10px 16px; color: rgba(255,255,255,0.65); font-size: 0.9rem; border-radius: 8px; }
.nav-sublink:hover, .nav-sublink.active { color: #fff; background: rgba(var(--primary-rgb), 0.4); }
.sidebar-logout { padding: 16px 20px; color: #ff8a8a; display: flex; align-items: center; gap: 10px; border-top: 1px solid rgba(255,255,255,0.1); margin-top: auto; }

.top-bar { background: var(--card); padding: 14px 28px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 0 rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 100; }
.top-bar-left, .top-bar-right { display: flex; align-items: center; gap: 16px; }
.top-title { font-weight: 600; color: var(--primary-darker); }
.user-pill { background: rgba(var(--primary-rgb), 0.12); color: var(--primary); padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; }
.btn-icon { background: none; border: none; font-size: 1.25rem; cursor: pointer; padding: 8px; }
.page-content { padding: 28px; }

.page-header { margin-bottom: 24px; display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; }
.page-header h1 { font-size: 1.5rem; color: var(--primary-darker); display: flex; align-items: center; gap: 12px; }
.page-header .subtitle { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; border-left: 4px solid var(--primary); }
.stat-card.success { border-color: var(--success); }
.stat-card.warning { border-color: var(--warning); }
.stat-card.danger { border-color: var(--danger); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; background: rgba(var(--primary-rgb), 0.12); color: var(--primary); }
.stat-card.success .stat-icon { background: rgba(25,135,84,0.12); color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(255,193,7,0.2); color: #997404; }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.85rem; }

.dashboard-welcome {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-darker);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
}

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 1100px) { .dashboard-grid { grid-template-columns: 1fr; } }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; border: none; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-header h3 { font-size: 1.1rem; margin: 0; }

.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.search-box { flex: 1; min-width: 200px; position: relative; }
.search-box input { width: 100%; padding: 12px 44px 12px 16px; border: 1px solid #dee2e6; border-radius: var(--radius); }
.search-box i { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.action-btns a, .action-btns button { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; border: none; cursor: pointer; font-size: 0.85rem; }
.action-view { background: rgba(var(--primary-rgb), 0.15); color: var(--primary); }
.action-edit { background: rgba(255,193,7,0.25); color: #997404; }
.action-delete { background: rgba(220,53,69,0.15); color: var(--danger); }
.action-toggle { background: rgba(25,135,84,0.15); color: var(--success); }

.badge-status { padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; }
.badge-active { background: #d1e7dd; color: var(--success); }
.badge-inactive { background: #f8d7da; color: var(--danger); }

.student-cell, .user-cell { display: flex; align-items: center; gap: 12px; }
.avatar-circle, .thumb-40 { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 0.85rem; flex-shrink: 0; overflow: hidden; background: var(--primary); }
.thumb-40 img { width: 100%; height: 100%; object-fit: cover; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(3, 47, 48, 0.45); z-index: 2000; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal-box { background: var(--card); border-radius: 16px; max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 28px; }
.modal-box.modal-lg { max-width: 960px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.chart-container { position: relative; height: 280px; }
.camera-preview { max-width: 200px; border-radius: 8px; margin-top: 8px; }
.low-stock { color: var(--danger); font-weight: 600; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 52px; height: 52px; border-radius: 14px; background: rgba(var(--primary-rgb), 0.12); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.stat-label { display: block; color: var(--muted); font-size: 0.85rem; }
.stat-value { display: block; font-size: 1.5rem; color: var(--primary-darker); }
.badge-master { background: #f0c040; color: #3d2f00; }
.user-pill-master { background: rgba(240, 192, 64, 0.2); color: #7a5d00; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.detail-grid .full-span { grid-column: 1 / -1; }
.detail-label { display: block; color: var(--muted); font-size: 0.85rem; margin-bottom: 4px; }
.table-actions { white-space: nowrap; }
.table-actions form { display: inline-block; }

/* Data tables */
.card .table-responsive { margin: -8px -8px 0; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.card-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef2f3;
}
.card-table-header h3 {
    font-size: 1.05rem;
    margin: 0;
    color: var(--primary-darker);
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-table-header .record-count {
    font-size: 0.85rem;
    color: var(--muted);
    background: rgba(var(--primary-rgb), 0.08);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
}
table.data-table { width: 100% !important; border-collapse: collapse; margin-bottom: 0; }
table.data-table thead th {
    background: var(--primary-darker);
    color: #fff;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 14px 16px;
    border: none;
    white-space: nowrap;
}
table.data-table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #eef2f3;
    font-size: 0.92rem;
}
table.data-table tbody tr:hover { background: rgba(var(--primary-rgb), 0.04); }
table.data-table tbody tr:nth-child(even) { background: #fafcfc; }
table.data-table tbody tr:nth-child(even):hover { background: rgba(var(--primary-rgb), 0.06); }

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    padding: 12px 8px 4px;
    font-size: 0.88rem;
    color: var(--muted);
}
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 12px;
    margin-left: 8px;
}
.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 8px !important;
    margin: 0 2px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

/* Activity log */
.activity-filter-card {
    margin-bottom: 24px;
    border: 1px solid #dee2e6;
}
.activity-filter-card .card-body { padding: 20px 24px; }
.activity-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.activity-filter-header h3 {
    font-size: 1.05rem;
    margin: 0;
    color: var(--primary-darker);
    display: flex;
    align-items: center;
    gap: 10px;
}
.activity-filter-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}
.activity-filter-fields .report-field { flex: 1 1 160px; min-width: 140px; }
.activity-filter-fields .report-field-wide { flex: 2 1 220px; min-width: 200px; }
.activity-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding-bottom: 2px;
}
.activity-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}
.activity-badge-success { background: #d1e7dd; color: #0f5132; }
.activity-badge-secondary { background: #e9ecef; color: #495057; }
.activity-badge-danger { background: #f8d7da; color: #842029; }
.activity-badge-primary { background: rgba(var(--primary-rgb), 0.15); color: var(--primary-darker); }
.activity-badge-warning { background: #fff3cd; color: #664d03; }
.activity-badge-info { background: #cff4fc; color: #055160; }
.activity-module-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}
.activity-user-cell strong { display: block; color: var(--primary-darker); }
.activity-user-cell small { color: var(--muted); font-size: 0.82rem; }
.activity-details-cell { color: #475569; max-width: 320px; word-break: break-word; }
.activity-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}
.activity-empty i {
    font-size: 2.5rem;
    color: rgba(var(--primary-rgb), 0.35);
    margin-bottom: 12px;
    display: block;
}
.activity-empty p { margin: 0; font-size: 0.95rem; }
.stat-card-available .stat-icon { background: rgba(25, 135, 84, 0.15); color: var(--success); }
.stat-card-available .stat-value { color: var(--success); }
.stock-summary-grid { margin-bottom: 24px; }

.account-photo-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.account-photo-preview { width: 88px; height: 88px; font-size: 1.5rem; }
.account-photo-preview img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .login-card { flex-direction: column-reverse; }
    .form-grid { grid-template-columns: 1fr; }
    
    /* Top bar responsive */
    .top-bar { padding: 10px 16px; flex-wrap: wrap; }
    .top-bar-left { flex: 1; min-width: 0; gap: 10px; }
    .top-bar-right { gap: 8px; }
    .top-bar-logo { height: 28px; }
    .top-title { font-size: 0.9rem; }
    .month-badge { font-size: 0.75rem; padding: 4px 8px; margin-left: 8px; }
    .user-pill { font-size: 0.75rem; padding: 4px 8px; }
    .page-actions { display: none; }
    
    /* Page header responsive */
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header h1 { font-size: 1.25rem; }
    
    /* Report toolbar responsive */
    .report-toolbar-fields { flex-direction: column; align-items: stretch; gap: 12px; }
    .report-field { flex: 1 1 100%; }
    .report-field .form-control { min-width: 100%; }
    .report-actions { flex-direction: column; align-items: stretch; }
    .report-actions .btn { width: 100%; justify-content: center; }
    
    /* Table responsive */
    .card { padding: 16px; }
    .card .table-responsive { 
        margin: -16px -16px 0; 
        border-radius: 0 0 var(--radius) var(--radius); 
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table.data-table { min-width: 800px; }
    table.data-table thead th { 
        padding: 10px 12px; 
        font-size: 0.75rem; 
    }
    table.data-table tbody td { 
        padding: 10px 12px; 
        font-size: 0.85rem; 
    }
    
    /* Table actions responsive */
    .table-actions { display: flex; flex-wrap: wrap; gap: 4px; }
    .table-actions .btn { padding: 6px 10px; font-size: 0.75rem; }
    .table-actions form { display: inline-block; }
    
    /* DataTables responsive */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        padding: 8px 4px;
        font-size: 0.8rem;
    }
    .dataTables_wrapper .dataTables_filter { width: 100%; text-align: left; margin-bottom: 8px; }
    .dataTables_wrapper .dataTables_filter input { width: 100%; margin-left: 0; }
    .dataTables_wrapper .dataTables_length { width: 100%; text-align: left; }
    .dataTables_wrapper .dataTables_paginate { 
        display: flex; 
        justify-content: center; 
        flex-wrap: wrap; 
        gap: 4px; 
    }
    
    /* Stats grid responsive */
    .stats-grid { grid-template-columns: 1fr; }
    
    /* Detail grid responsive */
    .detail-grid { grid-template-columns: 1fr; }
    
    /* Page content padding */
    .page-content { padding: 16px; }
    
    /* Card table header responsive */
    .card-table-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .page-header h1 { font-size: 1.1rem; }
    .card { padding: 12px; }
    .card .table-responsive { margin: -12px -12px 0; }
    table.data-table thead th { padding: 8px 10px; font-size: 0.7rem; }
    table.data-table tbody td { padding: 8px 10px; font-size: 0.8rem; }
    
    /* Top bar extra small screens */
    .top-bar { padding: 8px 12px; }
    .top-bar-left { gap: 8px; }
    .top-bar-logo { height: 24px; }
    .top-title { font-size: 0.8rem; }
    .month-badge { font-size: 0.7rem; padding: 3px 6px; margin-left: 6px; }
    .user-pill { font-size: 0.7rem; padding: 3px 6px; }
    .btn-icon { padding: 6px; font-size: 1rem; }
    
    /* Stats grid extra small screens */
    .stats-grid { grid-template-columns: 1fr; }
    
    /* Button responsive */
    .btn { padding: 8px 14px; font-size: 0.85rem; }
    .btn-sm { padding: 6px 10px; font-size: 0.75rem; }
    
    /* Form grid extra small screens */
    .form-grid { grid-template-columns: 1fr; }
    
    /* Dashboard grid extra small screens */
    .dashboard-grid { grid-template-columns: 1fr; }
    
    /* Account page extra small screens */
    .account-photo-row { flex-direction: column; align-items: flex-start; }
    .account-photo-preview { width: 64px; height: 64px; }
    
    /* Login page extra small screens */
    .login-card { min-height: auto; }
    .login-form-side { padding: 32px 24px; }
    .login-brand-side { padding: 32px 24px; }
    .login-brand-logo { width: 120px; }
    
    /* Modal extra small screens */
    .modal-box { padding: 20px; }
    .modal-header { margin-bottom: 16px; }
    
    /* Activity filter extra small screens */
    .activity-filter-fields { flex-direction: column; }
    .activity-filter-fields .report-field { flex: 1 1 100%; }
    
    /* Report toolbar extra small screens */
    .report-toolbar-card .card-body { padding: 16px; }
    .report-actions .btn { padding: 8px 12px; font-size: 0.8rem; }
}
    /* Action buttons on very small screens */
    .table-actions .btn { 
        padding: 5px 8px; 
        font-size: 0.7rem; 
        min-width: 28px; 
        height: 28px;
    }
    
    /* Report toolbar buttons */
    .report-actions .btn { 
        padding: 8px 12px; 
        font-size: 0.8rem; 
    }
    
    /* Form controls */
    .form-control { font-size: 0.9rem; }
}

/* Responsive tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .card { padding: 20px; }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .report-toolbar-fields { flex-wrap: wrap; }
}

/* Medium desktop improvements */
@media (min-width: 1025px) and (max-width: 1366px) {
    .sidebar { width: 240px; }
    .main-content { margin-left: 240px; }
    :root { --sidebar-width: 240px; }
}

/* Large desktop */
@media (min-width: 1367px) {
    .main-content { margin-left: var(--sidebar-width); }
    .sidebar { width: var(--sidebar-width); }
}

/* Print styles */
@media print {
    .sidebar, .top-bar, .page-actions, .report-toolbar-card, .btn {
        display: none !important;
    }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    table.data-table { page-break-inside: auto; }
    table.data-table tr { page-break-inside: avoid; }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .btn { min-height: 44px; min-width: 44px; }
    .btn-sm { min-height: 38px; min-width: 38px; }
    .nav-link { min-height: 44px; }
    .form-control { min-height: 44px; }
    .btn-icon { min-width: 44px; min-height: 44px; }
    
    /* Larger touch targets for mobile */
    .table-actions .btn { 
        min-width: 36px; 
        min-height: 36px; 
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card { border: 2px solid var(--text); }
    .btn { border: 2px solid currentColor; }
    table.data-table thead th { border: 2px solid var(--text); }
    table.data-table tbody td { border: 1px solid var(--text); }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card { border: 2px solid var(--text); }
    .btn { border: 2px solid currentColor; }
    table.data-table thead th { border: 2px solid var(--text); }
    table.data-table tbody td { border: 1px solid var(--text); }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
