/* ============================================================
   Malla UTESA — hoja de estilos principal
   Tipografía: Space Grotesk (display) + Inter (texto) + JetBrains Mono (claves)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

/* El navegador no debe oscurecer la página por su cuenta (modo oscuro forzado):
   los temas claros se declaran "only light"; los oscuros, "dark" (son decisión del usuario). */
:root { color-scheme: only light; }
[data-theme="medianoche"], [data-theme="violeta"] { color-scheme: dark; }

/* ---------- Tokens de tema ---------- */
:root, [data-theme="utesa"] {
  --bg: #F7F8F5;
  --bg-soft: #EFF2EA;
  --card: #FFFFFF;
  --text: #1B2318;
  --muted: #5B6B5F;
  --primary: #00542B;
  --primary-dark: #003D1F;
  --primary-soft: #E3EDE5;
  --accent: #C89B3C;
  --border: #DDE3D8;
  --danger: #C7402C;
  --success: #1E7A44;
  --shadow: 0 12px 30px rgba(12, 30, 18, 0.08);
}

[data-theme="medianoche"] {
  --bg: #0B1220;
  --bg-soft: #101A2E;
  --card: #141B2E;
  --text: #E7ECF7;
  --muted: #8792AA;
  --primary: #5B8DEF;
  --primary-dark: #3E6BD1;
  --primary-soft: #1C2740;
  --accent: #F2B84B;
  --border: #223052;
  --danger: #F0637A;
  --success: #57C97E;
  --shadow: 0 12px 30px rgba(0,0,0,0.45);
}

[data-theme="atardecer"] {
  --bg: #FFF6ED;
  --bg-soft: #FDEBDA;
  --card: #FFFFFF;
  --text: #3B1F12;
  --muted: #8A6650;
  --primary: #E85D2C;
  --primary-dark: #C4471C;
  --primary-soft: #FCE3D2;
  --accent: #FFB627;
  --border: #F3D9C4;
  --danger: #C7402C;
  --success: #3E8C5A;
  --shadow: 0 12px 30px rgba(184, 92, 30, 0.14);
}

[data-theme="oceano"] {
  --bg: #EFF7F9;
  --bg-soft: #E1F1F2;
  --card: #FFFFFF;
  --text: #0C2B2E;
  --muted: #4E7679;
  --primary: #0E7C86;
  --primary-dark: #0A5D65;
  --primary-soft: #DCF0F1;
  --accent: #21B0A6;
  --border: #CDE7E9;
  --danger: #C7402C;
  --success: #1E7A44;
  --shadow: 0 12px 30px rgba(14, 124, 134, 0.12);
}

[data-theme="violeta"] {
  --bg: #150F26;
  --bg-soft: #1B1433;
  --card: #1F1638;
  --text: #EDE7FB;
  --muted: #9A8FC2;
  --primary: #8B6FEA;
  --primary-dark: #6E51D6;
  --primary-soft: #2A2049;
  --accent: #E85DA0;
  --border: #34275A;
  --danger: #F0637A;
  --success: #57C97E;
  --shadow: 0 12px 30px rgba(0,0,0,0.5);
}

[data-theme="coral"] {
  --bg: #FFF4F5;
  --bg-soft: #FDE6E9;
  --card: #FFFFFF;
  --text: #3A1420;
  --muted: #8A5A66;
  --primary: #E23F63;
  --primary-dark: #B92E4E;
  --primary-soft: #FBDDE3;
  --accent: #FF8FA3;
  --border: #F6D3DA;
  --danger: #C7402C;
  --success: #3E8C5A;
  --shadow: 0 12px 30px rgba(226, 63, 99, 0.14);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  transition: background .25s ease, color .25s ease;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, .display {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.01em;
}
.mono { font-family: 'JetBrains Mono', monospace; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--primary); color: #fff; }

/* focus visibility */
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Layout helpers ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.muted { color: var(--muted); }
.hidden { display: none !important; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border-radius: 12px; border: none;
  font-weight: 600; font-size: 14.5px; transition: transform .12s ease, box-shadow .12s ease, background .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-danger-text { background: transparent; color: var(--danger); border: none; font-weight: 700; }

.field-label { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; display: block; }
.input, select.input {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--bg-soft); color: var(--text); font-size: 15px; font-family: inherit;
  transition: border-color .15s ease, background .15s ease;
}
.input:focus { border-color: var(--primary); background: var(--card); outline: none; }
.input::placeholder { color: var(--muted); }

/* ---------- Dropdown de carreras (select estilizado) ---------- */
.select-wrap { position: relative; }
.select-wrap select.input {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-left: 46px; padding-right: 38px; cursor: pointer;
}
.select-wrap select.input:disabled { cursor: not-allowed; opacity: .65; }
.select-badge {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 7px; background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 9px; color: #fff;
  pointer-events: none; transition: background .15s ease; letter-spacing: .02em;
}
.select-chevron {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--muted); width: 16px; height: 16px;
}
.select-hint { font-size: 12.5px; color: var(--muted); margin-top: 7px; line-height: 1.5; }

/* ---------- Top brand / disclaimer strip ---------- */
.disclaimer-strip {
  background: var(--primary-dark);
  color: #fff;
  font-size: 12.5px;
  text-align: center;
  padding: 8px 16px;
  font-weight: 500;
  letter-spacing: .01em;
}
.disclaimer-strip strong { font-weight: 700; }

/* ============================================================
   AUTH / LOGIN PAGE
   ============================================================ */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}
.auth-visual {
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 45%),
    linear-gradient(160deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-visual::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 70% 30%, black, transparent 70%);
}
.auth-visual-top { position: relative; z-index: 1; }
.auth-visual-top .tag {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .08em;
  background: rgba(255,255,255,.14); padding: 6px 12px; border-radius: 999px; text-transform: uppercase;
}
.auth-visual h1 { font-size: 42px; line-height: 1.08; margin: 22px 0 14px; max-width: 460px; }
.auth-visual p { font-size: 15.5px; opacity: .85; max-width: 420px; line-height: 1.6; }
.auth-mesh {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; max-width: 320px;
}
.auth-mesh i { display: block; aspect-ratio: 1; border-radius: 4px; background: rgba(255,255,255,.16); }
.auth-mesh i:nth-child(3n) { background: rgba(255,255,255,.32); }
.auth-mesh i:nth-child(5n) { background: var(--accent); }
.auth-visual-bottom { position: relative; z-index: 1; font-size: 13px; opacity: .75; }

.auth-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
}
.auth-box { width: 100%; max-width: 420px; }
.auth-box .kicker { font-size: 12.5px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .07em; }
.auth-box h2 { font-size: 27px; margin: 8px 0 4px; }
.auth-box .sub { color: var(--muted); font-size: 14.5px; margin-bottom: 28px; }

.tabs { display: flex; gap: 4px; background: var(--bg-soft); padding: 4px; border-radius: 12px; margin-bottom: 26px; }
.tab-btn {
  flex: 1; padding: 10px; border: none; background: transparent; border-radius: 9px;
  font-weight: 600; font-size: 14px; color: var(--muted); transition: all .15s ease;
}
.tab-btn.tab-active { background: var(--card); color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.06); }

.field { margin-bottom: 16px; }
.err-box {
  display: none; margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger);
  font-size: 13.5px; font-weight: 600; border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
}
.err-box.show { display: block; }
.hint-box {
  display: none; margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary-dark); font-size: 13px; font-weight: 500;
}
.hint-box.show { display: block; }
.pw-req { font-size: 12px; color: var(--muted); margin-top: 6px; }

.link-btn {
  background: none; border: none; padding: 0; margin: -6px 0 14px;
  color: var(--primary); font-size: 12.5px; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px; display: inline-block;
}
.link-btn:hover { color: var(--primary-dark); }
.link-btn:disabled { opacity: .6; cursor: default; text-decoration: none; }

.footer-note { text-align: center; margin-top: 28px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.profile-box { width: 100%; max-width: 520px; padding: 40px; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.dash-header-inner {
  max-width: 1180px; margin: 0 auto; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}

.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--card);
  display: flex; align-items: center; justify-content: center; color: var(--text);
  transition: background .15s ease;
}
.icon-btn:hover { background: var(--bg-soft); }

/* Theme picker popover */
.theme-pop {
  position: absolute; right: 24px; top: calc(100% + 8px); z-index: 30;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 14px; width: 240px; display: none;
}
.theme-pop.show { display: block; }
.theme-pop .title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 4px 6px 10px; }
.theme-swatch {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px;
  background: transparent; border: 1.5px solid transparent; text-align: left; margin-bottom: 4px;
}
.theme-swatch:hover { background: var(--bg-soft); }
.theme-swatch.theme-active { border-color: var(--primary); background: var(--primary-soft); }
.theme-dots { display: flex; gap: 3px; }
.theme-dots i { width: 12px; height: 12px; border-radius: 50%; display: block; border: 1px solid rgba(0,0,0,.08); }
.theme-label { font-size: 13.5px; font-weight: 600; }

/* Popover de comparación de carreras */
.compare-pop { width: 300px; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 10px; }
.compare-table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; padding: 4px 6px 8px;
}
.compare-table td { padding: 7px 6px; border-top: 1px solid var(--border); font-weight: 600; }
.compare-table tr.compare-current td { color: var(--primary); }
.compare-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.compare-name { font-family: 'JetBrains Mono', monospace; }
.compare-tag {
  margin-left: 6px; font-family: 'Inter', sans-serif; font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--primary);
  background: var(--primary-soft); padding: 2px 6px; border-radius: 999px;
}
.compare-titles { font-size: 11px; color: var(--muted); line-height: 1.6; border-top: 1px solid var(--border); padding-top: 8px; }
.compare-titles strong { color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 10.5px; }

/* Hero / progress */
.dash-hero { max-width: 1180px; margin: 0 auto; padding: 28px 24px 8px; }
.hero-grid { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
@media (max-width: 800px) { .hero-grid { grid-template-columns: 1fr; } }

.progress-card { padding: 26px; text-align: center; }
.ring-wrap { position: relative; width: 148px; height: 148px; margin: 0 auto 14px; }
.ring-wrap svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--bg-soft); stroke-width: 10; }
.ring-fg { fill: none; stroke: var(--primary); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center .pct { font-size: 30px; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.ring-center .lbl { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.progress-card .stat-line { font-size: 13px; color: var(--muted); margin-top: 4px; }

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 560px) { .stats-row { grid-template-columns: 1fr; } }
.stat-box { padding: 20px; }
.stat-box .num { font-size: 26px; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.stat-box .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-box .credits-bar-track { height: 6px; border-radius: 4px; background: var(--bg-soft); margin-top: 10px; overflow: hidden; }
.stat-box .credits-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .5s ease; }

/* Toolbar */
.toolbar {
  max-width: 1180px; margin: 22px auto 0; padding: 0 24px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
}
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.search-box input { padding-left: 40px; }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--card);
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.chip.chip-active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* Malla grid */
.malla-wrap { max-width: 1180px; margin: 24px auto 60px; padding: 0 24px; }
.cuatri-block { margin-bottom: 34px; }
.cuatri-head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.cuatri-head .num { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 20px; color: var(--primary); }
.cuatri-head .title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.cuatri-head .cnt { margin-left: auto; font-size: 12px; color: var(--muted); }

.materias-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }

.subject-card {
  position: relative;
  background: var(--card); border: 1.5px solid var(--border); border-radius: 14px;
  padding: 14px 14px 12px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 8px; min-height: 108px;
  transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease;
  overflow: hidden;
}
.subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); }
.subject-card .clave { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); font-weight: 600; }
.subject-card .nombre { font-size: 13.5px; font-weight: 600; line-height: 1.32; flex: 1; }
.subject-card .meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.subject-card .meta .cr { font-weight: 700; color: var(--text); }

.subject-card.done {
  background: var(--primary-soft); border-color: var(--primary);
}
.subject-card.done .clave, .subject-card.done .meta { color: var(--primary-dark); }
.subject-card.done .nombre { padding-right: 24px; }

.subject-card.locked { opacity: .55; cursor: not-allowed; }
.subject-card.locked:hover { transform: none; box-shadow: none; border-color: var(--border); }
.subject-card .lock-ico { position: absolute; top: 10px; right: 10px; color: var(--muted); }

/* Sello de aprobado — inspirado en los sellos oficiales de los documentos de pensum */
.sello {
  position: absolute; top: 6px; right: 6px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--primary); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  transform: rotate(-14deg) scale(0.9);
  opacity: 0; transition: opacity .2s ease, transform .2s ease;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 8px; text-align: center;
  letter-spacing: .02em; z-index: 2;
}
.subject-card.done .sello { opacity: .9; transform: rotate(-14deg) scale(1); }
.sello svg { width: 14px; height: 14px; }

.electivas-note {
  font-size: 12.5px; color: var(--muted); background: var(--bg-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px;
}

/* Empty search state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state svg { margin-bottom: 14px; opacity: .5; }

/* Prereq tooltip-ish detail on click could be added later; keep footer disclaimer */
.page-footer {
  text-align: center; padding: 30px 24px 50px; font-size: 12px; color: var(--muted); line-height: 1.7;
}

/* Toast for save confirmations */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s ease;
  z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Loading spinner */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.full-loader { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.full-loader .spinner-lg { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: spin .8s linear infinite; }

/* ---------- Google Login & Divider ---------- */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1.5px solid var(--border);
}
.auth-divider:not(:empty)::before {
  margin-right: 12px;
}
.auth-divider:not(:empty)::after {
  margin-left: 12px;
}

.btn-google {
  background: var(--card) !important;
  color: var(--text) !important;
  border: 1.5px solid var(--border) !important;
  box-shadow: none !important;
  transition: background .15s ease, border-color .15s ease !important;
}
.btn-google:hover {
  background: var(--bg-soft) !important;
  border-color: var(--muted) !important;
}

/* ============================================================
   MODO SELECCIÓN MÚLTIPLE (batch)
   ============================================================ */
/* ============================================================
   MODO SELECCIÓN MÚLTIPLE (banner + batch)
   ============================================================ */
.select-mode-banner {
  max-width: 1180px; margin: 20px auto 0; padding: 16px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--bg-soft); border: 1.5px dashed var(--border); border-radius: 16px;
  transition: background .2s ease, border-color .2s ease;
}
.select-mode-banner-icon {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1.5px solid var(--border); color: var(--muted);
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.select-mode-banner-text { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.select-mode-banner-text strong { font-size: 14.5px; }
.select-mode-banner-text span { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.select-mode-banner.active {
  background: var(--primary-soft); border: 1.5px solid var(--primary);
}
.select-mode-banner.active .select-mode-banner-icon {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.select-mode-banner .btn-ghost { background: var(--card); }

.icon-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.batch-bar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--card); border: 1.5px solid var(--primary); box-shadow: var(--shadow);
  border-radius: 14px; padding: 12px 14px 12px 18px; display: flex; align-items: center; gap: 18px;
  z-index: 90; font-size: 13.5px; font-weight: 600; max-width: calc(100vw - 32px);
}
.batch-bar.hidden { display: none; }

.subject-card.staged-add { border-color: var(--accent); border-width: 2px; }
.subject-card.staged-remove { border-color: var(--danger); border-width: 2px; }

/* ============================================================
   MODALES (configuración de perfil / confirmaciones)
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 15, 10, .55); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.hidden { display: none; }
.modal-box { width: 100%; max-width: 540px; max-height: 88vh; overflow-y: auto; padding: 26px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 19px; }

/* ============================================================

.btn-sm { padding: 9px 14px; font-size: 13px; }

/* Selector de vista (segmentado) */
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px; border: none; background: transparent;
  padding: 7px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.seg-btn.seg-active { background: var(--card); color: var(--primary); box-shadow: 0 1px 6px rgba(0,0,0,.08); }

/* ---------- Malla escalonada ---------- */
.malla-wrap.is-graph { max-width: none; padding: 0; }
.mg { --col-w: 188px; --col-gap: 40px; }
.mg-hint {
  max-width: 1180px; margin: 0 auto 10px; padding: 0 24px;
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 12px; color: var(--muted);
}
.mg-hint > span { display: inline-flex; align-items: center; gap: 6px; }
.mg-hint-tip { margin-left: auto; }
@media (max-width: 800px) { .mg-hint-tip { margin-left: 0; width: 100%; } }

.lg {
  width: 16px; height: 16px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 10px; font-weight: 800; flex-shrink: 0;
}
.lg-done { background: var(--primary); color: #fff; }
.lg-open { background: var(--card); border: 1.5px solid var(--primary); box-shadow: inset 3px 0 0 var(--accent); }
.lg-lock { background: var(--bg-soft); border: 1.5px dashed var(--muted); }

.mg-scroll {
  overflow-x: auto; overflow-y: hidden; padding: 10px 24px 22px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.mg-scroll::-webkit-scrollbar { height: 10px; }
.mg-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
@media (min-width: 1240px) { .mg-scroll { padding-left: max(24px, calc((100vw - 1180px) / 2)); } }

.mg-track { position: relative; display: flex; align-items: flex-start; width: max-content; }
.mg-band, .mg-band-cols { display: contents; }
.mg-band-title { display: none; }
.mg-lines { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; overflow: visible; }
.mg-lines path { fill: none; stroke: var(--border); stroke-width: 1.5; transition: opacity .15s ease, stroke .15s ease; }
.mg-lines path.ok { stroke: color-mix(in srgb, var(--primary) 50%, transparent); }
.mg-focus .mg-lines path { opacity: .1; }
.mg-focus .mg-lines path.hl { opacity: 1; stroke: var(--primary); stroke-width: 2.4; }
.mg-focus .mg-lines path.hl.hl-post { stroke: var(--accent); }

.mg-col { width: var(--col-w); margin-right: var(--col-gap); position: relative; z-index: 1; flex-shrink: 0; }
.mg-col:last-child { margin-right: 0; }
.mg-col-head {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center;
  padding: 0 0 12px; margin-bottom: 12px;
}
/* línea de "escalones" que une cada cuatrimestre con el siguiente */
.mg-col-head::after {
  content: ""; position: absolute; left: 34px; right: calc(-1 * var(--col-gap)); top: 15px; height: 2px;
  background: var(--border); z-index: -1;
}
.mg-col:last-child .mg-col-head::after { display: none; }
.mg-col.is-complete .mg-col-head::after { background: var(--primary); }
.mg-step {
  width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 15px;
  background: var(--card); color: var(--primary); border: 2px solid var(--primary);
}
.mg-col.is-complete .mg-step { background: var(--primary); color: #fff; }
.mg-step-el { border-color: var(--accent); color: var(--text); font-size: 12px; }
.mg-col-info { display: flex; flex-direction: column; min-width: 0; }
.mg-col-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.mg-col-sub { font-size: 12px; font-weight: 600; color: var(--text); }
.mg-col-bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--bg-soft); overflow: hidden; }
.mg-col-bar i { display: block; height: 100%; background: var(--primary); border-radius: 4px; transition: width .4s ease; }
.mg-col-body { display: flex; flex-direction: column; gap: 9px; }

.mg-node {
  position: relative; display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%;
  padding: 8px 10px 9px; min-height: 66px; border-radius: 11px; font: inherit; color: var(--text);
  background: var(--card); border: 1.5px solid var(--border);
  transition: transform .12s ease, opacity .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.mg-node:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.mg-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.mg-code { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.mg-cr { font-size: 10px; font-weight: 700; color: var(--muted); }
.mg-name { font-size: 12.5px; font-weight: 600; line-height: 1.28; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mg-req { display: none; font-size: 10px; color: var(--muted); line-height: 1.3; }
.mg-check {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); color: #fff; display: none; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.mg-check svg { width: 11px; height: 11px; }

.mg-node.st-done { background: var(--primary-soft); border-color: var(--primary); }
.mg-node.st-done .mg-check { display: flex; }
.mg-node.st-done .mg-code, .mg-node.st-done .mg-cr { color: var(--primary-dark); }
[data-theme="medianoche"] .mg-node.st-done .mg-code, [data-theme="violeta"] .mg-node.st-done .mg-code,
[data-theme="medianoche"] .mg-node.st-done .mg-cr, [data-theme="violeta"] .mg-node.st-done .mg-cr { color: var(--primary); }
.mg-node.st-open { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); box-shadow: inset 3px 0 0 var(--accent); }
.mg-node.st-open:hover { box-shadow: inset 3px 0 0 var(--accent), var(--shadow); }
.mg-node.st-lock { background: var(--bg-soft); border-style: dashed; color: var(--muted); }
.mg-node.st-lock .mg-name { font-weight: 500; }
.mg-node.st-slot { background: transparent; border: 1.5px dashed var(--accent); min-height: 50px; }
.mg-node.st-slot .mg-name { font-weight: 500; color: var(--muted); }
.mg-node.staged-add { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.mg-node.staged-remove { outline: 2.5px solid var(--danger); outline-offset: 1px; }
.mg-node.mg-dim { opacity: .22; }

.mg-focus .mg-node:not(.hl-self):not(.hl-pre):not(.hl-post) { opacity: .28; }
.mg-node.hl-self { outline: 2.5px solid var(--primary); outline-offset: 2px; opacity: 1; }
.mg-node.hl-pre { border-color: var(--primary); border-style: solid; }
.mg-node.hl-post { border-color: var(--accent); border-style: solid; }

.mg-electivas { max-width: 1180px; margin: 16px auto 0; padding: 0 24px; }
.mg-el-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.mg-el-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(188px, 1fr)); gap: 9px; }

/* ---------- Panel de detalle ---------- */
.detail-sheet {
  position: fixed; right: 20px; bottom: 20px; width: min(380px, calc(100vw - 32px)); max-height: min(70vh, 560px); overflow-y: auto;
  padding: 18px 18px 14px; z-index: 95; transform: translateY(16px); opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.detail-sheet.show { opacity: 1; transform: none; pointer-events: auto; }
body:has(.batch-bar:not(.hidden)) .detail-sheet { bottom: 84px; }
@media (max-width: 560px) { .detail-sheet { right: 16px; left: 16px; width: auto; bottom: 16px; } }
.detail-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.detail-head h3 { margin: 4px 0 0; font-size: 17px; line-height: 1.25; }
.detail-head .icon-btn { width: 32px; height: 32px; flex-shrink: 0; }
.detail-code { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 12px 0 4px; font-size: 12px; color: var(--muted); }
.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.pill-done { background: var(--primary); color: #fff; }
.pill-open { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--text); }
.pill-lock { background: var(--bg-soft); color: var(--muted); border: 1px dashed var(--muted); }
.detail-sec { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 10px; }
.detail-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.detail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.detail-list li { display: flex; gap: 7px; align-items: baseline; }
.detail-list .mark { width: 14px; flex-shrink: 0; color: var(--muted); font-weight: 700; }
.detail-list li.ok .mark { color: var(--primary); }
.detail-list li.no { color: var(--muted); }
.detail-list .mono { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.detail-note { font-size: 13px; color: var(--muted); margin: 0 0 4px; line-height: 1.5; }
.detail-foot { font-size: 12px; color: var(--muted); margin: 12px 0 0; }

/* ---------- Modal Vincular UTESA ---------- */
.utesa-box { max-width: 600px; }
.utesa-lead { font-size: 14px; line-height: 1.55; margin: 0 0 6px; }
.utesa-last { font-size: 12.5px; margin: 0 0 14px; }
.utesa-steps { list-style: none; counter-reset: st; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.utesa-steps li {
  counter-increment: st; position: relative; padding: 14px 14px 14px 52px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px;
}
.utesa-steps li::before {
  content: counter(st); position: absolute; left: 14px; top: 13px; width: 26px; height: 26px; border-radius: 8px;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
}
.utesa-steps .st-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.utesa-steps p { font-size: 13px; color: var(--muted); margin: 4px 0 10px; line-height: 1.5; }
.tag-soft { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--primary-soft); color: var(--primary); padding: 2px 7px; border-radius: 999px; }
.bookmarklet {
  display: inline-block; padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 700; text-decoration: none;
  background: var(--card); border: 1.5px dashed var(--primary); color: var(--primary); cursor: grab;
}
.utesa-paste { resize: vertical; font-size: 13px; min-height: 90px; }
kbd { font-family: 'JetBrains Mono', monospace; font-size: 11px; background: var(--card); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; }
.utesa-why { margin-top: 14px; font-size: 13px; color: var(--muted); }
.utesa-why summary { cursor: pointer; font-weight: 600; color: var(--text); }
.utesa-why p { line-height: 1.55; }
.imp-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; margin-top: 12px; }
.imp-list:empty { display: none; }
.imp-row { display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.imp-row:first-child { border-top: none; }
.imp-row input { width: 16px; height: 16px; accent-color: var(--primary); }
.imp-code { font-size: 11px; color: var(--muted); }
.imp-via { font-size: 11px; color: var(--muted); }
.imp-done { opacity: .6; cursor: default; }
.imp-foreign { font-size: 12px; color: var(--muted); padding: 10px 12px; margin: 0; border-top: 1px solid var(--border); }

/* ---------- Encabezado de impresión (oculto en pantalla) ---------- */
.print-header { display: none; }

/* ============================================================
   IMPRESIÓN — malla en 2 páginas horizontales (cuatrimestres 1–6 y 7–12)
   + electivas, siempre con colores claros y legible en blanco y negro
   ============================================================ */
@page { size: letter landscape; margin: 9mm; }

@media print {
  :root, [data-theme] {
    --bg: #fff; --bg-soft: #F2F4EF; --card: #fff; --text: #111; --muted: #555;
    --primary: #00542B; --primary-dark: #003D1F; --primary-soft: #E3EDE5; --accent: #C89B3C;
    --border: #C9D0C4; --shadow: none;
  }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body { background: #fff !important; height: auto; }
  body { font-size: 9pt; }

  .print-header {
    display: grid !important; grid-template-columns: 1fr auto auto; gap: 6mm; align-items: center;
    padding: 0 0 3mm; margin-bottom: 3mm; border-bottom: 1.5pt solid var(--primary);
  }
  .ph-left { display: flex; align-items: center; gap: 3mm; }
  .ph-badge { width: 11mm; height: 11mm; border-radius: 2.5mm; color: #fff; font: 700 9pt 'JetBrains Mono', monospace; display: flex; align-items: center; justify-content: center; }
  .ph-name { font: 700 13pt 'Space Grotesk', sans-serif; }
  .ph-career { font-size: 9pt; color: var(--muted); }
  .ph-date { font-size: 7.5pt; color: var(--muted); }
  .ph-stats { display: flex; gap: 5mm; }
  .ph-stats div { display: flex; flex-direction: column; align-items: center; }
  .ph-stats strong { font: 700 13pt 'Space Grotesk', sans-serif; color: var(--primary); }
  .ph-stats span { font-size: 7pt; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .ph-legend { display: flex; flex-direction: column; gap: 1mm; font-size: 7.5pt; }
  .ph-legend span { display: flex; align-items: center; gap: 1.5mm; }
  .ph-legend .lg { width: 3.4mm; height: 3.4mm; font-size: 6pt; border-radius: 1mm; }

  .malla-wrap, .malla-wrap.is-graph { max-width: none; margin: 0; padding: 0; }
  .mg { --col-gap: 0px; }
  .mg-scroll { overflow: visible; padding: 0 !important; }
  .mg-track { display: block; width: auto; }
  .mg-band { display: block; break-after: page; page-break-after: always; }
  .mg-band-title {
    display: block; font: 700 8pt 'Inter', sans-serif; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); margin: 0 0 2mm;
  }
  .mg-band-cols { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0 3mm; }
  .mg-col { width: auto; margin: 0; break-inside: avoid; }
  .mg-col-head { padding: 0 0 1.5mm; margin-bottom: 1.5mm; gap: 1mm 2mm; }
  .mg-col-head::after { top: 3.2mm; left: 7mm; right: -3mm; height: 0.6pt; }
  .mg-step { width: 6.5mm; height: 6.5mm; border-radius: 1.6mm; font-size: 8.5pt; border-width: 1pt; }
  .mg-col-title { font-size: 6.5pt; }
  .mg-col-sub { font-size: 7.5pt; }
  .mg-col-bar { height: 1mm; }
  .mg-col-body { gap: 1.3mm; }

  .mg-node {
    min-height: 0; padding: 1.2mm 1.8mm 1.4mm; border-radius: 1.6mm; gap: 0.5mm; border-width: 0.8pt;
    break-inside: avoid; transform: none !important; box-shadow: none !important; opacity: 1 !important; outline: none !important;
  }
  .mg-code { font-size: 6.5pt; }
  .mg-cr { font-size: 6.5pt; }
  .mg-name { font-size: 7.6pt; line-height: 1.18; -webkit-line-clamp: 2; }
  .mg-req { display: block; font-size: 6pt; line-height: 1.2; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .mg-check { width: 3.6mm; height: 3.6mm; top: -1.2mm; right: -1.2mm; box-shadow: 0 0 0 0.8pt #fff; }
  .mg-check svg { width: 2.2mm; height: 2.2mm; }
  .mg-node.st-open { box-shadow: inset 0.8mm 0 0 var(--accent) !important; }
  .mg-node.st-lock { color: #666; }
  .mg-node.st-slot { min-height: 0; }

  .mg-electivas { max-width: none; margin: 0; padding: 0; }
  .mg-el-head { padding-bottom: 2mm; margin-bottom: 2mm; }
  .mg-el-grid { grid-template-columns: repeat(6, 1fr); gap: 1.3mm 3mm; }

  .page-footer { padding: 3mm 0 0; font-size: 6.5pt; text-align: left; }

  /* Vista de tarjetas (por si se imprime sin pasar por el botón) */
  .materias-grid { grid-template-columns: repeat(4, 1fr); gap: 2mm; }
  .subject-card { min-height: 0; padding: 2mm; break-inside: avoid; box-shadow: none; }
  .cuatri-block { break-inside: avoid; margin-bottom: 4mm; }
}
.imp-doubt .imp-via { color: var(--danger); font-weight: 600; }
.imp-warn { color: var(--danger); font-weight: 600; }

/* ---------- Ajustes de listas de importación ---------- */
.imp-list { overflow-x: hidden; }
.imp-row { grid-template-columns: auto auto minmax(0, 1fr) auto; }
.imp-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.utesa-actions { display: flex; gap: 10px; margin-top: 16px; }
.utesa-actions .btn { flex: 1; }
.utesa-actions .btn-primary { flex: 1.4; }

/* ============================================================
   v3 — Sincronización, gráficos, navegación y mejoras móviles
   ============================================================ */
.perf-ok { font-size: 12.5px; font-weight: 600; color: var(--success); }
.perf-warn { font-size: 12.5px; font-weight: 600; color: var(--danger); }

/* ---------- Panel de sincronización ---------- */
.sync-wrap { max-width: 1180px; margin: 16px auto 0; padding: 0 24px; }
.sync-card { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.sync-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 260px; }
.sync-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sync-main p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }

/* ---------- Navegación rápida por cuatrimestre (malla) ---------- */
.mg-jump {
  position: sticky; top: var(--hdr-h, 64px); z-index: 15;
  display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none;
  max-width: none; margin: 0 0 6px; padding: 8px max(24px, calc((100vw - 1180px) / 2));
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.mg-jump::-webkit-scrollbar { display: none; }
.mg-jump-btn {
  flex: 0 0 auto; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--card); color: var(--muted);
  font: 700 13px 'Space Grotesk', sans-serif; transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.mg-jump-btn:hover { border-color: var(--primary); color: var(--primary); }
.mg-jump-btn.is-part { border-color: var(--primary); color: var(--primary); }
.mg-jump-btn.is-full { background: var(--primary); border-color: var(--primary); color: #fff; }
.mg-jump-btn.is-cur { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.mg-jump-el { border-style: dashed; }

/* ---------- Vista de gráficos ---------- */
.ch {
  --c-done: var(--primary);
  --c-open: var(--accent);
  --c-lock: color-mix(in srgb, var(--muted) 42%, var(--card));
  display: grid; grid-template-columns: 1fr; gap: 16px;
}
.ch-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.ch-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.ch-head h3 { margin: 0; font-size: 15px; }
.ch-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.ch-legend li { display: inline-flex; align-items: center; gap: 6px; }
.ch-legend-col { flex-direction: column; flex-wrap: nowrap; gap: 8px; font-size: 13px; color: var(--text); }
.ch-legend-col li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; min-width: 150px; }
.ch-legend-col strong { font-family: 'Space Grotesk', sans-serif; }
.sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; flex-shrink: 0; }
.sw-done { background: var(--c-done); }
.sw-open { background: var(--c-open); }
.sw-lock { background: var(--c-lock); }
.sw-line { height: 3px; width: 16px; border-radius: 2px; background: var(--primary); }
.sw-plan { height: 0; width: 16px; border-top: 2px dashed var(--muted); border-radius: 0; background: none; }

.ch-summary { display: grid; grid-template-columns: auto auto 1fr; gap: 20px 32px; align-items: center; }
.ch-donut { position: relative; width: 156px; height: 156px; }
.ch-donut svg { width: 100%; height: 100%; display: block; }
.dn-bg { fill: none; stroke: var(--bg-soft); stroke-width: 14; }
.dn-seg { fill: none; stroke-width: 14; transition: stroke-dasharray .5s ease; }
.dn-done { stroke: var(--c-done); }
.dn-open { stroke: var(--c-open); }
.dn-lock { stroke: var(--c-lock); }
.ch-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ch-donut-center strong { font: 700 30px 'Space Grotesk', sans-serif; }
.ch-donut-center span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ch-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.ch-kpis strong { display: block; font: 700 24px 'Space Grotesk', sans-serif; line-height: 1.1; }
.ch-kpis strong small { font-size: 14px; color: var(--muted); font-weight: 600; }
.ch-kpis span { font-size: 12px; color: var(--muted); }

.ch-svg { width: 100%; height: auto; display: block; }
.ax-grid { stroke: var(--border); stroke-width: 1; }
.ax-txt { fill: var(--muted); font-size: 10.5px; font-family: 'Inter', sans-serif; }
.ax-x { font-weight: 600; }
.bar-done { fill: var(--c-done); }
.bar-open { fill: var(--c-open); }
.bar-lock { fill: var(--c-lock); }
.bar-pend { fill: color-mix(in srgb, var(--accent) 20%, var(--card)); stroke: var(--accent); stroke-dasharray: 3 2; }
.bar-val { fill: var(--text); font-size: 10px; font-weight: 700; font-family: 'Inter', sans-serif; }
.pace-area { fill: color-mix(in srgb, var(--primary) 14%, transparent); }
.pace-you { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.pace-plan { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 4; }
.pace-dot { fill: var(--card); stroke: var(--primary); stroke-width: 2; }
.pace-mark { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 3; }
.pace-mark-txt { fill: var(--muted); font-size: 10.5px; font-weight: 600; }
.ch-read { font-size: 13.5px; line-height: 1.55; margin: 6px 0 0; }
.ch-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 10px 0 0; }
.ch-details { margin-top: 8px; font-size: 12.5px; }
.ch-details summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: 6px 0; }
.ch-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 12.5px; }
.ch-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px; }
.ch-table td { padding: 6px 8px; border-top: 1px solid var(--border); }
.ch-cap { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ch-cap select.input { width: auto; padding: 8px 30px 8px 12px; font-size: 14px; }

/* hoja de ruta (proyección) */
.rd-scroll { overflow-x: auto; margin: 12px -4px 0; padding: 4px 4px 10px; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.rd-track { display: flex; gap: 12px; width: max-content; }
.rd-col { width: 176px; flex: none; scroll-snap-align: start; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px; padding: 10px; }
.rd-col header { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; margin-bottom: 6px; }
.rd-col header span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.rd-bar { height: 4px; border-radius: 4px; background: var(--card); overflow: hidden; margin-bottom: 8px; }
.rd-bar i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.rd-list { display: flex; flex-direction: column; gap: 6px; }
.rd-chip {
  display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; padding: 6px 8px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit;
}
button.rd-chip:hover { border-color: var(--primary); }
.rd-chip .mono { font-size: 10px; color: var(--muted); font-weight: 600; }
.rd-name { font-size: 12px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rd-el { border-style: dashed; border-color: var(--accent); background: transparent; }

/* en la vista de gráficos no aplican búsqueda, filtros ni modo selección */
body[data-view="charts"] .search-box,
body[data-view="charts"] .filter-chips,
body[data-view="charts"] .select-mode-banner { display: none; }

/* ---------- Márgenes laterales en pantallas medianas ---------- */
@media (max-width: 1228px) { .select-mode-banner { margin-left: 24px; margin-right: 24px; } }

/* ---------- Responsive: tablet y teléfono ---------- */
@media (max-width: 860px) {
  .ch-summary { grid-template-columns: auto 1fr; }
  .ch-kpis { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .dash-hero { padding: 16px 16px 4px; }
  .toolbar, .sync-wrap, .malla-wrap { padding-left: 16px; padding-right: 16px; }
  .select-mode-banner { margin-left: 16px; margin-right: 16px; padding: 14px; }
  .select-mode-banner .btn { width: 100%; }
  .dash-header-inner { padding: 10px 14px; }
  .theme-pop { right: 12px; left: 12px; width: auto; }

  /* progreso: anillo + texto en una fila, indicadores en 3 columnas compactas */
  .progress-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; align-items: center; text-align: left; padding: 16px 18px; }
  .ring-wrap { width: 108px; height: 108px; margin: 0; }
  .ring-center .pct { font-size: 24px; }
  .progress-card .stat-line { font-size: 13px; margin: 0; }
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .stat-box { padding: 12px; }
  .stat-box .num { font-size: 20px; }
  #stat-credits { font-size: 16px; padding-top: 3px; }
  .stat-box .lbl { font-size: 11px; line-height: 1.25; }

  /* barra de herramientas */
  .toolbar { gap: 10px; margin-top: 16px; }
  .search-box { flex: 1 1 100%; max-width: none; }
  .seg { width: 100%; }
  .seg-btn { flex: 1; justify-content: center; min-height: 42px; }
  .filter-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; width: calc(100% + 32px); scrollbar-width: none; }
  .filter-chips::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; flex: 0 0 auto; }
  .input, select.input { font-size: 16px; }

  /* malla: una columna a la vez con "asomo" de la siguiente */
  .mg { --col-w: min(76vw, 250px); --col-gap: 26px; }
  .mg-scroll { padding: 10px 16px 22px; scroll-snap-type: x proximity; scroll-padding-left: 16px; }
  .mg-col { scroll-snap-align: start; }
  .mg-node { min-height: 72px; padding: 10px 12px; }
  .mg-name { font-size: 13px; }
  .mg-jump { padding: 8px 16px; }
  .mg-hint { padding: 0 16px; }
  .mg-electivas { padding: 0 16px; }
  .mg-el-grid { grid-template-columns: 1fr 1fr; }

  /* gráficos */
  .ch-card { padding: 16px 14px; border-radius: 16px; }
  .ch-summary { grid-template-columns: 1fr; justify-items: center; text-align: left; }
  .ch-legend-col { width: 100%; }
  .ch-kpis { width: 100%; }
  .ch-cap { width: 100%; justify-content: space-between; }
  .rd-col { width: 156px; }

  /* hojas inferiores (bottom sheets) */
  .detail-sheet {
    left: 0; right: 0; bottom: 0; width: auto; max-height: 78vh; border-radius: 20px 20px 0 0;
    padding: 12px 18px calc(18px + env(safe-area-inset-bottom)); transform: translateY(100%); box-shadow: 0 -12px 40px rgba(0,0,0,.18);
  }
  .detail-sheet.show { transform: none; }
  .detail-sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: 0 auto 12px; }
  body:has(.batch-bar:not(.hidden)) .detail-sheet { bottom: 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box { max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
  .utesa-steps li { padding: 14px 12px 14px 48px; }
  .batch-bar { left: 12px; right: 12px; transform: none; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: none; justify-content: space-between; gap: 10px; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); text-align: center; }
  .page-footer { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
}

/* ---------- Pantallas táctiles: objetivos de toque cómodos ---------- */
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .chip { padding: 10px 14px; }
  .mg-jump-btn { min-width: 40px; height: 40px; }
  .mg-hint-tip { display: none; }
}

/* ---------- Impresión: solo la malla ---------- */
@media print {
  .sync-wrap, .mg-jump, .ch { display: none !important; }
}
.pace-now { fill: var(--primary); stroke: var(--card); stroke-width: 2; }


/* ============================================================
   v4 — Malla como mapa de ruta (zoom, arrastre, caminos)
   ============================================================ */
.mg { --col-w: 178px; --col-gap: 46px; }
.mg-hint-tip { display: block; }

.mg-viewport { position: relative; }
.mg-scroll {
  padding: 0; scroll-snap-type: none; scroll-padding-left: 0;
  overflow-x: auto; overflow-y: hidden; touch-action: pan-x pan-y; cursor: grab;
  background-color: color-mix(in srgb, var(--bg-soft) 60%, var(--bg));
  background-image: radial-gradient(circle, color-mix(in srgb, var(--muted) 24%, transparent) 1.3px, transparent 1.6px);
  background-size: 28px 28px; background-attachment: local;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.mg-scroll.is-panning { cursor: grabbing; user-select: none; }
.mg-col { scroll-snap-align: none; }
.mg-zoom { position: relative; min-width: 100%; }
.mg-track {
  position: absolute; left: 0; top: 0; display: flex; align-items: flex-start; width: max-content;
  transform-origin: 0 0; padding: 22px 30px 44px;
}

/* controles de zoom (flotan a la derecha y acompañan al hacer scroll) */
.mg-controls {
  position: sticky; top: calc(var(--hdr-h, 64px) + 64px); z-index: 14; height: 0;
  display: flex; justify-content: flex-end; padding: 0 12px; pointer-events: none;
}
.mg-ctl-bar {
  pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px;
  background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); margin-top: 12px;
}
.mg-ctl {
  width: 44px; height: 44px; border: none; background: transparent; color: var(--text); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font: 700 12px 'Inter', sans-serif;
}
.mg-ctl:hover { background: var(--bg-soft); }
.mg-ctl:active { background: var(--primary-soft); color: var(--primary); }
.mg-zoom-val { color: var(--muted); height: 28px; font-size: 12px; }
.mg-ctl-sep { width: 26px; height: 1px; background: var(--border); margin: 4px 0; }

/* nivel (cuatrimestre): anillo de progreso */
.mg-step {
  position: relative; width: 46px; height: 46px; border: none; border-radius: 50%; background: transparent;
  display: grid; place-items: center; color: var(--primary);
}
.mg-step svg { position: absolute; inset: 0; width: 100%; height: 100%; rotate: -90deg; }
.mg-step .rg-bg { fill: var(--card); stroke: var(--border); stroke-width: 4; }
.mg-step .rg-fg { fill: none; stroke: var(--primary); stroke-width: 4; stroke-linecap: round; }
.mg-step b { position: relative; font: 700 19px 'Space Grotesk', sans-serif; }
.mg-col.is-complete .mg-step { background: transparent; color: #fff; }
.mg-col.is-complete .mg-step .rg-bg { fill: var(--primary); stroke: var(--primary); }
.mg-col.is-complete .mg-step .rg-fg { stroke: var(--accent); }
.mg-step-el { border: 3px solid var(--accent); background: var(--card); color: var(--text); }
.mg-step-el b { font-size: 14px; }
.mg-col-head { grid-template-columns: auto 1fr; gap: 6px 12px; }
.mg-col-head::after {
  top: 22px; left: 54px; height: 3px; border-radius: 2px;
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--muted) 40%, var(--border)) 0 7px, transparent 7px 13px);
}
.mg-col.is-complete .mg-col-head::after { background: var(--primary); }

/* materias como "niveles" del mapa */
.mg-node {
  min-height: 78px; border-radius: 16px; border: 2px solid var(--border); background: var(--card);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--border) 85%, transparent); padding: 9px 11px 10px;
}
.mg-node:hover { box-shadow: 0 6px 0 color-mix(in srgb, var(--primary) 22%, transparent), var(--shadow); transform: translateY(-2px); }
.mg-ico { width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; }
.mg-node.st-done { background: var(--primary-soft); border-color: var(--primary); box-shadow: 0 3px 0 color-mix(in srgb, var(--primary) 30%, transparent); }
.mg-check { width: 23px; height: 23px; top: -9px; right: -9px; background: var(--accent); color: #1b1b1b; box-shadow: 0 0 0 3px var(--bg); }
.mg-node.st-open {
  border-color: var(--accent); background: var(--card);
  box-shadow: inset 5px 0 0 var(--accent), 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
  animation: mg-pulse 2.6s ease-out infinite;
}
.mg-node.st-open:hover { animation: none; box-shadow: inset 5px 0 0 var(--accent), 0 6px 0 color-mix(in srgb, var(--accent) 30%, transparent), var(--shadow); }
@keyframes mg-pulse {
  0%   { box-shadow: inset 5px 0 0 var(--accent), 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); }
  70%  { box-shadow: inset 5px 0 0 var(--accent), 0 0 0 11px transparent; }
  100% { box-shadow: inset 5px 0 0 var(--accent), 0 0 0 0 transparent; }
}
.mg-node.st-lock {
  background: color-mix(in srgb, var(--bg-soft) 75%, var(--card)); border-style: dashed;
  border-color: color-mix(in srgb, var(--muted) 45%, var(--border)); color: var(--muted); box-shadow: none;
}
.mg-node.st-slot { box-shadow: none; }

/* caminos: recorrido · siguiente paso · bloqueado */
.mg-lines path { fill: none; stroke-linecap: round; }
.mg-lines path.lk { stroke: color-mix(in srgb, var(--muted) 38%, var(--border)); stroke-width: 2; stroke-dasharray: 3 7; }
.mg-lines path.ok { stroke: var(--primary); stroke-width: 3.5; stroke-dasharray: none; opacity: .85; }
.mg-lines path.go { stroke: var(--accent); stroke-width: 3.5; stroke-dasharray: none; opacity: 1; }
.mg-focus .mg-lines path { opacity: .08; }
.mg-focus .mg-lines path.hl { opacity: 1; stroke-dasharray: none; stroke-width: 4.5; }

@media (max-width: 640px) {
  .mg { --col-w: 178px; --col-gap: 46px; }
  .mg-scroll { padding: 0; scroll-snap-type: none; }
  .mg-col { scroll-snap-align: none; }
  .mg-ctl-bar { padding: 4px; border-radius: 16px; }
  .mg-ctl { width: 42px; height: 42px; }
}
@media (pointer: coarse) { .mg-hint-tip { display: block; } }

@media print {
  .mg-viewport { position: static; }
  .mg-controls { display: none !important; }
  .mg-scroll { overflow: visible !important; height: auto !important; background: none !important; border: none !important; cursor: auto; }
  .mg-zoom { position: static !important; width: auto !important; height: auto !important; min-width: 0; }
  .mg-track { position: static !important; scale: none !important; padding: 0 !important; display: block !important; width: auto !important; }
  .mg-step svg { display: none; }
  .mg-step { width: 6.5mm !important; height: 6.5mm !important; border: 1pt solid var(--primary) !important; border-radius: 1.6mm !important; background: #fff !important; color: var(--primary) !important; }
  .mg-step b { font-size: 8.5pt; }
  .mg-step-el { border-color: var(--accent) !important; color: #111 !important; }
  .mg-col.is-complete .mg-step { background: var(--primary) !important; color: #fff !important; }
  .mg-col-head::after { background: var(--border) !important; height: 0.6pt !important; top: 3.2mm !important; left: 7mm !important; }
  .mg-node { animation: none !important; }
  .mg-node.st-done { background: var(--primary-soft) !important; border-color: var(--primary) !important; }
  .mg-node .mg-ico { display: none; }
  .mg-check { background: var(--primary) !important; color: #fff !important; }
  .mg-node.st-open { background: #fff !important; border-color: var(--primary) !important; box-shadow: inset 0.8mm 0 0 var(--accent) !important; }
  .mg-node.st-lock { background: #f3f4f1 !important; }
}

/* ---------- Ventana de bienvenida (vincular cuenta) ---------- */
.link-box { max-width: 460px; text-align: center; }
.link-badge { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 22px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.link-box h3 { margin: 0; font-size: 24px; }
.link-lead { margin: 8px 0 16px; color: var(--muted); font-size: 15px; }
.link-list { list-style: none; padding: 0; margin: 0 0 20px; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.link-list li { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; line-height: 1.45; background: var(--bg-soft); border-radius: 12px; padding: 10px 14px; }
.link-list li span { color: var(--success); font-weight: 800; }
.link-main, .link-alt { width: 100%; }
.link-alt { margin-top: 10px; }
.link-note { margin: 14px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- Foto de perfil (marca del encabezado) ---------- */

/* Impresión: reafirma el tamaño compacto (las reglas del mapa en pantalla están más abajo en el archivo) */
@media print {
  .mg-col-head { gap: 1mm 2mm !important; padding: 0 0 1.5mm !important; margin-bottom: 1.5mm !important; }
  .mg-col-body { gap: 1.3mm !important; }
  .mg-node { min-height: 0 !important; padding: 1.2mm 1.8mm 1.4mm !important; border-radius: 1.6mm !important; border-width: 0.8pt !important; box-shadow: none !important; gap: 0.5mm !important; }
  .mg-node.st-open { box-shadow: inset 0.8mm 0 0 var(--accent) !important; }
  .mg-check { width: 3.6mm !important; height: 3.6mm !important; top: -1.2mm !important; right: -1.2mm !important; box-shadow: 0 0 0 0.8pt #fff !important; }
  .mg-step b { position: static; }
}


/* ---------- Video tutorial en la app ---------- */
.video-box { max-width: 900px; padding: 18px 20px 20px; }
.video-box iframe { width: 100%; aspect-ratio: 16 / 9; display: block; border: 0; border-radius: 14px; background: #0c1a12; }
.video-note a { color: var(--primary); font-weight: 600; }
.video-note { margin: 12px 2px 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.utesa-video-btn { margin: 0 0 12px; }
.utesa-tip { font-size: 12.5px !important; background: var(--card); border: 1px dashed var(--accent); border-radius: 10px; padding: 8px 12px; margin: 10px 0 0 !important; color: var(--text) !important; }
.sync-video { margin: 6px 0 0; font-size: 12.5px; text-align: left; }
@media (max-width: 640px) { .video-box { padding: 14px 14px calc(16px + env(safe-area-inset-bottom)); } }

/* ============================================================
   v5 — Configuración renovada y ajustes generales
   ============================================================ */
[hidden] { display: none !important; }
body.modal-open { overflow: hidden; }
.modal-box:focus { outline: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }

.settings-box { max-width: 600px; padding: 22px 22px 20px; }
.set-card {
  border: 1px solid var(--border); border-radius: 16px; background: color-mix(in srgb, var(--bg-soft) 55%, var(--card));
  padding: 14px 16px; margin-bottom: 12px;
}
.set-title { margin: 0 0 10px; font: 700 11px 'Inter', sans-serif; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.set-text { margin: 0 0 12px; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.set-row { display: flex; gap: 10px; align-items: center; }
.set-row .input { flex: 1; min-width: 0; }
.set-actions { flex-wrap: wrap; margin-top: 4px; }
.set-card .field { margin-bottom: 10px; }
.set-card .err-box, .set-card .hint-box { margin-top: 10px; }

.set-profile { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.set-avatar {
  width: 72px; height: 72px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center;
  color: #fff; font: 700 15px 'JetBrains Mono', monospace; flex-shrink: 0;
}
.set-avatar svg { display: block; width: 100%; height: 100%; }
.set-profile-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.set-profile-info strong { font: 700 18px 'Space Grotesk', sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-profile-info .muted { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-career-chip {
  align-self: flex-start; margin-top: 2px; font-size: 11.5px; font-weight: 700; padding: 3px 10px 3px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--chip, var(--primary)) 14%, var(--card)); color: var(--text); border: 1px solid color-mix(in srgb, var(--chip, var(--primary)) 40%, var(--border));
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.set-career-chip::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--chip, var(--primary)); margin-right: 6px; }

.set-theme { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.set-theme .theme-swatch { margin: 0; border-color: var(--border); }
.set-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--border); margin-right: 8px; vertical-align: 0; }
.set-dot.ok { background: var(--success); }
.set-check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin: 2px 0 12px; cursor: pointer; }
.set-check input { width: 16px; height: 16px; accent-color: var(--primary); }
.set-danger { border-style: dashed; border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.set-reset { margin-top: 12px; }
.btn.is-armed { background: color-mix(in srgb, var(--danger) 12%, var(--card)); border-color: var(--danger); color: var(--danger); }
.set-logout { width: 100%; margin-top: 4px; }

@media (max-width: 640px) {
  .settings-box { padding: 18px 14px calc(18px + env(safe-area-inset-bottom)); }
  .set-profile { grid-template-columns: auto 1fr; }
  .set-profile .btn { grid-column: 1 / -1; width: 100%; }
  .set-row { flex-wrap: wrap; }
  .set-row .input { flex: 1 1 100%; }
  .set-row > .btn { flex: 1; }
  .set-theme { grid-template-columns: 1fr 1fr; }
}

@media print {
  body.modal-open { overflow: visible !important; }
  .modal-overlay { display: none !important; }
}

/* Impresión: se ocultan los controles y quedan solo el encabezado y la malla */
@media print {
  .dash-header, .dash-hero, .select-mode-banner, .toolbar, .toast, .batch-bar, .detail-sheet,
  .modal-overlay, .disclaimer-strip, .mg-hint, .mg-lines, #loader { display: none !important; }
}

/* ---------- Inicio de sesión directo con UTESA ---------- */
.utesa-login { background: var(--bg-soft); border: 1.5px solid var(--primary); border-radius: 16px; padding: 16px 16px 14px; margin-bottom: 14px; }
.utesa-login .st-title { margin-bottom: 12px; }
.ul-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.utesa-login .field { margin-bottom: 12px; }
.ul-pass { position: relative; }
.ul-pass .input { padding-right: 84px; }
.ul-eye { position: absolute; right: 8px; top: 50%; translate: 0 -50%; border: none; background: none; color: var(--primary); font-size: 12.5px; font-weight: 700; padding: 8px 10px; border-radius: 8px; }
.ul-eye:hover { background: var(--primary-soft); }
.ul-consent { align-items: flex-start; line-height: 1.45; margin: 4px 0 12px; }
.ul-consent input { margin-top: 2px; flex-shrink: 0; }
.ul-consent span { color: var(--text); font-size: 12.5px; }
.ul-submit { width: 100%; }
.utesa-login .err-box { margin: 0 0 12px; }
.utesa-alt, .utesa-why { margin-top: 12px; font-size: 13px; color: var(--muted); }
.utesa-alt summary, .utesa-why summary { cursor: pointer; font-weight: 600; color: var(--text); padding: 6px 0; }
.utesa-alt[open] { margin-bottom: 4px; }
.utesa-alt-note { margin: 4px 0 10px; line-height: 1.5; }
@media (max-width: 640px) { .ul-grid { grid-template-columns: 1fr; } }
.utesa-login .select-wrap select.input { padding-left: 14px; }

/* ---------- Creador de personaje ---------- */
.set-editor[hidden] { display: none; }
.set-editor-foot { justify-content: flex-end; margin-top: 12px; }
.cc { display: block; }
.cc-top { display: flex; gap: 16px; align-items: center; }
.cc-preview { flex: 0 0 auto; width: 148px; height: 148px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 4px var(--card), 0 0 0 5.5px var(--border), 0 10px 26px rgba(0,0,0,.14); }
.cc-preview svg { display: block; width: 100%; height: 100%; }
.cc-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; flex: 1; }
.cc-kinds { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; gap: 3px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; }
.cc-kind { border: 0; background: none; padding: 9px 8px; border-radius: 9px; font: 600 13.5px 'Inter', sans-serif; color: var(--muted); min-height: 40px; }
.cc-kind[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.cc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cc-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 16px -2px 0; padding: 2px 2px 8px; scrollbar-width: thin; border-bottom: 1px solid var(--border); }
.cc-tab { flex: 0 0 auto; border: 1px solid var(--border); background: var(--card); color: var(--muted); border-radius: 999px; padding: 8px 14px; min-height: 40px; font: 600 13px 'Inter', sans-serif; white-space: nowrap; }
.cc-tab[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.cc-panel { max-height: 340px; overflow-y: auto; padding: 14px 2px 4px; overscroll-behavior: contain; }
.cc-field + .cc-field { margin-top: 18px; }
.cc-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.cc-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; }
.cc-tiles-2 { grid-template-columns: repeat(2, minmax(68px, 96px)); }
.cc-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px 5px; border: 1.5px solid var(--border); background: var(--card); border-radius: 12px; color: var(--text); transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease; }
.cc-tile svg, .cc-none { display: block; width: 52px; height: 52px; border-radius: 50%; }
.cc-none { display: flex; align-items: center; justify-content: center; background: var(--bg-soft); color: var(--muted); font-size: 22px; }
.cc-tile-name { font-size: 10.5px; line-height: 1.15; font-weight: 600; color: var(--muted); text-align: center; }
.cc-tile:hover { transform: translateY(-1px); border-color: var(--primary); }
.cc-tile[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.cc-tile[aria-checked="true"] .cc-tile-name { color: var(--text); }
.cc-swatches { display: flex; flex-wrap: wrap; gap: 10px; padding: 3px 2px; }
.cc-sw { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--card); box-shadow: 0 0 0 1.5px var(--border); padding: 0; background: var(--c, var(--bg-soft)); transition: transform .12s ease, box-shadow .15s ease; }
.cc-sw:hover { transform: scale(1.12); }
.cc-sw[aria-checked="true"] { box-shadow: 0 0 0 3px var(--primary); }
.cc-sw-none { background: linear-gradient(135deg, var(--card) 45%, var(--danger) 45% 55%, var(--card) 55%); }
.cc-kind:focus-visible, .cc-tab:focus-visible, .cc-tile:focus-visible, .cc-sw:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 520px) {
  .cc-top { flex-direction: column; align-items: stretch; text-align: center; }
  .cc-preview { align-self: center; }
  .cc-actions { justify-content: center; }
  .cc-panel { max-height: 300px; }
  .cc-tiles { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .cc-tile, .cc-sw { transition: none; } }

/* ---------- Mejoras de uso: PC y celular ---------- */
.cuatri-head { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; text-align: left; color: inherit; align-items: center; padding: 6px 0 10px; }
.cuatri-head.is-static { cursor: default; }
button.cuatri-head { cursor: pointer; }
button.cuatri-head:hover .title { color: var(--text); }
button.cuatri-head:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 6px; }
.cuatri-head .cnt { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cuatri-bar { flex: 1; min-width: 40px; max-width: 220px; height: 6px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; margin: 0 6px 0 8px; align-self: center; }
.cuatri-bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .4s ease; }
.cuatri-chev { color: var(--muted); align-self: center; transition: transform .2s ease; }
.cuatri-block.collapsed .cuatri-chev { transform: rotate(-90deg); }
.cuatri-block.collapsed .materias-grid { display: none; }
.cuatri-block.collapsed { margin-bottom: 18px; }
.cuatri-block.collapsed .cuatri-head { border-bottom-color: transparent; }

.next-up { margin: 0 0 26px; padding: 16px 18px 14px; border: 1px solid var(--border); border-radius: 18px; background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.next-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.next-head strong { font: 700 15px 'Space Grotesk', sans-serif; }
.next-head span { font-size: 12px; color: var(--muted); }
.next-list { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.next-chip { flex: 0 0 auto; width: 188px; scroll-snap-align: start; display: grid; gap: 3px; text-align: left; padding: 11px 13px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--bg-soft); color: var(--text); transition: transform .12s ease, border-color .15s ease; min-height: 44px; }
.next-chip:hover { transform: translateY(-2px); border-color: var(--primary); }
.next-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.next-chip .mono { font-size: 11px; color: var(--primary); font-weight: 600; }
.next-chip b { font-size: 13px; line-height: 1.25; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.next-chip em { font-style: normal; font-size: 11.5px; color: var(--muted); }

@media (min-width: 1100px) {
  .next-list { flex-wrap: wrap; overflow: visible; }
  .next-chip { width: calc(25% - 8px); }
}

@media (max-width: 640px) {

  /* Avance en pocos píxeles */
  .progress-card { flex-direction: row; align-items: center; gap: 16px; padding: 16px 18px; text-align: left; }
  .progress-card .ring-wrap { width: 108px; height: 108px; flex: 0 0 auto; }
  .progress-card .stat-line { font-size: 15px; font-weight: 600; color: var(--text); }
  .stat-box { padding: 14px 14px 12px; }

  /* Avisos compactos */
  .sync-card { padding: 12px 14px; }
  .select-mode-banner { padding: 12px 14px; gap: 10px; }
  .select-mode-banner-icon { display: none; }
  .select-mode-banner .btn, .sync-card .btn { width: 100%; }

  /* Cambio de vista siempre a mano (barra inferior) */
  #view-switch {
    position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 80; width: auto;
    background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 28px rgba(0,0,0,.18); border-radius: 16px; padding: 4px;
  }
  #view-switch .seg-btn { min-height: 46px; }
  .malla-wrap { padding-bottom: 96px; }
  .batch-bar { bottom: calc(76px + env(safe-area-inset-bottom)); }

  .materias-grid { gap: 10px; }
  .next-chip { width: 164px; }
  .cuatri-bar { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .cuatri-bar i, .cuatri-chev, .next-chip { transition: none; } }
@media print { .next-up, .cuatri-chev, .cuatri-bar { display: none !important; } #view-switch { position: static !important; } }
@media (max-width: 640px) {
  .select-mode-banner:not(.active) .select-mode-banner-text span { display: none; }
  .sync-card .btn, .select-mode-banner .btn { min-height: 46px; }
}

/* ---------- Encabezado: marca a la izquierda, cuenta a la derecha ---------- */
.app-brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; border-radius: 10px; }
.app-brand:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.app-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.app-name { font: 700 16px 'Space Grotesk', sans-serif; letter-spacing: -.01em; white-space: nowrap; }

.user-menu-wrap { position: relative; flex: 0 1 auto; min-width: 0; }
.user-chip {
  display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 4px 12px 4px 4px; min-height: 48px;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px; color: var(--text);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.user-chip:hover { background: var(--bg-soft); }
.user-chip[aria-expanded="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.user-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.user-avatar {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  color: #fff; font: 700 11px 'Space Grotesk', sans-serif;
}
.user-avatar svg { display: block; width: 100%; height: 100%; }
.user-chip-text { display: flex; flex-direction: column; min-width: 0; text-align: left; line-height: 1.2; }
.user-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.user-chev { color: var(--muted); flex: 0 0 auto; transition: transform .2s ease; }
.user-chip[aria-expanded="true"] .user-chev { transform: rotate(180deg); }

.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 290px; max-width: calc(100vw - 24px);
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 8px;
}
.user-menu[hidden] { display: none; }
.user-menu-head { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin: 0 -8px 6px; padding-left: 20px; padding-right: 20px; }
.user-menu-head strong { font: 700 15px 'Space Grotesk', sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-head span { font-size: 12px; color: var(--muted); line-height: 1.35; }
.um-sync::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border); margin-right: 6px; }
.um-sync.is-on::before { background: var(--success); }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; min-height: 44px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text); font: 600 14px 'Inter', sans-serif; text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item svg { flex: 0 0 auto; color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--bg-soft); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--primary); }
.menu-item:hover svg, .menu-item:focus-visible svg { color: var(--primary); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-danger, .menu-danger svg { color: var(--danger); }
.menu-danger:hover, .menu-danger:focus-visible { background: color-mix(in srgb, var(--danger) 10%, var(--card)); }
.menu-danger:hover svg, .menu-danger:focus-visible svg { color: var(--danger); }

@media (max-width: 640px) {
  .dash-header-inner { padding: 10px 14px; gap: 10px; }
  .app-name { display: none; }
  .user-chip { padding-right: 10px; }
  .user-sub { display: none; }
  .user-name { max-width: 42vw; }
  .user-menu { position: fixed; left: 12px; right: 12px; top: calc(var(--hdr-h, 64px) + 6px); width: auto; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .user-chev, .user-chip { transition: none; } }
@media print { .user-menu-wrap, .app-brand { display: none !important; } }

/* ---------- Asistente de perfil (primer uso) ---------- */
.profile-box.wiz { max-width: 620px; padding: 0 0 28px; overflow: hidden; }
.wiz > :not(.wiz-progress) { margin-left: 32px; margin-right: 32px; }
.wiz-progress { height: 5px; background: var(--bg-soft); }
.wiz-progress i { display: block; height: 100%; width: 25%; background: var(--primary); border-radius: 0 99px 99px 0; transition: width .35s ease; }
.wiz-top { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; margin-bottom: 6px; }
.wiz-kicker { color: var(--primary); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; }
.wiz-link { background: none; border: 0; color: var(--muted); font-size: 13px; font-weight: 600; padding: 8px 4px; min-height: 40px; }
.wiz-link:hover { color: var(--text); text-decoration: underline; }
.wiz-step h2 { margin: 6px 0 4px; font-size: 25px; }
.wiz-sub { margin: 0 0 20px; font-size: 14.5px; color: var(--muted); }
.wiz-step[hidden] { display: none; }
.wiz-sex { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wiz-sex-opt { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px 10px; border: 1.5px solid var(--border); border-radius: 16px; background: var(--card); color: var(--text); transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease; min-height: 44px; }
.wiz-sex-opt:hover { transform: translateY(-2px); border-color: var(--primary); }
.wiz-sex-opt[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--primary-soft); }
.wiz-sex-opt:focus-visible, .wiz-career:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.wiz-sex-av svg { display: block; width: 64px; height: 64px; border-radius: 50%; }
.wiz-sex-name { font-size: 13px; font-weight: 700; text-align: center; line-height: 1.2; }
.wiz-careers { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 4px; }
.wiz-career { display: flex; align-items: center; gap: 12px; text-align: left; padding: 11px 12px; border: 1.5px solid var(--border); border-radius: 14px; background: var(--card); color: var(--text); min-height: 56px; transition: border-color .15s ease, box-shadow .15s ease; }
.wiz-career:hover { border-color: var(--c, var(--primary)); }
.wiz-career[aria-checked="true"] { border-color: var(--c, var(--primary)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--primary)) 20%, transparent); }
.wiz-career-badge { flex: 0 0 auto; min-width: 42px; height: 36px; padding: 0 8px; border-radius: 10px; background: var(--c, var(--primary)); color: #fff; display: flex; align-items: center; justify-content: center; font: 700 12px 'Space Grotesk', sans-serif; }
.wiz-career-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.wiz-career-txt b { font-size: 13.5px; }
.wiz-career-txt small { font-size: 11.5px; color: var(--muted); }
.wiz-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.wiz-themes .theme-swatch { margin: 0; border-color: var(--border); }
.wiz-summary { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-soft); margin: 18px 0 10px; }
.wiz-sum-av svg { display: block; width: 72px; height: 72px; border-radius: 50%; }
.wiz-sum-txt { display: flex; flex-direction: column; gap: 2px; }
.wiz-sum-txt b { font: 700 19px 'Space Grotesk', sans-serif; }
.wiz-sum-txt small { color: var(--muted); font-size: 13px; }
.wiz-note { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.wiz-nav { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.wiz-nav .btn { min-width: 130px; }
.wiz-nav .btn-primary { flex: 1; max-width: 280px; }
.wiz .err-box { margin-top: 14px; }
.wiz .set-editor { padding: 14px 14px 10px; }
@media (max-width: 560px) {
  .profile-shell { padding: 0; align-items: flex-start; }
  .profile-box.wiz { border-radius: 0; box-shadow: none; border-left: 0; border-right: 0; min-height: calc(100vh - 36px); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .wiz > :not(.wiz-progress) { margin-left: 18px; margin-right: 18px; }
  .wiz-step h2 { font-size: 22px; }
  .wiz-sex { gap: 8px; }
  .wiz-nav { position: sticky; bottom: 0; background: var(--card); padding: 12px 0 4px; margin-top: 18px; }
  .wiz-nav .btn-primary { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .wiz-progress i, .wiz-sex-opt { transition: none; } }

/* Comparador de carreras: con 18 carreras la tabla se desplaza dentro del cuadro */
.compare-pop { max-height: calc(100vh - 110px); overflow-y: auto; overscroll-behavior: contain; }
.compare-titles { font-size: 11px; }

/* Asistente de perfil con 18 carreras: dos columnas en el celular */
@media (max-width: 560px) {
  .wiz-careers { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .wiz-career { padding: 9px 9px; gap: 8px; align-items: flex-start; }
  .wiz-career-badge { min-width: 38px; height: 30px; font-size: 11px; padding: 0 6px; }
  .wiz-career-txt b { font-size: 12px; }
  .wiz-career-txt small { font-size: 10.5px; }
}

/* Android/Chrome móvil: sin el destello azul ni franjas al tocar, ni selección accidental de texto en controles */
* { -webkit-tap-highlight-color: transparent; }
button, a, summary, label, [role="button"], [data-open-video], .menu-item, .mg-node, .materia, .nav-item, select {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
button, summary, [role="button"], .menu-item, .mg-node, .materia, .nav-item {
  -webkit-user-select: none; user-select: none;
}
button:focus, a:focus, summary:focus, [role="button"]:focus { outline: none; }
button:focus-visible, a:focus-visible, summary:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
::selection { background: var(--primary-soft); color: var(--text); }
