/* ============================================================
   FORJA · Design System
   Paleta oficial de marca (assets/Forja paleta de colores.svg):
     Cyprus     #014651   Malachite  #03D26F   Starship  #CEF431
     Aqua Haze  #EAF4F4   Cod Gray   #161514
   Estética: geometría redondeada, lima sobre negro cálido,
   tipografía geométrica en cuerpo ligero y micro-labels tracked.
   Cumple WCAG 2.1 AA en ambos temas.
   ============================================================ */

/* ---------- 1. tokens de marca (no cambian con el tema) ---------- */
:root {
  --brand-cyprus: #014651;
  --brand-malachite: #03d26f;
  --brand-starship: #cef431;
  --brand-aqua: #eaf4f4;
  --brand-cod: #161514;

  /* forma */
  --r-panel: 28px;
  --r-card: 22px;
  --r-field: 14px;
  --r-sm: 10px;
  --r-pill: 999px;

  /* tipografía */
  --font-display: 'Kumbh Sans', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* movimiento */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- 2. tema oscuro (por defecto) ---------- */
:root,
:root[data-theme='dark'] {
  color-scheme: dark;

  --bg: #121211;
  --bg-tint-a: rgba(206, 244, 49, 0.06);
  --bg-tint-b: rgba(3, 210, 111, 0.05);
  --surface: #1c1c1a;
  --surface-2: #262723;
  --surface-3: #303129;
  --line: #2e302b;
  --line-strong: #414439;

  --text: #eaf4f4;
  --text-muted: #8e978c;
  --text-faint: #5e645a;

  --accent: #cef431;
  --accent-ink: #161514;
  --accent-dim: #a8c929;
  --accent-soft: rgba(206, 244, 49, 0.14);
  --accent-border: transparent;

  --ok: #03d26f;
  --ok-text: #03d26f;
  --ok-soft: rgba(3, 210, 111, 0.12);
  --warn: #ffc24b;
  --warn-text: #ffc24b;
  --warn-soft: rgba(255, 194, 75, 0.1);
  --warn-border: rgba(255, 194, 75, 0.28);
  --danger: #ff6f5e;
  --danger-text: #ff6f5e;
  --danger-soft: rgba(255, 111, 94, 0.1);

  --focus: #cef431;
  --shadow-card: none;
  --shadow-pop: 0 18px 44px rgba(0, 0, 0, 0.55);

  --logo-fg: #eaf4f4;
  --logo-accent: #cef431;

  /* alias legacy usado en estilos inline de los JS */
  --muted: var(--text-muted);
}

/* ---------- 3. tema claro ---------- */
:root[data-theme='light'] {
  color-scheme: light;

  --bg: #eaf4f4;
  --bg-tint-a: rgba(206, 244, 49, 0.3);
  --bg-tint-b: rgba(3, 210, 111, 0.12);
  --surface: #ffffff;
  --surface-2: #f2f8f8;
  --surface-3: #e4efef;
  --line: #d3e3e3;
  --line-strong: #b0c9c9;

  --text: #014651;
  --text-muted: #4a6068;
  --text-faint: #7c9299;

  --accent: #cef431;
  --accent-ink: #014651;
  --accent-dim: #b9e016;
  --accent-soft: rgba(206, 244, 49, 0.35);
  --accent-border: #014651;

  --ok: #03d26f;
  --ok-text: #07733f;
  --ok-soft: rgba(3, 210, 111, 0.16);
  --warn: #f0b400;
  --warn-text: #8a6205;
  --warn-soft: rgba(255, 221, 0, 0.18);
  --warn-border: rgba(138, 98, 5, 0.3);
  --danger: #c62f1e;
  --danger-text: #c62f1e;
  --danger-soft: rgba(198, 47, 30, 0.08);

  --focus: #014651;
  --shadow-card: 0 1px 2px rgba(1, 70, 81, 0.05), 0 8px 24px rgba(1, 70, 81, 0.06);
  --shadow-pop: 0 18px 44px rgba(1, 70, 81, 0.18);

  --logo-fg: #014651;
  --logo-accent: #03d26f;
}

/* preferencia del sistema, sólo si el usuario no eligió explícitamente */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;

    --bg: #eaf4f4;
    --bg-tint-a: rgba(206, 244, 49, 0.3);
    --bg-tint-b: rgba(3, 210, 111, 0.12);
    --surface: #ffffff;
    --surface-2: #f2f8f8;
    --surface-3: #e4efef;
    --line: #d3e3e3;
    --line-strong: #b0c9c9;

    --text: #014651;
    --text-muted: #4a6068;
    --text-faint: #7c9299;

    --accent-ink: #014651;
    --accent-dim: #b9e016;
    --accent-soft: rgba(206, 244, 49, 0.35);
    --accent-border: #014651;

    --ok-text: #07733f;
    --warn: #f0b400;
    --warn-text: #8a6205;
    --warn-soft: rgba(255, 221, 0, 0.18);
    --warn-border: rgba(138, 98, 5, 0.3);
    --danger: #c62f1e;
    --danger-text: #c62f1e;
    --danger-soft: rgba(198, 47, 30, 0.08);

    --focus: #014651;
    --shadow-card: 0 1px 2px rgba(1, 70, 81, 0.05), 0 8px 24px rgba(1, 70, 81, 0.06);
    --shadow-pop: 0 18px 44px rgba(1, 70, 81, 0.18);

    --logo-fg: #014651;
    --logo-accent: #03d26f;
  }
}

/* ---------- 4. base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 88% -12%, var(--bg-tint-a), transparent 62%),
    radial-gradient(900px 520px at -12% 108%, var(--bg-tint-b), transparent 62%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0;
}

a {
  color: var(--ok-text);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* foco visible y consistente en todo lo interactivo */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: 14px;
  letter-spacing: -0.01em;
}

input, textarea, select {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  padding: 10px 13px;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
input:hover, textarea:hover, select:hover { border-color: var(--line-strong); }
input:focus, textarea:focus, select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }

/* micro-label tracked, el contrapunto a los titulares geométricos */
.eyebrow,
.brand-sub,
.ex-meta,
.footer-note {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 600;
}

/* ---------- 5. topbar y navegación ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-logo {
  height: 30px;
  width: auto;
  flex-shrink: 0;
  display: block;
}
.brand-logo .logo-fg { fill: var(--logo-fg); }
.brand-logo .logo-accent { fill: var(--logo-accent); }

.brand-sub {
  color: var(--text-muted);
  margin-top: 3px;
}

.topnav {
  display: flex;
  gap: 4px;
  margin-left: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px;
  /* que el menú se encoja y scrollee en vez de empujar "Salir" fuera de
     pantalla en anchos intermedios (tablet y teléfono en horizontal) */
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.topnav::-webkit-scrollbar { display: none; }
.nav-tab {
  padding: 8px 18px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13.5px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active {
  background: var(--accent);
  border-color: var(--accent-border);
  color: var(--accent-ink);
  font-weight: 700;
}

.topbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* toggle de tema */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--line-strong);
}
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .i-sun { display: none; }
.theme-toggle .i-moon { display: block; }
:root[data-theme='light'] .theme-toggle .i-sun { display: block; }
:root[data-theme='light'] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme]) .theme-toggle .i-moon { display: none; }
}

/* ---------- 6. layout ---------- */
.app {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 71px);
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidebar h2 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.main {
  padding: 30px 34px 96px;
  min-width: 0;
}

/* ---------- 7. botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.1s;
}
.btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent-border);
  color: var(--accent-ink);
  font-weight: 700;
}
.btn.primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-border);
}

.btn.danger { color: var(--danger-text); }
.btn.danger:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.ghost:hover {
  background: var(--surface-2);
  border-color: var(--line);
}

.btn.sm {
  min-height: 34px;
  padding: 7px 15px;
  font-size: 12.5px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
  font-size: 15px;
  flex-shrink: 0;
}
.icon-btn:hover {
  color: var(--danger-text);
  background: var(--danger-soft);
}

.add-row-btn {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px dashed var(--line-strong);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.add-row-btn:hover {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  border-style: solid;
}

.text-btn {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0;
  transition: color 0.15s;
}
.text-btn:hover { color: var(--warn-text); }
.text-btn.undo:hover { color: var(--text); }
.text-btn.video { color: var(--ok-text); }
.text-btn.video:hover { color: var(--ok-text); text-decoration: underline; }

/* ---------- 8. sidebar de alumnos ---------- */
.new-student { display: flex; gap: 8px; }
.new-student input { flex: 1; min-width: 0; }

.student-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.student-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 15px 17px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.student-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.student-card.active {
  border-color: var(--accent-dim);
  background: var(--accent-soft);
}
.student-card .name { font-weight: 600; font-size: 15px; }
.student-card .meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12px;
}
.student-card .meta .issues { color: var(--warn-text); font-weight: 600; }

.mini-bar {
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
  flex: 1;
}
.mini-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width 0.35s var(--ease);
}

/* ---------- 9. editor ---------- */
.empty-state {
  height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state .big {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(38px, 7vw, 78px);
  color: var(--surface-3);
  line-height: 1;
  letter-spacing: -0.04em;
}

.editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.editor-head .who {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.editor-head input.student-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.035em;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 10px;
  margin-left: -10px;
  border-radius: var(--r-field);
  max-width: 100%;
}
.editor-head input.student-name:hover { border-color: var(--line); }
.editor-head input.student-name:focus {
  border-color: var(--focus);
  background: var(--surface);
}

.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.link-chip {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 8px 16px;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* ---------- 10. meses (macro ciclos) y semanas ---------- */
.macro-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 4px 0 12px;
}
.macro-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13.5px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.macro-tab:hover { color: var(--text); border-color: var(--line-strong); }
.macro-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--text);
  font-weight: 700;
}
.macro-tab .macro-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
}
.macro-tab.active .macro-count { background: var(--surface); color: var(--text-muted); }
.macro-tab.add { border-style: dashed; }

.macro-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.macro-bar:empty { display: none; }
.macro-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  font-weight: 600;
}
.macro-field.grow { flex: 1 1 220px; min-width: 0; }
.macro-actions { display: flex; gap: 8px; margin-left: auto; }
.macro-actions .btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.move-week {
  width: auto;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.macro-archived {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.macro-archived:first-child { border-top: 0; padding-top: 2px; }
.macro-archived .muted { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

.week-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin: 4px 0 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px;
  width: fit-content;
  max-width: 100%;
}
.week-tab {
  padding: 9px 18px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  transition: color 0.15s, background 0.15s;
}
.week-tab:hover { color: var(--text); }
.week-tab.active {
  background: var(--accent);
  border-color: var(--accent-border);
  color: var(--accent-ink);
  font-weight: 700;
}

.week-actions {
  display: flex;
  gap: 8px;
  margin: 8px 0 32px;
  flex-wrap: wrap;
}

/* ---------- 11. bloque de día ---------- */
.day-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.day-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.day-head input.day-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.025em;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 10px;
  margin-left: -10px;
  width: 190px;
}
.day-head input.day-name:hover { border-color: var(--line); }
.day-head input.day-name:focus { border-color: var(--focus); }
.day-head .spacer { flex: 1; }

.day-progress {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: var(--r-pill);
  padding: 5px 13px;
  white-space: nowrap;
}
.day-progress b { color: var(--text); font-weight: 700; }

.day-foot {
  padding: 12px 20px 16px;
  display: flex;
  gap: 10px;
}

/* ---------- 12. tabla de ejercicios ---------- */
.ex-table {
  width: 100%;
  border-collapse: collapse;
}
.ex-table th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 12px 8px 6px;
}
.ex-table td { padding: 3px 8px; vertical-align: middle; }
.ex-table tr td:first-child,
.ex-table tr th:first-child { padding-left: 20px; }
.ex-table tr td:last-child,
.ex-table tr th:last-child { padding-right: 14px; }
.ex-table input {
  width: 100%;
  background: transparent;
  border-color: transparent;
  padding: 8px 10px;
  border-radius: var(--r-sm);
}
.ex-table input:hover { border-color: var(--line); }
.ex-table input:focus {
  border-color: var(--focus);
  background: var(--surface-2);
}
.ex-table .col-name { min-width: 220px; }
.ex-table .col-s { width: 68px; }
.ex-table .col-m { width: 108px; }
.ex-table .col-status { width: 34px; text-align: center; }
.ex-table .col-x { width: 38px; }

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
}
.status-dot.done {
  background: var(--accent);
  border-color: var(--accent-dim);
}
.status-dot.issue {
  background: var(--warn);
  border-color: var(--warn);
}

/* ---------- 13. actividad ---------- */
.activity {
  margin-top: 36px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.activity h3 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.activity-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.activity-item .when {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.activity-item .what b { color: var(--warn-text); }
.activity-item.done .what b { color: var(--ok-text); }
.activity-item .comment { color: var(--text-muted); margin-top: 3px; }
.activity-empty { color: var(--text-muted); font-size: 13.5px; }
.activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.activity-head h3 { margin-bottom: 0; }

/* resumen que queda cuando el profesor limpia el historial */
.archive-box { margin: 20px 0 0; }
.archive-box summary .count { color: var(--text-faint); margin-left: 6px; letter-spacing: 0.04em; }
.archive-body { padding: 0 20px 18px; }
.archive-entry {
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.archive-entry:first-child { border-top: 0; padding-top: 2px; }
.archive-when {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.archive-total { font-weight: 600; }
.archive-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}
.archive-cols .eyebrow { color: var(--text-faint); margin-bottom: 6px; }
.archive-lines { list-style: none; display: grid; gap: 5px; margin: 0; padding: 0; }
.archive-lines li { color: var(--text-muted); font-size: 13px; }
.archive-lines b { color: var(--text); font-weight: 600; }
.archive-entry .muted { color: var(--text-faint); }

/* ---------- 14. savebar y toast ---------- */
.savebar {
  position: fixed;
  bottom: 22px;
  right: 28px;
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 9px 10px 9px 20px;
  box-shadow: var(--shadow-pop);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s var(--ease);
  z-index: 40;
}
.savebar.show {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.savebar .hint { color: var(--text-muted); font-size: 13px; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translate(-50%, 12px);
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent-border);
  font-weight: 700;
  font-size: 13.5px;
  padding: 12px 22px;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s var(--ease);
  z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   vista del alumno
   ============================================================ */
.student-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 26px 20px 96px;
}
.student-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero { margin: 30px 0 10px; }
.hero .hello {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 11px;
  font-weight: 600;
}
.hero h1 {
  font-size: clamp(40px, 9vw, 68px);
  font-weight: 300;
  line-height: 0.98;
  letter-spacing: -0.045em;
  margin-top: 10px;
}
.hero h1 .accent {
  color: var(--ok-text);
  font-weight: 500;
}

.progress-line {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 24px 0 26px;
}
.progress-line .bar {
  flex: 1;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.progress-line .bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width 0.45s var(--ease);
}
.progress-line .pct {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.03em;
  min-width: 54px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* puntaje */
.score-row {
  display: flex;
  gap: 10px;
  margin: 22px 0 4px;
  flex-wrap: wrap;
}
.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 9px 19px;
  font-size: 14px;
  color: var(--text);
  box-shadow: var(--shadow-card);
}
.score-chip b {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.score-chip .star { color: var(--accent-dim); }
.score-chip.alt { border-color: var(--line); }

/* selectores */
.selector-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 26px;
}
/* el mes al que pertenecen las semanas que ve el alumno */
.month-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.pills::-webkit-scrollbar { display: none; }
.pill {
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.pill:hover {
  color: var(--text);
  border-color: var(--line-strong);
}
.pill.active {
  background: var(--accent);
  border-color: var(--accent-border);
  color: var(--accent-ink);
  font-weight: 700;
}
.pill.day.complete:not(.active) {
  color: var(--ok-text);
  border-color: var(--ok);
}
.pill.day.complete:not(.active)::after { content: ' ✓'; }

/* tarjetas de ejercicio */
.ex-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ex-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 17px 19px;
  display: flex;
  gap: 15px;
  align-items: flex-start;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, opacity 0.2s;
  animation: rise 0.35s var(--ease) backwards;
}
.ex-card:nth-child(1) { animation-delay: 0.02s; }
.ex-card:nth-child(2) { animation-delay: 0.05s; }
.ex-card:nth-child(3) { animation-delay: 0.08s; }
.ex-card:nth-child(4) { animation-delay: 0.11s; }
.ex-card:nth-child(5) { animation-delay: 0.14s; }
.ex-card:nth-child(6) { animation-delay: 0.17s; }
.ex-card:nth-child(7) { animation-delay: 0.2s; }
.ex-card:nth-child(8) { animation-delay: 0.23s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.ex-card.done { border-color: var(--accent-dim); }
.ex-card.done .ex-name {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--accent-dim);
}
.ex-card.issue { border-color: var(--warn-border); }

.check-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  margin-top: 1px;
  color: transparent;
  font-size: 17px;
  font-weight: 800;
}
.check-btn:hover { border-color: var(--accent-dim); }
.ex-card.done .check-btn {
  background: var(--accent);
  border-color: var(--accent-dim);
  color: var(--accent-ink);
  animation: pop 0.25s var(--bounce);
}
@keyframes pop { 0% { transform: scale(0.7); } 100% { transform: scale(1); } }

.ex-body { flex: 1; min-width: 0; }
.ex-name {
  font-weight: 600;
  font-size: 15.5px;
  transition: color 0.2s;
}
.ex-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  color: var(--text-muted);
}
.ex-meta b {
  color: var(--text);
  font-weight: 700;
  font-size: 12.5px;
}
.ex-notes {
  margin-top: 9px;
  font-size: 13px;
  color: var(--warn-text);
}

.ex-actions {
  margin-top: 12px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.issue-box {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.issue-box textarea { resize: vertical; min-height: 64px; }
.issue-box .row { display: flex; gap: 8px; }

.issue-note {
  margin-top: 11px;
  font-size: 13px;
  color: var(--warn-text);
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-radius: var(--r-field);
  padding: 9px 14px;
}

.pts-tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-pill);
  padding: 2px 10px;
  vertical-align: 2px;
  animation: pop 0.25s var(--bounce);
}
.pts-tag.issue {
  background: var(--warn);
  color: #161514;
  border-color: transparent;
}
.ex-card.done .ex-name .pts-tag { text-decoration: none; }

.video-box {
  margin-top: 12px;
  border-radius: var(--r-field);
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 16 / 9;
  animation: rise 0.3s backwards;
}
.video-box iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.video-box.link {
  aspect-ratio: auto;
  padding: 13px 17px;
  background: var(--surface-2);
}

/* cierre del día */
.day-done-banner {
  margin-top: 24px;
  text-align: center;
  padding: 30px 20px;
  border: 1px dashed var(--accent-dim);
  border-radius: var(--r-panel);
  background: var(--accent-soft);
  animation: rise 0.4s backwards;
}
.day-done-banner .trophy {
  font-size: 42px;
  animation: pop 0.4s var(--bounce);
}
.day-done-banner .display {
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
}
.day-done-banner .bonus {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ok-text);
}
.day-done-banner p {
  color: var(--text-muted);
  margin: 6px 0 0;
  font-size: 13.5px;
}
.day-done-banner .sub { font-size: 12px; color: var(--text-faint); }

.rest-day {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
}
.rest-day .display {
  font-size: 30px;
  font-weight: 300;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.footer-note {
  margin-top: 44px;
  text-align: center;
  color: var(--text-faint);
}

/* ============================================================
   catálogo de ejercicios y panel de admin
   ============================================================ */
.exercises-view .main { max-width: 1000px; }
.exercises-view.wide .main { max-width: none; }

.ex-view-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 300;
  letter-spacing: -0.04em;
}
.ex-view-sub {
  color: var(--text-muted);
  font-size: 13.5px;
  max-width: 580px;
  margin: 10px 0 0;
}

.new-exercise {
  display: grid;
  grid-template-columns: 1fr 170px 1fr auto;
  gap: 8px;
  margin: 20px 0 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 14px;
  box-shadow: var(--shadow-card);
}
.new-exercise.teacher-form { grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr auto; }

/* Los inputs traen un ancho intrínseco (~20 caracteres) que en grid actúa como
   mínimo y desborda la fila. min-width:0 los deja encogerse con la columna. */
.new-exercise input,
.new-exercise select,
.catalog-row input,
.catalog-row select { min-width: 0; }

.muscle-group { margin-bottom: 26px; }
.muscle-group h3 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.muscle-group h3 .count {
  color: var(--text-faint);
  margin-left: 6px;
  letter-spacing: 0.04em;
}

.catalog-row {
  display: grid;
  grid-template-columns: 1fr 170px 1fr 30px 32px;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.catalog-row input,
.catalog-row select {
  background: transparent;
  border-color: transparent;
}
.catalog-row input:hover,
.catalog-row select:hover { border-color: var(--line); }
.catalog-row input:focus,
.catalog-row select:focus {
  border-color: var(--focus);
  background: var(--surface-2);
}
.catalog-row .c-video { font-size: 12.5px; color: var(--text-muted); }

.video-ok {
  text-align: center;
  color: var(--ok-text);
  font-size: 13px;
  text-decoration: none;
}
.video-ok:hover { text-decoration: none; }
.video-ok.off { color: var(--text-faint); }

/* filas de admin */
/* Mínimos ajustados para que la fila entre en un teléfono en horizontal
   (~830px de ancho útil) sin obligar a scrollear al costado. */
.admin-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.2fr) minmax(150px, 1.6fr) minmax(90px, 1fr) 70px 100px minmax(150px, auto);
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.admin-row.head {
  color: var(--text-muted);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  border-bottom-color: var(--line-strong);
}
.admin-row .muted {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-row .row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}
.row-suspended > span:not(.row-actions) { opacity: 0.5; }

.badge-active {
  display: inline-block;
  color: var(--ok-text);
  background: var(--ok-soft);
  border-radius: var(--r-pill);
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 600;
}
.badge-suspended {
  display: inline-block;
  color: var(--danger-text);
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: var(--r-pill);
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}

.finance-controls {
  display: flex;
  gap: 22px;
  align-items: center;
  flex-wrap: wrap;
  margin: 20px 0 24px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-card);
  color: var(--text-muted);
  font-size: 13.5px;
}
.finance-controls input[type='month'],
.finance-controls input[type='number'] {
  margin-left: 8px;
  padding: 8px 12px;
}
.finance-controls input[type='number'] { width: 120px; }

.admin-row.finance-row { grid-template-columns: minmax(180px, 1.6fr) 110px 150px 110px; }
.finance-row input[type='checkbox'] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}
.finance-total { font-weight: 700; }
.hist-row { cursor: pointer; }
.hist-row:hover { background: var(--surface-2); }

/* ficha del alumno */
.ficha {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}
.ficha summary {
  cursor: pointer;
  padding: 15px 20px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  list-style: none;
  transition: color 0.15s;
}
.ficha summary::-webkit-details-marker { display: none; }
.ficha summary::before { content: '▸ '; color: var(--ok-text); }
.ficha[open] summary::before { content: '▾ '; }
.ficha summary:hover { color: var(--text); }
.ficha-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 4px 20px 20px;
}
.ficha-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  font-weight: 600;
}
.ficha-grid .wide { grid-column: 1 / -1; }
.ficha-grid textarea { resize: vertical; min-height: 58px; }

/* ============================================================
   badge de la navegación
   ============================================================ */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--warn);
  color: #161514;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.nav-tab.active .nav-badge {
  background: var(--accent-ink);
  color: var(--accent);
}

/* ============================================================
   chips de estado
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: var(--r-pill);
  padding: 3px 11px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-muted);
  white-space: nowrap;
}
.chip-pending {
  background: var(--warn-soft);
  border-color: var(--warn-border);
  color: var(--warn-text);
}
.chip-rejected {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger-text);
}
.chip-ok {
  background: var(--ok-soft);
  border-color: transparent;
  color: var(--ok-text);
}

.link-btn {
  font: inherit;
  font-weight: 700;
  color: var(--text);
  text-align: left;
  padding: 0;
  border-radius: 4px;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.link-btn:hover { text-decoration-color: var(--accent-dim); }

.hint-text {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-faint);
}

/* ============================================================
   formularios en panel (detalle de profesor, datos de pago)
   ============================================================ */
.panel-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 22px;
  margin-bottom: 26px;
  box-shadow: var(--shadow-card);
}
.panel-title {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.field-grid label,
.wide-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}
.wide-field {
  margin-top: 14px;
}
.wide-field textarea { resize: vertical; min-height: 60px; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.pay-method {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 16px 18px;
  margin: 0 0 14px;
}
.pay-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.pay-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ============================================================
   bandeja de aprobaciones
   ============================================================ */
.approval-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 16px 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-card);
}
.approval-name { font-weight: 700; font-size: 15px; }
.approval-meta {
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.approval-meta b { color: var(--text); }
.approval-actions { display: flex; gap: 8px; }

.resolved-row {
  grid-template-columns: 1fr 1fr auto;
  font-size: 13.5px;
}

/* ============================================================
   sugerencia de categoría (profesor)
   ============================================================ */
.suggest-body { padding: 4px 20px 20px; }
.suggest-body .ex-view-sub { margin-bottom: 14px; }
.suggest-form {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 8px;
}
.suggest-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.suggest-item {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  font-size: 13px;
}

/* estados en el catálogo */
.catalog-row.is-pending,
.catalog-row.is-rejected { position: relative; }
.catalog-row.is-rejected input,
.catalog-row.is-rejected select { opacity: 0.55; }
.catalog-status {
  grid-column: 1 / -1;
  padding: 2px 0 6px;
}
.icon-btn.is-locked {
  cursor: default;
  font-size: 12px;
  opacity: 0.5;
}
.icon-btn.is-locked:hover { background: none; color: var(--text-muted); }

/* ============================================================
   agenda semanal en la ficha del alumno
   ============================================================ */
.schedule-block { display: flex; flex-direction: column; gap: 10px; }
.schedule-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}
.schedule-count {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--ok-text);
}
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
}
.schedule-day {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  padding: 10px;
  background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
}
.schedule-day.on {
  border-color: var(--accent-dim);
  background: var(--accent-soft);
}
.day-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  cursor: pointer;
}
.day-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.schedule-day .day-time {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
}
.schedule-day .day-time:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================
   aviso de cobro del profesor
   ============================================================ */
.billing-banner {
  margin: 18px 28px 0;
  background: var(--surface);
  border: 1px solid var(--accent-dim);
  border-radius: var(--r-panel);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
}
.billing-banner.is-paid { border-color: var(--line); }

.billing-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.billing-amount {
  font-family: var(--font-display);
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin-top: 6px;
}
.billing-detail {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--text-muted);
}
.billing-detail b { color: var(--text); }
.billing-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.billing-students { margin-top: 16px; }
.billing-students summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.billing-students summary:hover { color: var(--text); }
.billing-students ul {
  list-style: none;
  margin: 12px 0 8px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px;
}
.billing-students li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 7px 12px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
}
.billing-students .muted { color: var(--text-muted); font-size: 12px; }

.pay-methods {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.pay-methods .eyebrow { color: var(--text-muted); display: block; margin-bottom: 12px; }
.pay-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.pay-card {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 15px 17px;
  background: var(--surface-2);
}
.pay-card-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}
.pay-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 4px 0;
  color: var(--text-muted);
}
.pay-line b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
  text-align: right;
}
.pay-card .btn { margin-top: 10px; width: 100%; }
.pay-notes {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* filas de alumnos en el detalle de profesor */
.admin-row.student-row {
  grid-template-columns: minmax(160px, 1.6fr) 120px 90px minmax(140px, 1fr) 100px;
}
.admin-row.student-row .issues { color: var(--warn-text); font-size: 12px; font-weight: 600; }
.admin-row.student-row .mini-bar {
  display: inline-block;
  width: 70px;
  vertical-align: middle;
  margin-right: 8px;
}

/* ============================================================
   responsive
   ============================================================ */
/* Entre tablet y teléfono horizontal, el alta de profesor pasa a dos columnas:
   seis campos en una línea quedan ilegibles antes de desbordar. */
@media (max-width: 1000px) {
  .new-exercise.teacher-form { grid-template-columns: repeat(2, 1fr); }
  .new-exercise.teacher-form button { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .main { padding: 22px 16px 96px; }
  .new-exercise,
  .catalog-row { grid-template-columns: 1fr; }
  .catalog-row { padding: 12px 0; }
  .ficha-grid { grid-template-columns: 1fr 1fr; }
  .macro-actions { margin-left: 0; width: 100%; }
  .macro-actions .btn { flex: 1; }
  .archive-cols { grid-template-columns: 1fr; }
  .archive-body { padding: 0 16px 16px; }
  .savebar { right: 16px; left: 16px; justify-content: space-between; }

  /* el encabezado del día no entra en una línea: que baje en vez de que el
     bloque lo recorte y deje el contador y la ✕ fuera de alcance */
  .day-head { flex-wrap: wrap; row-gap: 10px; }
  .day-head input.day-name {
    width: auto;
    flex: 1 1 100%;
    min-width: 0;
  }
  /* el spacer empuja contador y ✕ al margen derecho de la segunda línea */
  .day-head .spacer { flex: 1; }

  /* La tabla de ejercicios tiene 9 columnas: a este ancho se convierte en
     una tarjeta apilada por ejercicio, así no hay scroll horizontal ni zoom. */
  .ex-table,
  .ex-table tbody,
  .ex-table tr,
  .ex-table td { display: block; }
  .ex-table thead { display: none; }

  .ex-table tbody {
    padding: 4px 14px 2px;
  }
  /* Flex en vez de grid: así el nombre del ejercicio se queda con todo el
     ancho sobrante de su línea en lugar de una fracción fija. Cada grupo
     suma 100%, por lo que cae solo en su propia línea. */
  .ex-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 8px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    padding: 13px 14px;
    margin-bottom: 10px;
  }
  .ex-table td { padding: 0; }
  /* anula el padding lateral de la tabla de escritorio, que tiene más
     especificidad y le sumaba 34px de ancho a la primera y última celda */
  .ex-table tr td:first-child,
  .ex-table tr th:first-child { padding-left: 0; }
  .ex-table tr td:last-child,
  .ex-table tr th:last-child { padding-right: 0; }

  /* línea 1: estado · nombre · quitar.
     Las bases suman exactamente el 100% de la línea (más los dos gaps de 8px),
     así los tres entran juntos y los campos numéricos bajan a la línea 2. */
  /* El botón de quitar es el último <td> del DOM, así que hace falta `order`
     para subirlo a la primera línea: flex arma las líneas en orden. */
  .ex-table td.col-status { order: 1; flex: 0 0 14px; width: auto; text-align: left; }
  .ex-table td.c-ex { order: 2; flex: 1 1 calc(100% - 70px); min-width: 0; }
  .ex-table td.col-x { order: 3; flex: 0 0 32px; width: auto; }

  /* línea 2: series · reps · recupero */
  .ex-table td[data-label]:nth-child(3),
  .ex-table td[data-label]:nth-child(4),
  .ex-table td[data-label]:nth-child(5) { order: 4; flex: 1 1 calc(33.333% - 6px); }
  /* línea 3: carga · rir */
  .ex-table td[data-label]:nth-child(6),
  .ex-table td[data-label]:nth-child(7) { order: 5; flex: 1 1 calc(50% - 4px); }
  /* línea 4: salvedades */
  .ex-table td[data-label]:nth-child(8) { order: 6; flex: 1 1 100%; }

  .ex-table td[data-label] {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
  }
  .ex-table td[data-label]::before {
    content: attr(data-label);
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
  }

  /* en tarjeta los campos se ven como campos, no como texto suelto */
  .ex-table input {
    background: var(--surface);
    border-color: var(--line);
    padding: 9px 10px;
  }
  .ex-table td.c-ex input { font-weight: 600; }

  .day-foot { padding: 4px 14px 14px; }
}

/* menú en mobile: marca + acciones arriba, pestañas deslizables abajo */
@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
    padding: 10px 16px;
    row-gap: 4px;
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--bg);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
  .brand-logo { height: 24px; }
  .brand-sub { font-size: 10px; letter-spacing: 0.12em; }
  .topnav {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-radius: var(--r-pill);
  }
  .topnav::-webkit-scrollbar { display: none; }
  .nav-tab {
    padding: 8px 15px;
    font-size: 12.5px;
    flex-shrink: 0;
  }
}

@media (max-width: 720px) {
  .new-exercise.teacher-form { grid-template-columns: 1fr; }
  .suggest-form { grid-template-columns: 1fr; }
  .billing-banner { margin: 14px 16px 0; padding: 18px; }
  .approval-card { flex-direction: column; align-items: stretch; }
  .approval-actions .btn { flex: 1; }
  .admin-row.head { display: none; }

  /* fila de alumno en el detalle de profesor: nombre arriba, datos debajo */
  .admin-row.student-row {
    grid-template-columns: 1fr auto;
    row-gap: 6px;
    padding: 14px 0;
  }
  .admin-row.student-row > :nth-child(1) { grid-column: 1 / -1; }
  .admin-row.student-row > :nth-child(2) { grid-column: 1; }
  .admin-row.student-row > :nth-child(3) { grid-column: 2; justify-self: end; }
  .admin-row.student-row > :nth-child(4) { grid-column: 1; }
  .admin-row.student-row > :nth-child(5) { grid-column: 2; justify-self: end; }

  .admin-row.resolved-row {
    grid-template-columns: 1fr auto;
    row-gap: 4px;
    padding: 12px 0;
  }
  .admin-row.resolved-row > :nth-child(2) { grid-column: 1; }
  .admin-row.resolved-row > :nth-child(3) { grid-column: 2; justify-self: end; }
  .admin-row [data-label]::before {
    content: attr(data-label) ': ';
    color: var(--text-muted);
    font-size: 12px;
  }

  /* fila de profesor como tarjeta */
  .admin-row:not(.finance-row):not(.student-row):not(.resolved-row) {
    grid-template-columns: 1fr auto;
    row-gap: 6px;
    padding: 14px 0;
  }
  .admin-row:not(.finance-row):not(.student-row):not(.resolved-row) > span:nth-child(1) { grid-column: 1; grid-row: 1; }
  .admin-row:not(.finance-row):not(.student-row):not(.resolved-row) > span:nth-child(5) { grid-column: 2; grid-row: 1; justify-self: end; }
  .admin-row:not(.finance-row):not(.student-row):not(.resolved-row) > span:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .admin-row:not(.finance-row):not(.student-row):not(.resolved-row) > span:nth-child(3) { grid-column: 1; grid-row: 3; }
  .admin-row:not(.finance-row):not(.student-row):not(.resolved-row) > span:nth-child(4) { grid-column: 2; grid-row: 3; justify-self: end; }
  .admin-row:not(.finance-row):not(.student-row):not(.resolved-row) > .row-actions { grid-column: 1 / -1; grid-row: 4; margin-top: 4px; }

  /* filas de finanzas en dos líneas */
  .admin-row.finance-row {
    grid-template-columns: 1fr auto;
    row-gap: 6px;
    padding: 12px 0;
  }
  .finance-row > :nth-child(1) { grid-column: 1; grid-row: 1; }
  .finance-row > :nth-child(4) { grid-column: 2; grid-row: 1; justify-self: end; }
  .finance-row > :nth-child(2) { grid-column: 1; grid-row: 2; }
  .finance-row > :nth-child(3) { grid-column: 2; grid-row: 2; justify-self: end; }

  .finance-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .finance-controls label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .finance-controls input[type='month'] { flex: 1; max-width: 220px; }
}

/* ---------- accesibilidad: movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
