/* ═══════════════════════════════════════════════════════════════════
   DESIGN SYSTEM — Centro Preuniversitario
═══════════════════════════════════════════════════════════════════ */
:root {
  --brand:       #4f46e5;
  --brand-dark:  #3730a3;
  --brand-light: #eef2ff;
  --brand-mid:   #c7d2fe;

  --success:    #16a34a;
  --success-bg: #f0fdf4;
  --success-bd: #bbf7d0;

  --warn:    #d97706;
  --warn-bg: #fffbeb;
  --warn-bd: #fde68a;

  --danger:    #dc2626;
  --danger-bg: #fef2f2;
  --danger-bd: #fecaca;

  --info:    #0284c7;
  --info-bg: #f0f9ff;
  --info-bd: #bae6fd;

  --orange:    #ea580c;
  --orange-bg: #fff7ed;
  --orange-bd: #fed7aa;

  --purple:    #7c3aed;
  --purple-bg: #f5f3ff;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --radius-sm: 6px;
  --radius:    9px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.09);
  --shadow:    0 2px 10px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.13);

  --sb-width:    240px;
  --sb-width-sm: 64px;
  --header-h:    56px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-800);
  background: #f1f5f9;
  min-height: 100vh;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR LAYOUT
══════════════════════════════════════════════════════════ */

.sb-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(17,24,39,.45);
  z-index: 29;
  backdrop-filter: blur(2px);
}
body.sb-open .sb-overlay { display: block; }

/* ── Sidebar ── */
.app-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sb-width);
  background: #fff;
  border-right: 1.5px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  z-index: 30;
  transition: width .22s cubic-bezier(.4,0,.2,1), transform .22s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
body.sb-collapsed .app-sidebar { width: var(--sb-width-sm); }

/* Brand */
.sb-brand {
  display: flex; align-items: center; gap: .7rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  min-height: var(--header-h);
  flex-shrink: 0;
}
.sb-brand-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(79,70,229,.3);
}
.sb-brand-icon i { font-size: 1.1rem; color: #fff; }
.sb-brand-text {
  display: flex; flex-direction: column;
  overflow: hidden; white-space: nowrap;
  transition: opacity .15s;
}
.sb-brand-title { font-size: .88rem; font-weight: 800; color: var(--gray-900); }
.sb-brand-sub   { font-size: .63rem; color: var(--gray-400); margin-top: .05rem; }
body.sb-collapsed .sb-brand-text { opacity: 0; pointer-events: none; }

/* Nav */
.sb-nav { padding: .5rem 0; flex: 1; overflow-y: auto; overflow-x: hidden; }
.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 99px; }

.sb-nav-label {
  font-size: .6rem; font-weight: 800; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .07em;
  padding: .55rem 1rem .2rem;
  white-space: nowrap;
  transition: opacity .15s;
}
body.sb-collapsed .sb-nav-label { opacity: 0; }

.sb-nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .58rem 1rem;
  color: var(--gray-600);
  text-decoration: none;
  font-size: .82rem; font-weight: 600;
  border-radius: var(--radius-sm);
  margin: .08rem .5rem;
  transition: background .15s, color .15s;
  white-space: nowrap; overflow: hidden;
  position: relative;
}
.sb-nav-item i { font-size: 1.05rem; flex-shrink: 0; }
.sb-item-text { overflow: hidden; transition: opacity .15s; }
body.sb-collapsed .sb-item-text { opacity: 0; pointer-events: none; }
.sb-nav-item:hover { background: var(--brand-light); color: var(--brand); text-decoration: none; }
.sb-nav-item.active { background: var(--brand-light); color: var(--brand); }
.sb-nav-danger:hover { background: var(--danger-bg) !important; color: var(--danger) !important; }

/* Collapsed tooltips */
body.sb-collapsed .sb-nav-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(var(--sb-width-sm) + .5rem); top: 50%;
  transform: translateY(-50%);
  background: var(--gray-900); color: #fff;
  padding: .3rem .65rem;
  border-radius: var(--radius-sm);
  font-size: .72rem; font-weight: 600;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .15s; z-index: 100;
}
body.sb-collapsed .sb-nav-item:hover::after { opacity: 1; }

.sb-divider { height: 1px; background: var(--gray-100); margin: .2rem 0; }
.sb-spacer  { flex: 1; min-height: 1rem; }

/* User section */
.sb-user {
  display: flex; align-items: center; gap: .6rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--gray-100);
  overflow: hidden; flex-shrink: 0;
}
.sb-user .avatar { flex-shrink: 0; }
.sb-user-info { flex: 1; overflow: hidden; white-space: nowrap; transition: opacity .15s; }
.sb-user-name { font-size: .78rem; font-weight: 700; color: var(--gray-800); }
.sb-user-role { font-size: .66rem; color: var(--gray-400); }
.sb-logout {
  flex-shrink: 0; width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-400); text-decoration: none;
  transition: background .15s, color .15s;
}
.sb-logout:hover { background: var(--danger-bg); color: var(--danger); }
body.sb-collapsed .sb-user-info,
body.sb-collapsed .sb-logout { opacity: 0; pointer-events: none; }

/* ── App Main ── */
.app-main {
  margin-left: var(--sb-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left .22s cubic-bezier(.4,0,.2,1);
}
body.sb-collapsed .app-main { margin-left: var(--sb-width-sm); }

/* ── Header ── */
.app-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky; top: 0; z-index: 20;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}
.header-left  { display: flex; align-items: center; gap: .75rem; }
.header-right { display: flex; align-items: center; gap: .6rem; }

.header-breadcrumb {
  display: flex; align-items: center; gap: .35rem;
  font-size: .73rem; color: var(--gray-400);
}
.header-breadcrumb span { color: var(--gray-700); font-weight: 700; }

.sb-toggle {
  border: none; background: none; cursor: pointer;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500); flex-shrink: 0;
  transition: background .15s, color .15s;
}
.sb-toggle:hover { background: var(--gray-100); color: var(--gray-800); }
.sb-toggle i { font-size: 1.15rem; }

/* ── Content ── */
.app-content { flex: 1; padding: 1.25rem 1.5rem; }

/* ── Footer ── */
.app-footer {
  background: #fff;
  border-top: 1px solid var(--gray-200);
  padding: .55rem 1.5rem;
  text-align: center;
  font-size: .71rem;
  color: var(--gray-400);
  flex-shrink: 0;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: var(--sb-width) !important;
    box-shadow: none;
  }
  body.sb-open .app-sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .app-main { margin-left: 0 !important; }
  .app-content { padding: 1rem; }
}

/* ══════════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════════ */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 1.1rem 1.3rem;
}
.card-sm    { padding: .75rem 1rem; }
.card-flush { padding: 0; overflow: hidden; }

/* ══════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .42rem .9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-300);
  background: #fff; color: var(--gray-700);
  font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: all .15s;
  white-space: nowrap; line-height: 1; font-family: inherit;
}
.btn i { font-size: .9rem; }
.btn:hover:not(:disabled)   { background: var(--gray-50); border-color: var(--gray-400); box-shadow: var(--shadow-xs); }
.btn:active:not(:disabled)  { transform: scale(.98); }
.btn:disabled               { opacity: .4; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: #15803d; border-color: #15803d; }

.btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; border-color: #b91c1c; }

.btn-ghost   { background: transparent; border-color: transparent; color: var(--gray-600); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); border-color: var(--gray-200); }

.btn-light   { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }
.btn-light:hover:not(:disabled) { background: var(--gray-200); }

.btn-sm  { padding: .3rem .65rem;  font-size: .75rem; }
.btn-lg  { padding: .6rem 1.3rem;  font-size: .875rem; }
.btn-xl  { padding: .75rem 1.6rem; font-size: .95rem; }
.btn-icon{ padding: .38rem; aspect-ratio: 1; }
.w-full  { width: 100%; justify-content: center; }

/* ══════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════ */
label {
  font-size: .73rem; font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .03em;
  display: block; margin-bottom: .3rem;
}
input[type=text], input[type=password], input[type=number], input[type=time],
select, textarea {
  width: 100%; padding: .45rem .7rem;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  font-size: .82rem; color: var(--gray-800); background: #fff;
  transition: border-color .15s, box-shadow .15s; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
input:disabled, select:disabled {
  background: var(--gray-50); color: var(--gray-400); cursor: not-allowed;
}
select {
  appearance: none;
  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='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .6rem center;
  padding-right: 2rem;
}

/* ══════════════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .6rem; border-radius: 99px;
  font-size: .7rem; font-weight: 700; white-space: nowrap;
}
.badge i { font-size: .75rem; }
.badge-ok     { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-bd); }
.badge-warn   { background: var(--warn-bg);    color: var(--warn);    border: 1px solid var(--warn-bd); }
.badge-danger { background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-bd); }
.badge-info   { background: var(--info-bg);    color: var(--info);    border: 1px solid var(--info-bd); }
.badge-orange { background: var(--orange-bg);  color: var(--orange);  border: 1px solid var(--orange-bd); }
.badge-purple { background: var(--purple-bg);  color: var(--purple);  border: 1px solid #ddd6fe; }
.badge-gray   { background: var(--gray-100);   color: var(--gray-500);border: 1px solid var(--gray-200); }
.badge-lock   { background: #f5f3ff;           color: var(--purple);  border: 1px solid #ddd6fe; }

/* ══════════════════════════════════════════════════════════
   ALERTS
══════════════════════════════════════════════════════════ */
.alert {
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .75rem 1rem; border-radius: var(--radius);
  font-size: .8rem; font-weight: 500;
}
.alert i { font-size: 1rem; flex-shrink: 0; margin-top: .05rem; }
.alert-danger  { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-bd); }
.alert-warning { background: var(--warn-bg);   color: var(--warn);   border: 1px solid var(--warn-bd); }
.alert-success { background: var(--success-bg);color: var(--success); border: 1px solid var(--success-bd); }
.alert-info    { background: var(--info-bg);   color: var(--info);   border: 1px solid var(--info-bd); }

/* ══════════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════════ */
.tabs { display: flex; border-bottom: 2px solid var(--gray-100); background: #fff; }
.tab-btn {
  flex: 1; padding: .65rem .5rem;
  border: none; border-bottom: 2.5px solid transparent;
  background: transparent; cursor: pointer;
  font-size: .8rem; font-weight: 600; color: var(--gray-400);
  display: flex; align-items: center; justify-content: center; gap: .35rem;
  transition: all .15s; font-family: inherit; margin-bottom: -2px;
}
.tab-btn:hover  { color: var(--gray-700); background: var(--gray-50); }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); background: var(--brand-light); }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-ok     { background: var(--success); }
.dot-warn   { background: var(--warn); }
.dot-danger { background: var(--danger); }
.dot-info   { background: var(--purple); }
.dot-gray   { background: var(--gray-300); }

/* ══════════════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════════════ */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .79rem; }
thead th {
  padding: .55rem .85rem; text-align: left;
  font-size: .7rem; font-weight: 700; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .04em;
  background: var(--gray-50); border-bottom: 2px solid var(--gray-100);
  white-space: nowrap;
}
tbody td { padding: .55rem .85rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
.text-center { text-align: center; }

/* Row states */
.row-danger    { background: var(--danger-bg)  !important; }
.row-danger:hover    { background: #fee2e2 !important; }
.row-warning   { background: var(--warn-bg)    !important; }
.row-warning:hover   { background: #fef3c7 !important; }
.row-locked    { background: var(--purple-bg)  !important; opacity: .85; }
.row-corrected { background: #faf5ff           !important; }
.row-ok        { background: var(--success-bg) !important; }
.row-info      { background: var(--purple-bg)  !important; }
.row-success   { background: var(--success-bg) !important; }
.row-alt       { background: var(--gray-50)    !important; }

/* ══════════════════════════════════════════════════════════
   PROGRESS
══════════════════════════════════════════════════════════ */
.progress-wrap { height: 6px; background: var(--gray-100); border-radius: 99px; overflow: hidden; }
.progress-bar  { height: 100%; border-radius: 99px; transition: width .4s; }
.progress-brand{ background: linear-gradient(90deg, var(--brand), #818cf8); }
.progress-blue { background: linear-gradient(90deg, var(--brand), #818cf8); }
.progress-green{ background: linear-gradient(90deg, var(--success), #4ade80); }

/* ══════════════════════════════════════════════════════════
   PANEL GRID (Validador)
══════════════════════════════════════════════════════════ */
.panel-wrap  { overflow-x: auto; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.panel-table { border-collapse: separate; border-spacing: 0; font-size: .75rem; white-space: nowrap; width: 100%; }
.panel-table th {
  padding: .5rem .7rem; background: var(--brand); color: #fff;
  font-size: .7rem; font-weight: 700; border: 1px solid rgba(255,255,255,.15);
  text-align: center;
}
.panel-table th.th-sec { text-align: left; min-width: 200px; background: var(--brand-dark); position: sticky; left: 0; z-index: 2; }
.panel-table td { border: 1px solid var(--gray-100); padding: .3rem .35rem; }
.panel-table td.td-sec {
  text-align: left; background: var(--gray-50);
  border-right: 2px solid var(--gray-200);
  min-width: 200px; padding: .5rem .75rem;
  position: sticky; left: 0; z-index: 1;
}

.cell-btn {
  width: 100%; padding: .32rem .5rem; border: none;
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  transition: filter .12s, transform .1s; min-width: 56px;
}
.cell-btn:hover  { filter: brightness(.9); transform: scale(1.04); }
.cell-btn:active { transform: scale(.97); }
.cell-ok   { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-bd); }
.cell-parc { background: var(--warn-bg);    color: var(--warn);    border: 1px solid var(--warn-bd); }
.cell-pend { background: var(--gray-100);   color: var(--gray-500);border: 1px solid var(--gray-200); }
.cell-nohor{ background: var(--orange-bg);  color: var(--orange);  border: 1px solid var(--orange-bd); }

/* ══════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(17,24,39,.5); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px;
}
.modal-box {
  background: #fff; border-radius: var(--radius-xl);
  border: 1px solid var(--gray-200); box-shadow: var(--shadow-lg);
  padding: 1.4rem; width: 100%; max-width: 500px;
  max-height: calc(100vh - 80px); overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.1rem;
}
.modal-header h3 { font-size: .95rem; display: flex; align-items: center; gap: .5rem; color: var(--gray-900); }
.modal-close {
  border: none; background: var(--gray-100); color: var(--gray-500);
  border-radius: var(--radius-sm); cursor: pointer; padding: .3rem;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-700); }
.modal-footer {
  display: flex; gap: .6rem; justify-content: flex-end;
  margin-top: 1.2rem; padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
}

/* ══════════════════════════════════════════════════════════
   SUMMARY CARDS (Validador)
══════════════════════════════════════════════════════════ */
.summary-strip { display: flex; gap: .5rem; flex-wrap: wrap; }
.scard {
  padding: .5rem .8rem; border-radius: var(--radius);
  text-align: center; min-width: 64px; flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
}
.scard i       { font-size: 1rem; }
.scard-val     { font-size: 1.15rem; font-weight: 800; line-height: 1; }
.scard-lbl     { font-size: .62rem; font-weight: 700; line-height: 1.2; text-transform: uppercase; letter-spacing: .03em; }

/* ══════════════════════════════════════════════════════════
   AVATAR
══════════════════════════════════════════════════════════ */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 800; flex-shrink: 0;
}
.avatar-indigo { background: var(--brand-light); color: var(--brand); }
.avatar-blue   { background: var(--brand-light); color: var(--brand); }
.avatar-red    { background: var(--danger-bg);   color: var(--danger); }
.avatar-green  { background: var(--success-bg);  color: var(--success); }

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════════════════ */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #eef2ff 0%, #f1f5f9 55%, #f0fdf4 100%);
}
.login-box {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  padding: 2.25rem; width: 100%; max-width: 385px;
}
.login-icon {
  width: 60px; height: 60px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.1rem;
  box-shadow: 0 4px 16px rgba(79,70,229,.38);
}
.login-icon i { font-size: 1.9rem; color: #fff; }
.tab-toggle {
  flex: 1; padding: .6rem; border: none; cursor: pointer;
  font-size: .82rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  transition: all .15s; font-family: inherit;
}

/* ══════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════ */
#toast {
  position: fixed; bottom: 1.75rem; left: 50%; transform: translateX(-50%);
  padding: .7rem 1.4rem; border-radius: 99px;
  font-size: .8rem; font-weight: 700;
  display: flex; align-items: center; gap: .5rem;
  box-shadow: var(--shadow-lg); z-index: 300;
  pointer-events: none; opacity: 0; transition: opacity .25s;
  white-space: nowrap;
}
#toast.show        { opacity: 1; }
#toast.toast-success{ background: var(--success); color: #fff; }
#toast.toast-error  { background: var(--danger);  color: #fff; }

/* ══════════════════════════════════════════════════════════
   ACTION BAR (Validador)
══════════════════════════════════════════════════════════ */
.action-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem;
  padding: .65rem 1rem; border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

/* Ref chips */
.ref-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  background: var(--brand-light); color: var(--brand);
  border: 1px solid var(--brand-mid); border-radius: 99px;
  padding: .12rem .5rem; font-size: .68rem; font-weight: 700;
  white-space: nowrap;
}
.cargado-cell { padding: .4rem .6rem; }
.cargado-main { font-weight: 700; font-size: .82rem; line-height: 1.2; }
.cargado-sub  { font-size: .7rem; color: var(--gray-400); margin-top: .1rem; }

/* Back btn */
.back-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; color: var(--brand); cursor: pointer;
  border: none; background: none; padding: 0;
  margin-bottom: .85rem; font-weight: 700; font-family: inherit;
}
.back-btn:hover { text-decoration: underline; }

.section-title {
  font-size: .88rem; font-weight: 700; color: var(--gray-700);
  display: flex; align-items: center; gap: .4rem;
}
.section-title i { color: var(--brand); font-size: 1rem; }

/* ══════════════════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════════════════ */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.justify-center { justify-content: center; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.flex-1    { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.ml-auto   { margin-left: auto; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-2-bs { margin-top: .5rem; }  /* alias for Bootstrap mt-2 conflict-free */
.p-0    { padding: 0; }
.hidden { display: none !important; }
.text-xs  { font-size: .7rem; }
.text-sm  { font-size: .79rem; }
.text-muted    { color: var(--gray-400); }
.text-secondary{ color: var(--gray-500); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }
.divider{ border: none; border-top: 1px solid var(--gray-100); margin: .75rem 0; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinning { animation: spin 1s linear infinite; }
