/* Tema: script inline en base.html asigna data-theme antes del primer paint */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1017;
  --bg-elevated: #111827;
  --panel: #151c28;
  --panel-hover: #1c2636;
  --border: #2a3544;
  --border-strong: #3d4d63;
  --text: #eef2f7;
  --text-secondary: #9fb0c8;
  --muted: #7d8fa3;
  --accent: #3b82f6;
  --accent-muted: rgba(59, 130, 246, 0.15);
  --accent-hover: #60a5fa;
  --danger: #f87171;
  --ok: #4ade80;
  --warning: #fbbf24;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --sidebar-accent: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  --input-bg: #0c1017;
  --link-nav: #9fb0c8;
  --message-info-bg: rgba(59, 130, 246, 0.12);
  --message-info-text: #93c5fd;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f0f2f5;
  --bg-elevated: #ffffff;
  --panel: #ffffff;
  --panel-hover: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-muted: rgba(37, 99, 235, 0.1);
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
  --warning: #d97706;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --sidebar-accent: linear-gradient(180deg, #2563eb 0%, #1e40af 100%);
  --input-bg: #ffffff;
  --link-nav: #475569;
  --message-info-bg: rgba(37, 99, 235, 0.08);
  --message-info-text: #1d4ed8;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 1000;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.65rem 1rem;
  clip: auto;
  overflow: visible;
  white-space: normal;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: var(--shadow);
  outline: none;
}
.skip-link:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  --sidebar-width: 272px;
}

body.sidebar-open-mobile {
  overflow: hidden;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 180;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

[data-theme="dark"] .sidebar-backdrop {
  background: rgba(0, 0, 0, 0.55);
}

@media (max-width: 899px) {
  .layout[data-sidebar="open"] .sidebar-backdrop {
    display: block;
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 200;
  background: var(--panel);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), flex-basis 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease, border-color 0.2s ease;
}

@media (max-width: 899px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: min(var(--sidebar-width), min(288px, 92vw));
    transform: translateX(-105%);
    border-radius: 0 20px 20px 0;
  }

  .layout[data-sidebar="open"] .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }
}

@media (min-width: 900px) {
  .sidebar {
    position: relative;
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    min-height: 100vh;
    transform: none;
    border-radius: 0;
  }

  .layout[data-sidebar="closed"] .sidebar {
    flex-basis: 0;
    width: 0;
    overflow: hidden;
    opacity: 0;
    border-right-color: transparent;
    pointer-events: none;
  }
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  padding: 1.1rem 0 1.35rem;
  min-height: 0;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.85rem 1rem;
  margin: 0 0 0.85rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.sidebar-close {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sidebar-close:hover {
  background: var(--panel-hover);
  border-color: var(--border-strong);
  color: var(--text);
}

.sidebar-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar-close__ico {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-close__ico svg {
  display: block;
}

@media (max-width: 899px) {
  .sidebar-close {
    display: inline-flex;
  }
}

.sidebar-brand__mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: var(--sidebar-accent);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
  flex-shrink: 0;
}

@supports not (background: color-mix(in srgb, red, blue)) {
  .sidebar-brand__mark {
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
  }
}

.sidebar-brand__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.sidebar-brand__name {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.15;
}

.sidebar-brand__tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0.65rem;
  scrollbar-gutter: stable;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  margin: 0.12rem 0;
  color: var(--link-nav);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-link__ico {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  color: var(--muted);
  transition: background 0.18s ease, color 0.18s ease;
}

@supports not (color: color-mix(in srgb, red, blue)) {
  .sidebar-link__ico {
    background: var(--bg-elevated);
    opacity: 0.9;
  }
}

.sidebar-link__ico svg {
  display: block;
}

.sidebar-link__label {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.sidebar-link__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  margin-left: 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  vertical-align: middle;
}

.sidebar-link:hover {
  background: var(--accent-muted);
  color: var(--text);
  text-decoration: none;
}

.sidebar-link:hover .sidebar-link__ico {
  background: color-mix(in srgb, var(--accent-muted) 80%, var(--panel));
  color: var(--accent);
}

.sidebar-link.active {
  background: var(--accent-muted);
  color: var(--accent);
  text-decoration: none;
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 12%, transparent);
}

.sidebar-link.active .sidebar-link__ico {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

@supports not (color: color-mix(in srgb, red, blue)) {
  .sidebar-link:hover .sidebar-link__ico {
    background: var(--accent-muted);
  }
  .sidebar-link.active {
    border-color: rgba(37, 99, 235, 0.2);
    box-shadow: none;
  }
  [data-theme="dark"] .sidebar-link.active {
    border-color: rgba(59, 130, 246, 0.25);
  }
}

.sidebar-section {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-left: 1.1rem;
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.15rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.sidebar-user__avatar {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
  background: var(--sidebar-accent);
}

.sidebar-user__meta {
  min-width: 0;
  flex: 1;
}

.sidebar-user__name {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user__hint {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.sidebar-footer .sidebar-logout-form {
  margin: 0.65rem 0 0;
}
.sidebar-footer .sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.sidebar-footer .sidebar-logout:hover {
  background: var(--panel-hover);
  border-color: var(--border);
  color: var(--text);
}
.sidebar-footer .sidebar-logout:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar-footer .btn-install {
  display: block;
  width: 100%;
  margin: 0.65rem 0 0.4rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.3;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.sidebar-footer .btn-install:hover {
  border-style: solid;
  background: var(--accent-muted);
  color: var(--accent-hover);
}
.sidebar-footer .btn-install:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-x: auto;
  background: var(--bg);
}

.main-inner {
  padding: 1.5rem 2rem 2.5rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

@media (min-width: 900px) {
  .main-header {
    padding: 0.65rem 2rem;
  }
}

.main-header__start,
.main-header__end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-toggle:hover {
  border-color: var(--border-strong);
  background: var(--panel-hover);
}

.sidebar-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar-toggle__ico {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
}

.sidebar-toggle__chev {
  position: absolute;
  inset: 0;
  margin: auto;
  display: block;
}

.sidebar-toggle__chev--expand {
  display: none;
}

.layout[data-sidebar="closed"] .sidebar-toggle__chev--collapse {
  display: none;
}

.layout[data-sidebar="closed"] .sidebar-toggle__chev--expand {
  display: block;
}

.header-notifs {
  position: relative;
}

.header-notifs__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.header-notifs__btn:hover {
  border-color: var(--border-strong);
  background: var(--panel-hover);
}

.header-notifs__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.header-notifs__btn-ico {
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-notifs__btn-ico svg {
  display: block;
}

.header-notifs__badge {
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.28rem;
  font-size: 0.62rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1rem;
  text-align: center;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  box-shadow: 0 0 0 2px var(--panel);
}

.header-notifs__dropdown {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 80;
  width: min(22rem, calc(100vw - 2.5rem));
  max-height: min(24rem, 70vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

/* El display:flex de arriba puede ganar al atributo [hidden] en algunos navegadores → panel “pegado” visible */
.header-notifs__dropdown[hidden] {
  display: none !important;
  pointer-events: none;
  visibility: hidden;
}

.header-notifs__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.header-notifs__title {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}

.header-notifs__all {
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.header-notifs__all:hover {
  text-decoration: underline;
}

.header-notifs__list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.header-notifs__item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 1rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}

.header-notifs__list li:last-child .header-notifs__item {
  border-bottom: none;
}

.header-notifs__item:hover {
  background: var(--panel-hover);
  text-decoration: none;
}

.header-notifs__item--unread {
  background: var(--accent-muted);
}

.header-notifs__item--unread .header-notifs__item-title {
  color: var(--accent);
}

.header-notifs__item-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.header-notifs__item-msg {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.header-notifs__item-meta {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.header-notifs__empty {
  margin: 0;
  padding: 1.15rem 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
  list-style: none;
}

.theme-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
}

/* No usar ".theme-icons svg { display: block }" aquí: gana a display:none y se ven ambos iconos. */
.theme-icons__sun,
.theme-icons__moon {
  display: none;
}

/* Icono del tema activo: luna en oscuro, sol en claro */
html[data-theme="dark"] .theme-icons__moon {
  display: block;
}

html[data-theme="light"] .theme-icons__sun {
  display: block;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.theme-toggle--icon-only {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  gap: 0;
}
.theme-toggle:hover {
  border-color: var(--border-strong);
  background: var(--panel-hover);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-fab {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.theme-fab:hover {
  transform: scale(1.05);
}
.theme-fab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

h1 {
  font-size: 1.65rem;
  margin: 0 0 0.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.dashboard-hero {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem 1.65rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.dashboard-hero__copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.dashboard-hero__eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.dashboard-hero__title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
}

.dashboard-hero__lead {
  margin: 0;
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.dashboard-hero__accent {
  flex-shrink: 0;
  width: min(8rem, 28vw);
  border-radius: 14px;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--accent) 45%, transparent), transparent 70%),
    linear-gradient(145deg, var(--accent-muted), transparent);
  opacity: 0.95;
}

@supports not (background: color-mix(in srgb, red, blue)) {
  .dashboard-hero__accent {
    background: radial-gradient(circle at 30% 30%, rgba(37, 99, 235, 0.2), transparent 70%), var(--accent-muted);
  }
}

@media (max-width: 560px) {
  .dashboard-hero {
    flex-direction: column;
  }

  .dashboard-hero__accent {
    width: 100%;
    min-height: 4.5rem;
  }
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.dashboard-stat {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

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

[data-theme="dark"] .dashboard-stat:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.dashboard-stat__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 12px;
  background: var(--accent-muted);
  color: var(--accent);
}

.dashboard-stat__icon svg {
  display: block;
}

.dashboard-stat__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.dashboard-stat__value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
}

.dashboard-stat__label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  line-height: 1.35;
}

.dashboard-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.dashboard-section__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.dashboard-section__link {
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.dashboard-section__link:hover {
  text-decoration: underline;
}

.dashboard-subjects {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.dashboard-subject-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem 1rem;
  padding: 1rem 1.15rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.dashboard-subject-card:hover {
  border-color: var(--border-strong);
  background: var(--panel-hover);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.dashboard-subject-card__code {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-muted);
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  white-space: nowrap;
}

.dashboard-subject-card__name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}

.dashboard-subject-card__chev {
  color: var(--muted);
  display: flex;
  transition: transform 0.18s ease, color 0.18s ease;
}

.dashboard-subject-card:hover .dashboard-subject-card__chev {
  color: var(--accent);
  transform: translateX(3px);
}

.dashboard-empty {
  margin: 0;
  padding: 1.25rem 1.35rem;
  border-radius: 14px;
  border: 1px dashed var(--border-strong);
  color: var(--muted);
  font-size: 0.92rem;
  background: var(--bg-elevated);
}

.subject-list-page__hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 2rem;
  padding: 1.5rem 1.65rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.subject-list-page__title {
  margin: 0 0 0.4rem;
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.subject-list-page__lead {
  margin: 0;
  max-width: 40rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.subject-list-page__cta {
  flex-shrink: 0;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 1.35rem;
}

.subject-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.subject-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.subject-card--inactive {
  opacity: 0.72;
}

.subject-card__media-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.subject-card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-elevated);
  overflow: hidden;
}

.subject-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.subject-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
      circle at 30% 20%,
      color-mix(in srgb, var(--accent) 35%, transparent),
      transparent 55%
    ),
    linear-gradient(145deg, var(--accent-muted), var(--panel-hover));
}

@supports not (background: color-mix(in srgb, red, blue)) {
  .subject-card__placeholder {
    background: radial-gradient(
        circle at 30% 20%,
        rgba(37, 99, 235, 0.22),
        transparent 55%
      ),
      linear-gradient(145deg, var(--accent-muted), var(--panel-hover));
  }
}

.subject-card__placeholder-code {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--accent);
  opacity: 0.85;
}

.subject-card__badge {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  padding: 0.28rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(15, 23, 42, 0.72);
  border-radius: 8px;
  backdrop-filter: blur(6px);
}

[data-theme="dark"] .subject-card__badge {
  background: rgba(0, 0, 0, 0.55);
}

.subject-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.1rem 1.15rem 1.2rem;
  flex: 1;
}

.subject-card__name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.subject-card__name a {
  color: var(--text);
  text-decoration: none;
}

.subject-card__name a:hover {
  color: var(--accent);
  text-decoration: none;
}

.subject-card__desc {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.subject-card__desc--empty {
  color: var(--muted);
  font-style: italic;
}

.subject-card__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-top: auto;
  padding-top: 0.35rem;
}

.subject-card__stat {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.subject-card__stat-n {
  font-weight: 800;
  color: var(--accent);
  margin-right: 0.15rem;
}

.subject-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.subject-list-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-radius: 18px;
  border: 1px dashed var(--border-strong);
  background: var(--bg-elevated);
}

.subject-list-empty__text {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.subject-form-page__head {
  margin-bottom: 1.5rem;
}

.subject-form-page__title {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.subject-form-page__sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.subject-form {
  max-width: 36rem;
  padding: 1.35rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.subject-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.form-row--wide textarea {
  max-width: 100%;
}

.field-help {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.btn--sm {
  padding: 0.38rem 0.7rem;
  font-size: 0.78rem;
  border-radius: 9px;
}

.subject-delete-page__form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.subject-modal {
  padding: 0;
  border: none;
  max-width: min(32rem, calc(100vw - 1.5rem));
  width: 100%;
  background: transparent;
  box-shadow: none;
}

.subject-modal::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

[data-theme="dark"] .subject-modal::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

.subject-modal__panel {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 42rem);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.subject-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.subject-modal__title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.subject-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.subject-modal__close:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.subject-modal__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.subject-modal__form {
  padding: 1.1rem 1.2rem 1.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.subject-modal__form .form-row:last-of-type {
  margin-bottom: 0;
}

.subject-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.messages {
  margin: 0 0 1.25rem;
  padding: 0;
}
.messages li {
  list-style: none;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.4rem;
  border: 1px solid transparent;
}
.messages .success {
  background: rgba(74, 222, 128, 0.12);
  color: var(--ok);
  border-color: rgba(74, 222, 128, 0.25);
}
[data-theme="light"] .messages .success {
  background: rgba(22, 163, 74, 0.1);
  color: #15803d;
}
.messages .error {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.25);
}
[data-theme="light"] .messages .error {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
}
.messages .info,
.messages .debug {
  background: var(--message-info-bg);
  color: var(--message-info-text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  background: var(--accent);
  color: #fff;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
  color: #fff;
}
.btn:active {
  transform: scale(0.98);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn.secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.secondary:hover {
  background: var(--panel-hover);
  border-color: var(--border-strong);
}
.btn.danger {
  background: var(--danger);
  color: #fff;
}
.btn.danger:hover {
  filter: brightness(1.08);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.15rem 1.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  border-color: var(--border-strong);
}
[data-theme="light"] .card:hover {
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
th,
td {
  text-align: left;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}
tr:last-child td {
  border-bottom: none;
}
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-elevated);
}

.form-row {
  margin-bottom: 0.95rem;
}
.form-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  max-width: 32rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-row input:focus-visible,
.form-row select:focus-visible,
.form-row textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.35rem 0;
}
.form-check input {
  width: auto;
  margin-top: 0.2rem;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.stat .v {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.stat .l {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
}

.atlas-img-wrap {
  position: relative;
  max-width: 520px;
  margin: 0.5rem 0;
}
.atlas-img-wrap img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: crosshair;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: radial-gradient(ellipse 120% 80% at 50% -20%, var(--accent-muted), transparent),
    var(--bg);
}
.login-box {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow);
}
.login-box .login-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.errorlist {
  color: var(--danger);
  font-size: 0.8rem;
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
}

code {
  font-size: 0.85em;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

body.lms-modal-open {
  overflow: hidden;
}

/* —— Examen tipo LMS (Moodle / Coursera lite) —— */
.lms-exam {
  margin: -0.5rem -0.5rem 0;
}

.lms-exam__header {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 1.25rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.lms-exam__header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.lms-exam__title {
  font-size: 1.35rem;
  margin: 0;
}

.lms-exam__meta {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.lms-exam__timer-wrap {
  text-align: right;
}

.lms-exam__timer-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.lms-exam__timer {
  font-size: 1.35rem;
}

.lms-exam__progress {
  height: 6px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.lms-exam__progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 0 2px 2px 0;
  transition: width 0.35s ease;
}

.lms-exam__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 960px) {
  .lms-exam__layout {
    grid-template-columns: 1fr 200px;
  }
}

.lms-exam__form {
  min-width: 0;
}

.lms-card--question {
  scroll-margin-top: 5rem;
}

.lms-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.lms-card__head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.15rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.lms-q-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85rem;
  height: 1.85rem;
  padding: 0 0.35rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--accent-muted);
  color: var(--accent);
}

.lms-chip {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}

.lms-chip--mcq {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
}

.lms-chip--region {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.lms-card__points {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.lms-card__body {
  padding: 1.1rem 1.25rem 1.25rem;
}

.lms-card__prompt {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  line-height: 1.55;
}

.lms-hint {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 36rem;
}

.lms-mcq-instruccion {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.lms-mcq-options {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.lms-radio--mcq {
  margin-bottom: 0;
  align-items: center;
}

.lms-radio--mcq .lms-radio__text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.45rem;
}

.lms-mcq-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0 0.35rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.82rem;
  background: var(--accent-muted);
  color: var(--accent);
  flex-shrink: 0;
}

.lms-mcq-sep {
  margin: 0 0.4rem;
  color: var(--muted);
  font-weight: 400;
}

.lms-mcq-body {
  font-size: 0.92rem;
  color: var(--text);
}

.mcq-admin-intro {
  max-width: 42rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.question-prompt-input {
  width: 100%;
  min-height: 6.5rem;
  font-size: 0.95rem;
}

.question-form__stack .form-row {
  margin-bottom: 0.85rem;
}

.mcq-options-block {
  margin-top: 0.5rem;
}

.mcq-options-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.mcq-options-root {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.mcq-option-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.mcq-option-row--removed {
  display: none !important;
}

.mcq-option-row--errors {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.25);
}

.mcq-plaquita.mcq-plaquita--on {
  border-color: var(--ok);
  background: rgba(74, 222, 128, 0.18);
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25);
}

.mcq-plaquita.mcq-plaquita--on::after {
  opacity: 1;
}

.mcq-option-row__meta {
  display: none;
}

.mcq-row-letter {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1rem;
  background: var(--accent-muted);
  color: var(--accent);
  align-self: flex-start;
  margin-top: 0.15rem;
}

.mcq-row-body {
  flex: 1;
  min-width: 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mcq-row-body label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.mcq-row-text {
  width: 100%;
  resize: vertical;
  min-height: 3.25rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9rem;
}

.mcq-row-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  align-self: stretch;
  justify-content: center;
}

.mcq-plaquita {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  border: 2px solid var(--border-strong);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.mcq-plaquita:hover {
  border-color: var(--ok);
  background: rgba(74, 222, 128, 0.08);
}

.mcq-plaquita:has(.mcq-plaquita-input:checked) {
  border-color: var(--ok);
  background: rgba(74, 222, 128, 0.18);
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25);
}

.mcq-plaquita-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.mcq-plaquita::after {
  content: "✓";
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ok);
  opacity: 0.25;
}

.mcq-plaquita:has(.mcq-plaquita-input:checked)::after {
  opacity: 1;
}

.mcq-row-remove {
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  border-radius: 8px;
}

.lms-radio {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.4rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lms-radio:hover {
  border-color: var(--border-strong);
  background: var(--panel-hover);
}

.lms-radio__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.lms-radio__box {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  margin-top: 0.15rem;
  position: relative;
}

.lms-radio__input:checked + .lms-radio__box {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--panel);
}

.lms-radio__text {
  font-size: 0.9rem;
  color: var(--text);
}

.question-type-section {
  margin: 1.25rem 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}

.question-type-section__title {
  font-size: 0.95rem;
  margin: 0 0 0.65rem;
  color: var(--text);
}

.form-row--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.form-row--inline > div {
  flex: 1;
  min-width: 7rem;
}

.lms-exam__nav {
  position: sticky;
  top: 5.5rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 0.85rem;
}

.lms-exam__nav-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.lms-exam__nav-title {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.lms-exam__nav-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.lms-exam__nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.lms-nav-pill {
  aspect-ratio: 1;
  min-height: 2rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.lms-nav-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lms-nav-pill.is-answered {
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.45);
  color: var(--ok);
}

.lms-nav-pill.is-current {
  box-shadow: 0 0 0 2px var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

.lms-exam__nav-legend {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted);
}

.lms-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.lms-legend-dot--ok {
  background: var(--ok);
}

.lms-legend-dot--idle {
  background: var(--border-strong);
}

.lms-legend-dot--cur {
  background: var(--accent);
}

.atlas-field {
  margin-bottom: 0.85rem;
}

.atlas-field__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.atlas-field__select {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9rem;
}

.exam-confirm-warn {
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
  padding: 1rem;
  margin-bottom: 1rem;
  color: var(--warning);
  font-size: 0.88rem;
}

.exam-confirm-warn__sub {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.exam-confirm-text {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.exam-confirm-stats {
  display: grid;
  gap: 0.5rem;
}

.exam-confirm-stats > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.exam-confirm-stats .sub {
  color: var(--muted);
  font-size: 0.8rem;
}

.lms-exam__nav-list {
  margin: 0;
  padding-left: 1.1rem;
}

.lms-exam__nav-link {
  color: var(--link-nav);
  text-decoration: none;
  line-height: 1.7;
}

.lms-exam__nav-link:hover {
  color: var(--accent);
}

.lms-exam__submit-bar {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.lms-exam__submit {
  padding: 0.65rem 1.5rem;
  font-size: 1rem;
}

.lms-exam__submit-hint {
  margin-top: 0.75rem;
}

/* Vista previa región (fuera del modal) */
.atlas-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.atlas-preview__frame {
  position: relative;
  max-width: 320px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}

.atlas-preview__frame img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.atlas-preview__markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.atlas-preview__dot {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--panel);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.atlas-preview__badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.atlas-preview__badge.has-points {
  color: var(--ok);
  border-color: rgba(74, 222, 128, 0.35);
}

.atlas-open-btn__ico {
  margin-right: 0.25rem;
}

/* Modal atlas / confirmación (visibilidad por clase; evita bugs con atributo hidden) */
.lms-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lms-modal.is-open {
  display: flex;
}

.lms-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.lms-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.lms-modal__panel--narrow {
  max-width: 440px;
}

.lms-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.lms-modal__title {
  margin: 0;
  font-size: 1.15rem;
}

.lms-modal__x {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
}

.lms-modal__x:hover {
  background: var(--border);
  color: var(--text);
}

.lms-modal__body {
  padding: 1rem 1.15rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.lms-modal__intro {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.atlas-thumb-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.atlas-thumb {
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  width: 72px;
  height: 54px;
  background: var(--bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.atlas-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.atlas-thumb.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-muted);
}

.atlas-stage {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: crosshair;
}

.atlas-stage__img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
  user-select: none;
}

.atlas-stage__markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.atlas-marker {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--panel);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.atlas-modal__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.atlas-modal__count {
  font-size: 0.88rem;
  color: var(--muted);
}

.lms-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.15rem;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

/* —— Detalle de asignatura: índice tipo libro —— */
.subject-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  padding: 1.35rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.subject-hero__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.subject-hero__title {
  margin: 0 0 0.25rem;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.subject-hero__code {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.subject-hero__desc {
  margin: 0;
  max-width: 42rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
}
.subject-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.book-toc {
  margin-bottom: 1.75rem;
  padding: 1.15rem 1.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-sm);
}
.book-toc__heading {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.book-toc__hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}
.book-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 1;
}
@media (min-width: 640px) {
  .book-toc__list {
    columns: 2;
    column-gap: 1.5rem;
  }
}
.book-toc__item {
  break-inside: avoid;
  margin-bottom: 0.35rem;
}
.book-toc__link {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  padding: 0.35rem 0.25rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.book-toc__link:hover {
  background: var(--accent-muted);
  color: var(--accent);
  text-decoration: none;
}
.book-toc__num {
  flex-shrink: 0;
  min-width: 1.65rem;
  font-weight: 700;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  text-align: right;
}
.book-toc__num--appendix {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.book-toc__label {
  flex: 1;
  font-weight: 500;
  line-height: 1.35;
}

.book-index {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.book-chapter {
  scroll-margin-top: 5.5rem;
  padding: 0 0 0 1rem;
  border-left: 3px solid var(--border-strong);
  margin-left: 0.15rem;
}
.book-chapter--appendix {
  border-left-color: var(--muted);
  opacity: 0.98;
}
.book-chapter__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.book-chapter__header-start {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex: 1;
  min-width: min(100%, 12rem);
}
.book-chapter__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.book-chapter__actions .btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}
.book-chapter__btn-delete {
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.35);
}
[data-theme="dark"] .book-chapter__btn-delete {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
}
.book-chapter__btn-delete:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: var(--danger);
}
[data-theme="dark"] .book-chapter__btn-delete:hover {
  background: rgba(248, 113, 113, 0.1);
}

.subject-themes-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.9rem 1.15rem;
}
.subject-themes-toolbar__label {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
}
.book-chapter__index {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 800;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.book-chapter__index--appendix {
  background: var(--panel-hover);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}
.book-chapter__kicker {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.book-chapter__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.book-chapter__grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 900px) {
  .book-chapter__grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
  }
}

.index-panel {
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.index-panel--full {
  grid-column: 1 / -1;
}
.index-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}
.index-panel__head .index-panel__title {
  margin: 0;
}
.index-panel__add {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
}
.index-panel__title {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.index-panel__empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
}

.index-lines {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: idx;
}
.index-lines__item {
  border-bottom: 1px solid var(--border);
}
.index-lines__item:last-child {
  border-bottom: none;
}
.index-lines__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  padding: 0.65rem 0.15rem;
  color: inherit;
  text-decoration: none;
  transition: background 0.12s ease;
  border-radius: 8px;
}
a.index-lines__row:hover {
  background: var(--panel-hover);
  text-decoration: none;
  color: inherit;
}
.index-lines__row--locked {
  cursor: not-allowed;
  opacity: 0.72;
}
.index-lines__badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.index-lines__badge--conference {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.25);
  color: var(--accent);
}
[data-theme="dark"] .index-lines__badge--conference {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}
.index-lines__badge--seminar {
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.28);
  color: #b45309;
}
[data-theme="dark"] .index-lines__badge--seminar {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.25);
  color: #fbbf24;
}
.index-lines__badge--eval {
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.25);
  color: #15803d;
}
[data-theme="dark"] .index-lines__badge--eval {
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.22);
  color: #86efac;
}
.index-lines__text {
  flex: 1;
  min-width: 8rem;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.35;
}
.index-lines__meta {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--warning);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.index-lines__chev {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.book-empty__title {
  margin: 0 0 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
}
.book-empty__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0;
}

.content-form-card {
  max-width: 42rem;
  padding: 1.25rem 1.35rem;
}
.content-form-card .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.content-form-card .field-help {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.content-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}
.content-preview-frame {
  width: 100%;
  height: 75vh;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 0.5rem;
}

