/* ============================================================
   MicroFin - Microfinance Management System
   Stylesheet
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #1a365d;
    --primary-light: #2c5282;
    --primary-lighter: #ebf4ff;
    --accent: #38a169;
    --accent-light: #c6f6d5;
    --danger: #e53e3e;
    --danger-light: #fed7d7;
    --warning: #dd6b20;
    --warning-light: #feebc8;
    --info: #3182ce;
    --info-light: #bee3f8;
    --gray-50: #f7fafc;
    --gray-100: #edf2f7;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e0;
    --gray-400: #a0aec0;
    --gray-500: #718096;
    --gray-600: #4a5568;
    --gray-700: #2d3748;
    --gray-800: #1a202c;
    --sidebar-width: 260px;
    --sidebar-collapsed: 60px;
    --topbar-height: 56px;
    --radius: 8px;
    --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);
    --transition: 0.2s ease;
}

html { font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-700);
    line-height: 1.5;
    min-height: 100vh;
}

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

/* ---- Login Screen ---- */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.login-header h1 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--gray-600);
    font-size: 0.875rem;
}

.form-control, input[type="text"], input[type="number"], input[type="email"],
input[type="password"], input[type="date"], input[type="tel"],
select, textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--gray-700);
    background: white;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.15);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

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

.btn-success { background: var(--accent); color: white; }
.btn-success:hover { background: #2f855a; }

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

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

.btn-info { background: var(--info); color: white; }
.btn-info:hover { background: #2b6cb0; }

.btn-outline {
    background: transparent;
    border-color: var(--gray-300);
    color: var(--gray-600);
}
.btn-outline:hover { background: var(--gray-100); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 0.5rem; background: none; border: none; cursor: pointer; font-size: 1.25rem; }

.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---- Toggle Switch ---- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--gray-300);
    border-radius: 24px;
    transition: 0.3s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ---- Communications Settings ---- */
.comm-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.comm-status.enabled { background: var(--accent-light); color: #276749; }
.comm-status.disabled { background: var(--gray-100); color: var(--gray-500); }
.comm-status .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ---- Alerts ---- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #feb2b2; }
.alert-success { background: var(--accent-light); color: #276749; border: 1px solid #9ae6b4; }
.alert-warning { background: var(--warning-light); color: #9c4221; border: 1px solid #fbd38d; }
.alert-info { background: var(--info-light); color: #2a4365; border: 1px solid #90cdf4; }

/* ---- App Layout ---- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: width var(--transition);
}

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

.sidebar-logo { font-size: 1.5rem; }
.sidebar-title { font-size: 1.125rem; font-weight: 700; }

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: var(--accent);
}

.nav-icon { font-size: 1.125rem; width: 1.5rem; text-align: center; }

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

.user-info { display: flex; align-items: center; gap: 0.5rem; }
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.875rem;
}
.user-name { font-size: 0.8125rem; color: rgba(255,255,255,0.8); }

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.top-bar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-800);
}

.top-bar-actions { margin-left: auto; }
.date-display { color: var(--gray-500); font-size: 0.875rem; }

.content-area {
    padding: 1.5rem;
}

/* ---- Cards ---- */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
}

.card-body { padding: 1.25rem; }
.card-footer { padding: 0.75rem 1.25rem; border-top: 1px solid var(--gray-200); background: var(--gray-50); }

/* ---- KPI Cards ---- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.kpi-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.kpi-icon.blue { background: var(--primary-lighter); }
.kpi-icon.green { background: var(--accent-light); }
.kpi-icon.orange { background: var(--warning-light); }
.kpi-icon.red { background: var(--danger-light); }
.kpi-icon.purple { background: #e9d8fd; }

.kpi-info { flex: 1; min-width: 0; }
.kpi-label { font-size: 0.75rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.kpi-value { font-size: 1.5rem; font-weight: 800; color: var(--gray-800); line-height: 1.2; margin-top: 0.25rem; }
.kpi-sub { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.25rem; }

/* ---- Tables ---- */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}

tr:hover td { background: var(--gray-50); }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
small.text-muted { display: block; margin-top: 4px; font-size: 0.8rem; }
.text-success { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'Courier New', monospace; }

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: var(--accent-light); color: #276749; }
.badge-danger { background: var(--danger-light); color: #9b2c2c; }
.badge-warning { background: var(--warning-light); color: #9c4221; }
.badge-info { background: var(--info-light); color: #2a4365; }
.badge-gray { background: var(--gray-200); color: var(--gray-600); }
.badge-primary { background: var(--primary-lighter); color: var(--primary); }

/* ---- Toolbar ---- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.toolbar .search-input {
    max-width: 300px;
}

.toolbar .spacer { flex: 1; }

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1rem;
}

.pagination button {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition);
}

.pagination button:hover:not(:disabled) { background: var(--gray-100); }
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

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

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

.modal-title { font-size: 1.125rem; font-weight: 700; color: var(--gray-800); }

.modal-close {
    background: none; border: none;
    font-size: 1.5rem; cursor: pointer;
    color: var(--gray-400);
    padding: 0.25rem;
    line-height: 1;
}
.modal-close:hover { color: var(--gray-700); }

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

.modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 280px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast-success { background: #276749; color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--info); color: white; }
.toast-warning { background: var(--warning); color: white; }

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

/* ---- Tabs ---- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.25rem;
    gap: 0;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- Grid helpers ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }

/* ---- Detail view ---- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.detail-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.detail-item .value {
    font-size: 0.9375rem;
    color: var(--gray-800);
    font-weight: 500;
}

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-400);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.9375rem; }

/* ---- Loading ---- */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ---- Schedule table highlight ---- */
tr.overdue td { background: #fff5f5; }
tr.paid td { background: #f0fff4; }

/* ---- Charts ---- */
.chart-container {
    position: relative;
    height: 220px;
    width: 100%;
}
.chart-container.chart-lg {
    height: 280px;
}

/* ---- Sidebar Overlay (mobile) ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    html { font-size: 13px; }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        transition: transform 0.25s ease;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    }
    .main-content {
        margin-left: 0;
    }

    /* Top bar */
    .top-bar {
        padding: 0 0.75rem;
        gap: 0.5rem;
    }
    .top-bar-title {
        font-size: 1rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .date-display { display: none; }

    /* Content area */
    .content-area {
        padding: 0.75rem;
    }

    /* Grids collapse */
    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* KPI grid: 2 columns on tablets */
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    .kpi-card {
        padding: 1rem;
        gap: 0.75rem;
    }
    .kpi-icon {
        width: 40px; height: 40px;
        font-size: 1.25rem;
    }
    .kpi-value {
        font-size: 1.2rem;
    }

    /* Tabs: horizontal scroll */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0;
        padding-bottom: 0;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab {
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Toolbar stacks */
    .toolbar {
        gap: 0.5rem;
    }
    .toolbar .search-input {
        max-width: 100%;
        width: 100%;
        order: -1;
    }
    .toolbar .spacer { display: none; }
    .toolbar .btn {
        flex: 0 0 auto;
    }

    /* Tables: better scroll */
    .table-container {
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table {
        min-width: 600px;
    }
    th, td {
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
    }

    /* Cards */
    .card-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .card-body {
        padding: 1rem;
    }

    /* Buttons: larger touch targets */
    .btn {
        padding: 0.625rem 1rem;
        min-height: 40px;
    }
    .btn-sm {
        padding: 0.5rem 0.75rem;
        min-height: 36px;
    }
    .btn-group {
        gap: 0.375rem;
    }
    .btn-group .btn {
        flex: 1 1 auto;
        min-width: 0;
    }

    /* Detail grid */
    .detail-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    /* Nav items: bigger touch targets */
    .nav-item {
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
    }

    /* Charts */
    .chart-container { height: 200px; }
    .chart-container.chart-lg { height: 240px; }

    /* Pagination */
    .pagination button {
        padding: 0.5rem 0.625rem;
        min-height: 36px;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .content-area {
        padding: 0.5rem;
    }

    /* Modal goes nearly full-screen */
    .modal-overlay {
        padding: 0.5rem;
        align-items: flex-end;
    }
    .modal {
        max-height: 95vh;
        border-radius: 12px 12px 0 0;
    }
    .modal.modal-lg {
        max-width: 100%;
    }

    /* Detail grid single column */
    .detail-grid {
        grid-template-columns: 1fr;
    }

    /* Toast full width */
    .toast-container {
        left: 0.5rem;
        right: 0.5rem;
        top: 0.5rem;
    }
    .toast {
        min-width: auto;
        max-width: 100%;
    }

    /* Login card */
    .login-card {
        padding: 1.5rem;
    }

    /* Toolbar buttons wrap */
    .toolbar .btn {
        font-size: 0.8125rem;
    }

    /* Charts smaller */
    .chart-container { height: 180px; }
    .chart-container.chart-lg { height: 220px; }

    /* KPI compact */
    .kpi-card {
        padding: 0.875rem;
    }
    .kpi-value {
        font-size: 1.1rem;
    }
    .kpi-label {
        font-size: 0.6875rem;
    }
}

/* ---- Touch-friendly: ensure minimum 44px targets ---- */
@media (hover: none) and (pointer: coarse) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 40px; }
    .nav-item { min-height: 44px; }
    .tab { min-height: 44px; }
    .pagination button { min-height: 40px; }
    .modal-close { min-width: 44px; min-height: 44px; }
    .sidebar-toggle { min-width: 44px; min-height: 44px; }
}

/* ---- Safe area insets (notched phones) ---- */
@supports (padding: env(safe-area-inset-bottom)) {
    .content-area {
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }
    .top-bar {
        padding-top: env(safe-area-inset-top);
    }
    .sidebar {
        padding-top: env(safe-area-inset-top);
    }
    .sidebar-footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}

/* ---- Print ---- */
@media print {
    .sidebar, .sidebar-overlay, .top-bar, .toolbar, .btn, .pagination { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
