/* =====================================================================
   SIA TecnoCaribe — Estilos institucionales
   Paleta: Azul marino #003366 · Celeste #0099FF · Dorado #FFC000 · Gris #F8F9FA
   ===================================================================== */
:root {
    --inst-navy: #003366;
    --inst-navy-dark: #00264d;
    --inst-navy-light: #0b4a85;
    --inst-sky: #0099FF;
    --inst-gold: #FFC000;
    --inst-gray: #F8F9FA;
    --header-h: 60px;
    --footer-h: 36px;
    --sidebar-w: 262px;
    --bs-primary: #003366;
    --bs-primary-rgb: 0, 51, 102;
    --bs-link-color: #0077cc;
    --bs-link-hover-color: #0099FF;
    --bs-body-bg: #F8F9FA;
    --bs-font-sans-serif: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

body { background: var(--inst-gray); }

/* ---------- Botones y componentes con la paleta ---------- */
.btn-primary { --bs-btn-bg: var(--inst-navy); --bs-btn-border-color: var(--inst-navy); --bs-btn-hover-bg: var(--inst-navy-light);
    --bs-btn-hover-border-color: var(--inst-navy-light); --bs-btn-active-bg: var(--inst-navy-dark); --bs-btn-active-border-color: var(--inst-navy-dark);
    --bs-btn-disabled-bg: #5d7a97; --bs-btn-disabled-border-color: #5d7a97; }
.btn-outline-primary { --bs-btn-color: var(--inst-navy); --bs-btn-border-color: var(--inst-navy); --bs-btn-hover-bg: var(--inst-navy);
    --bs-btn-hover-border-color: var(--inst-navy); --bs-btn-active-bg: var(--inst-navy-dark); }
.btn-sky { --bs-btn-color: #fff; --bs-btn-bg: var(--inst-sky); --bs-btn-border-color: var(--inst-sky); --bs-btn-hover-bg: #0084db;
    --bs-btn-hover-border-color: #0084db; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #0070bb; --bs-btn-active-color: #fff; }
.btn-gold, .btn-edit { --bs-btn-color: #2b2100; --bs-btn-bg: var(--inst-gold); --bs-btn-border-color: var(--inst-gold);
    --bs-btn-hover-bg: #e6ad00; --bs-btn-hover-border-color: #e6ad00; --bs-btn-hover-color: #2b2100; --bs-btn-active-bg: #cc9a00; }
.text-navy { color: var(--inst-navy) !important; }
.text-sky { color: var(--inst-sky) !important; }
.bg-navy { background: var(--inst-navy) !important; color: #fff; }
.bg-gold { background: var(--inst-gold) !important; color: #2b2100; }
.badge-gold { background: var(--inst-gold); color: #2b2100; }
a { color: #0077cc; }
a:hover { color: var(--inst-sky); }
.form-control:focus, .form-select:focus { border-color: var(--inst-sky); box-shadow: 0 0 0 .2rem rgba(0, 153, 255, .2); }
.form-check-input:checked { background-color: var(--inst-navy); border-color: var(--inst-navy); }
.nav-tabs .nav-link.active { color: var(--inst-navy); border-top: 3px solid var(--inst-sky); font-weight: 600; }
.nav-tabs .nav-link { color: #4b5d70; }
.page-link { color: var(--inst-navy); }
.page-item.active .page-link { background: var(--inst-navy); border-color: var(--inst-navy); }
.page-link:hover { color: var(--inst-sky); }
.alert-warning { border-left: 4px solid var(--inst-gold); }
.required::after { content: " *"; color: #d63384; }

/* ---------- Header fijo ---------- */
.app-header { height: var(--header-h); background: var(--inst-navy); border-bottom: 3px solid var(--inst-gold); z-index: 1040; }
.app-badge-sistema { background: rgba(255,255,255,.12); color: #e9f4ff; font-weight: 500; border: 1px solid rgba(255,255,255,.2); }
.app-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--inst-gold); color: var(--inst-navy); display: inline-flex;
    align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.app-rol { font-size: .72rem; color: #b8d4ef; }

/* ---------- Sidebar ---------- */
.app-sidebar, .offcanvas-lg.app-sidebar { background-color: var(--inst-navy-dark) !important; width: var(--sidebar-w); }
@media (min-width: 992px) {
    .app-sidebar { position: fixed; top: var(--header-h); bottom: var(--footer-h); left: 0; overflow-y: auto; }
    .app-main { margin-left: var(--sidebar-w); }
}
.app-sidebar .offcanvas-header { background: var(--inst-navy); }
.app-nav { padding: .75rem .5rem 1.5rem; }
.app-nav-top, .app-nav-group { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .6rem .8rem; border-radius: .5rem;
    color: #dbe8f5; text-decoration: none; background: transparent; border: 0; font-weight: 600; font-size: .92rem; text-align: left; }
.app-nav-top:hover, .app-nav-group:hover { background: rgba(255,255,255,.07); color: #fff; }
.app-nav-top.active { background: var(--inst-sky); color: #fff; }
.app-nav-group .app-chevron { transition: transform .2s; font-size: .75rem; }
.app-nav-group.collapsed .app-chevron { transform: rotate(-90deg); }
.app-nav-section { margin-bottom: .15rem; }
.app-nav-link { display: block; padding: .42rem .8rem .42rem 2.45rem; color: #b8cde2; text-decoration: none; font-size: .87rem;
    border-left: 3px solid transparent; border-radius: 0 .4rem .4rem 0; margin: 1px 0; }
.app-nav-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.app-nav-link.active { color: #fff; border-left-color: var(--inst-sky); background: rgba(0,153,255,.18); font-weight: 600; }
.app-nav-link.destacado { color: var(--inst-gold); font-weight: 600; }
.app-nav-link.destacado.active { color: #fff; }

/* ---------- Contenido y footer fijo ---------- */
.app-main { padding-top: var(--header-h); padding-bottom: calc(var(--footer-h) + 1rem); min-height: 100vh; }
.app-footer { position: fixed; bottom: 0; left: 0; right: 0; height: var(--footer-h); background: #fff; border-top: 1px solid #dee2e6;
    display: flex; align-items: center; justify-content: space-between; padding: 0 1rem; font-size: .78rem; color: #6c757d; z-index: 1030; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.4rem; color: var(--inst-navy); margin: 0; font-weight: 700; }
.page-head .breadcrumb { margin: 0; font-size: .8rem; }
.card { border: 1px solid #e3e8ee; border-radius: .75rem; }
.card-header { background: #fff; border-bottom: 1px solid #e9eef3; font-weight: 600; color: var(--inst-navy); }
.card-accent { border-top: 3px solid var(--inst-sky); }

/* Tablas */
.table-inst thead th { background: var(--inst-navy); color: #fff; font-weight: 600; font-size: .8rem; white-space: nowrap; vertical-align: middle;
    border-color: var(--inst-navy-light); }
.table-inst tbody td { font-size: .86rem; vertical-align: middle; }
.table-inst tfoot td, .table-inst tfoot th { background: #fff8db; font-weight: 700; color: var(--inst-navy); }
.table-inst tbody tr:hover { background: #f1f8ff; }
.table-responsive { border-radius: .5rem; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }

/* KPIs */
.kpi { border: 0; border-radius: .9rem; background: #fff; box-shadow: 0 1px 3px rgba(0,30,60,.08); padding: 1rem 1.1rem; height: 100%;
    border-left: 4px solid var(--inst-sky); }
.kpi.kpi-gold { border-left-color: var(--inst-gold); }
.kpi.kpi-navy { border-left-color: var(--inst-navy); }
.kpi.kpi-danger { border-left-color: #dc3545; }
.kpi-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: #5b6f84; font-weight: 600; }
.kpi-value { font-size: 1.45rem; font-weight: 700; color: var(--inst-navy); line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi-icon { font-size: 1.6rem; color: var(--inst-sky); opacity: .85; }
.total-hoy { background: linear-gradient(120deg, var(--inst-navy), var(--inst-navy-light)); color: #fff; border-radius: 1rem; padding: 1.1rem 1.4rem;
    border-bottom: 4px solid var(--inst-gold); }
.total-hoy .valor { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Barras simples */
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: .6rem; align-items: center; font-size: .82rem; margin-bottom: .45rem; }
.bar-track { background: #eaf2fa; border-radius: 999px; height: 9px; overflow: hidden; }
.bar-fill { background: var(--inst-sky); height: 100%; border-radius: 999px; }

/* Autocompletar */
.ac-wrap { position: relative; }
.ac-list { position: absolute; z-index: 1060; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid #cfd8e3; border-radius: .5rem;
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.12); max-height: 320px; overflow-y: auto; display: none; }
.ac-list.show { display: block; }
.ac-item { padding: .5rem .75rem; cursor: pointer; border-bottom: 1px solid #f0f3f6; font-size: .88rem; }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.active { background: #e8f5ff; }
.ac-item small { color: #6c757d; }
.ac-empty { padding: .6rem .75rem; color: #6c757d; font-size: .85rem; }

/* Selección de estudiante */
.selected-card { border: 1px dashed var(--inst-sky); background: #f3faff; border-radius: .75rem; }

/* Wizard de matrícula */
.wizard-step { border-left: 3px solid #dbe5ef; padding-left: 1rem; margin-bottom: 1.25rem; }
.wizard-step.done { border-left-color: var(--inst-sky); }
.wizard-num { width: 28px; height: 28px; border-radius: 50%; background: var(--inst-navy); color: #fff; display: inline-flex; align-items: center;
    justify-content: center; font-weight: 700; font-size: .85rem; margin-right: .5rem; }

/* Planilla de notas */
.grade-input { width: 4.6rem; text-align: center; font-weight: 600; }
.grade-input.changed { background: #fff6d6; border-color: var(--inst-gold); }
.grade-input.new-grade { background: #eaf7ff; border-color: var(--inst-sky); }
.grade-low { color: #c1121f; }
.badge-promedio { background: var(--inst-gold); color: #2b2100; font-weight: 700; }
.nota-audit { font-size: .7rem; color: #6c757d; display: block; line-height: 1.2; }

/* Login */
.auth-body { min-height: 100vh; background: radial-gradient(circle at top right, var(--inst-navy-light), var(--inst-navy) 45%, var(--inst-navy-dark)); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 480px; border-radius: 1.1rem; overflow: hidden; }
.auth-card.wide { max-width: 640px; }
.auth-brand { background: #fff; padding: 1.75rem 2rem .5rem; text-align: center; border-bottom: 4px solid var(--inst-gold); }
.auth-brand img { max-width: 260px; width: 100%; }

/* Recibo */
.recibo { max-width: 820px; margin: 0 auto; background: #fff; border: 1px solid #dfe5ec; border-radius: .75rem; padding: 1.5rem; }
.recibo-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; border-bottom: 3px solid var(--inst-gold); padding-bottom: .75rem; }
.recibo-num { background: var(--inst-navy); color: #fff; border-radius: .5rem; padding: .5rem .9rem; text-align: right; }
.recibo-num .n { font-size: 1.15rem; font-weight: 700; letter-spacing: .03em; }
.recibo-anulado { position: relative; }
.recibo-anulado::after { content: "ANULADO"; position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg); font-size: 5rem;
    font-weight: 900; color: rgba(220, 53, 69, .18); pointer-events: none; }

/* Impresión */
.print-body { background: #fff; }
.print-toolbar { padding: .5rem 1rem; background: #f1f4f8; display: flex; gap: .5rem; }
.print-page { padding: 1rem 1.25rem; }
.print-header { display: flex; align-items: center; gap: 1rem; border-bottom: 3px solid var(--inst-gold); padding-bottom: .6rem; margin-bottom: .8rem; }
.print-header img { height: 54px; }
.print-inst { font-weight: 700; color: var(--inst-navy); font-size: 1.05rem; }
.print-footer { margin-top: 1rem; font-size: .72rem; color: #6c757d; border-top: 1px solid #dee2e6; padding-top: .4rem; }
.print-table { font-size: .72rem; }
.print-table th { background: var(--inst-navy) !important; color: #fff !important; }

@media print {
    @page { size: auto; margin: 12mm 10mm; }
    .no-print, .app-header, .app-sidebar, .app-footer, .page-head .btn, .btn, form.filters, .pagination, #app-alerts { display: none !important; }
    .app-main { margin: 0 !important; padding: 0 !important; }
    body { background: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .card { border: 0 !important; box-shadow: none !important; }
    .table-inst thead th { background: var(--inst-navy) !important; color: #fff !important; }
    a { color: inherit; text-decoration: none; }
    .recibo { border: 0; }
}

@media (max-width: 575.98px) {
    .page-head h1 { font-size: 1.2rem; }
    .kpi-value { font-size: 1.2rem; }
    .total-hoy .valor { font-size: 1.5rem; }
}
