/* ============================================================
   Dominus — Sistema de diseno
   Scuola Italiana Villa Alemana
   ============================================================ */

:root {
  /* superficies */
  --bg: #f3f6fb;
  --bg-deep: #eef2f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-hover: #f5f8ff;
  --line: #e7ebf3;
  --line-strong: #d5dce9;

  /* texto */
  --text: #0f1729;
  --text-soft: #334155;
  --muted: #6b7891;
  --faint: #94a3b8;

  /* marca */
  --blue: #2563eb;
  --blue-deep: #1d4ed8;
  --blue-light: #7ba5ff;
  --blue-soft: #eef4ff;
  --green: #16a34a;
  --green-soft: #e9f9ef;
  --red: #e11d48;
  --red-soft: #fff1f4;
  --gold: #d97706;
  --gold-soft: #fff7e8;
  --violet: #7c3aed;
  --violet-soft: #f4efff;

  /* sidebar oscuro */
  --nav-bg: #101c33;
  --nav-bg-2: #0a1222;
  --nav-text: rgba(226, 232, 240, 0.78);
  --nav-text-strong: #f8fafc;
  --nav-hover: rgba(255, 255, 255, 0.07);
  --nav-active: rgba(59, 130, 246, 0.18);
  --nav-line: rgba(148, 163, 184, 0.16);

  /* sombras */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 18px 44px rgba(15, 23, 42, 0.12);
  --shadow-blue: 0 8px 20px rgba(37, 99, 235, 0.26);

  /* geometria */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --sidebar-w: 274px;
  --topbar-h: 74px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

button,
input,
select,
textarea { font: inherit; }

button { cursor: pointer; }

a { color: inherit; text-decoration: none; }

h1,
h2,
h3 { letter-spacing: -0.02em; }

::-webkit-scrollbar { width: 10px; height: 10px; }

::-webkit-scrollbar-track { background: transparent; }

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
  border: 3px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* ============================ SIDEBAR ============================ */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(185deg, var(--nav-bg) 0%, var(--nav-bg-2) 100%);
  border-right: 1px solid rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  color: var(--nav-text);
}

.sidebar::before {
  content: "";
  position: absolute;
  top: -120px;
  left: -60px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.22), transparent 68%);
  pointer-events: none;
}

.brand {
  position: relative;
  padding: 18px 18px 12px;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
}

.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.brand-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--nav-text-strong);
  letter-spacing: -0.03em;
}

.brand-subtitle {
  margin-top: 1px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(148, 163, 184, 0.85);
}

.muted { color: var(--muted); }

.school-ribbon {
  position: relative;
  margin: 0 18px 12px;
  height: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 8px;
  overflow: hidden;
  border-radius: 999px;
  opacity: 0.9;
}

.school-ribbon span:nth-child(1) { background: #16a34a; }

.school-ribbon span:nth-child(2) { background: #f8fafc; }

.school-ribbon span:nth-child(3) { background: #e11d48; }

.school-ribbon span:nth-child(4) { background: var(--gold); }

.quick-search {
  position: relative;
  margin: 0 16px 12px;
}

.quick-search i,
.quick-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: rgba(148, 163, 184, 0.9);
}

.quick-search input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--nav-line);
  border-radius: var(--radius-sm);
  padding: 0 12px 0 37px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--nav-text-strong);
  outline: none;
  font-size: 13px;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.quick-search input::placeholder { color: rgba(148, 163, 184, 0.75); }

.quick-search input:focus {
  border-color: rgba(122, 165, 255, 0.7);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.nav-scroll {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 2px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-scroll::-webkit-scrollbar { width: 6px; }

.nav-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border: none;
  border-radius: 999px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item { display: block; }

.nav-group-title {
  padding: 3px 10px 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(148, 163, 184, 0.6);
}

.nav-btn {
  position: relative;
  min-height: 38px;
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 11px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  color: var(--nav-text);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 130ms ease, color 130ms ease;
}

.nav-btn i,
.nav-btn svg {
  width: 18px;
  height: 18px;
  color: rgba(148, 163, 184, 0.9);
  transition: color 130ms ease;
}

.nav-btn:hover {
  background: var(--nav-hover);
  color: var(--nav-text-strong);
}

.nav-btn:hover i,
.nav-btn:hover svg { color: var(--blue-light); }

.nav-btn.active {
  background: var(--nav-active);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(122, 165, 255, 0.22);
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--blue-light);
}

.nav-btn.active i,
.nav-btn.active svg { color: var(--blue-light); }

.nav-submenu {
  margin: 3px 0 6px 21px;
  padding-left: 11px;
  border-left: 1px solid var(--nav-line);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-subbtn {
  min-height: 33px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 550;
  color: rgba(203, 213, 225, 0.72);
  transition: background 130ms ease, color 130ms ease;
}

.nav-subbtn i,
.nav-subbtn svg {
  width: 15px;
  height: 15px;
  color: rgba(148, 163, 184, 0.75);
}

.nav-subbtn:hover {
  background: var(--nav-hover);
  color: var(--nav-text-strong);
}

.nav-subbtn.active {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  font-weight: 700;
}

.nav-subbtn.active i,
.nav-subbtn.active svg { color: var(--blue-light); }

.sidebar-footer {
  position: relative;
  padding: 12px;
  border-top: 1px solid var(--nav-line);
  background: rgba(0, 0, 0, 0.18);
}

.profile-card {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue) 0%, #4f46e5 100%);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.profile-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--nav-text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-role {
  font-size: 11.5px;
  color: rgba(148, 163, 184, 0.9);
}

.logout-link {
  margin-top: 8px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--nav-line);
  font-size: 12.5px;
  font-weight: 650;
  color: rgba(226, 232, 240, 0.8);
  transition: background 130ms ease, color 130ms ease, border-color 130ms ease;
}

.logout-link:hover {
  background: rgba(225, 29, 72, 0.16);
  border-color: rgba(244, 63, 94, 0.4);
  color: #fecdd3;
}

.logout-link i,
.logout-link svg { width: 15px; height: 15px; }

/* ============================ MAIN / TOPBAR ============================ */

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: var(--topbar-h);
  padding: 14px 28px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
}

.menu-toggle i,
.menu-toggle svg { width: 19px; height: 19px; }

.page-kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--blue);
}

.page-title {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.date-chip,
.icon-btn,
.primary-btn,
.soft-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 650;
  transition: transform 130ms ease, box-shadow 130ms ease, border-color 130ms ease, background 130ms ease, color 130ms ease;
}

.date-chip {
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 600;
}

.soft-btn:hover {
  border-color: var(--blue-light);
  color: var(--blue-deep);
  background: var(--blue-soft);
}

.icon-btn {
  position: relative;
  width: 40px;
  min-width: 40px;
  padding: 0;
  color: var(--muted);
}

.icon-btn:hover {
  border-color: var(--blue-light);
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.primary-btn {
  border: none;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow-blue);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.34);
}

.primary-btn:active { transform: translateY(0); }

.full-btn { width: 100%; }

.date-chip i,
.date-chip svg,
.icon-btn i,
.icon-btn svg,
.primary-btn i,
.primary-btn svg,
.soft-btn i,
.soft-btn svg {
  width: 16px;
  height: 16px;
}

.user-chip {
  margin-left: 4px;
  padding-left: 13px;
  border-left: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip .avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.user-chip-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.user-chip-copy span {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.content {
  flex: 1;
  padding: 26px 28px 40px;
  max-width: 1560px;
  width: 100%;
}

.view { display: none; }

.view.active { display: block; }

/* ============================ METRICAS ============================ */

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

.metric {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.metric::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  opacity: 0;
  transition: opacity 160ms ease;
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}

.metric:hover::after { opacity: 1; }

.metric-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.metric-top > span {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.metric small {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: var(--faint);
  font-weight: 550;
}

.metric-icon,
.item-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--blue-soft);
  color: var(--blue);
}

.metric-icon i,
.metric-icon svg,
.item-icon i,
.item-icon svg,
.module-tile > i,
.module-tile > svg {
  width: 19px;
  height: 19px;
}

.metric-icon.blue,
.item-icon.blue { background: var(--blue-soft); color: var(--blue); }

.metric-icon.green,
.item-icon.green { background: var(--green-soft); color: var(--green); }

.metric-icon.red,
.item-icon.red { background: var(--red-soft); color: var(--red); }

.metric-icon.gold,
.item-icon.gold { background: var(--gold-soft); color: var(--gold); }

.metric-icon.violet,
.item-icon.violet { background: var(--violet-soft); color: var(--violet); }

/* chip de tendencia opcional dentro de .metric */
.metric-trend {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--surface-soft);
  color: var(--muted);
}

.metric-trend i,
.metric-trend svg { width: 13px; height: 13px; }

.metric-trend.up { background: var(--green-soft); color: #15803d; }

.metric-trend.down { background: var(--red-soft); color: #be123c; }

/* ============================ LAYOUT GRIDS ============================ */

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.overview-grid.horarios-listado {
  grid-template-columns: minmax(0, 1fr);
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.stack {
  display: grid;
  gap: 16px;
}

.margin-top { margin-top: 20px; }

/* ============================ PANELES ============================ */

.panel,
.module-tile {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.panel.pad { padding: 20px; }

.panel-head {
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(180deg, #fcfdff, var(--surface));
}

.panel h2,
.module-tile h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 750;
}

.panel p,
.module-tile p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

/* ============================ TABLAS ============================ */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 12px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  background: var(--surface-soft);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  white-space: nowrap;
}

tbody tr { transition: background 120ms ease; }

tbody tr:hover { background: var(--surface-hover); }

tbody tr:last-child td { border-bottom: none; }

.empty-cell {
  padding: 34px 18px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

td strong { font-weight: 650; }

td small {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--faint);
}

/* ============================ BADGES ============================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.badge.blue { background: var(--blue-soft); border-color: #dbe7ff; color: #1d4ed8; }

.badge.green { background: var(--green-soft); border-color: #c7f0d7; color: #15803d; }

.badge.red { background: var(--red-soft); border-color: #fecdd6; color: #be123c; }

.badge.gold { background: var(--gold-soft); border-color: #fde8c4; color: #b45309; }

/* ============================ LISTAS ============================ */

.list { display: flex; flex-direction: column; }

.list-item {
  padding: 14px 20px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  transition: background 120ms ease;
}

.list-item:hover { background: var(--surface-hover); }

.list-item:last-child { border-bottom: none; }

.list-item strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
}

.list-item span {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.list-item small {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--faint);
}

.empty-box {
  padding: 34px 20px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

/* ============================ MODULE TILES ============================ */

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

.compact-modules .module-tile { padding: 18px; }

.module-tile {
  position: relative;
  display: block;
  padding: 20px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.module-tile > i,
.module-tile > svg {
  width: 42px;
  height: 42px;
  padding: 11px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
  display: block;
}

.module-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}

.module-tile.blue > i,
.module-tile.blue > svg { background: var(--blue-soft); color: var(--blue); }

.module-tile.red > i,
.module-tile.red > svg { background: var(--red-soft); color: var(--red); }

.module-tile.green > i,
.module-tile.green > svg { background: var(--green-soft); color: var(--green); }

.module-tile.gold > i,
.module-tile.gold > svg { background: var(--gold-soft); color: var(--gold); }

.module-tile.violet > i,
.module-tile.violet > svg { background: var(--violet-soft); color: var(--violet); }

.module-tile.blue:hover { border-color: #bfd4ff; }

.module-tile.red:hover { border-color: #fecdd6; }

.module-tile.green:hover { border-color: #bbe9cd; }

.module-tile.gold:hover { border-color: #fbdda6; }

.action-grid { align-items: start; }

.action-panel { min-height: 100%; }

.section-title {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: center;
}

.section-title > i,
.section-title > svg {
  width: 40px;
  height: 40px;
  padding: 10px;
  border-radius: 11px;
  background: var(--blue-soft);
  color: var(--blue);
}

.section-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
}

.section-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.history-grid .panel { min-height: 250px; }

/* ============================ SUBNAV (pestanas) ============================ */

.subnav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 5px;
  margin-bottom: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.subnav::-webkit-scrollbar { height: 0; }

.subnav-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  transition: background 130ms ease, color 130ms ease, box-shadow 130ms ease;
}

.subnav-link i,
.subnav-link svg {
  width: 16px;
  height: 16px;
  color: var(--faint);
  transition: color 130ms ease;
}

.subnav-link:hover {
  background: var(--surface-soft);
  color: var(--text-soft);
}

.subnav-link:hover i,
.subnav-link:hover svg { color: var(--muted); }

.subnav-link.active {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow-blue);
}

.subnav-link.active i,
.subnav-link.active svg { color: #fff; }

/* ============================ DASHBOARD HERO ============================ */

.hero-band {
  position: relative;
  margin-bottom: 20px;
  padding: 24px 26px;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, #132038 0%, #1b3160 55%, #1d4ed8 130%);
  color: #fff;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-band::before {
  content: "";
  position: absolute;
  top: -140px;
  right: -60px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.3), transparent 65%);
}

.hero-band::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, #16a34a 0 33%, #f8fafc 33% 66%, #e11d48 66% 100%);
  opacity: 0.85;
}

.hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(191, 219, 254, 0.9);
}

.hero-band h2 {
  margin: 7px 0 0;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.hero-band p {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: rgba(226, 232, 240, 0.82);
  max-width: 620px;
}

.hero-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-stat {
  min-width: 118px;
  padding: 12px 15px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(6px);
}

.hero-stat span {
  display: block;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(191, 219, 254, 0.9);
}

.hero-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* ============================ TIMELINE ACTIVIDAD ============================ */

.timeline { padding: 6px 0; }

.timeline-item {
  position: relative;
  padding: 12px 20px 12px 52px;
  transition: background 120ms ease;
}

.timeline-item:hover { background: var(--surface-hover); }

.timeline-item::before {
  content: "";
  position: absolute;
  left: 26px;
  top: 34px;
  bottom: -12px;
  width: 1px;
  background: var(--line);
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
  position: absolute;
  left: 15px;
  top: 14px;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.timeline-dot i,
.timeline-dot svg { width: 12px; height: 12px; }

.timeline-dot.red { background: var(--red-soft); color: var(--red); }

.timeline-dot.green { background: var(--green-soft); color: var(--green); }

.timeline-dot.gold { background: var(--gold-soft); color: var(--gold); }

.timeline-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-head strong { font-size: 13.5px; font-weight: 700; }

.timeline-time {
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.timeline-item p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* ==================== MODULOS ESPECIFICOS ==================== */

.submodule-section {
  display: none;
}

.submodule-section.active {
  display: block;
}

.submodule-section.active.metric-grid,
.submodule-section.active.stat-row,
.submodule-section.active.module-grid,
.submodule-section.active.three-col,
.submodule-section.active.two-col,
.submodule-section.active.overview-grid,
.submodule-section.active.stack {
  display: grid;
}

.inspectoria-action {
  margin-bottom: 20px;
}

.matricula-console {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(47, 158, 68, 0.12), rgba(199, 146, 43, 0.12), rgba(227, 27, 47, 0.08)),
    var(--surface);
  box-shadow: var(--shadow);
}

.matricula-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 14px;
}

.matricula-title h2 {
  margin: 0;
  font-size: 23px;
}

.matricula-title p {
  margin: 4px 0 0;
  color: var(--muted);
}

.compact-stats {
  margin-top: 0;
}

.enrollment-table th,
.enrollment-table td {
  white-space: nowrap;
}

.enrollment-table td:nth-child(3) {
  min-width: 250px;
  white-space: normal;
}

.status-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.status-dot i,
.status-dot svg {
  width: 14px;
  height: 14px;
}

.status-dot.ok {
  background: var(--green-soft);
  border-color: #b8e6c5;
  color: var(--green);
}

.status-dot.warn {
  background: var(--gold-soft);
  border-color: #f1d99c;
  color: #9a640f;
}

.student-record-section.active {
  display: grid;
  gap: 18px;
}

.student-record-panel {
  overflow: hidden;
  border-top: 4px solid transparent;
  border-image: linear-gradient(90deg, var(--green) 0 31%, var(--gold) 31% 38%, var(--red) 38% 69%, var(--blue) 69% 100%) 1;
}

.student-record-head {
  min-height: 94px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.record-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.record-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #cfe0f8;
}

.record-mark i,
.record-mark svg {
  width: 23px;
  height: 23px;
}

.record-eyebrow {
  margin: 0 0 3px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.record-heading h2,
.record-section-title h3 {
  margin: 0;
}

.record-heading h2 {
  font-size: 22px;
}

.record-heading > div > p:last-child,
.record-section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.record-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.enrollment-context {
  padding: 16px 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) minmax(220px, 1.15fr);
  gap: 12px;
  align-items: end;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.context-status {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-left: 1px solid var(--line);
}

.context-status strong,
.context-status small {
  display: block;
}

.context-status strong {
  font-size: 13px;
}

.context-status small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.student-record-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  align-items: stretch;
}

.student-photo-column {
  padding: 24px;
  background: var(--surface-soft);
  border-right: 1px solid var(--line);
}

.student-photo-frame {
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
}

.student-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.student-photo-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--blue);
  background:
    linear-gradient(135deg, rgba(47, 111, 183, 0.08), rgba(47, 158, 68, 0.08)),
    #fff;
  font-size: 42px;
  font-weight: 900;
}

.photo-field {
  margin-top: 14px;
}

.upload-photo-btn {
  width: 100%;
  justify-content: center;
}

.photo-field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.student-record-id {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.student-record-id span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.student-record-id strong {
  font-variant-numeric: tabular-nums;
}

.student-record-fields {
  min-width: 0;
}

.record-section {
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.record-section:last-child {
  border-bottom: 0;
}

.record-section-title {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 16px;
}

.record-section-title > i,
.record-section-title > svg {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--blue);
}

.record-section-title h3 {
  font-size: 16px;
}

.record-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-span-2 {
  grid-column: span 2;
}

.student-record-footer {
  min-height: 74px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.student-record-footer > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.student-record-footer > span i,
.student-record-footer > span svg {
  width: 17px;
  height: 17px;
  color: var(--green);
}

.recent-enrollments {
  margin-top: 0;
}

.mail-admin-shell.active {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.mail-profile-panel {
  position: sticky;
  top: 96px;
}

.mail-profile-list {
  display: grid;
}

.mail-profile-row {
  min-width: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto 18px;
  gap: 11px;
  align-items: center;
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.mail-profile-row:hover {
  background: var(--surface-soft);
}

.mail-profile-row.active {
  background: var(--blue-soft);
  box-shadow: inset 4px 0 0 var(--blue);
}

.mail-profile-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.mail-profile-icon i,
.mail-profile-icon svg {
  width: 19px;
  height: 19px;
}

.mail-profile-icon.active {
  color: var(--green);
  background: var(--green-soft);
  border-color: #b8e6c5;
}

.mail-profile-icon.inactive {
  color: #9a640f;
  background: var(--gold-soft);
  border-color: #f1d99c;
}

.mail-profile-copy {
  min-width: 0;
}

.mail-profile-copy strong,
.mail-profile-copy small,
.mail-profile-copy em {
  display: block;
}

.mail-profile-copy strong {
  font-size: 14px;
}

.mail-profile-copy small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-profile-copy em {
  margin-top: 4px;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.mail-profile-copy em.ok {
  color: var(--green);
}

.mail-profile-copy em.error {
  color: var(--red);
}

.mail-profile-state {
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.mail-profile-state.active {
  color: #167234;
  background: var(--green-soft);
}

.mail-profile-state.inactive {
  color: #8a5b09;
  background: var(--gold-soft);
}

.mail-profile-chevron {
  width: 16px;
  height: 16px;
  color: #94a3b8;
}

.mail-profile-summary {
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
}

.mail-profile-summary strong {
  color: var(--text);
}

.mail-detail-stack {
  min-width: 0;
  display: grid;
  gap: 20px;
}

.mail-config-panel {
  border-top: 4px solid var(--blue);
}

.mail-config-head {
  min-height: 90px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.mail-config-head h2,
.mail-section-title h3,
.mail-history-head h2 {
  margin: 0;
}

.mail-config-form {
  display: grid;
}

.mail-form-section {
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.mail-section-title {
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.mail-section-title > i,
.mail-section-title > svg {
  width: 19px;
  height: 19px;
  margin-top: 2px;
  color: var(--blue);
}

.mail-section-title h3 {
  font-size: 15px;
}

.mail-section-title p {
  margin: 3px 0 0;
}

.mail-config-footer {
  min-height: 70px;
  padding: 14px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--surface-soft);
}

.mail-test-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
}

.mail-test-compose,
.mail-test-history {
  min-width: 0;
  padding: 20px;
}

.mail-test-compose {
  border-right: 1px solid var(--line);
}

.mail-history-head {
  min-height: 40px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mail-history-head h2 {
  font-size: 18px;
}

.mail-history-head span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.mail-sender-readonly {
  min-height: 54px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}

.mail-sender-readonly > i,
.mail-sender-readonly > svg {
  width: 20px;
  height: 20px;
  color: var(--green);
}

.mail-sender-readonly strong,
.mail-sender-readonly small {
  display: block;
}

.mail-sender-readonly strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.mail-sender-readonly small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.filters {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px) minmax(140px, 180px) auto;
  gap: 10px;
  align-items: end;
}

.filters.enrollment-filters {
  grid-template-columns: 1fr 1fr 1fr 1fr minmax(220px, 1.2fr) auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid.two-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0 13px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

.field input::placeholder,
.field textarea::placeholder { color: var(--faint); }

.field input:hover,
.field select:hover,
.field textarea:hover { border-color: #b9c5da; }

.field select[multiple] {
  min-height: 160px;
  padding: 8px;
}

.field input[type="file"] {
  padding: 9px 12px;
}

.field textarea {
  min-height: 92px;
  padding: 11px 12px;
  resize: vertical;
}

.check-row {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 800;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.full {
  grid-column: 1 / -1;
  width: 100%;
}

.inline-form {
  display: inline;
}

.mini-btn {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 0 10px;
  font-weight: 800;
  color: #334155;
}

.mini-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.mini-btn.blue {
  border-color: #b8d4f5;
  color: #174d8b;
  background: var(--blue-soft);
}

.mini-btn.green {
  border-color: #b9e6c6;
  color: #167234;
  background: var(--green-soft);
}

.mini-btn.red {
  border-color: #fecdd3;
  color: #b42331;
  background: var(--red-soft);
}

.mini-btn.gold {
  border-color: #f6d78d;
  color: #8a5b09;
  background: var(--gold-soft);
}

.action-strip,
.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.inline-editor {
  min-width: 330px;
  display: grid;
  grid-template-columns: 150px minmax(140px, 1fr) auto;
  gap: 7px;
  align-items: center;
}

.inline-editor input,
.inline-editor select {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 8px;
  background: #fff;
}

.inline-editor.compact {
  grid-template-columns: minmax(140px, 1fr) auto;
}

.panel-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.stat-row {
    display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.submodule-section:not(.active) {
    display: none;
}

.stat-pill {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 13px;
}

.stat-pill strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.stat-pill span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 9px;
  color: #174d8b;
  background: var(--blue-soft);
  font-weight: 850;
  font-size: 12px;
}

.attachment-link i,
.attachment-link svg {
  width: 15px;
  height: 15px;
}

.detail-text {
  max-width: 460px;
  color: var(--muted);
  line-height: 1.4;
}

.table-actions {
  min-width: 190px;
}

.soft-line {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f8fafc 0%, #edf4ff 100%);
}

.login-shell {
  width: min(100%, 440px);
}

.login-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.install-card {
  width: min(100%, 520px);
}

.login-brand {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
}

.login-brand img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.login-brand h1 {
  margin: 0;
  font-size: 23px;
}

.login-brand p {
  margin: 3px 0 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
}

.login-form input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  outline: none;
}

.login-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 183, 0.14);
}

.full-btn {
  width: 100%;
}

.link-btn {
  margin-top: 14px;
}

.alert {
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-weight: 650;
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  box-shadow: var(--shadow-xs);
}

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
  display: grid;
  width: min(380px, calc(100vw - 32px));
  gap: 10px;
  pointer-events: none;
}

.app-toast {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 30px;
  align-items: start;
  gap: 10px;
  padding: 13px 12px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.18);
  pointer-events: auto;
  animation: toast-in 180ms ease-out both;
}

.app-toast.success { border-left-color: var(--green); }
.app-toast.error { border-left-color: var(--red); }

.app-toast-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
}

.app-toast.success .app-toast-icon { background: var(--green-soft); color: var(--green); }
.app-toast.error .app-toast-icon { background: var(--red-soft); color: var(--red); }
.app-toast-icon svg { width: 17px; height: 17px; }

.app-toast-copy { min-width: 0; }
.app-toast-copy strong { display: block; margin-bottom: 2px; font-size: 13px; }
.app-toast-copy span { display: block; color: var(--text-soft); font-size: 12.5px; line-height: 1.4; }

.app-toast-close {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.app-toast-close:hover { background: var(--surface-soft); color: var(--text); }
.app-toast-close:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.app-toast-close svg { width: 16px; height: 16px; }
.app-toast.is-leaving { animation: toast-out 160ms ease-in both; }

@keyframes toast-in {
  from { opacity: 0; transform: translate3d(16px, 8px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translate3d(0, 0, 0); }
  to { opacity: 0; transform: translate3d(12px, 0, 0); }
}

@media (max-width: 640px) {
  .toast-stack { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .app-toast,
  .app-toast.is-leaving { animation: none; }
}

/* ---- Login dividido (Dominus) ---- */

.login-body-split {
  display: block;
  background: var(--bg);
  padding: 0;
}

.login-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 560px) 1fr;
}

.login-visual {
  position: relative;
  overflow: hidden;
  background: #0f2f4d;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 56px 40px;
}

.login-visual-mesh {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(720px 480px at -10% -10%, rgba(47, 158, 68, 0.35), transparent 60%),
    radial-gradient(640px 520px at 110% 15%, rgba(199, 146, 43, 0.30), transparent 55%),
    radial-gradient(760px 640px at 50% 120%, rgba(227, 27, 47, 0.28), transparent 55%);
}

.login-visual-texture {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0px, rgba(255, 255, 255, 0.05) 1px, transparent 1px, transparent 26px);
}

.login-visual-brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-visual-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-visual-logo img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.login-visual-name {
  color: #fff;
  font-weight: 900;
  font-size: 19px;
  letter-spacing: 0.2px;
}

.login-visual-tag {
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  font-weight: 700;
  margin-top: 2px;
}

.login-visual-copy {
  position: relative;
  max-width: 400px;
}

.login-visual-ribbon {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
}

.login-visual-ribbon span {
  width: 26px;
  height: 5px;
  border-radius: 3px;
  display: block;
}

.login-visual-ribbon span:nth-child(1) { background: var(--green); }

.login-visual-ribbon span:nth-child(2) { background: #fff; }

.login-visual-ribbon span:nth-child(3) { background: var(--red); }

.login-visual-ribbon span:nth-child(4) { background: var(--gold); }

.login-visual-copy h1 {
  margin: 0 0 14px;
  color: #fff;
  font-size: 32px;
  line-height: 1.25;
  font-weight: 800;
}

.login-visual-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  line-height: 1.6;
}

.login-visual-footer {
  position: relative;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  font-weight: 600;
}

.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg);
}

.login-form-wrap {
  width: 100%;
  max-width: 400px;
}

.login-form-head {
  margin-bottom: 32px;
}

.login-form-kicker {
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.login-form-head h2 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 900;
}

.login-form-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.login-form-side .login-form input {
  height: 46px;
}

.login-help {
  margin: 10px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

@media (max-width: 860px) {.login-split {
    grid-template-columns: 1fr;
  }

.login-visual {
    padding: 32px 28px;
    min-height: 260px;
  }

.login-visual-copy h1 {
    font-size: 24px;
  }
}

.login-form .alert {
  margin-bottom: 0;
}

.alert.error {
  background: var(--red-soft);
  color: #b42331;
  border: 1px solid #fecdd3;
}

.alert.success {
  background: var(--green-soft);
  color: #167234;
  border: 1px solid #bbf7d0;
}

@media (max-width: 1180px) {.overview-grid { grid-template-columns: 1fr; }

.metric-grid,
.module-grid,
.three-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.two-col { grid-template-columns: 1fr; }

.filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.matricula-title { flex-direction: column; }

.enrollment-context { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.record-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.mail-admin-shell.active { grid-template-columns: 1fr; }

.mail-profile-panel { position: static; }

.mail-profile-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.mail-profile-row:nth-child(odd) { border-right: 1px solid var(--line); }
}

@media (max-width: 820px) {.app-shell { grid-template-columns: 1fr; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    z-index: 20;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 18px 0 44px rgba(15, 23, 42, 0.18);
  }

.sidebar.open { transform: translateX(0); }

.menu-toggle { display: inline-flex; }

.topbar { grid-template-columns: auto 1fr; }

.top-actions {
    grid-column: 1 / -1;
    width: 100%;
    overflow: visible;
  }

.top-actions .date-chip {
    min-width: 0;
    flex: 1;
  }

.top-actions .primary-btn {
    width: 42px;
    min-width: 42px;
    padding: 0;
    gap: 0;
    overflow: hidden;
    font-size: 0;
  }

.content { padding: 16px; }

.metric-grid,
.module-grid,
.three-col,
.stat-row,
.form-grid,
.filters { grid-template-columns: 1fr; }

.matricula-console { padding: 14px; }

.matricula-title .action-strip {
    width: 100%;
  }

.student-record-head,
.student-record-footer {
    align-items: stretch;
    flex-direction: column;
  }

.record-head-actions {
    justify-content: stretch;
  }

.record-head-actions > * {
    flex: 1;
    justify-content: center;
  }

.enrollment-context,
.student-record-layout,
.record-grid {
    grid-template-columns: 1fr;
  }

.student-photo-column {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

.student-photo-frame {
    width: min(100%, 240px);
    margin: 0 auto;
  }

.field-span-2 {
    grid-column: auto;
  }

.mail-profile-list,
.mail-test-panel {
    grid-template-columns: 1fr;
  }

.mail-profile-row:nth-child(odd) {
    border-right: 0;
  }

.mail-config-head,
.mail-config-footer {
    align-items: stretch;
    flex-direction: column;
  }

.mail-config-footer .primary-btn {
    width: 100%;
  }

.mail-test-compose {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

.inline-editor,
.inline-editor.compact {
    min-width: 260px;
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   LIBRO DE CLASES: asistencia y leccionario
   Nota: lucide reemplaza <i> por <svg>, por eso cada regla de icono
   se escribe siempre como ".algo i, .algo svg".
   ============================================================================ */

.att-toolbar {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface-soft);
}

.att-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.att-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.att-states {
  display: inline-flex;
  gap: 6px;
}

.att-states input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.att-chip {
  width: 38px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.att-legend .att-chip {
  width: 26px;
  height: 24px;
  font-size: 11px;
  cursor: default;
}

.att-chip:hover { border-color: #b9c5da; }

.att-states input:checked + .att-chip.ok,
.att-legend .att-chip.ok {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.att-states input:checked + .att-chip.warn,
.att-legend .att-chip.warn {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

.att-states input:checked + .att-chip.bad,
.att-legend .att-chip.bad {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.att-states input:checked + .att-chip.info,
.att-legend .att-chip.info {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.att-states input:checked + .att-chip.soft,
.att-legend .att-chip.soft {
  background: #64748b;
  border-color: #64748b;
  color: #fff;
}

.att-states input:checked + .att-chip {
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.16);
}

.att-states input:focus-visible + .att-chip {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.att-states input:disabled + .att-chip {
  opacity: 0.55;
  cursor: not-allowed;
}

.att-note {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 0 11px;
  font-size: 12.5px;
  color: var(--text);
  outline: none;
  transition: border-color 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

.att-note:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.att-table td { padding-top: 9px; padding-bottom: 9px; }

.att-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface-soft);
}

.signature-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid #c7f0d7;
  background: var(--green-soft);
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: center;
}

.signature-box strong {
  display: block;
  font-size: 13.5px;
  font-weight: 750;
  color: #15803d;
}

.signature-box span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #3f7a56;
  font-variant-numeric: tabular-nums;
}

.pct-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pct-cell b {
  min-width: 48px;
  text-align: right;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.pct-bar {
  flex: 1;
  height: 7px;
  min-width: 70px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.pct-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--blue);
  transition: width 200ms ease;
}

.pct-bar span.ok { background: var(--green); }
.pct-bar span.warn { background: var(--gold); }
.pct-bar span.bad { background: var(--red); }

.code-block {
  margin: 10px 0 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: #0f172a;
  color: #cbd5e1;
  font-family: "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

/* Filtros del libro: flexibles, para que el boton no se estire al saltar de fila */
.filters.libro-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.filters.libro-filters .field {
  flex: 1 1 180px;
  min-width: 160px;
}

.filters.libro-filters .primary-btn {
  flex: 0 0 auto;
  align-self: flex-end;
}

/* ============================================================================
   CONVIVENCIA, CALIFICACIONES, PIE Y EDE
   Recordatorio: lucide reemplaza <i> por <svg>, escribir siempre ".algo i, .algo svg".
   ============================================================================ */

/* --- Selector de tipo de anotacion --- */
.tipo-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tipo-picker input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tipo-option {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease, box-shadow 130ms ease;
}

.tipo-option i,
.tipo-option svg {
  width: 17px;
  height: 17px;
  color: var(--faint);
  transition: color 130ms ease;
}

.tipo-option:hover { border-color: #b9c5da; }

.tipo-picker input:checked + .tipo-option.green {
  background: var(--green-soft);
  border-color: var(--green);
  color: #15803d;
  box-shadow: inset 0 0 0 1px var(--green);
}

.tipo-picker input:checked + .tipo-option.red {
  background: var(--red-soft);
  border-color: var(--red);
  color: #be123c;
  box-shadow: inset 0 0 0 1px var(--red);
}

.tipo-picker input:checked + .tipo-option.blue {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue-deep);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.tipo-picker input:checked + .tipo-option.green i,
.tipo-picker input:checked + .tipo-option.green svg { color: var(--green); }
.tipo-picker input:checked + .tipo-option.red i,
.tipo-picker input:checked + .tipo-option.red svg { color: var(--red); }
.tipo-picker input:checked + .tipo-option.blue i,
.tipo-picker input:checked + .tipo-option.blue svg { color: var(--blue); }

.tipo-picker input:focus-visible + .tipo-option {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* --- Timeline: extras para la hoja de vida --- */
.timeline-extra {
  margin: 5px 0 0 !important;
  font-size: 12.5px;
  color: var(--text-soft);
}

.timeline-extra b { font-weight: 700; }

.timeline-foot {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--faint);
}

.timeline-foot > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

.timeline-foot i,
.timeline-foot svg { width: 13px; height: 13px; }

.timeline-foot .ok { color: #15803d; }
.timeline-foot .warn { color: #b45309; }

.timeline-item.is-anulada { opacity: 0.62; }
.timeline-item.is-anulada p { text-decoration: line-through; }
.timeline-item.is-anulada .timeline-extra { text-decoration: none; }

.timeline-inline-form {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.timeline-inline-form input {
  min-height: 32px;
  width: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 0 10px;
  font-size: 12px;
  outline: none;
}

.timeline-inline-form input:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.timeline-inline-form .soft-btn {
  min-height: 32px;
  padding: 0 11px;
  font-size: 12px;
}

/* --- Calificaciones --- */
.eval-picker {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  overflow-x: auto;
  background: var(--surface-soft);
}

.eval-chip {
  min-width: 190px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  transition: border-color 130ms ease, box-shadow 130ms ease, transform 130ms ease;
}

.eval-chip strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.eval-chip span {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
}

.eval-chip:hover {
  border-color: var(--blue-light);
  transform: translateY(-1px);
}

.eval-chip.active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue), var(--shadow-blue);
}

.eval-chip.active strong { color: var(--blue-deep); }

.nota-input {
  width: 84px;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 10px;
  font-size: 14px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text);
  outline: none;
  transition: border-color 130ms ease, box-shadow 130ms ease, color 130ms ease;
}

.nota-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.nota-input.ok { color: #15803d; border-color: #bbe9cd; }
.nota-input.warn { color: #b45309; border-color: #fbdda6; }
.nota-input.bad { color: #be123c; border-color: #fecdd6; }

.notas-table th,
.notas-table td { padding: 10px 12px; }

.notas-table .nota-col {
  text-align: center;
  width: 74px;
}

.notas-table th.nota-col small {
  display: block;
  margin-top: 2px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--faint);
}

.nota-pill {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
}

.nota-pill.ok { background: var(--green-soft); border-color: #c7f0d7; color: #15803d; }
.nota-pill.warn { background: var(--gold-soft); border-color: #fde8c4; color: #b45309; }
.nota-pill.bad { background: var(--red-soft); border-color: #fecdd6; color: #be123c; }
.nota-pill.soft { background: var(--surface-soft); color: var(--faint); }
.nota-pill.strong { font-size: 13.5px; font-weight: 800; }

/* --- Listas con dato al costado (panel EDE) --- */
.list-item:has(.list-item-aside) {
  grid-template-columns: 40px 1fr auto;
}

.list-item-aside {
  text-align: right;
  white-space: nowrap;
}

.list-item-aside small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* --- Tarjetas del contenido exportado --- */
.mini-card {
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.mini-card b {
  display: block;
  font-size: 12.5px;
  font-weight: 750;
  font-family: "Cascadia Code", Consolas, Menlo, monospace;
  color: var(--blue-deep);
}

.mini-card span {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
}

/* ============================================================================
   NOTIFICACIONES AL APODERADO
   ============================================================================ */

.evento-item {
  grid-template-columns: 40px 1fr auto;
  align-items: center;
}

.evento-controles {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.evento-controles .check-row {
  min-height: 32px;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-soft);
  cursor: pointer;
}

.evento-controles .check-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
  cursor: pointer;
}

.evento-perfil {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 10px;
  font-size: 12.5px;
  color: var(--text);
  outline: none;
  transition: border-color 130ms ease, box-shadow 130ms ease;
}

.evento-perfil:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.notif-error {
  color: #be123c !important;
  cursor: help;
}

.preview-asunto {
  padding: 13px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.preview-asunto span {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.preview-asunto strong {
  display: block;
  margin-top: 4px;
  font-size: 14.5px;
  font-weight: 750;
}

.preview-correo {
  width: 100%;
  height: 640px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
}

@media (max-width: 1180px) {
  .evento-item { grid-template-columns: 40px 1fr; }
  .evento-controles { grid-column: 1 / -1; margin-top: 10px; }
}

/* ============================================================================
   ENTREVISTAS
   Recordatorio: lucide reemplaza <i data-lucide> por <svg>, asi que cada
   regla de icono se escribe para las dos formas (i y svg).
   ============================================================================ */

.tipo-picker input:checked + .tipo-option.gold {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: #b45309;
  box-shadow: inset 0 0 0 1px var(--gold);
}

.tipo-picker input:checked + .tipo-option.gold i,
.tipo-picker input:checked + .tipo-option.gold svg { color: var(--gold); }

.check-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
}

.check-line input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
  cursor: pointer;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.mini-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.mini-card strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* --- Participantes --- */

.part-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.part-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) 170px;
  gap: 10px;
  align-items: end;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.part-row .field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.part-checks {
  display: grid;
  gap: 2px;
}

.part-checks .check-line { margin-top: 0; }

/* El boton vive dentro de un .field en grid: sin esto se estira a todo el ancho. */
[data-part-add] {
  justify-self: start;
  width: fit-content;
}

.part-remove {
  grid-column: 1 / -1;
  justify-self: end;
}

/* --- Historial con scroll interno --- */

.scroll-list {
  display: grid;
  gap: 10px;
  /* Alrededor de 6 registros a la vista; el resto queda en scroll interno. */
  max-height: min(72vh, 1020px);
  overflow-y: auto;
  padding: 4px 20px 20px;
}

.ent-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 13px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 130ms ease, box-shadow 130ms ease;
}

.ent-row:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}

.ent-row.is-anulada { opacity: 0.62; }

.ent-dot {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--blue-soft);
}

.ent-dot i,
.ent-dot svg {
  width: 19px;
  height: 19px;
  color: var(--blue);
}

.ent-dot.green { background: var(--green-soft); }
.ent-dot.green i,
.ent-dot.green svg { color: var(--green); }
.ent-dot.red { background: var(--red-soft); }
.ent-dot.red i,
.ent-dot.red svg { color: var(--red); }
.ent-dot.gold { background: var(--gold-soft); }
.ent-dot.gold i,
.ent-dot.gold svg { color: var(--gold); }

.ent-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ent-head strong {
  font-size: 14.5px;
  font-weight: 750;
  color: var(--text);
  letter-spacing: -0.2px;
}

.ent-date {
  margin-left: auto;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  white-space: nowrap;
}

.ent-body > p {
  margin: 7px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-soft);
}

.ent-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.ent-foot span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ent-foot i,
.ent-foot svg {
  width: 14px;
  height: 14px;
  color: var(--faint);
}

.ent-foot .ok { color: var(--green); }
.ent-foot .ok i,
.ent-foot .ok svg { color: var(--green); }

.ent-foot .soft-btn { margin-left: auto; }
.ent-foot .soft-btn + .soft-btn { margin-left: 0; }

/* --- Acta --- */

.acta-sub {
  margin: 20px 0 8px;
  font-size: 11.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.acta-sub:first-child { margin-top: 0; }

.acta-texto {
  margin: 0;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-soft);
  white-space: pre-line;
}

@media (max-width: 1000px) {
  .part-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .part-checks { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .part-row { grid-template-columns: 1fr; }
  .ent-date { margin-left: 0; }
  .scroll-list { padding: 4px 14px 16px; }
}

/* ============================================================================
   PLANIFICACIONES
   (regla permanente: cada icono se escribe para `i` y para `svg`)
   ============================================================================ */

/* --- Lista de OA para marcar --- */

.oa-list {
  margin-top: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.oa-eje {
  margin: 12px 10px 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue-deep);
}

.oa-eje:first-child { margin-top: 6px; }

.oa-item {
  display: flex;
  gap: 10px;
  padding: 9px 11px;
  margin: 0 4px 4px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-soft);
  cursor: pointer;
}

.oa-item:hover { border-color: var(--line-strong); }
.oa-item.is-static { cursor: default; }

.oa-item input[type="checkbox"] {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--blue);
  cursor: pointer;
}

.oa-item b {
  font-weight: 800;
  color: var(--text);
  margin-right: 6px;
}

.oa-item em {
  font-style: normal;
  margin-right: 6px;
}

.oa-row {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}

.oa-row > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.oa-row b { font-weight: 800; color: var(--text); }

.oa-row p {
  margin: 7px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-soft);
}

.oa-row small {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--faint);
}

/* --- Tarjetas de revision UTP --- */

.rev-card {
  padding: 15px 17px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.rev-card + .rev-card { margin-top: 10px; }

.rev-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.rev-head > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rev-head strong {
  font-size: 14.5px;
  font-weight: 750;
  color: var(--text);
  letter-spacing: -0.2px;
}

.rev-head .ent-date { margin-left: auto; }

.rev-meta {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.rev-proposito {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-soft);
}

.rev-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

/* --- La clase planificada dentro del leccionario --- */

.plan-sugerida {
  margin: 0 20px 4px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--blue);
  background: var(--blue-soft);
}

.plan-sugerida-head {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-wrap: wrap;
}

.plan-sugerida-head > i,
.plan-sugerida-head > svg {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--blue);
}

.plan-sugerida-head > div { flex: 1; min-width: 200px; }

.plan-sugerida-head strong {
  display: block;
  font-size: 14px;
  font-weight: 750;
  color: var(--blue-deep);
  letter-spacing: -0.2px;
}

.plan-sugerida-head span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  color: #3b5bb5;
}

.plan-sugerida p {
  margin: 9px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-soft);
}

.plan-sugerida p b { color: var(--blue-deep); }

.plan-sugerida .plan-nota {
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px dashed rgba(37, 99, 235, 0.28);
  font-size: 11.5px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .plan-sugerida { margin-left: 14px; margin-right: 14px; }
  .rev-head .ent-date { margin-left: 0; }
}

/* ==========================================================================
   Casillas en linea
   Antes esto se escribia con style="display:inline-flex..." en cada plantilla
   (la ficha del estudiante tenia tres copias). El problema no era la
   repeticion: era que la casilla y su texto quedaban desalineados en cuanto
   el texto se iba a dos lineas.
   ========================================================================== */

label.check-inline {
  /* El selector lleva `label` a proposito: dentro de `.field` la regla
     `.field label` tiene la misma especificidad, y sin el elemento esta
     perderia segun el orden del archivo. */
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-soft);
  cursor: pointer;
}

label.check-inline input[type="checkbox"] {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  /* MIN-HEIGHT, no solo height: `.field input` fija min-height 42px para los
     campos de texto y min-height le gana a height. Sin esto la casilla queda
     de 15 x 42 y se ve despegada de su texto, que es exactamente como se veia
     en la pantalla de Salud. */
  min-height: 15px;
  max-height: 15px;
  min-width: 15px;
  /* 2px para que la casilla quede alineada con la primera linea del texto y
     no con el centro del bloque cuando el texto ocupa dos lineas. */
  margin-top: 2px;
}

.check-inline span { flex: 1 1 auto; }

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: flex-start;
}

/* ==========================================================================
   Adjuntos
   ========================================================================== */

.adjuntos-lista {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.adjuntos-lista .adjunto {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft, #fbfcfe);
  font-size: 13px;
}

/* lucide reemplaza <i data-lucide> por <svg>, asi que las dos tienen que
   estar en el selector: con solo `i` el icono queda sin estilo al cargar. */
.adjuntos-lista .adjunto i,
.adjuntos-lista .adjunto svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--muted);
}

.adjuntos-lista .adjunto a {
  font-weight: 600;
  color: var(--blue-deep, #1d4ed8);
  text-decoration: none;
}

.adjuntos-lista .adjunto a:hover { text-decoration: underline; }

.adjuntos-lista .adjunto-anulado {
  opacity: 0.62;
}

.adjuntos-lista .adjunto-anulado span:first-of-type {
  text-decoration: line-through;
}

/* ==========================================================================
   Muestra insuficiente
   Un "100% de asistencia" calculado sobre una sola clase se lee igual que uno
   calculado sobre 180. Esta clase es para marcar el primero.
   ========================================================================== */

.dato-debil {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
}

.dato-debil i,
.dato-debil svg { width: 13px; height: 13px; }

/* ==========================================================================
   Submenu anidado
   Un modulo puede colgar del menu de otro (la clave `padre` en dashboard.php):
   Justificativos vive dentro de Inspectoria porque es Inspectoria quien hace
   ese tramite, y Denuncias dentro de Convivencia. El codigo sigue separado;
   lo que se ordena es el menu, que tiene que seguir a quien usa el sistema y
   no a como estan repartidos los archivos.
   ========================================================================== */

.nav-subgroup {
  margin: 10px 0 3px;
  padding: 0 12px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.42);
}

/* El primero no lleva margen superior: ya lo separa el submenu del padre. */
.nav-submenu > .nav-subgroup:first-child { margin-top: 2px; }

/* Horario semanal por curso: la cuadrícula es la vista principal. */
.horarios-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
}

.horarios-filter,
.horarios-modos { display: flex; align-items: center; gap: 8px; min-width: 0; }
.horarios-filter label { color: var(--text-soft); font-size: 11px; font-weight: 700; }
.horarios-filter select {
  min-width: 220px;
  max-width: 320px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}
.horarios-filter select:focus-visible,
.horarios-modos a:focus-visible,
.horarios-libre:focus-visible,
.horarios-calendar-scroll:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.horarios-modos { gap: 0; border: 1px solid var(--line-strong); border-radius: 5px; overflow: hidden; flex-shrink: 0; }
.horarios-modos a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}
.horarios-modos a + a { border-left: 1px solid var(--line-strong); }
.horarios-modos a:hover { background: var(--surface-hover); color: var(--text); }
.horarios-modos a.active { background: var(--blue-soft); color: var(--blue-deep); }
.horarios-modos svg { width: 14px; height: 14px; }
.horarios-empty-state { padding: 36px 20px; color: var(--muted); text-align: center; font-size: 12px; }
.horarios-empty-state a { color: var(--blue-deep); font-weight: 700; text-decoration: underline; }
.horarios-dias { display: none; }
.horarios-calendar-scroll { width: 100%; max-width: 100%; overflow-x: auto; }
.horarios-calendar { width: 100%; min-width: 880px; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.horarios-caption { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.horarios-calendar th,
.horarios-calendar td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.horarios-calendar tr > :last-child { border-right: 0; }
.horarios-calendar tbody tr:last-child > * { border-bottom: 0; }
.dominus-modern:not(.organizador-page) .horarios-calendar thead th {
  padding: 8px 10px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}
.horarios-calendar thead th:first-child,
.horarios-calendar .horarios-time { width: 88px; position: sticky; left: 0; z-index: 2; }
.horarios-calendar thead th:first-child { z-index: 3; }
.dominus-modern:not(.organizador-page) .horarios-calendar .horarios-time {
  padding: 8px 8px;
  top: auto;
  background: var(--surface-soft);
  color: var(--text-soft);
  text-align: left;
  vertical-align: top;
}
.horarios-time span,
.horarios-time strong,
.horarios-time small { display: block; }
.horarios-time span { color: var(--muted); font-size: 10px; font-weight: 700; }
.horarios-time strong { margin-top: 4px; color: var(--text); font-size: 12.5px; }
.horarios-time small { color: var(--muted); font-size: 10px; }
.dominus-modern:not(.organizador-page) .horarios-calendar td { height: 88px; padding: 5px; background: var(--surface); vertical-align: top; }
.horarios-calendar tbody tr:nth-child(even) td { background: var(--surface-soft); }
.horarios-evento {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 76px;
  padding: 7px 8px;
  border-left: 3px solid var(--blue);
  border-radius: 4px;
  background: color-mix(in srgb, var(--blue) 9%, var(--surface));
  overflow-wrap: anywhere;
}
.horarios-evento.inactivo { border-left-color: var(--muted); background: var(--surface-soft); opacity: .72; }
.horarios-evento strong { color: var(--text); font-size: 11.5px; line-height: 1.3; }
.horarios-docente,
.horarios-sala { display: inline-flex; align-items: flex-start; gap: 5px; color: var(--text-soft); font-size: 10px; line-height: 1.35; }
.horarios-docente svg,
.horarios-sala svg { width: 12px; height: 12px; flex: 0 0 12px; margin-top: 1px; }
.horarios-marca { margin-top: auto; border-radius: 3px; padding: 2px 5px; font-size: 9px; font-weight: 700; }
.horarios-marca.demo { background: color-mix(in srgb, var(--gold) 13%, var(--surface)); color: var(--gold); }
.horarios-marca.inactiva { background: var(--surface); color: var(--muted); }
.horarios-libre { display: flex; align-items: center; justify-content: center; min-height: 76px; border-radius: 4px; color: var(--faint); }
a.horarios-libre:hover { background: var(--surface-hover); color: var(--blue); }
.horarios-libre svg { width: 16px; height: 16px; opacity: .65; }

@media (max-width: 800px) {
  .horarios-toolbar { align-items: stretch; flex-direction: column; }
  .horarios-filter { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
  .horarios-filter select { width: 100%; min-width: 0; max-width: none; }
  .horarios-modos { align-self: flex-start; }
  .horarios-dias { display: flex; border-bottom: 1px solid var(--line); }
  .horarios-dias button { flex: 1; min-width: 0; padding: 9px 4px; border: 0; border-bottom: 2px solid transparent; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 700; }
  .horarios-dias button[aria-pressed="true"] { border-bottom-color: var(--blue); color: var(--blue-deep); }
  .horarios-dias button:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
}
