:root {
    --sidebar-width: 238px;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #e4e8ef;
    --border-strong: #d7dde7;
    --text: #172033;
    --muted: #6b7280;
    --muted-2: #8b95a7;
    --primary: #1f4f9d;
    --primary-strong: #173d7b;
    --primary-soft: #edf4ff;
    --success: #157347;
    --success-soft: #edf9f2;
    --warning: #9a5b12;
    --warning-soft: #fff7e9;
    --danger: #b42318;
    --danger-soft: #fff0ee;
    --shadow: 0 8px 28px rgba(18, 32, 56, 0.06);
    --radius: 16px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* Shell */
.app-shell { min-height: 100vh; }

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    z-index: 20;
    display: flex;
    flex-direction: column;
    padding: 18px 14px 14px;
    background: #fff;
    border-right: 1px solid var(--border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 5px 6px 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid #eef1f5;
}

.brand-mark {
    width: 43px;
    height: 43px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    flex: 0 0 43px;
}

.brand-mark img { width: 37px; height: 37px; object-fit: contain; }

.brand-copy { min-width: 0; display: flex; flex-direction: column; }
.brand-copy strong { font-size: .92rem; line-height: 1.25; color: var(--text); }
.brand-copy span { margin-top: 2px; color: var(--muted); font-size: .72rem; }

.sidebar-section-label {
    padding: 10px 10px 7px;
    color: #9aa3b2;
    font-size: .67rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .09em;
}
.sidebar-section-label-spaced { margin-top: 12px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 11px;
    border-radius: 10px;
    color: #4d586b;
    font-weight: 600;
    transition: .18s ease;
}
.sidebar-link i { width: 20px; text-align: center; font-size: 1rem; color: #7c8798; }
.sidebar-link:hover { background: #f5f7fa; color: var(--text); }
.sidebar-link.active { background: var(--primary-soft); color: var(--primary); }
.sidebar-link.active i { color: var(--primary); }

.sidebar-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 8px 2px;
    border-top: 1px solid #eef1f5;
}

.sidebar-user { min-width: 0; display: flex; align-items: center; gap: 9px; flex: 1; }
.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex: 0 0 35px;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), #3d72c6);
    font-weight: 800;
}
.user-meta { min-width: 0; display: flex; flex-direction: column; }
.user-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.user-meta span { color: var(--muted); font-size: .68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-logout {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #7c8798;
}
.sidebar-logout:hover { background: #f7f1f1; color: var(--danger); }

.app-main { min-height: 100vh; margin-left: var(--sidebar-width); }

.app-topbar {
    height: 66px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--border);
}
.topbar-kicker { color: var(--muted-2); font-size: .67rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.topbar-title { display: block; margin-top: 1px; font-size: .9rem; }
.topbar-role {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    color: #40506a;
    background: #f7f9fc;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 700;
}
.topbar-role i { color: var(--primary); }

.app-content { max-width: 1550px; margin: 0 auto; padding: 30px; }

/* Alerts */
.app-alert {
    display: flex;
    align-items: center;
    gap: 9px;
    border: 0;
    border-radius: 12px;
    box-shadow: none;
}

/* Headings */
.page-header-clean {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}
.page-kicker {
    display: inline-block;
    color: var(--primary);
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .09em;
}
.page-header-clean h1 {
    margin: 4px 0 5px;
    color: var(--text);
    font-size: clamp(1.55rem, 2vw, 1.9rem);
    font-weight: 750;
    line-height: 1.18;
}
.page-header-clean p { margin: 0; color: var(--muted); font-size: .92rem; }

/* Buttons */
.btn-clean { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 10px; font-weight: 650; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn-soft {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: #465268;
    background: #f7f9fc;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-weight: 650;
}
.btn-soft:hover { background: #eef2f7; border-color: var(--border-strong); color: var(--text); }
.btn-open {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 9px;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid #dbe8fb;
    border-radius: 8px;
    font-weight: 700;
}
.btn-open:hover { background: #dfeafb; color: var(--primary-strong); }

/* Cards */
.surface-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.surface-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px;
    border-bottom: 1px solid #edf0f4;
}
.surface-card-header h2 { margin: 3px 0 0; font-size: 1.05rem; font-weight: 750; }
.surface-card-header p { margin: 4px 0 0; color: var(--muted); font-size: .84rem; }
.surface-card-body { padding: 22px; }

/* Dashboard */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 92px;
    padding: 17px 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(18,32,56,.035);
}
.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.05rem;
}
.stat-card > div:last-child { display: flex; flex-direction: column; }
.stat-card span { color: var(--muted); font-size: .75rem; }
.stat-card strong { margin-top: 2px; font-size: 1.35rem; line-height: 1; }
.progress-pill, .count-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
}
.process-steps { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.process-step { position: relative; display: flex; gap: 10px; min-width: 0; }
.process-step:not(:last-child)::after { content: ""; position: absolute; left: 36px; right: -2px; top: 15px; height: 1px; background: #dde3ec; z-index: 0; }
.step-dot {
    position: relative;
    z-index: 1;
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #eef1f5;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px #dce1e9;
    color: #717d90;
    font-size: .72rem;
    font-weight: 800;
}
.process-step.done .step-dot { background: var(--success); color: #fff; box-shadow: 0 0 0 1px #bfe7d1; }
.process-step.next .step-dot { background: var(--primary); color: #fff; box-shadow: 0 0 0 1px #cbdcf7; }
.process-step > div:last-child { min-width: 0; padding-top: 2px; }
.process-step strong { display: block; font-size: .79rem; }
.process-step span { display: block; margin-top: 2px; color: var(--muted); font-size: .7rem; line-height: 1.3; }
.process-step.muted { opacity: .68; }

.quick-actions { display: flex; flex-direction: column; gap: 8px; }
.quick-action {
    display: grid;
    grid-template-columns: 38px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 11px;
    border: 1px solid #edf0f4;
    border-radius: 11px;
    color: var(--text);
    transition: .18s ease;
}
.quick-action:hover { background: #f8fafc; border-color: #dfe5ee; transform: translateY(-1px); }
.quick-action-icon { width: 38px; height: 38px; display: grid; place-items: center; background: #f2f5f9; border-radius: 10px; color: var(--primary); }
.quick-action strong { display: block; font-size: .8rem; }
.quick-action small { display: block; margin-top: 2px; color: var(--muted); font-size: .7rem; }
.quick-action > i { color: #9aa3b2; }

/* Filters & inputs */
.filter-bar { padding: 14px; }
.clean-control {
    min-height: 42px;
    border-color: var(--border-strong);
    border-radius: 10px;
    font-size: .86rem;
}
.clean-control:focus { border-color: #9bb8e6; box-shadow: 0 0 0 .18rem rgba(31,79,157,.10); }
.clean-label { color: #344055; font-size: .78rem; font-weight: 700; }
.input-icon-wrap { position: relative; }
.input-icon-wrap > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); z-index: 3; color: #9aa3b2; pointer-events: none; }
.input-icon-wrap .form-control { padding-left: 38px; }
.optional-text { margin-left: 4px; color: #98a1af; font-size: .67rem; font-weight: 500; }
.required-dot { color: var(--danger); }
.readonly-field { min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px dashed #cfd6e1; border-radius: 10px; background: #fafbfc; color: #5d687a; font-size: .82rem; }
.readonly-field i { color: var(--success); }

/* Tables */
.clean-table thead th {
    padding: 12px 16px;
    color: #788397;
    background: #fafbfc;
    border-bottom: 1px solid var(--border);
    font-size: .69rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .045em;
    white-space: nowrap;
}
.clean-table tbody td {
    padding: 13px 16px;
    border-color: #eef1f5;
    color: #3e4a5d;
    font-size: .81rem;
}
.clean-table tbody tr:hover { background: #fbfcfe; }
.document-cell { display: flex; align-items: center; gap: 11px; min-width: 250px; }
.document-icon { width: 37px; height: 37px; flex: 0 0 37px; display: grid; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.document-cell strong { display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #283447; font-size: .81rem; }
.document-cell small, .date-secondary { display: block; margin-top: 3px; color: #8b95a7; font-size: .69rem; }
.date-primary { display: block; color: #455166; font-weight: 650; }
.page-count { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; background: #f2f4f7; color: #4a5668; font-weight: 750; }
.pagination-wrap { padding: 14px 18px; border-top: 1px solid #eef1f5; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 800;
    white-space: nowrap;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-cargada, .status-procesando, .status-pendiente { background: var(--warning-soft); color: var(--warning); }
.status-preparada, .status-completado { background: var(--success-soft); color: var(--success); }
.status-error { background: var(--danger-soft); color: var(--danger); }

.empty-panel { min-height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; color: var(--muted); }
.empty-panel > span { width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 12px; background: #f2f5f8; color: #8c96a6; font-size: 1.1rem; }
.empty-panel strong { color: #455166; font-size: .87rem; }
.empty-panel p { margin: 4px 0 12px; font-size: .78rem; }
.empty-panel-large { min-height: 220px; }

/* Upload */
.upload-zone {
    min-height: 210px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 26px;
    border: 1.5px dashed #c6d0df;
    border-radius: 14px;
    background: #fbfcfe;
    cursor: pointer;
    text-align: center;
    transition: .18s ease;
}
.upload-zone:hover { border-color: #8facdc; background: #f7faff; }
.upload-zone-error { border-color: #e49b95; background: #fff8f7; }
.upload-icon { width: 50px; height: 50px; display: grid; place-items: center; margin-bottom: 3px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); font-size: 1.35rem; }
.upload-zone strong { font-size: .92rem; color: #32405a; }
.upload-zone > span:not(.upload-icon):not(.upload-button) { color: var(--muted); font-size: .75rem; }
.upload-button { margin-top: 5px; padding: 7px 11px; border: 1px solid var(--border-strong); border-radius: 9px; background: #fff; color: #465268; font-size: .75rem; font-weight: 700; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 26px; padding-top: 20px; border-top: 1px solid #eef1f5; }
.info-side-card { padding: 26px; }
.info-illustration { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); font-size: 1.55rem; }
.info-side-card h2 { margin: 5px 0 9px; font-size: 1.12rem; }
.info-side-card > p { color: var(--muted); line-height: 1.55; }
.info-list { display: grid; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid #eef1f5; }
.info-list > div { display: flex; align-items: center; gap: 8px; color: #536075; font-size: .78rem; }
.info-list i { color: var(--success); }

/* Acta detail */
.acta-title-wrap { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.acta-title-wrap h1 { max-width: 820px; overflow-wrap: anywhere; }
.back-link { width: 36px; height: 36px; margin-top: 3px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: #687386; }
.back-link:hover { color: var(--primary); border-color: #c8d7ec; background: #f8fbff; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.header-actions form { margin: 0; }
.acta-summary-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); }
.summary-item { padding: 18px 20px; border-right: 1px solid #eef1f5; }
.summary-item:last-child { border-right: 0; }
.summary-item span { display: block; color: var(--muted); font-size: .7rem; }
.summary-item strong { display: block; margin-top: 4px; color: #334057; font-size: .82rem; overflow-wrap: anywhere; }
.acta-note { display: flex; gap: 10px; margin: 0 20px 18px; padding: 12px 14px; border-radius: 10px; background: #faf7ef; border: 1px solid #eee5d3; color: #6d6047; }
.acta-note > i { margin-top: 1px; }
.acta-note strong { display: block; font-size: .76rem; }
.acta-note p { margin: 2px 0 0; font-size: .76rem; }
.horizontal-steps { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.horizontal-step { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; }
.horizontal-step:not(:last-child)::after { content: ""; position: absolute; left: 35px; right: -4px; top: 16px; height: 2px; background: #e6eaf0; z-index: 0; }
.horizontal-step > span { position: relative; z-index: 1; width: 33px; height: 33px; flex: 0 0 33px; display: grid; place-items: center; border-radius: 50%; background: #f0f2f6; border: 3px solid #fff; box-shadow: 0 0 0 1px #dfe4ec; color: #737f91; font-size: .71rem; font-weight: 800; }
.horizontal-step.done > span { background: var(--success); color: #fff; box-shadow: 0 0 0 1px #c0e6d2; }
.horizontal-step.current > span { background: var(--primary); color: #fff; box-shadow: 0 0 0 1px #cbdcf7; }
.horizontal-step.future { opacity: .67; }
.horizontal-step strong { display: block; font-size: .78rem; }
.horizontal-step small { display: block; margin-top: 2px; color: var(--muted); font-size: .68rem; }

.pages-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; padding: 18px; }
.page-preview-card { overflow: hidden; border: 1px solid var(--border); border-radius: 13px; background: #fff; }
.page-image-wrap { position: relative; height: 240px; display: block; background: #f2f4f7; overflow: hidden; }
.page-image-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; transition: transform .2s ease; }
.page-image-wrap:hover img { transform: scale(1.015); }
.image-open { position: absolute; right: 10px; bottom: 10px; width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,.92); color: #415069; box-shadow: 0 3px 10px rgba(0,0,0,.08); }
.page-preview-body { padding: 13px 14px 14px; }
.page-preview-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.page-preview-title strong { font-size: .8rem; }
.page-preview-title span { color: var(--muted); font-size: .68rem; }
.page-meta-row { display: flex; align-items: center; justify-content: space-between; margin-top: 5px; color: var(--muted); font-size: .7rem; }
.page-meta-row strong { color: #4b586d; font-size: .7rem; }
.page-secondary-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 11px; color: var(--primary); font-size: .72rem; font-weight: 700; }
.engine-chip, .mono-chip, .role-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; background: #f3f5f8; color: #4c586b; font-size: .7rem; font-weight: 700; }
.mono-chip { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.role-chip { background: var(--primary-soft); color: var(--primary); }
.user-table-cell { display: flex; align-items: center; gap: 9px; }
.user-avatar-sm { width: 30px; height: 30px; flex-basis: 30px; border-radius: 8px; font-size: .72rem; }

/* Login */
.login-page { min-height: 100vh; background: #f4f6f9; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 43%) 1fr; }
.login-brand-panel { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 52px; background: linear-gradient(145deg, #173d7b 0%, #1f4f9d 62%, #376eb7 100%); color: #fff; }
.login-brand-panel::after { content: ""; position: absolute; width: 460px; height: 460px; border-radius: 50%; right: -210px; bottom: -170px; border: 70px solid rgba(255,255,255,.055); }
.login-brand-content { position: relative; z-index: 1; max-width: 430px; margin: auto 0; }
.login-brand-logo { width: 78px; height: 78px; padding: 5px; object-fit: contain; border-radius: 17px; background: rgba(255,255,255,.98); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.login-institution { display: block; margin-top: 24px; font-size: .69rem; font-weight: 800; letter-spacing: .13em; opacity: .78; }
.login-brand-content h1 { margin: 10px 0 12px; max-width: 390px; font-size: clamp(2rem,3vw,3rem); line-height: 1.08; font-weight: 760; }
.login-brand-content p { margin: 0; max-width: 390px; color: rgba(255,255,255,.78); line-height: 1.6; font-size: .9rem; }
.login-brand-footer { position: relative; z-index: 1; color: rgba(255,255,255,.62); font-size: .75rem; }
.login-form-panel { display: grid; place-items: center; padding: 34px; }
.login-form-card { width: 100%; max-width: 410px; }
.login-form-card h2 { margin: 5px 0 5px; font-size: 1.65rem; font-weight: 760; }
.login-subtitle { margin: 0; color: var(--muted); }
.login-mobile-brand { display: none; }

/* Legacy aliases kept for compatibility */
.app-card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.eyebrow { color: var(--primary); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.empty-state { padding: 30px !important; text-align: center; color: var(--muted); }

@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .pages-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .process-steps, .horizontal-steps { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
    .process-step:nth-child(2)::after, .horizontal-step:nth-child(2)::after { display: none; }
}

@media (max-width: 900px) {
    :root { --sidebar-width: 76px; }
    .app-sidebar { padding-left: 10px; padding-right: 10px; }
    .brand-copy, .sidebar-link span, .sidebar-section-label, .user-meta { display: none; }
    .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
    .sidebar-link { justify-content: center; }
    .sidebar-link i { font-size: 1.08rem; }
    .sidebar-footer { justify-content: center; flex-direction: column; }
    .sidebar-user { flex: 0 0 auto; }
    .acta-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .summary-item:nth-child(2) { border-right: 0; }
    .summary-item:nth-child(-n+2) { border-bottom: 1px solid #eef1f5; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand-panel { display: none; }
    .login-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 34px; }
    .login-mobile-brand img { width: 48px; height: 48px; object-fit: contain; border-radius: 10px; border: 1px solid var(--border); }
    .login-mobile-brand div { display: flex; flex-direction: column; }
    .login-mobile-brand strong { font-size: .88rem; }
    .login-mobile-brand span { color: var(--muted); font-size: .7rem; }
}

@media (max-width: 700px) {
    :root { --sidebar-width: 0px; }
    .app-sidebar { position: static; width: auto; height: auto; padding: 10px 14px; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--border); }
    .sidebar-brand { margin: 0 auto 0 0; padding: 0; border: 0; }
    .brand-copy { display: flex; }
    .sidebar-nav { flex-direction: row; }
    .sidebar-link { padding: 9px; }
    .sidebar-link span, .sidebar-footer, .sidebar-section-label { display: none; }
    .app-main { margin-left: 0; }
    .app-topbar { display: none; }
    .app-content { padding: 20px 14px; }
    .page-header-clean { flex-direction: column; align-items: stretch; }
    .page-header-clean > .btn, .header-actions .btn { width: 100%; }
    .header-actions { width: 100%; flex-direction: column; }
    .header-actions form { width: 100%; }
    .header-actions form .btn { width: 100%; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .process-steps, .horizontal-steps { grid-template-columns: 1fr; }
    .process-step::after, .horizontal-step::after { display: none !important; }
    .pages-grid { grid-template-columns: 1fr; padding: 12px; }
    .acta-summary-grid { grid-template-columns: 1fr; }
    .summary-item { border-right: 0; border-bottom: 1px solid #eef1f5; }
    .summary-item:last-child { border-bottom: 0; }
    .login-form-panel { padding: 26px 18px; }
}

@media (max-width: 460px) {
    .stats-grid { grid-template-columns: 1fr; }
    .brand-copy { display: none; }
}

/* =========================================================
   Interfaz académica institucional
   ========================================================= */

:root {
    --academic-navy: #18365f;
    --academic-blue: #245493;
    --academic-line: #dfe4ea;
    --academic-soft: #f7f8fa;
    --academic-text: #1e293b;
    --academic-muted: #667085;
}

/* Login: vuelve a la composición original, con controles actualizados. */
.pagina-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #f1f3f6;
}

.tarjeta-login.login-institucional {
    width: 100%;
    max-width: 430px;
    padding: 34px 36px 36px;
    background: #fff;
    border: 1px solid #dfe3e8;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(27, 44, 72, .08);
}

.encabezado-login {
    margin-bottom: 28px;
    text-align: center;
}

.login-logo {
    width: 98px;
    height: 98px;
    margin: 0 auto 10px;
    display: grid;
    place-items: center;
}

.login-logo .logo-sistema {
    width: 92px;
    height: 92px;
    object-fit: contain;
}

.encabezado-login h1 {
    margin: 8px 0 3px;
    color: #17233a;
    font-size: 1.45rem;
    font-weight: 750;
}

.encabezado-login p {
    margin: 0;
    color: #707a8b;
    font-size: .88rem;
}

.login-label {
    color: #2e3a4f;
    font-size: .79rem;
    font-weight: 700;
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap > i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #8994a5;
    z-index: 2;
}

.login-control {
    min-height: 46px;
    padding-left: 39px;
    border: 1px solid #cfd6df;
    border-radius: 9px;
    font-size: .88rem;
}

.login-control:focus {
    border-color: #7192c1;
    box-shadow: 0 0 0 .18rem rgba(36, 84, 147, .10);
}

.login-submit {
    min-height: 45px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 9px;
    font-weight: 700;
}

/* Navegación más sobria. */
.institutional-sidebar {
    background: #fff;
    border-right-color: #dde2e8;
}

.institutional-brand {
    border-bottom: 0;
    padding-bottom: 14px;
    margin-bottom: 4px;
}

.institutional-nav {
    margin-top: 6px;
}

.institutional-nav .sidebar-link {
    border-radius: 7px;
    padding: 10px 11px;
}

.institutional-nav .sidebar-link.active {
    background: #edf2f8;
    color: var(--academic-navy);
    box-shadow: none;
}

.user-avatar {
    border-radius: 7px;
    background: var(--academic-blue);
}

.institutional-topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid #dde2e8;
}

.institutional-topbar > div:first-child {
    display: flex;
    flex-direction: column;
}

.institutional-topbar strong {
    color: #253247;
    font-size: .86rem;
}

.institutional-topbar span {
    margin-top: 2px;
    color: #7a8493;
    font-size: .7rem;
}

.institutional-role {
    color: #5f6978;
    font-size: .75rem;
    font-weight: 650;
}

.institutional-content {
    max-width: 1500px;
    padding-top: 28px;
}

/* Encabezados y botones. */
.institutional-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.institutional-page-header h1 {
    margin: 0 0 5px;
    color: #1c2738;
    font-size: 1.65rem;
    font-weight: 760;
    letter-spacing: -.02em;
}

.institutional-page-header p {
    margin: 0;
    color: var(--academic-muted);
    font-size: .88rem;
}

.institutional-primary-btn,
.institutional-secondary-btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 7px;
    font-size: .82rem;
    font-weight: 700;
}

.institutional-primary-btn {
    background: var(--academic-blue);
    border-color: var(--academic-blue);
}

.institutional-primary-btn:hover,
.institutional-primary-btn:focus {
    background: #1d467e;
    border-color: #1d467e;
}

.institutional-secondary-btn {
    color: #465268;
    background: #fff;
    border: 1px solid #d7dde5;
}

.institutional-secondary-btn:hover {
    background: #f5f7f9;
    border-color: #cbd2dc;
}

.institutional-back {
    width: 35px;
    height: 35px;
    flex: 0 0 35px;
    display: grid;
    place-items: center;
    color: #5c6879;
    background: #fff;
    border: 1px solid #d9dee5;
    border-radius: 7px;
}

.institutional-back:hover {
    color: var(--academic-blue);
    border-color: #bfcadd;
}

/* Paneles: casi sin efecto de tarjeta. */
.institutional-panel {
    background: #fff;
    border: 1px solid var(--academic-line);
    border-radius: 9px;
    box-shadow: none;
}

.institutional-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 19px;
    border-bottom: 1px solid #e8ebef;
}

.institutional-panel-heading.compact {
    padding-bottom: 13px;
}

.institutional-panel-heading h2,
.form-section-heading h2 {
    margin: 0;
    color: #243044;
    font-size: .98rem;
    font-weight: 750;
}

.institutional-panel-heading p,
.form-section-heading p {
    margin: 4px 0 0;
    color: #7a8493;
    font-size: .76rem;
}

/* Inicio. */
.institutional-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
    align-items: start;
}

.institutional-actions-panel {
    overflow: hidden;
}

.institutional-actions {
    display: flex;
    flex-direction: column;
    padding: 6px 0;
}

.institutional-actions > a {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 9px;
    align-items: center;
    padding: 12px 17px;
    color: #324056;
    border-bottom: 1px solid #edf0f3;
}

.institutional-actions > a:last-child {
    border-bottom: 0;
}

.institutional-actions > a:hover {
    background: #f8f9fb;
}

.institutional-actions > a > i {
    color: var(--academic-blue);
    font-size: 1rem;
}

.institutional-actions strong,
.institutional-actions small {
    display: block;
}

.institutional-actions strong {
    font-size: .8rem;
}

.institutional-actions small {
    margin-top: 2px;
    color: #8992a0;
    font-size: .69rem;
}

.plain-link,
.plain-action {
    color: var(--academic-blue);
    font-size: .76rem;
    font-weight: 700;
}

.plain-link:hover,
.plain-action:hover {
    color: #173f76;
    text-decoration: underline;
}

/* Formularios. */
.institutional-form {
    max-width: 1100px;
}

.form-section-panel {
    padding: 21px;
}

.form-section-heading {
    margin-bottom: 18px;
    padding-bottom: 13px;
    border-bottom: 1px solid #eceff2;
}

.institutional-label {
    margin-bottom: 6px;
    color: #354155;
    font-size: .76rem;
    font-weight: 700;
}

.institutional-control {
    min-height: 42px;
    border: 1px solid #cfd6df;
    border-radius: 7px;
    color: #253247;
    font-size: .84rem;
}

.institutional-control:focus {
    border-color: #7e9bc3;
    box-shadow: 0 0 0 .16rem rgba(36, 84, 147, .10);
}

textarea.institutional-control {
    min-height: 92px;
}

.institutional-upload {
    min-height: 165px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px;
    color: #354155;
    background: #fafbfc;
    border: 1px dashed #bfc8d4;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
}

.institutional-upload:hover {
    background: #f6f8fb;
    border-color: #8da3bf;
}

.institutional-upload > i {
    color: var(--academic-blue);
    font-size: 1.4rem;
}

.institutional-upload strong {
    margin-top: 2px;
    font-size: .86rem;
}

.institutional-upload > span:not(.institutional-upload-button) {
    color: #7c8696;
    font-size: .72rem;
}

.institutional-upload-button {
    margin-top: 5px;
    padding: 6px 10px;
    color: #354155;
    background: #fff;
    border: 1px solid #d1d7df;
    border-radius: 6px;
    font-size: .72rem;
    font-weight: 700;
}

.selected-files {
    margin-top: 14px;
    padding: 13px 15px;
    background: #fafbfc;
    border: 1px solid #e2e6eb;
    border-radius: 7px;
}

.selected-files-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 9px;
    border-bottom: 1px solid #e7eaee;
}

.selected-files-heading strong {
    color: #354155;
    font-size: .78rem;
}

.selected-files-heading span {
    color: #8992a0;
    font-size: .68rem;
}

.selected-files ol {
    max-height: 220px;
    margin: 10px 0 0;
    padding-left: 25px;
    overflow: auto;
}

.selected-files li {
    padding: 3px 0;
    color: #566174;
    font-size: .74rem;
}

.institutional-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 20px;
}

/* Filtros y tablas. */
.filter-panel {
    padding: 15px;
}

.institutional-search {
    position: relative;
}

.institutional-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #8993a2;
    z-index: 2;
}

.institutional-search input {
    padding-left: 36px;
}

.institutional-table thead th {
    padding: 11px 14px;
    color: #667085;
    background: #f8f9fb;
    border-bottom: 1px solid #dfe4ea;
    font-size: .68rem;
    font-weight: 750;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
}

.institutional-table tbody td {
    padding: 12px 14px;
    color: #3e4a5d;
    border-color: #edf0f3;
    font-size: .78rem;
    vertical-align: middle;
}

.institutional-table tbody tr:hover {
    background: #fafbfc;
}

.table-title {
    display: block;
    color: #263247;
    font-size: .79rem;
}

.table-title + small,
.institutional-table td small {
    display: block;
    margin-top: 3px;
    color: #8a93a0;
    font-size: .67rem;
}

.simple-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 7px;
    border-radius: 5px;
    font-size: .68rem;
    font-weight: 750;
}

.simple-status-cargada,
.simple-status-procesando,
.simple-status-pendiente {
    color: #7c561a;
    background: #fff5e6;
}

.simple-status-preparada,
.simple-status-completado {
    color: #17643d;
    background: #edf8f2;
}

.simple-status-error {
    color: #a33832;
    background: #fff0ef;
}

.institutional-empty {
    min-height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 24px;
    color: #7a8493;
    text-align: center;
}

.institutional-empty.large {
    min-height: 190px;
}

.institutional-empty > i {
    margin-bottom: 5px;
    color: #8c98aa;
    font-size: 1.35rem;
}

.institutional-empty strong {
    color: #485568;
    font-size: .8rem;
}

.institutional-empty span {
    font-size: .73rem;
}

/* Detalle de acta. */
.acta-context {
    margin-bottom: 4px;
    color: #6f7989;
    font-size: .74rem;
}

.acta-academic-summary {
    display: grid;
    grid-template-columns: 110px 110px minmax(200px, 1fr) 100px 100px 100px;
}

.acta-academic-summary > div {
    padding: 15px 17px;
    border-right: 1px solid #eceff2;
}

.acta-academic-summary > div:last-child {
    border-right: 0;
}

.acta-academic-summary span,
.acta-academic-summary strong {
    display: block;
}

.acta-academic-summary span {
    color: #7b8492;
    font-size: .67rem;
}

.acta-academic-summary strong {
    margin-top: 4px;
    color: #354155;
    font-size: .78rem;
}

.acta-observation {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 16px 15px;
    padding: 10px 12px;
    color: #625a4d;
    background: #fbf8f2;
    border: 1px solid #eee7dc;
    border-radius: 6px;
    font-size: .74rem;
}

.original-files-list {
    padding: 5px 0;
}

.original-file-row {
    display: grid;
    grid-template-columns: 34px 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: #3c485b;
    border-bottom: 1px solid #edf0f3;
}

.original-file-row:last-child {
    border-bottom: 0;
}

.original-file-row:hover {
    background: #f9fafb;
}

.original-file-number {
    color: #8c95a2;
    font-size: .68rem;
    font-variant-numeric: tabular-nums;
}

.original-file-row > i {
    color: var(--academic-blue);
}

.original-file-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .76rem;
}

.original-file-open {
    color: #738095;
    font-size: .69rem;
}

.pages-total {
    color: #657185;
    font-size: .72rem;
    font-weight: 700;
}

.academic-pages-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
}

.academic-page-card {
    overflow: hidden;
    color: #344055;
    background: #fff;
    border: 1px solid #e0e4e9;
    border-radius: 7px;
}

.academic-page-card:hover {
    border-color: #bdc8d6;
}

.academic-page-image {
    height: 235px;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 6px;
    background: #fafafa;
    border-bottom: 1px solid #e5e8ec;
}

.academic-page-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.academic-page-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 11px;
}

.academic-page-caption strong {
    font-size: .75rem;
}

.academic-page-caption span {
    color: #7c8695;
    font-size: .67rem;
}

@media (max-width: 1200px) {
    .institutional-grid { grid-template-columns: 1fr; }
    .institutional-actions-panel { max-width: none; }
    .academic-pages-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .acta-academic-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .acta-academic-summary > div { border-bottom: 1px solid #eceff2; }
}

@media (max-width: 900px) {
    .academic-pages-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    .institutional-page-header { flex-direction: column; align-items: stretch; }
    .institutional-page-header > .btn,
    .institutional-page-header > form,
    .institutional-page-header > form .btn { width: 100%; }
    .institutional-form { max-width: none; }
    .acta-academic-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .academic-pages-grid { grid-template-columns: 1fr; }
    .selected-files-heading { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 460px) {
    .tarjeta-login.login-institucional { padding: 28px 22px 30px; }
    .acta-academic-summary { grid-template-columns: 1fr; }
}

/* Respuesta visual inmediata durante navegación; no añade dependencias. */
.nav-progress {
    position: fixed;
    z-index: 99999;
    top: 0;
    left: 0;
    width: 0;
    height: 2px;
    opacity: 0;
    background: var(--primary, #1f4f9d);
    pointer-events: none;
    transition: width .2s ease, opacity .15s ease;
}
.nav-progress.is-loading {
    width: 72%;
    opacity: 1;
}


/* Hojas del acta: interfaz compacta, sin exponer detalles técnicos. */
.add-sheets-details {
    position: relative;
    margin-left: auto;
}

.add-sheets-details > summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    color: var(--academic-blue);
    background: #fff;
    border: 1px solid #cfd8e5;
    border-radius: 6px;
    font-size: .73rem;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.add-sheets-details > summary::-webkit-details-marker { display: none; }

.add-sheets-details[open] > summary {
    background: #f7f9fc;
}

.add-sheets-form {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    right: 0;
    width: min(430px, 82vw);
    padding: 14px;
    background: #fff;
    border: 1px solid #dce2e9;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(26, 39, 57, .12);
}

.add-sheets-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}

.add-sheets-actions span {
    color: #778296;
    font-size: .68rem;
}

.academic-page-caption > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.academic-page-caption small {
    color: #8a93a1;
    font-size: .64rem;
}

@media (max-width: 700px) {
    .institutional-panel-heading { align-items: flex-start; }
    .add-sheets-details { margin-left: 0; }
    .add-sheets-form { position: static; width: 100%; margin-top: 8px; box-shadow: none; }
    .add-sheets-actions { align-items: stretch; flex-direction: column; }
}


/* Inicio y cierre de sesión simplificados */
.sidebar-logout-form {
    width: 100%;
}

.sidebar-logout-text {
    width: 100%;
    padding: 10px 11px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #4d586b;
    text-align: left;
    font-weight: 600;
}

.sidebar-logout-text:hover {
    background: #f7f1f1;
    color: var(--danger);
}

.welcome-title {
    margin: 0;
    color: var(--academic-text);
    font-size: clamp(1.65rem, 2.2vw, 2rem);
    font-weight: 750;
    line-height: 1.2;
}
