:root{--sidebar:260px;--ink:#172033;--muted:#64748b;--surface:#f5f7fb;--accent:#2457d6}
*{box-sizing:border-box}
html,body{max-width:100%;overflow-x:hidden}
body{margin:0;color:var(--ink);background:var(--surface);font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif}
body.sidebar-open{overflow:hidden}
.app-shell{min-height:100vh;max-width:100%;overflow-x:hidden}
a,button{touch-action:manipulation}
.sidebar{position:fixed;inset:0 auto 0 0;width:var(--sidebar);background:#fff;border-right:1px solid #e8edf4;z-index:1040;overflow-y:auto;overflow-x:hidden}
.sidebar-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.42);z-index:1035;opacity:0;pointer-events:none;transition:.2s ease}
.sidebar-backdrop.show{opacity:1;pointer-events:auto}
.brand{min-height:72px;display:flex;align-items:center;gap:12px;padding:14px 18px}
.brand-mark{width:40px;height:40px;border-radius:12px;background:var(--accent);color:#fff;display:grid;place-items:center;font-weight:800;font-size:1.25rem;flex:0 0 auto}
.brand strong,.brand small{display:block}
.brand small{color:var(--muted);font-size:.72rem}
.nav-section{font-size:.68rem;font-weight:800;letter-spacing:.08em;color:#94a3b8;padding:18px 14px 6px}
.sidebar .nav-link{display:flex;align-items:center;gap:10px;border-radius:10px;color:#334155;padding:10px 12px;margin:2px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sidebar .nav-link:hover,.sidebar .nav-link:focus{background:#f1f5f9;color:#0f172a}
.main-area{margin-left:var(--sidebar);min-height:100vh;display:flex;flex-direction:column;min-width:0}
.topbar{height:64px;background:#fff;border-bottom:1px solid #e8edf4;display:flex;align-items:center;padding:0 22px;position:sticky;top:0;z-index:1020;gap:12px}
.content{padding:28px;flex:1;max-width:100%;overflow-x:hidden}
.footer{padding:18px 28px;color:#64748b;font-size:.78rem}
.tiny{font-size:.7rem}
.page-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:15px;margin-bottom:24px}
.page-heading h1{font-size:1.65rem;margin-bottom:5px;line-height:1.15}
.page-heading p{color:var(--muted);margin:0}
.page-heading .badge{white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}
.metric-card{height:100%;background:#fff;border:1px solid #e8edf4;border-radius:16px;padding:18px;display:flex;align-items:center;gap:14px;min-width:0}
.metric-icon{width:44px;height:44px;border-radius:12px;background:#edf3ff;color:var(--accent);display:grid;place-items:center;font-size:1.15rem;flex:0 0 auto}
.metric-card small,.metric-card strong{display:block}
.metric-card small{color:var(--muted)}
.metric-card strong{font-size:1.3rem;overflow-wrap:anywhere}
.status-row{padding:10px 0;display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.login-page{min-height:100vh;display:grid;place-items:center;background:linear-gradient(145deg,#eef3ff,#f8fafc)}
.login-card{width:min(430px,calc(100% - 30px));background:#fff;border:1px solid #e6ebf2;border-radius:20px;padding:34px;box-shadow:0 24px 70px rgba(30,41,59,.1)}
.permission-card{display:flex;gap:12px;align-items:flex-start;border:1px solid #e7ebf2;border-radius:14px;padding:14px;height:100%;cursor:pointer}
.permission-card:hover{background:#f8fafc}
.permission-card span,.permission-card strong,.permission-card small{display:block}
.permission-card small{color:var(--muted);margin-top:3px}
.table th{white-space:nowrap;font-size:.78rem;color:#667085;text-transform:uppercase;letter-spacing:.02em}
.table td{vertical-align:middle;overflow-wrap:anywhere}
.table td strong{font-weight:650}
.table-responsive{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.update-check{display:flex;justify-content:space-between;gap:1rem;padding:.65rem 0;border-bottom:1px solid #edf0f5}
.update-check:last-of-type{border-bottom:0}
.update-check span{color:#667085}
.update-check strong{text-align:right;overflow-wrap:anywhere}
.card .form-label{font-weight:600;color:#344054}
.card .form-text{color:#667085}
.pagination{gap:2px}
.pagination .page-link{border-radius:8px}
.content .card{border-radius:14px}
.badge.border{border-color:#e3e8ef!important}
.action-group{display:flex;justify-content:flex-end;gap:.45rem;flex-wrap:wrap}
.stack-form-actions [class*='col-'], .stack-form-actions > div{min-width:0}
.stack-form-actions .btn, .stack-form-actions .form-select, .stack-form-actions .form-control{min-height:42px}
.table-mobile-card td .small{display:block}
.table-mobile-card td code{white-space:normal;word-break:break-all}
.academic-summary,.student-directory-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.academic-summary .item,.student-directory-summary .item{background:#fff;border:1px solid #e8edf4;border-radius:14px;padding:14px;min-width:0}
.academic-summary small,.student-directory-summary small,.profile-data-grid small,.group-card small{display:block;color:var(--muted)}
.academic-summary strong,.student-directory-summary strong{font-size:1.05rem;overflow-wrap:anywhere}
.import-feature-list{display:grid;gap:10px;color:#344054}
.import-feature-list>div{padding:9px 12px;background:#f8fafc;border:1px solid #edf1f6;border-radius:10px}
.import-stat{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid #e8edf4;background:#f8fafc;border-radius:12px;padding:12px;min-width:0}
.import-stat small{color:var(--muted)}
.import-stat strong{font-size:1.1rem;overflow-wrap:anywhere}
.text-break{word-break:break-all}
.student-name-cell{display:flex;align-items:center;gap:12px;min-width:0}
.student-avatar{width:38px;height:38px;border-radius:12px;background:#edf3ff;color:var(--accent);display:grid;place-items:center;font-weight:800;flex:0 0 auto}
.student-profile-avatar{width:54px;height:54px;border-radius:16px;background:var(--accent);color:#fff;display:grid;place-items:center;font-size:1.4rem;font-weight:800;flex:0 0 auto}
.profile-data-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 18px}
.profile-data-grid>div{min-width:0}
.profile-data-grid strong{display:block;overflow-wrap:anywhere}
.profile-data-grid .span-2{grid-column:span 2}
.profile-period-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.period-pill{display:flex;align-items:center;justify-content:space-between;text-decoration:none;color:var(--ink);border:1px solid #e5eaf1;border-radius:12px;padding:12px 14px;background:#fff;gap:10px;min-width:0}
.period-pill:hover{background:#f8fafc}
.period-pill.active{border-color:#b9cdfd;background:#edf3ff;color:#163f9e}
.student-course-list{display:grid;gap:14px}
.course-card-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}
.group-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.group-card{border:1px solid #e7ebf2;border-radius:14px;padding:14px;background:#fbfcfe;min-width:0}
.schedule-text{line-height:1.55;overflow-wrap:anywhere}
.course-trace{display:flex;gap:18px;flex-wrap:wrap;color:#667085;font-size:.76rem;border-top:1px solid #eef1f5;padding-top:12px}
.student-table-card .table td{padding-top:13px;padding-bottom:13px}
.mobile-only{display:none!important}
.desktop-only{display:block}

@media(max-width:991.98px){
  .mobile-only{display:block!important}
  .desktop-only{display:none!important}
  .sidebar{transform:translateX(-100%);transition:.2s ease;max-width:86vw}
  .sidebar.open{transform:translateX(0);box-shadow:10px 0 35px rgba(15,23,42,.16)}
  .main-area{margin-left:0}
  .content{padding:20px 14px}
  .footer{padding:16px 14px}
  .topbar{padding:0 14px;height:68px}
  .topbar .btn{min-height:44px}
  .page-heading{flex-direction:column}
  .page-heading .btn,.page-heading .badge{width:100%}
  .page-heading h1{font-size:1.4rem}
  .academic-summary,.student-directory-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
  .group-grid{grid-template-columns:1fr}
  .card-body{padding:1rem!important}
  .action-group{justify-content:stretch}
  .action-group .btn,.action-group form{width:100%}
  .stack-form-actions{display:grid!important;grid-template-columns:1fr;gap:.65rem}
  .stack-form-actions .btn,.stack-form-actions a.btn{width:100%}
  .update-check{align-items:flex-start;flex-direction:column}
  .update-check strong{max-width:100%;word-break:break-word;text-align:left}
  .table-mobile-card thead{display:none}
  .table-mobile-card,.table-mobile-card tbody,.table-mobile-card tr,.table-mobile-card td{display:block;width:100%}
  .table-mobile-card tbody tr{border-bottom:1px solid #e8edf4;padding:14px 14px 10px;background:#fff}
  .table-mobile-card tbody tr:last-child{border-bottom:0}
  .table-mobile-card td{border:0!important;padding:0 0 10px!important;min-height:auto!important}
  .table-mobile-card td::before{content:attr(data-label);display:block;font-size:.72rem;font-weight:700;color:var(--muted);letter-spacing:.02em;text-transform:uppercase;margin-bottom:4px}
  .table-mobile-card td[data-label="Acciones"]::before,.table-mobile-card td[data-label="Acción"]::before,.table-mobile-card td[data-label=""]::before{display:none}
  .table-mobile-card td[data-label="Acciones"],.table-mobile-card td[data-label="Acción"],.table-mobile-card td.action-cell{text-align:left!important;padding-top:2px!important}
  .table-mobile-card td.action-cell .btn,.table-mobile-card td.action-cell form,.table-mobile-card td.action-cell .btn-group{width:100%}
  .table-mobile-card td.action-cell form{display:block}
  .table-mobile-card td.action-cell .btn+.btn,.table-mobile-card td.action-cell form+.form,.table-mobile-card td.action-cell form+.btn{margin-top:.45rem}
  .table-mobile-card td.action-cell .d-inline{display:block!important}
  .table-mobile-card td.action-cell .btn{margin-top:.45rem}
  .mobile-card-list{display:grid;gap:12px}
  .mobile-card{background:#fff;border:1px solid #e8edf4;border-radius:14px;padding:14px;box-shadow:0 .125rem .25rem rgba(15,23,42,.03);min-width:0}
  .mobile-card .title{font-weight:700;margin-bottom:2px;overflow-wrap:anywhere}
  .mobile-card .sub{color:var(--muted);font-size:.85rem;margin-bottom:12px;overflow-wrap:anywhere}
  .mobile-card .meta{display:grid;gap:8px}
  .mobile-card .meta-item small{display:block;color:var(--muted);font-size:.72rem;text-transform:uppercase;letter-spacing:.03em}
  .mobile-card .meta-item div{overflow-wrap:anywhere}
  .mobile-card .actions{margin-top:12px;display:grid;gap:8px}
  .mobile-card .actions .btn,.mobile-card .actions form{width:100%}
}
@media(max-width:575.98px){
  .login-card{padding:24px}
  .metric-card{padding:15px}
  .academic-summary,.student-directory-summary,.profile-data-grid,.profile-period-list{grid-template-columns:1fr}
  .profile-data-grid .span-2{grid-column:auto}
  .student-profile-heading .d-flex.align-items-start{align-items:center!important}
  .student-profile-avatar{width:46px;height:46px;border-radius:14px}
  .course-card-head{display:block}
  .group-card{padding:13px}
  .student-course-card .card-body{padding:18px!important}
  .content select.form-select,.content input.form-control{min-height:42px}
}

/* SISAE 1.7.1 - detalle de importaciones */
.detail-list{display:grid;gap:0;border-top:1px solid #edf1f5}
.detail-row{display:grid;grid-template-columns:minmax(150px,42%) minmax(0,1fr);gap:16px;align-items:start;padding:12px 0;border-bottom:1px solid #edf1f5}
.detail-row>span{color:var(--muted);font-size:.86rem}
.detail-row>strong{font-weight:650;text-align:right;overflow-wrap:anywhere;min-width:0}
@media(max-width:767.98px){
  .detail-row{grid-template-columns:1fr;gap:4px;padding:11px 0}
  .detail-row>strong{text-align:left}
}

/* SISAE 1.8.0 - conciliación avanzada */
.reconciliation-list{display:grid;gap:14px}
.reconciliation-item{border:1px solid #e5eaf1;border-radius:14px;padding:16px;background:#fbfcfe;min-width:0}
.reconciliation-item .form-select{max-width:100%}
@media(max-width:767.98px){
  .reconciliation-item{padding:14px}
  .reconciliation-item .btn{width:100%}
}

/* SISAE 1.8.1 - conciliaciones */
.reconciliation-tabs{display:flex;flex-wrap:wrap}
.reconciliation-tabs .nav-link{display:flex;align-items:center;justify-content:center;gap:.25rem;white-space:nowrap}
@media(max-width:767.98px){
  .reconciliation-tabs{display:grid;grid-template-columns:1fr;gap:.5rem!important}
  .reconciliation-tabs .nav-link{width:100%;justify-content:space-between;padding:.75rem .9rem}
}

/* SISAE 1.11.3 - refresh portal docente */
.teacher-page{display:grid;gap:1.25rem}
.teacher-page-heading{margin-bottom:.25rem}
.teacher-kicker{display:inline-flex;align-items:center;gap:.35rem;padding:.35rem .65rem;border-radius:999px;background:#e8f0ff;color:#214dc0;font-size:.76rem;font-weight:700;margin-bottom:.65rem}
.teacher-panel{background:#fff;border:1px solid #e8edf4;border-radius:20px;padding:1.35rem;box-shadow:0 18px 44px rgba(15,23,42,.05)}
.teacher-panel-sticky{position:sticky;top:86px}
.teacher-panel-head{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;margin-bottom:1rem}
.teacher-panel-head.compact{margin-bottom:1.25rem}
.teacher-panel-head h2{font-size:1.08rem;margin:0 0 .25rem}
.teacher-panel-head p{margin:0;color:var(--muted)}
.teacher-metric-card{height:100%;display:flex;align-items:center;gap:1rem;background:linear-gradient(180deg,#ffffff,#f9fbff);border:1px solid #e8edf4;border-radius:18px;padding:1.1rem 1.15rem;box-shadow:0 10px 30px rgba(15,23,42,.04)}
.teacher-metric-icon{width:52px;height:52px;display:grid;place-items:center;border-radius:16px;background:#edf3ff;color:var(--accent);font-size:1.25rem;flex:0 0 auto}
.teacher-metric-copy span{display:block;color:var(--muted);font-size:.9rem}
.teacher-metric-copy strong{display:block;font-size:1.7rem;line-height:1.1;margin-top:.2rem}
.teacher-group-list,.teacher-import-grid,.teacher-student-grid{display:grid;gap:1rem}
.teacher-group-card,.teacher-import-card,.teacher-student-card{background:linear-gradient(180deg,#fff,#fcfdff);border:1px solid #e6ecf5;border-radius:18px;padding:1.1rem 1.1rem 1rem;box-shadow:0 8px 25px rgba(15,23,42,.04)}
.teacher-group-head,.teacher-student-head{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem}
.teacher-course-title,.teacher-student-name,.teacher-identity-name{font-size:1.05rem;font-weight:800;line-height:1.3;color:#132238;overflow-wrap:anywhere}
.teacher-course-subtitle,.teacher-student-code,.teacher-identity-meta{color:var(--muted);font-size:.9rem;overflow-wrap:anywhere}
.teacher-chip{display:inline-flex;align-items:center;justify-content:center;padding:.42rem .75rem;border-radius:999px;background:#eef2ff;color:#2748b8;font-size:.78rem;font-weight:800;white-space:nowrap;border:1px solid #dce6ff}
.teacher-chip.success{background:#e9f8ef;color:#17794e;border-color:#c8ecd7}
.teacher-stat-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.75rem;margin-top:1rem}
.teacher-stat-grid.compact{grid-template-columns:repeat(2,minmax(0,1fr))}
.teacher-stat-item{padding:.85rem .9rem;border:1px solid #edf1f6;border-radius:14px;background:#f9fbfe;min-width:0}
.teacher-stat-item span{display:block;color:var(--muted);font-size:.78rem;text-transform:uppercase;letter-spacing:.03em;margin-bottom:.18rem}
.teacher-stat-item strong{display:block;font-size:.96rem;line-height:1.35;overflow-wrap:anywhere}
.teacher-group-actions,.teacher-link-grid{display:flex;gap:.75rem;flex-wrap:wrap}
.teacher-group-actions{margin-top:1rem}
.teacher-group-actions .btn,.teacher-link-grid .btn{min-width:0}
.teacher-identity-card{display:flex;align-items:center;gap:.9rem;padding:1rem;border:1px solid #e9edf5;border-radius:18px;background:#f9fbff}
.teacher-identity-avatar,.teacher-student-avatar{width:52px;height:52px;display:grid;place-items:center;border-radius:16px;background:linear-gradient(135deg,#2457d6,#3b82f6);color:#fff;font-weight:800;font-size:1.2rem;flex:0 0 auto}
.teacher-student-avatar{width:46px;height:46px;border-radius:14px;font-size:1rem}
.teacher-data-list{display:grid;gap:.85rem;margin-top:1rem}
.teacher-data-list.compact{margin-top:0}
.teacher-data-row{display:flex;justify-content:space-between;gap:1rem;padding-bottom:.85rem;border-bottom:1px solid #eef2f7;align-items:flex-start}
.teacher-data-row:last-child{border-bottom:0;padding-bottom:0}
.teacher-data-row span{color:var(--muted);font-size:.85rem}
.teacher-data-row strong{font-size:.96rem;text-align:right;overflow-wrap:anywhere}
.teacher-link-grid{display:grid;grid-template-columns:1fr 1fr;margin-top:1.15rem}
.teacher-empty-state{display:grid;place-items:center;text-align:center;padding:2rem 1.5rem;border:1px dashed #d8e1ef;border-radius:20px;background:linear-gradient(180deg,#fbfcff,#f6f9ff)}
.teacher-empty-state.large{padding:3rem 1.75rem}
.teacher-empty-icon{width:58px;height:58px;display:grid;place-items:center;border-radius:18px;background:#edf3ff;color:#2457d6;font-size:1.4rem;font-weight:800;margin-bottom:1rem}
.teacher-empty-state h3{margin:0 0 .45rem;font-size:1.1rem}
.teacher-empty-state p{margin:0;color:var(--muted);max-width:42rem}

@media (min-width:1200px){
  .teacher-group-list,.teacher-import-grid,.teacher-student-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .teacher-group-list>.teacher-empty-state,.teacher-import-grid>.teacher-empty-state,.teacher-student-grid>.teacher-empty-state{grid-column:1/-1}
}
@media(max-width:991.98px){
  .teacher-panel-sticky{position:static}
  .teacher-panel-head{flex-direction:column}
  .teacher-panel-head .btn{width:100%}
  .teacher-link-grid{grid-template-columns:1fr}
}
@media(max-width:767.98px){
  .teacher-group-card,.teacher-import-card,.teacher-student-card,.teacher-panel{padding:1rem}
  .teacher-stat-grid,.teacher-stat-grid.compact{grid-template-columns:1fr}
  .teacher-group-actions,.teacher-link-grid{display:grid;grid-template-columns:1fr}
  .teacher-group-actions .btn,.teacher-link-grid .btn{width:100%}
  .teacher-data-row{display:grid;gap:.2rem}
  .teacher-data-row strong{text-align:left}
  .teacher-group-head,.teacher-student-head{display:grid}
}

/* SISAE 1.11.4 - resolución asistida de grupo */
.group-resolution-list{display:grid;gap:.85rem}
.group-resolution-option{display:flex;gap:.9rem;align-items:flex-start;border:1px solid #e4eaf3;border-radius:16px;padding:1rem;background:#fff;cursor:pointer;transition:.15s ease}
.group-resolution-option:hover{border-color:#b7c9f8;background:#f8fbff}
.group-resolution-option:has(input:checked){border-color:#7da2f5;background:#eef4ff;box-shadow:0 0 0 3px rgba(36,87,214,.08)}
.group-resolution-option .form-check-input{margin-top:.25rem;flex:0 0 auto}
.group-resolution-main{display:grid;gap:.2rem;min-width:0}
.group-resolution-title{font-weight:800;color:#172033}
.group-resolution-type{font-size:.82rem;color:#2457d6;font-weight:700;text-transform:uppercase;letter-spacing:.03em}
.group-resolution-meta{font-size:.87rem;color:#64748b;overflow-wrap:anywhere}
@media(max-width:767.98px){.group-resolution-option{padding:.9rem}.group-resolution-option .form-check-input{width:1.15rem;height:1.15rem}}
