@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --primary: #001430;
    --primary-container: #002855;
    --on-primary: #ffffff;
    --on-primary-container: #7490c3;
    --primary-fixed: #d6e3ff;
    --primary-fixed-dim: #aac7fd;
    --surface: #faf9fd;
    --surface-container-lowest: #ffffff;
    --surface-container-low: #f4f3f7;
    --surface-container: #eeedf2;
    --surface-container-high: #e9e7ec;
    --surface-container-highest: #e3e2e6;
    --surface-variant: #e3e2e6;
    --on-surface: #1a1c1f;
    --on-surface-variant: #43474f;
    --outline: #747780;
    --outline-variant: #c4c6d0;
    --secondary: #505f76;
    --secondary-container: #d0e1fb;
    --tertiary-container: #422000;
    --on-tertiary-container: #d97705;
    --tertiary-fixed: #ffdcc3;
    --error: #ba1a1a;
    --error-container: #ffdad6;
    --on-error-container: #93000a;
    --inverse-surface: #2f3034;
    --inverse-on-surface: #f1f0f5;
    --shadow-color: rgba(26,28,31,0.04);
    --radius: 8px;
    --radius-lg: 16px;
    --transition: 200ms cubic-bezier(.4,0,.2,1);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--surface);
    color: var(--on-surface);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 256px; position: fixed; left: 0; top: 0; bottom: 0; z-index: 40;
    background: rgba(244,243,247,0.92); backdrop-filter: blur(24px);
    display: flex; flex-direction: column; transition: transform var(--transition);
}
.sidebar-header { padding: 32px 24px 16px; }
.sidebar-brand { font-size: 18px; font-weight: 900; letter-spacing: -0.04em; color: var(--primary-container); text-transform: uppercase; }
.sidebar-version { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; color: var(--on-surface-variant); opacity: 0.6; text-transform: uppercase; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 8px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px; padding: 12px 20px;
    color: rgba(26,28,31,0.7); font-weight: 500; font-size: 14px;
    text-decoration: none; border-radius: var(--radius); transition: all var(--transition);
    border-left: 4px solid transparent; margin-bottom: 2px;
}
.sidebar-nav a:hover { background: var(--surface-container-high); color: var(--on-surface); }
.sidebar-nav a.active {
    border-left-color: var(--primary-container); background: rgba(255,255,255,0.5);
    color: var(--on-surface); font-weight: 700;
}
.sidebar-nav .material-symbols-outlined { font-size: 22px; }
.sidebar-footer { padding: 16px; margin-top: auto; }
.sidebar-footer .btn-export {
    width: 100%; padding: 12px; background: var(--primary-container); color: var(--on-primary);
    border: none; border-radius: 12px; font-weight: 700; font-size: 13px; cursor: pointer;
    transition: all var(--transition); margin-bottom: 16px;
}
.sidebar-footer .btn-export:hover { filter: brightness(1.15); }
.sidebar-footer a {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    color: rgba(26,28,31,0.6); font-size: 13px; text-decoration: none;
    transition: color var(--transition);
}
.sidebar-footer a:hover { color: var(--on-surface); }

.main-content { margin-left: 256px; flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* ===== TOPBAR ===== */
.topbar {
    height: 56px; background: var(--surface-container-highest); display: flex;
    align-items: center; justify-content: space-between; padding: 0 32px;
    position: sticky; top: 0; z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 24px; }
.topbar-title { font-size: 17px; font-weight: 700; color: var(--on-surface); }
.topbar-tabs { display: flex; gap: 0; }
.topbar-tabs a {
    padding: 16px 20px; font-size: 13px; font-weight: 500; color: rgba(26,28,31,0.55);
    text-decoration: none; transition: all var(--transition); border-bottom: 2px solid transparent;
}
.topbar-tabs a:hover { color: var(--on-surface); }
.topbar-tabs a.active { color: var(--primary-container); font-weight: 700; border-bottom-color: var(--primary-container); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-icon {
    padding: 8px; border-radius: 50%; cursor: pointer; color: var(--on-surface-variant);
    transition: background var(--transition); background: none; border: none; font-size: 22px;
}
.topbar-icon:hover { background: var(--surface-container-high); }
.topbar-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--secondary-container); overflow: hidden; }
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ===== PAGE CONTENT ===== */
.page-content { padding: 32px; max-width: 1600px; margin: 0 auto; width: 100%; padding-bottom: 120px; }

/* ===== CARDS ===== */
.card {
    background: var(--surface-container-lowest); border-radius: var(--radius);
    box-shadow: 0 1px 3px var(--shadow-color); padding: 24px;
}
.card-grid { display: grid; gap: 16px; }
.card-grid-4 { grid-template-columns: repeat(4, 1fr); }
.card-grid-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid-2 { grid-template-columns: repeat(2, 1fr); }

/* KPI Cards */
.kpi-card {
    background: var(--surface-container-lowest); padding: 20px 24px; border-radius: var(--radius);
    box-shadow: 0 1px 3px var(--shadow-color); border-left: 4px solid var(--on-primary-container);
}
.kpi-card.amber { border-left-color: #f59e0b; }
.kpi-card.navy { border-left-color: var(--primary); }
.kpi-card.red { border-left-color: var(--error); }
.kpi-label { font-size: 10px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(67,71,79,0.7); margin-bottom: 4px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--on-surface); }
.kpi-badge {
    display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px;
    border-radius: 999px; margin-left: 8px;
}
.kpi-badge.green { background: #ecfdf5; color: #059669; }
.kpi-badge.rose { background: #fff1f2; color: #e11d48; }
.kpi-badge.muted { background: var(--surface-container-low); color: rgba(67,71,79,0.4); }
.kpi-badge.blue { background: var(--primary-fixed); color: var(--primary-container); }

/* Integrador Cards */
.integrador-card {
    background: var(--surface-container-lowest); border-radius: 12px; padding: 24px;
    box-shadow: 0 2px 8px var(--shadow-color); display: flex; gap: 16px;
    transition: all var(--transition); cursor: pointer; position: relative;
}
.integrador-card:hover { box-shadow: 0 4px 16px rgba(26,28,31,0.08); transform: translateY(-1px); }
.integrador-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--secondary-container); overflow: hidden; flex-shrink: 0; display:flex;align-items:center;justify-content:center;font-size:24px;font-weight:700;color:var(--primary-container); }
.integrador-avatar img { width: 100%; height: 100%; object-fit: cover; }
.integrador-info { flex: 1; min-width: 0; }
.integrador-name { font-size: 14px; font-weight: 700; color: var(--on-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.integrador-role { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--primary-fixed); color: var(--primary-container); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.integrador-stats { margin-top: 8px; }
.integrador-stats-label { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(67,71,79,0.6); }
.integrador-stats-val { font-size: 18px; font-weight: 800; color: var(--on-surface); }
.integrador-edit {
    position: absolute; top: 12px; right: 12px; font-size: 10px; font-weight: 700;
    padding: 4px 12px; border-radius: 4px; background: var(--primary-container); color: var(--on-primary);
    border: none; cursor: pointer; text-transform: uppercase; letter-spacing: 0.05em;
}

/* ===== TABLES ===== */
.data-table { width: 100%; text-align: left; border-collapse: collapse; font-size: 13px; }
.data-table thead { background: var(--surface-container-low); }
.data-table thead th {
    padding: 10px 16px; font-size: 10px; font-weight: 900; letter-spacing: 0.1em;
    text-transform: uppercase; color: rgba(67,71,79,0.65); white-space: nowrap;
}
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--surface-container-low); }
.data-table tbody td { padding: 10px 16px; border-bottom: 1px solid rgba(196,198,208,0.15); vertical-align: middle; }
.data-table.navy-header thead { background: var(--primary-container); }
.data-table.navy-header thead th { color: var(--on-primary); }
.data-table.amber-header thead { background: #d97705; }
.data-table.amber-header thead th { color: white; }
.data-table td.bold { font-weight: 700; color: var(--primary); }

/* ===== STATUS PILLS ===== */
.status-pill {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
    font-size: 10px; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap;
}
.status-pill.pendiente { background: #fef3c7; color: #92400e; }
.status-pill.actualizar { background: #e2e8f0; color: #334155; }
.status-pill.espera { background: #dbeafe; color: #1e40af; }
.status-pill.verificar { background: #f3e8ff; color: #6b21a8; }
.status-pill.na { background: var(--surface-container-low); color: rgba(67,71,79,0.5); }
.status-pill.concluido { background: #d1fae5; color: #065f46; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
    font-size: 13px; font-weight: 700; border: none; border-radius: var(--radius);
    cursor: pointer; transition: all var(--transition); text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary-container); color: var(--on-primary); }
.btn-primary:hover { filter: brightness(1.15); box-shadow: 0 4px 12px rgba(0,40,85,0.2); }
.btn-secondary { background: var(--surface-container-highest); color: var(--on-surface); }
.btn-secondary:hover { background: var(--surface-container-high); }
.btn-outline { background: none; border: 1px solid rgba(196,198,208,0.5); color: var(--on-surface); }
.btn-outline:hover { background: var(--surface-container-high); }
.btn-danger { background: none; border: 1px solid var(--error); color: var(--error); }
.btn-danger:hover { background: var(--error-container); }
.btn-sm { padding: 6px 14px; font-size: 11px; }
.btn-icon { padding: 8px; border-radius: 50%; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(67,71,79,0.7); margin-bottom: 6px; }
.form-input, .form-select {
    width: 100%; padding: 10px 12px; background: var(--surface-container-low);
    border: 1px solid transparent; border-radius: var(--radius); font-size: 14px;
    font-weight: 500; color: var(--on-surface); font-family: inherit;
    transition: all var(--transition); outline: none;
}
.form-input:focus, .form-select:focus { background: var(--surface-container-lowest); border-color: var(--primary-container); box-shadow: 0 0 0 2px rgba(0,40,85,0.1); }
.form-input.readonly { pointer-events: none; opacity: 0.8; }
.form-input.error-bg { background: var(--error-container); color: var(--on-error-container); font-weight: 700; }
.form-select { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2343474f' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-grid { display: grid; gap: 16px; }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }

/* ===== SECTION HEADERS ===== */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 10px; border-radius: 4px; background: var(--primary-fixed); color: var(--on-primary-container); }
.section-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--primary); text-transform: uppercase; margin-top: 6px; }
.section-divider { border-left: 4px solid var(--primary-container); padding-left: 12px; }
.section-divider.amber { border-left-color: var(--on-tertiary-container); }

/* ===== EXTERNAL SOURCE BLOCKS ===== */
.source-block { border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px var(--shadow-color); margin-bottom: 16px; border: 1px solid rgba(196,198,208,0.3); }
.source-header { padding: 14px 20px; display: flex; align-items: center; gap: 16px; color: white; }
.source-header.sindo { background: #005c8a; }
.source-header.dad { background: #f28e2c; }
.source-header.socio-1 { background: #0092d1; }
.source-header.socio-2 { background: #f98935; }
.source-header.socio-3 { background: #6366f1; }
.source-header.socio-4 { background: #14b8a6; }
.source-tag { font-size: 11px; font-weight: 700; padding: 3px 10px; background: rgba(255,255,255,0.2); border-radius: 4px; }
.source-address { font-size: 13px; font-weight: 500; flex: 1; }
.source-locality { font-size: 13px; font-weight: 700; margin-left: auto; }
.source-btn-add {
    padding: 4px 16px; font-size: 10px; font-weight: 700; border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1); color: white; border-radius: 4px; cursor: pointer;
    transition: background var(--transition);
}
.source-btn-add:hover { background: rgba(255,255,255,0.25); }

/* ===== FOOTER BAR ===== */
.footer-bar {
    position: fixed; bottom: 0; left: 256px; right: 0; height: 72px; z-index: 30;
    background: rgba(255,255,255,0.92); backdrop-filter: blur(16px);
    border-top: 1px solid rgba(196,198,208,0.2); box-shadow: 0 -4px 24px rgba(0,0,0,0.04);
    display: flex; align-items: center; justify-content: space-between; padding: 0 32px;
}
.footer-progress { display: flex; align-items: center; gap: 24px; }
.footer-progress-label { font-size: 10px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(67,71,79,0.6); }
.footer-progress-bar { width: 160px; height: 6px; background: var(--surface-container-highest); border-radius: 999px; overflow: hidden; }
.footer-progress-fill { height: 100%; background: var(--primary-container); border-radius: 999px; transition: width 0.6s ease; }
.footer-progress-value { font-size: 14px; font-weight: 700; color: var(--primary); }
.footer-modules-label { font-size: 10px; font-weight: 900; text-transform: uppercase; color: rgba(67,71,79,0.6); letter-spacing: 0.08em; }
.footer-modules-value { font-size: 14px; font-weight: 700; }
.footer-divider { width: 1px; height: 32px; background: rgba(196,198,208,0.3); }
.footer-actions { display: flex; gap: 12px; }
.footer-user { display: flex; align-items: center; gap: 12px; border-left: 1px solid rgba(196,198,208,0.3); padding-left: 24px; }
.footer-user-name { font-size: 12px; font-weight: 900; color: var(--primary); text-align: right; }
.footer-user-role { font-size: 10px; font-weight: 700; color: var(--on-tertiary-container); text-transform: uppercase; letter-spacing: 0.1em; }
.footer-user-avatar { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--primary-container); padding: 2px; overflow: hidden; display:flex;align-items:center;justify-content:center;background:var(--secondary-container);font-weight:700;font-size:14px;color:var(--primary-container); }

/* ===== LOGIN ===== */
.login-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 100%); }
.login-card { background: var(--surface-container-lowest); border-radius: 16px; padding: 48px; width: 420px; box-shadow: 0 24px 64px rgba(0,0,0,0.2); }
.login-brand { font-size: 22px; font-weight: 900; color: var(--primary-container); text-align: center; letter-spacing: -0.04em; text-transform: uppercase; }
.login-subtitle { font-size: 12px; color: var(--on-surface-variant); text-align: center; margin-top: 4px; letter-spacing: 0.1em; text-transform: uppercase; }
.login-error { background: var(--error-container); color: var(--on-error-container); padding: 10px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 600; margin-top: 16px; display: none; }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 100; display: none; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: var(--surface-container-lowest); border-radius: 16px; padding: 32px; width: 520px; max-width: 90vw; max-height: 85vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,0.15); }
.modal-title { font-size: 18px; font-weight: 800; color: var(--primary); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ===== TOAST ===== */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius); font-size: 13px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,0.12); transform: translateX(120%); transition: transform 0.3s ease; }
.toast.show { transform: translateX(0); }
.toast.success { background: #065f46; color: white; }
.toast.error { background: var(--error); color: white; }
.toast.info { background: var(--primary-container); color: white; }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 24px; }
.pagination button {
    width: 36px; height: 36px; border: none; border-radius: var(--radius);
    font-weight: 600; font-size: 13px; cursor: pointer; background: none;
    color: var(--on-surface-variant); transition: all var(--transition);
}
.pagination button:hover { background: var(--surface-container-high); }
.pagination button.active { background: var(--primary-container); color: var(--on-primary); }

/* ===== TABS ===== */
.filter-tabs { display: flex; gap: 0; border-bottom: 1px solid rgba(196,198,208,0.2); margin-bottom: 16px; }
.filter-tabs button {
    padding: 12px 24px; font-size: 13px; font-weight: 500; border: none;
    background: none; cursor: pointer; color: var(--on-surface-variant);
    border-bottom: 2px solid transparent; transition: all var(--transition);
}
.filter-tabs button:hover { color: var(--on-surface); }
.filter-tabs button.active { color: var(--primary-container); font-weight: 700; border-bottom-color: var(--primary-container); }

/* ===== SEARCH BAR ===== */
.search-bar { position: relative; }
.search-bar input { padding-left: 40px; width: 100%; }
.search-bar .material-symbols-outlined { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--on-surface-variant); font-size: 20px; }

/* ===== INLINE EDITABLE ===== */
.inline-edit { background: transparent; border: 1px solid transparent; padding: 4px 6px; font-size: 11px; font-family: inherit; color: var(--on-surface); border-radius: 4px; width: 100%; transition: all var(--transition); }
.inline-edit:hover { border-color: rgba(196,198,208,0.4); }
.inline-edit:focus { outline: none; border-color: var(--primary-container); background: var(--surface-container-lowest); }
select.inline-edit { cursor: pointer; appearance: none; padding-right: 20px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24'%3E%3Cpath fill='%2343474f' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 4px center; }

/* ===== MEMORANDUM TABLE (compact columns) ===== */
.data-table.memo-table { table-layout: fixed; }
.data-table.memo-table th:nth-child(1) { width: 22%; } /* Departamento */
.data-table.memo-table th:nth-child(2) { width: 10%; } /* Estatus */
.data-table.memo-table th:nth-child(3) { width: 8%; }  /* No Oficio */
.data-table.memo-table th:nth-child(4) { width: 9%; }  /* Of Fecha */
.data-table.memo-table th:nth-child(5) { width: 8%; }  /* Resp Oficio */
.data-table.memo-table th:nth-child(6) { width: 9%; }  /* Resp Fecha */
.data-table.memo-table th:nth-child(7) { width: 7%; }  /* Caducidad */
.data-table.memo-table th:nth-child(8) { width: 14%; } /* Observaciones */
.data-table.memo-table th:nth-child(9) { width: 6%; }  /* Record */
.data-table.memo-table th:nth-child(10) { width: 7%; } /* Fecha Record */
.data-table.memo-table td { padding: 6px 8px; font-size: 11px; }
.data-table.memo-table .inline-edit { font-size: 10px; padding: 3px 4px; }
.data-table.memo-table select.inline-edit { font-size: 10px; padding: 3px 4px; min-width: 80px; }

/* ===== DELETE BUTTON (inline) ===== */
.btn-delete-row {
    width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(186,26,26,0.3);
    background: none; color: var(--error); cursor: pointer; display: flex;
    align-items: center; justify-content: center; font-size: 14px;
    transition: all var(--transition); padding: 0; flex-shrink: 0;
}
.btn-delete-row:hover { background: var(--error-container); border-color: var(--error); }

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    z-index: 39; backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ===== USERS TABLE ===== */
.user-row-active { opacity: 1; }
.user-row-inactive { opacity: 0.5; }

/* ===== UTILITIES ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.col-span-2 { grid-column: span 2; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }
.space-y-8 > * + * { margin-top: 32px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1400px) {
    .card-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .page-content { padding: 24px; }
}
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); z-index: 50; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .footer-bar { left: 0; padding: 0 16px; }
    .card-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .topbar { padding: 0 16px; }
    .topbar-title { font-size: 14px; }
    .footer-progress { gap: 12px; }
    .footer-progress-bar { width: 100px; }
    .footer-user { padding-left: 12px; }
    .footer-user-name { font-size: 10px; }
    .footer-user-role { font-size: 8px; }
    .footer-actions .btn { padding: 4px 10px; font-size: 10px; }
}
@media (max-width: 768px) {
    .card-grid-4, .card-grid-3, .card-grid-2 { grid-template-columns: 1fr; }
    .form-grid-4, .form-grid-2 { grid-template-columns: 1fr; }
    .page-content { padding: 16px; }
    .topbar { padding: 0 12px; }
    .footer-bar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
    .footer-divider { display: none; }
    .login-card { padding: 32px 24px; width: 90vw; }
    .section-title { font-size: 16px; }
    .source-header { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
    .modal { padding: 24px; width: 95vw; }
    .kpi-value { font-size: 22px; }
    .col-span-2 { grid-column: span 1; }
}
