/* ==========================================================================
   Sistema de diseño · Intranet IEP Inmaculada Concepción
   ========================================================================== */
:root {
  /* Marca (escudo del colegio): granate + amarillo como acento puntual */
  --vino-950: #2a0a12;
  --vino-900: #3b0f1a;
  --vino-800: #7a1f33;
  --vino-700: #93283f;
  --tinte-600: #93283f;
  --tinte-500: #b13a52;
  --tinte-100: #f4dde2;
  --tinte-50: #fbf0f2;
  --oro-500: #f0d000;
  --oro-300: #f7e15a;
  --oro-100: #fdf6cc;

  /* Neutros (ligeramente cálidos para acompañar el granate) */
  --ink: #1f1a1c;
  --ink-2: #463d40;
  --muted: #6b6064;
  --line: #e8e1e2;
  --line-2: #f1ecec;
  --bg: #f8f5f4;
  --surface: #ffffff;

  /* Niveles de logro */
  --ad: #13795b;
  --ad-bg: #e3f4ec;
  --a: #1f5fad;
  --a-bg: #e4eefa;
  --b: #8f5b00;
  --b-bg: #fbf0d9;
  --c: #b42318;
  --c-bg: #fce8e6;
  --j: #6b4fa0;
  --j-bg: #efeaf8;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgb(46 11 20 / 0.06);
  --shadow: 0 1px 2px rgb(46 11 20 / 0.05), 0 4px 14px rgb(46 11 20 / 0.05);
  --shadow-lg: 0 16px 48px rgb(42 10 18 / 0.22);

  /* Movimiento */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --font-sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;

  --sidebar-w: 264px;
  --topbar-h: 68px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
p {
  margin: 0;
}
a {
  color: var(--tinte-600);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
svg {
  flex-shrink: 0;
}
.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.num {
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--muted);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
:focus-visible {
  outline: 2px solid var(--tinte-500);
  outline-offset: 2px;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}
.btn .icon {
  width: 18px;
  height: 18px;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--vino-800);
  border-color: var(--vino-800);
  color: #fff;
}
.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}
.btn--danger {
  background: var(--c);
  border-color: var(--c);
  color: #fff;
}
.btn--sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}
.btn--block {
  width: 100%;
  height: 46px;
  font-size: 15px;
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) {
    background: var(--bg);
  }
  .btn--primary:hover:not(:disabled) {
    background: var(--vino-700);
  }
  .btn--ghost:hover:not(:disabled) {
    background: var(--line-2);
  }
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}
.icon-btn:active {
  transform: scale(0.94);
}
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover {
    background: var(--line-2);
  }
}

/* ---------- Formularios ---------- */
.field {
  display: grid;
  gap: 6px;
}
.field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.input,
.field input,
.field select,
.field textarea {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 16px; /* 16px evita el zoom automático en iOS */
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field textarea {
  height: auto;
  min-height: 140px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}
.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--tinte-500);
  box-shadow: 0 0 0 3px rgb(168 50 74 / 0.18);
}
.select {
  height: 40px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235f6d80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  appearance: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  max-width: 100%;
}
input[type='date'].select {
  padding-right: 12px;
  background-image: none;
}
.input-group {
  position: relative;
}
.input-group input {
  padding-right: 48px;
}
.input-group .icon-btn {
  position: absolute;
  right: 2px;
  top: 2px;
}
.form-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--c-bg);
  color: var(--c);
  font-size: 14px;
  font-weight: 500;
}

/* ---------- Segmented control ---------- */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--line-2);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar {
  display: none;
}
.seg button {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}
.seg button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Login
   ========================================================================== */
.login {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.login__brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 56px;
  color: #fff;
  background:
    radial-gradient(120% 80% at 0% 0%, rgb(168 50 74 / 0.35), transparent 60%),
    linear-gradient(160deg, var(--vino-800), var(--vino-950));
  overflow: hidden;
}
.login__brand::after {
  /* Trama sutil de líneas, evoca papel institucional */
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(135deg, rgb(255 255 255 / 0.035) 0 1px, transparent 1px 14px);
  pointer-events: none;
}
.login__brand-inner {
  position: relative;
  z-index: 1;
  max-width: 440px;
  margin-block: auto;
}
.login__brand .escudo {
  margin-bottom: 28px;
}
/* Separa el escudo granate del fondo granate oscuro */
.login__brand .escudo,
.sidebar__brand .escudo {
  filter: drop-shadow(0 2px 6px rgb(0 0 0 / 0.35));
}
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--oro-300);
}
.login__brand h1 {
  margin-top: 10px;
  font-family: var(--font-serif);
  font-size: clamp(32px, 4vw, 46px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.login__intro {
  margin-top: 16px;
  font-size: 16px;
  color: rgb(255 255 255 / 0.78);
  max-width: 38ch;
}
.login__features {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  font-size: 14px;
  color: rgb(255 255 255 / 0.88);
}
.login__features li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.login__features .icon {
  width: 18px;
  height: 18px;
  color: var(--oro-300);
}
.login__foot {
  position: relative;
  z-index: 1;
  font-size: 13px;
  color: rgb(255 255 255 / 0.55);
}
.login__panel {
  display: grid;
  place-items: center;
  padding: 48px 24px;
  background: var(--surface);
}
.login__form {
  width: 100%;
  max-width: 380px;
  display: grid;
  gap: 18px;
}
.login__form h2 {
  font-family: var(--font-serif);
  font-size: 28px;
}
.login__form > p {
  margin-top: -10px;
  font-size: 14px;
}
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.demo-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), border-color 160ms ease, background-color 160ms ease;
}
.demo-card:active {
  transform: scale(0.97);
}
@media (hover: hover) and (pointer: fine) {
  .demo-card:hover {
    border-color: var(--tinte-100);
    background: var(--tinte-50);
  }
}
.demo-card__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--tinte-50);
  color: var(--vino-800);
}
.demo-card strong {
  display: block;
  font-size: 14px;
}
.demo-card small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.login__note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ==========================================================================
   Estructura de la app
   ========================================================================== */
.shell {
  min-height: 100dvh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--vino-900);
  color: rgb(255 255 255 / 0.86);
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
}
.sidebar__brand strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
}
.sidebar__brand small {
  font-size: 12px;
  color: rgb(255 255 255 / 0.55);
}
.sidebar__close {
  display: none;
  margin-left: auto;
  color: #fff;
}
.nav {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 16px 12px;
  overflow-y: auto;
}
.nav__label {
  padding: 12px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.4);
}
.nav__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: rgb(255 255 255 / 0.72);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .nav__item:hover {
    background: rgb(255 255 255 / 0.06);
    color: #fff;
  }
}
.nav__item[aria-current='page'] {
  background: rgb(255 255 255 / 0.1);
  color: #fff;
}
.nav__item[aria-current='page']::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--oro-500);
}
.nav__item .badge {
  margin-left: auto;
}
.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--oro-500);
  color: var(--vino-950);
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.badge:empty {
  display: none;
}
.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgb(255 255 255 / 0.08);
}
.sidebar__user > div {
  min-width: 0;
  flex: 1;
}
.sidebar__user strong {
  display: block;
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__user small {
  font-size: 12px;
  color: rgb(255 255 255 / 0.55);
}
.sidebar__user .icon-btn {
  color: rgb(255 255 255 / 0.7);
}
@media (hover: hover) and (pointer: fine) {
  .sidebar__user .icon-btn:hover {
    background: rgb(255 255 255 / 0.08);
    color: #fff;
  }
}
.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--oro-100);
  color: var(--vino-900);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar--lg {
  width: 64px;
  height: 64px;
  font-size: 22px;
}
.scrim {
  display: none;
}

.main {
  margin-left: var(--sidebar-w);
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 32px;
  background: rgb(248 245 244 / 0.88);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__menu {
  display: none;
  margin-left: -8px;
}
.topbar__title {
  min-width: 0;
  flex: 1;
}
.topbar__title h1 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__title p {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ad);
}

.view {
  padding: 28px 32px 64px;
  max-width: 1240px;
}
.view:focus {
  outline: none;
}
.view.is-entering {
  animation: view-in 160ms var(--ease-out);
}
@keyframes view-in {
  from {
    opacity: 0;
  }
}

/* ==========================================================================
   Componentes de contenido
   ========================================================================== */
.stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* evita que una tabla ancha estire la página */
  gap: 24px;
}
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 20px 0;
}
.card__head h2 {
  font-size: 16px;
  font-weight: 700;
}
.card__head a {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.card__body {
  padding: 16px 20px 20px;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar .spacer {
  flex: 1;
}

.hello {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.hello h2 {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 700;
}
.hello p {
  margin-top: 4px;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.stat {
  padding: 18px 20px;
}
.stat__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.stat__label .icon {
  width: 16px;
  height: 16px;
}
.stat__value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 10px;
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat__value small {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.stat__foot {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}
.meter {
  height: 6px;
  margin-top: 12px;
  border-radius: 3px;
  background: var(--line-2);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ad);
}

/* Listas */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list > li + li {
  border-top: 1px solid var(--line-2);
}
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
}
.row__main {
  min-width: 0;
  flex: 1;
}
.row__title {
  font-weight: 600;
  font-size: 14px;
}
.row__sub {
  font-size: 13px;
  color: var(--muted);
}
.row__time {
  width: 64px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.row__time small {
  display: block;
  font-weight: 500;
  color: var(--muted);
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--c, var(--tinte-500));
  flex-shrink: 0;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--line-2);
  color: var(--ink-2);
}
.tag--curso {
  background: color-mix(in oklab, var(--c) 11%, white);
  color: color-mix(in oklab, var(--c) 85%, black);
}
.tag--live {
  background: var(--ad-bg);
  color: var(--ad);
}
.tag--warn {
  background: var(--b-bg);
  color: var(--b);
}
.tag--danger {
  background: var(--c-bg);
  color: var(--c);
}
.tag--ok {
  background: var(--ad-bg);
  color: var(--ad);
}
.tag .icon {
  width: 14px;
  height: 14px;
}
/* Meses de pensión */
.mes {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.legend .mes {
  display: inline-grid;
}
.mes--btn {
  border: 0;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), box-shadow 140ms ease;
}
.mes--btn:active {
  transform: scale(0.9);
}
@media (hover: hover) and (pointer: fine) {
  .mes--btn:hover {
    box-shadow: 0 0 0 2px var(--tinte-500);
  }
}
/* Credenciales temporales */
.cred {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--tinte-50);
}
.cred small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.cred strong {
  font-size: 17px;
}
.mono {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  letter-spacing: 0.04em;
}
/* Buscador */
.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 360px;
}
.search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search .input {
  height: 40px;
  padding-left: 38px;
  font-size: 14px;
}
.form-narrow {
  display: grid;
  gap: 16px;
  max-width: 420px;
}
.block {
  display: block;
}
.error-text {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--c);
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
}
.check input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--vino-800);
}
.notice--alerta {
  background: var(--c-bg);
  color: var(--c);
}
.acciones {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: nowrap;
}
.select--sm {
  height: 34px;
  padding: 0 28px 0 10px;
  font-size: 13px;
  background-position: right 8px center;
  width: 100%;
  min-width: 128px;
}
.select--sm.is-cruce {
  border-color: var(--c);
  background-color: var(--c-bg);
}
.horario--editar td {
  vertical-align: middle;
}
/* Selector de hijo(a) en la barra superior (portal de padres) */
.hijo-select .select {
  max-width: 220px;
}
/* Pensiones del portal de padres */
.meses {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
}
.mes-item {
  display: grid;
  justify-items: center;
  gap: 4px;
}
.mes-item small {
  font-size: 12px;
  color: var(--muted);
}
/* Zona para subir archivos */
.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}
.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.dropzone .icon {
  width: 24px;
  height: 24px;
  color: var(--vino-800);
}
.dropzone.is-over,
.dropzone:focus-within {
  border-color: var(--tinte-500);
  background: var(--tinte-50);
}
.dropzone.is-busy {
  opacity: 0.6;
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .dropzone:hover {
    border-color: var(--tinte-500);
  }
}
/* Cinco cuentas de demostración: la última ocupa todo el ancho */
.demo-grid > :last-child:nth-child(odd) {
  grid-column: 1 / -1;
}
.mes--pagado {
  background: var(--ad-bg);
  color: var(--ad);
}
.mes--vencido {
  background: var(--c);
  color: #fff;
}
.mes--pendiente {
  background: var(--b-bg);
  color: var(--b);
  font-size: 20px;
}
.mes--exento {
  background: var(--bg);
  color: var(--muted);
}
.mes--futuro {
  background: var(--surface);
  border: 1px dashed var(--line);
}
.tag--j {
  background: var(--j-bg);
  color: var(--j);
}
.unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tinte-500);
  flex-shrink: 0;
}

.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 15px;
}

/* Notas y niveles */
.nota {
  display: inline-block;
  min-width: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.nota--ad {
  color: var(--ad);
}
.nota--a {
  color: var(--a);
}
.nota--b {
  color: var(--b);
}
.nota--c {
  color: var(--c);
}
.nota--vacia {
  color: #a5afbd;
  font-weight: 500;
}
.nivel {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}
.nivel--ad {
  background: var(--ad-bg);
  color: var(--ad);
}
.nivel--a {
  background: var(--a-bg);
  color: var(--a);
}
.nivel--b {
  background: var(--b-bg);
  color: var(--b);
}
.nivel--c {
  background: var(--c-bg);
  color: var(--c);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--muted);
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Tablas */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.table th {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th:first-child,
.table td:first-child {
  text-align: left;
  padding-left: 20px;
}
.table th:last-child,
.table td:last-child {
  padding-right: 20px;
}
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-2);
  text-align: center;
  vertical-align: middle;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table .fila-grupo td {
  padding-top: 14px;
  padding-bottom: 8px;
  text-align: left;
  font-weight: 700;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.table .fila-grupo small {
  font-weight: 500;
  color: var(--muted);
}
.table .sticky {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
}
.table th.sticky {
  background: var(--bg);
}
.table .curso-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  font-weight: 600;
}
.table .curso-cell small {
  display: block;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
}
.table .col-prom {
  background: var(--tinte-50);
}
.table th.col-prom {
  background: var(--tinte-100);
  color: var(--vino-800);
}
.table tfoot td,
.table tfoot .sticky {
  font-weight: 700;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

/* Inputs de notas (registro docente) */
.nota-input {
  width: 52px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}
.nota-input:focus {
  outline: none;
  border-color: var(--tinte-500);
  box-shadow: 0 0 0 3px rgb(168 50 74 / 0.18);
}
.nota-input.is-dirty {
  background: var(--oro-100);
  border-color: var(--oro-300);
}
.nota-input.is-invalid {
  border-color: var(--c);
  box-shadow: 0 0 0 3px rgb(180 35 24 / 0.15);
  background: var(--c-bg);
}
.alumno-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}
.alumno-cell .avatar {
  width: 30px;
  height: 30px;
  font-size: 11px;
}
.alumno-cell strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.alumno-cell small {
  font-size: 12px;
  color: var(--muted);
}
.idx {
  width: 20px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Barra de guardado */
.savebar {
  position: sticky;
  bottom: 16px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 18px;
  border-radius: var(--radius);
  background: var(--vino-900);
  color: #fff;
  box-shadow: var(--shadow-lg);
  transition: transform 220ms var(--ease-out), opacity 220ms var(--ease-out);
}
.savebar[data-hidden='true'] {
  transform: translateY(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
}
.savebar p {
  flex: 1;
  font-size: 14px;
}
.savebar .btn--ghost {
  color: rgb(255 255 255 / 0.8);
}
.savebar .btn--primary {
  background: var(--oro-500);
  border-color: var(--oro-500);
  color: var(--vino-950);
}
@media (hover: hover) and (pointer: fine) {
  .savebar .btn--ghost:hover {
    background: rgb(255 255 255 / 0.08);
  }
  .savebar .btn--primary:hover:not(:disabled) {
    background: var(--oro-300);
  }
}

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--tinte-50);
  color: var(--vino-800);
  font-size: 14px;
}
.notice .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

/* Asistencia: selector P/T/F/J */
.asis-opts {
  display: inline-flex;
  gap: 6px;
}
.asis-opts label {
  position: relative;
  cursor: pointer;
}
.asis-opts input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.asis-opts span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
  transition: transform 140ms var(--ease-out), background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.asis-opts label:active span {
  transform: scale(0.94);
}
.asis-opts input:focus-visible + span {
  outline: 2px solid var(--tinte-500);
  outline-offset: 2px;
}
.asis-opts input[value='P']:checked + span {
  background: var(--ad-bg);
  border-color: var(--ad);
  color: var(--ad);
}
.asis-opts input[value='T']:checked + span {
  background: var(--b-bg);
  border-color: var(--b);
  color: var(--b);
}
.asis-opts input[value='F']:checked + span {
  background: var(--c-bg);
  border-color: var(--c);
  color: var(--c);
}
.asis-opts input[value='J']:checked + span {
  background: var(--j-bg);
  border-color: var(--j);
  color: var(--j);
}

/* Calendario de asistencia */
.cal {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.cal__head {
  padding-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
.cal__day {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 62px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.cal__day small {
  font-size: 11px;
  font-weight: 600;
}
.cal__day--off {
  background: var(--bg);
  color: #a5afbd;
  border-color: transparent;
}
.cal__day--p small {
  color: var(--ad);
}
.cal__day--t {
  background: var(--b-bg);
  border-color: transparent;
}
.cal__day--t small {
  color: var(--b);
}
.cal__day--f {
  background: var(--c-bg);
  border-color: transparent;
}
.cal__day--f small {
  color: var(--c);
}
.cal__day--j {
  background: var(--j-bg);
  border-color: transparent;
}
.cal__day--j small {
  color: var(--j);
}
.cal__day--hoy {
  box-shadow: inset 0 0 0 2px var(--vino-700);
}
.cal__blank {
  min-height: 62px;
}
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

/* Horario */
.horario {
  width: 100%;
  border-collapse: separate;
  border-spacing: 6px;
  table-layout: fixed;
  min-width: 760px;
}
.horario th {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 4px;
}
.horario th.is-today {
  color: var(--vino-800);
}
.horario th.is-today span {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--tinte-100);
}
.horario td.hora {
  width: 76px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  vertical-align: top;
  padding-top: 8px;
}
.clase {
  height: 58px;
  padding: 8px 10px;
  border-radius: 9px;
  background: color-mix(in oklab, var(--c) 10%, white);
  border-left: 3px solid var(--c);
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
}
.clase strong {
  display: block;
  font-weight: 700;
  color: color-mix(in oklab, var(--c) 80%, black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clase small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clase--libre {
  background: var(--bg);
  border-left-color: var(--line);
}
.recreo td {
  padding: 0;
}
.recreo__bar {
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: repeating-linear-gradient(135deg, var(--line-2) 0 6px, var(--bg) 6px 12px);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.horario-mobile {
  display: none;
}

/* Tareas */
.tarea {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
}
.tarea + .tarea {
  border-top: 1px solid var(--line-2);
}
.tarea__main {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 6px;
}
.tarea__main h3 {
  font-size: 15px;
  font-weight: 600;
}
.tarea__main p {
  font-size: 14px;
  color: var(--ink-2);
}
.tarea__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.tarea__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
}

/* Comunicados */
.com {
  display: flex;
  gap: 14px;
  width: 100%;
  padding: 16px 20px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease;
}
.com + .com {
  border-top: 1px solid var(--line-2);
}
@media (hover: hover) and (pointer: fine) {
  .com:hover {
    background: var(--bg);
  }
}
.com__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--tinte-50);
  color: var(--vino-800);
  flex-shrink: 0;
}
.com__main {
  min-width: 0;
  flex: 1;
}
.com__top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.com__main h3 {
  margin-top: 3px;
  font-size: 15px;
  font-weight: 600;
}
.com.is-unread h3 {
  font-weight: 700;
}
.com__main p {
  margin-top: 3px;
  font-size: 14px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.com__date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* Perfil */
.perfil-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
}
.perfil-head h2 {
  font-family: var(--font-serif);
  font-size: 24px;
}
.dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line-2);
}
.dl > div {
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-2);
}
.dl dt {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.dl dd {
  margin: 2px 0 0;
  font-weight: 600;
}

/* Cursos del docente */
.curso-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.curso-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-top: 3px solid var(--c);
  background: var(--surface);
}
.curso-card h3 {
  font-size: 15px;
}
.curso-card p {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Diálogo ---------- */
.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.dialog::backdrop {
  background: rgb(42 10 18 / 0.45);
}
.dialog[open] {
  animation: dialog-in 200ms var(--ease-out);
}
.dialog[open]::backdrop {
  animation: fade-in 200ms var(--ease-out);
}
.dialog.is-closing {
  animation: dialog-out 140ms ease forwards;
}
.dialog.is-closing::backdrop {
  animation: fade-out 140ms ease forwards;
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
}
@keyframes dialog-out {
  to {
    opacity: 0;
    transform: scale(0.97);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes fade-out {
  to {
    opacity: 0;
  }
}
.dialog__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 0 24px;
}
.dialog__head h2 {
  flex: 1;
  font-family: var(--font-serif);
  font-size: 22px;
  padding-top: 6px;
}
.dialog__body {
  padding: 16px 24px 24px;
  display: grid;
  gap: 16px;
}
.dialog__body .prose {
  white-space: pre-line;
  color: var(--ink-2);
  line-height: 1.6;
}
.dialog__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--line-2);
}

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: grid;
  gap: 8px;
  justify-items: end;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--vino-950);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  opacity: 0;
  transition: transform 260ms var(--ease-out), opacity 260ms var(--ease-out);
}
.toast.is-in {
  transform: translateY(0);
  opacity: 1;
}
.toast.is-out {
  transition-duration: 160ms;
  transform: translateY(6px);
  opacity: 0;
}
.toast .icon {
  width: 18px;
  height: 18px;
  color: #6fd6a8;
}
.toast--error {
  background: var(--c);
}
.toast--error .icon {
  color: #fff;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 300ms var(--ease-drawer), box-shadow 300ms ease;
  }
  .menu-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar__close {
    display: inline-grid;
  }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgb(42 10 18 / 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms ease;
  }
  .menu-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }
  .main {
    margin-left: 0;
  }
  .topbar {
    padding: 0 16px;
  }
  .topbar__menu {
    display: inline-grid;
  }
  .view {
    padding: 20px 16px 48px;
  }
  .login {
    grid-template-columns: minmax(0, 1fr);
  }
  .login__brand {
    padding: 32px 24px;
  }
  .login__brand .escudo {
    width: 48px;
    height: auto;
    margin-bottom: 16px;
  }
  .login__features,
  .login__foot {
    display: none;
  }
  .login__panel {
    padding: 32px 16px 48px;
    place-items: start center;
  }
}
@media (max-width: 760px) {
  .horario-desktop {
    display: none;
  }
  .horario-mobile {
    display: grid;
    gap: 14px;
  }
}
@media (max-width: 640px) {
  .meses {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .hijo-select .select {
    max-width: 150px;
    height: 36px;
    font-size: 13px;
  }
  .stack > .grid-2 {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .stats {
    gap: 10px;
  }
  .stat {
    padding: 14px 16px;
  }
  .stat__value {
    font-size: 28px;
  }
  .hello h2 {
    font-size: 24px;
  }
  .topbar .pill {
    display: none;
  }
  .card__head {
    padding: 16px 16px 0;
  }
  .card__body {
    padding: 14px 16px 16px;
  }
  .table th:first-child,
  .table td:first-child {
    padding-left: 16px;
  }
  .tarea {
    flex-direction: column;
    padding: 16px;
    gap: 12px;
  }
  .tarea__side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .com {
    padding: 14px 16px;
  }
  .com__icon {
    display: none;
  }
  .dl {
    grid-template-columns: minmax(0, 1fr);
  }
  .dl > div {
    padding: 12px 16px;
  }
  .perfil-head {
    padding: 20px 16px;
  }
  .demo-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .cal__day {
    min-height: 50px;
    padding: 6px;
  }
  .cal__day small {
    font-size: 10px;
  }
  .savebar {
    bottom: 10px;
    flex-wrap: wrap;
  }
  .toasts {
    left: 16px;
    right: 16px;
    bottom: 16px;
    justify-items: stretch;
  }
  .alumno-cell {
    min-width: 170px;
  }
  .table .curso-cell {
    min-width: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .savebar,
  .toast {
    transition-property: opacity;
  }
  .savebar[data-hidden='true'],
  .toast {
    transform: none;
  }
  .dialog[open],
  .dialog.is-closing {
    animation-name: fade-in;
  }
  .dialog.is-closing {
    animation-name: fade-out;
  }
  .btn:active,
  .icon-btn:active,
  .demo-card:active,
  .asis-opts label:active span {
    transform: none;
  }
}
