:root {
  --surface-app: #fafafa;
  --surface-panel: #ffffff;
  --surface-sunken: #f4f4f5;
  --surface-hover: #f4f4f5;
  --ink-primary: #18181b;
  --ink-secondary: #52525b;
  --ink-muted: #71717a;
  --ems-primary: #2563eb;
  --ems-primary-dark: #1d4ed8;
  --bs-primary: #2563eb;
  --bs-primary-rgb: 37, 99, 235;
  --bs-link-color: #2563eb;
  --bs-link-hover-color: #1d4ed8;
  --ems-navy: #18181b;
  --ems-navy-2: #27272a;
  --ems-teal: #2563eb;
  --ems-teal-dark: #1d4ed8;
  --ems-gold: #2563eb;
  --ems-gold-2: #1d4ed8;
  --ems-gold-fg: #ffffff;
  --ems-highlight: #2563eb;
  --ems-accent: #2563eb;
  --ems-bg: var(--surface-app);
  --ems-card: var(--surface-panel);
  --ems-surface: var(--surface-sunken);
  --ems-text: var(--ink-primary);
  --ems-muted: var(--ink-muted);
  --ems-border: #e4e4e7;
  --ems-danger: #dc2626;
  --ems-success: #16a34a;
  --ems-sidebar-bg: #1e3a8a;
  --ems-sidebar-text: #eff6ff;
  --ems-sidebar-muted: #bfdbfe;
  --ems-sidebar-hover: rgba(255, 255, 255, 0.1);
  --ems-sidebar-active: rgba(255, 255, 255, 0.16);
  --ems-sidebar-line: rgba(255, 255, 255, 0.18);
  --ems-nav-hover: var(--surface-hover);
  --ems-icon: var(--ink-secondary);
  --ems-brand-bg: var(--surface-sunken);
  --ems-brand-fg: var(--ink-primary);
  --ems-shadow: none;
  --ems-chip-bg: var(--surface-sunken);
  --ems-chip-fg: var(--ink-secondary);
  --ems-cal-teoria-bg: #f4f4f5;
  --ems-cal-teoria-fg: #3f3f46;
  --ems-cal-practica-bg: #eff6ff;
  --ems-cal-practica-fg: #1d4ed8;
  --ems-hero: var(--surface-panel);
  --ems-hero-num: var(--ink-primary);
  --ems-input-bg: #ffffff;
  --sidebar-width: 240px;
  --sidebar-mini: 64px;
  --header-height: 56px;
  --ems-sidebar: var(--sidebar-width);
  --ems-topbar: var(--header-height);
  --ems-footer: 48px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --surface-app: #09090b;
  --surface-panel: #18181b;
  --surface-sunken: #09090b;
  --surface-hover: #27272a;
  --ink-primary: #f4f4f5;
  --ink-secondary: #a1a1aa;
  --ink-muted: #71717a;
  --bs-link-color: #93c5fd;
  --bs-link-hover-color: #bfdbfe;
  --ems-navy: #f4f4f5;
  --ems-navy-2: #e4e4e7;
  --ems-teal: #60a5fa;
  --ems-teal-dark: #93c5fd;
  --ems-gold: #60a5fa;
  --ems-gold-2: #93c5fd;
  --ems-gold-fg: #09090b;
  --ems-highlight: #60a5fa;
  --ems-accent: #60a5fa;
  --ems-bg: var(--surface-app);
  --ems-card: var(--surface-panel);
  --ems-surface: #27272a;
  --ems-text: var(--ink-primary);
  --ems-muted: var(--ink-secondary);
  --ems-border: #27272a;
  --ems-danger: #f87171;
  --ems-success: #4ade80;
  --ems-sidebar-bg: #172554;
  --ems-sidebar-text: #eff6ff;
  --ems-sidebar-muted: #93c5fd;
  --ems-sidebar-hover: rgba(255, 255, 255, 0.08);
  --ems-sidebar-active: rgba(255, 255, 255, 0.14);
  --ems-sidebar-line: rgba(255, 255, 255, 0.14);
  --ems-nav-hover: var(--surface-hover);
  --ems-icon: var(--ink-secondary);
  --ems-brand-bg: var(--surface-hover);
  --ems-brand-fg: var(--ink-primary);
  --ems-shadow: none;
  --ems-chip-bg: #27272a;
  --ems-chip-fg: #e4e4e7;
  --ems-cal-teoria-bg: #27272a;
  --ems-cal-teoria-fg: #e4e4e7;
  --ems-cal-practica-bg: #1e3a8a;
  --ems-cal-practica-fg: #bfdbfe;
  --ems-hero: var(--surface-panel);
  --ems-hero-num: var(--ink-primary);
  --ems-input-bg: #18181b;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

html, body { height: 100%; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--surface-app);
  color: var(--ink-primary);
  font-size: 0.875rem;
  line-height: 1.5;
  font-weight: 400;
}

body.app-locked { overflow: hidden; }

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--surface-app);
}

@media (min-width: 1200px) {
  .login-wrap { grid-template-columns: 1fr 1.1fr; }
  .login-panel { order: 1; }
  .login-hero { order: 2; display: flex; }
  .brand-logo-form { display: none; }
}

.login-hero {
  display: none;
  position: relative;
  overflow: hidden;
  padding: 3rem;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(15, 23, 42, 0.78) 0%, rgba(30, 58, 138, 0.5) 100%),
    url("../images/portada.jpg") center/cover;
  border-left: 0;
  align-items: flex-start;
  justify-content: center !important;
}

.login-hero h2 {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.5;
  color: #fff;
}

.login-hero p { color: #fff; }

.login-kicker {
  color: var(--ems-highlight);
  letter-spacing: 0.08em;
}

.brand-logo { width: auto; max-width: 180px; }

.brand-logo img { height: 36px; width: auto; }

.login-hero .logo-for-light { display: none; }
.login-hero .logo-for-dark { display: block; }

.login-hero .brand-logo { max-width: 320px; }

.login-hero .brand-logo img {
  height: auto;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.brand-logo-form { max-width: 240px; }

.brand-logo-form img { height: 112px; width: auto; }

.logo-for-dark { display: none; }
html[data-theme="dark"] .logo-for-light { display: none; }
html[data-theme="dark"] .logo-for-dark { display: block; }
.sidebar .logo-for-light { display: none; }
.sidebar .logo-for-dark { display: block; }

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 0.375rem;
  display: grid;
  place-items: center;
  background: var(--surface-panel);
  color: var(--ink-secondary);
  border: 1px solid var(--ems-border);
  font-size: 1rem;
  flex-shrink: 0;
}

.login-panel {
  background: var(--surface-app);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  position: relative;
}

.login-tools {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  display: flex;
  gap: 0.45rem;
  z-index: 5;
}

.login-card { width: 100%; max-width: 24rem; }

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

body.admin-layout {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--header-height) minmax(0, 1fr) auto;
  transition: grid-template-columns 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.admin-layout.sidebar-collapsed {
  grid-template-columns: var(--sidebar-mini) minmax(0, 1fr);
}

.admin-header {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  height: var(--header-height);
  z-index: 1045;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem 0 1rem;
  background: var(--surface-panel);
  border-bottom: 1px solid var(--ems-border);
}

.admin-main {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.sidebar {
  grid-column: 1;
  grid-row: 1 / -1;
  background: var(--ems-sidebar-bg);
  color: var(--ems-sidebar-text);
  position: relative;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.75rem;
  width: auto;
  z-index: 1035;
  border-right: 1px solid var(--ems-sidebar-line);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0.15rem 0.75rem;
  padding: 0.35rem 0.5rem 0.85rem;
  border-bottom: 1px solid var(--ems-sidebar-line);
}

.sidebar-brand img {
  width: 100%;
  height: auto;
  max-height: 96px;
  object-fit: contain;
}

.nav-link-ems {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ems-sidebar-text);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
  margin-bottom: 0.125rem;
}

.nav-link-ems i {
  width: 1.25rem;
  text-align: center;
  color: var(--ems-sidebar-muted);
  flex-shrink: 0;
}

.nav-link-ems:hover {
  background: var(--ems-sidebar-hover);
  color: #fff;
}

.nav-link-ems:hover i { color: #fff; }

.nav-link-ems.active {
  background: var(--ems-sidebar-active);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 2px 0 0 #93c5fd;
}

.nav-link-ems.active i { color: #fff; }

.nav-section {
  margin: 0.85rem 0.75rem 0.25rem;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ems-sidebar-muted);
  white-space: nowrap;
}

.subnav .nav-link-ems {
  font-size: 0.8125rem;
  padding: 0.4rem 0.75rem 0.4rem 2.15rem;
}

body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .nav-section {
  display: none;
}

body.sidebar-collapsed .sidebar-brand {
  margin-left: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
}

body.sidebar-collapsed .sidebar-brand img {
  width: 40px;
  height: 40px;
  max-height: none;
}

body.sidebar-collapsed .nav-link-ems {
  justify-content: center;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}

body.sidebar-collapsed .subnav .nav-link-ems { padding-left: 0.45rem; }

.sidebar-overlay {
  display: none;
  position: fixed;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(9, 9, 11, 0.4);
  z-index: 1030;
}

.sidebar-overlay.show { display: block; }

.header-title { min-width: 0; }

.header-title-main {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crumb {
  color: var(--ink-muted);
  font-weight: 400;
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-collapse {
  width: 34px;
  height: 34px;
  border: 1px solid var(--ems-border);
  background: var(--surface-panel);
  border-radius: 0.375rem;
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-collapse:hover {
  background: var(--surface-hover);
  color: var(--ink-primary);
}

.user-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 50%;
  color: var(--ink-primary);
}

.user-chip .avatar { width: 32px; height: 32px; display: block; }

.user-menu-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 12rem;
  padding: 0.55rem 1rem 0.35rem;
  white-space: normal;
}

.user-menu-head strong {
  color: var(--ink-primary);
  font-size: 0.875rem;
  font-weight: 600;
}

.user-menu-head span {
  color: var(--ink-muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 1.25rem 1.5rem 1.5rem;
}

.content .row > * {
  min-width: 0;
}

.app-footer {
  grid-column: 2;
  grid-row: 3;
  min-height: var(--ems-footer);
  z-index: 1038;
  border-top: 1px solid var(--ems-border);
  background: var(--ems-card);
  color: var(--ems-muted);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.45rem;
}

.app-footer a {
  color: var(--ems-muted);
  text-decoration: none;
  white-space: nowrap;
}

.app-footer a:hover { color: var(--ink-primary); }

.terms-public {
  min-height: 100vh;
  background: var(--ems-bg, #f4f7f8);
  padding: 2rem 1.2rem 3rem;
}

.terms-page {
  max-width: 820px;
  margin: 0 auto;
}

.terms-page h1 {
  font-size: 1.55rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.terms-page h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 1.45rem;
  margin-bottom: 0.4rem;
}

.terms-page p,
.terms-page li {
  font-size: 0.94rem;
  line-height: 1.55;
}

.terms-page .terms-meta {
  color: var(--ems-muted);
  font-size: 0.85rem;
}

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

.page-title {
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink-primary);
  font-size: 1.5rem;
}

.stat-card,
.table-card,
.panel,
.card {
  background: var(--surface-panel);
  border: 1px solid var(--ems-border);
  border-radius: 0.5rem;
  box-shadow: none;
  min-width: 0;
  max-width: 100%;
}

.stat-card {
  padding: 1.125rem 1.25rem;
  height: 100%;
}

.stat-card .icon-wrap,
.stat-card.gold .icon-wrap,
.stat-card.navy .icon-wrap,
html[data-theme="dark"] .stat-card.navy .icon-wrap,
html[data-theme="dark"] .stat-card.gold .icon-wrap {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.375rem;
  display: grid;
  place-items: center;
  background: var(--surface-sunken);
  color: var(--ink-secondary);
  border: 1px solid var(--ems-border);
}

.table {
  color: var(--ems-text);
}

.table thead th {
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: var(--ink-muted);
  font-weight: 500;
  background: transparent;
  border-color: var(--ems-border);
}

.table td,
.table th {
  border-color: var(--ems-border);
  vertical-align: middle;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--ems-surface);
}

.avatar-lg {
  width: 96px;
  height: 96px;
  border-radius: 16px;
  object-fit: cover;
  background: var(--ems-surface);
}

.id-photo {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--ems-border);
  background: var(--ems-surface);
}

.photo-drop {
  border: 1.5px dashed var(--ems-border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  background: var(--ems-surface);
  cursor: pointer;
}

.photo-drop:hover { border-color: var(--ems-teal); }

.badge-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 0.4rem;
  border-radius: 6px;
  background: var(--ems-navy);
  color: #fff;
  font-weight: 800;
  margin-right: 0.25rem;
}

.timeline-item {
  position: relative;
  padding-left: 1.4rem;
  border-left: 2px solid var(--ems-border);
  margin-left: 0.5rem;
  padding-bottom: 1rem;
}

.timeline-item::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ems-teal);
  position: absolute;
  left: -6px;
  top: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--ems-chip-bg);
  color: var(--ems-chip-fg);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.btn-ems,
.btn-gold,
.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 500;
  border-radius: 0.375rem;
}

.btn-ems:hover,
.btn-ems:focus,
.btn-ems:disabled,
.btn-gold:hover,
.btn-gold:focus,
.btn-gold:active,
.btn-primary:hover,
.btn-primary:focus {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

.btn-secondary {
  background: #696cff;
  border-color: #6062d3;
  color: #fff;
  font-weight: 500;
}

.btn-secondary:hover,
.btn-secondary:focus {
  background: #6062d3;
  border-color: #6062d3;
  color: #fff;
}

.btn-danger {
  font-weight: 600;
}

.search-input { max-width: 320px; }

.account-row.debe { color: var(--ems-danger); font-weight: 700; }
.account-row.haber { color: var(--ems-success); font-weight: 700; }

.bar-track {
  height: 10px;
  background: var(--ems-surface);
  border: 1px solid var(--ems-border);
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--ems-teal);
}

.dash-bars {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  height: 190px;
}

.dash-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dash-bar-plot {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.dash-bar-col {
  width: 70%;
  max-width: 42px;
  border-radius: 6px 6px 2px 2px;
  background: var(--ems-primary);
}

.dash-bar-lbl {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ems-muted);
}

.progress-hero {
  background: var(--surface-panel);
  color: var(--ink-primary);
  border: 1px solid var(--ems-border);
  border-radius: 0.5rem;
  padding: 1.25rem;
}

.progress-hero .display-6 { color: var(--ems-hero-num); font-size: 1.75rem; }

.click-row { cursor: pointer; }

.click-row:hover { background: var(--ems-surface); }

.swal2-popup { font-family: "Inter", system-ui, sans-serif; }

.user-chip.dropdown-toggle::after { display: none; }

.list-group-item {
  background: var(--ems-card);
  color: var(--ems-text);
  border-color: var(--ems-border);
}

.list-group-item.active {
  background: var(--surface-hover);
  border-color: var(--ems-border);
  color: var(--ink-primary);
  font-weight: 600;
}

.pay-box {
  border: 1px solid var(--ems-border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: var(--ems-surface);
}

.pay-box .pay-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ems-muted);
  font-weight: 700;
}

.cal-wrap { user-select: none; }

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-dows {
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ems-muted);
  text-align: center;
}

.cal-day {
  min-height: 92px;
  border: 1px solid var(--ems-border);
  border-radius: 8px;
  padding: 0.35rem 0.4rem;
  background: var(--ems-card);
  cursor: pointer;
}

.cal-day:hover { border-color: var(--ems-teal); }

.cal-day.is-muted {
  background: var(--ems-surface);
  cursor: default;
  min-height: 40px;
}

.cal-day.is-today {
  border-color: var(--ems-highlight);
  box-shadow: inset 0 0 0 1px var(--ems-highlight);
}

.cal-day.has-class { background: var(--ems-surface); }

.cal-day-num {
  font-weight: 800;
  font-size: 0.82rem;
  margin-bottom: 0.2rem;
}

.cal-ev {
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 0.12rem 0.28rem;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-ev.ev-teoria,
.cal-legend .ev-teoria {
  background: var(--ems-cal-teoria-bg);
  color: var(--ems-cal-teoria-fg);
}

.cal-ev.ev-practica,
.cal-legend .ev-practica {
  background: var(--ems-cal-practica-bg);
  color: var(--ems-cal-practica-fg);
}

.cal-ev.done { opacity: 0.65; text-decoration: line-through; }

.cal-legend {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 0.8rem;
  font-size: 0.8rem;
}

.cal-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  margin-right: 0.3rem;
  vertical-align: middle;
}

.cal-legend .ev-teoria { background: var(--ems-cal-teoria-bg); }
.cal-legend .ev-practica { background: var(--ems-cal-practica-bg); }

.form-control,
.form-select {
  background-color: var(--ems-input-bg);
  color: var(--ems-text);
  border-color: var(--ems-border);
}

.form-control:focus,
.form-select:focus {
  background-color: var(--ems-input-bg);
  color: var(--ems-text);
  border-color: var(--ems-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.form-label,
.text-muted,
.small.text-muted {
  color: var(--ems-muted) !important;
}

.nav-tabs {
  border-bottom-color: var(--ems-border);
}

.nav-tabs .nav-link {
  color: var(--ems-muted);
}

.nav-tabs .nav-link.active {
  background: var(--ems-card);
  color: var(--ems-text);
  border-color: var(--ems-border) var(--ems-border) var(--ems-card);
}

.acct-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  background: var(--ems-surface);
  border: 1px solid var(--ems-border);
  border-radius: 12px;
  padding: 0.45rem;
  margin-bottom: 1rem;
}

.acct-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.72rem 0.8rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  color: var(--ems-muted);
  background: transparent;
}

.acct-tab i { color: var(--ems-teal); }

.acct-tab:hover {
  background: var(--ems-card);
  color: var(--ems-text);
}

.acct-tab.active {
  background: var(--surface-panel);
  color: var(--ink-primary);
  box-shadow: none;
  border: 1px solid var(--ems-border);
}

.acct-tab.active i { color: var(--ems-primary); }

.doc-item {
  border: 1px solid var(--ems-border);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  background: var(--ems-surface);
}

.photo-grid img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--ems-border);
  background: var(--ems-surface);
}

.modal-content {
  background: var(--ems-card);
  color: var(--ems-text);
  border-color: var(--ems-border);
}

.modal-header,
.modal-footer {
  border-color: var(--ems-border);
}

.dropdown-menu {
  background: var(--ems-card);
  border-color: var(--ems-border);
}

.dropdown-item {
  color: var(--ems-text);
}

.dropdown-item:hover {
  background: var(--ems-surface);
  color: var(--ems-text);
}

.js-swal-link { color: var(--ems-text); }

.swal2-popup {
  background: var(--ems-card) !important;
  color: var(--ems-text) !important;
}

.swal2-title,
.swal2-html-container {
  color: var(--ems-text) !important;
}

@media (max-width: 1199.98px) {
  .login-hero { display: none !important; }
}

@media (max-width: 992px) {
  body.admin-layout,
  body.admin-layout.sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }
  .admin-header,
  .admin-main,
  .app-footer,
  body.sidebar-collapsed .admin-main {
    grid-column: 1;
    margin-left: 0;
  }
  .sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    height: auto;
    transform: translateX(-105%);
    width: var(--sidebar-width);
    z-index: 1046;
  }
  .sidebar.open {
    transform: none;
    box-shadow: 4px 0 16px rgba(9, 9, 11, 0.15);
  }
  body.sidebar-collapsed .sidebar { width: var(--sidebar-width); }
  body.sidebar-collapsed .sidebar-label { display: inline; }
  body.sidebar-collapsed .nav-section { display: block; }
  body.sidebar-collapsed .sidebar-brand {
    margin: 0 0.15rem 0.75rem;
    padding: 0.35rem 0.5rem 0.85rem;
  }
  body.sidebar-collapsed .sidebar-brand img {
    width: 100%;
    height: auto;
    max-height: 96px;
  }
  body.sidebar-collapsed .nav-link-ems,
  body.sidebar-collapsed .subnav .nav-link-ems {
    justify-content: flex-start;
    padding: 0.5rem 0.75rem;
  }
  .app-footer { flex-direction: column; align-items: flex-start; }
  .acct-tabs { grid-template-columns: 1fr; }
}

/* ── MFA Code Inputs ────────────────────────────────── */
.mfa-code-inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.mfa-digit {
  width: 48px;
  height: 56px;
  border: 2px solid var(--ems-border);
  border-radius: 10px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: "Inter", ui-monospace, monospace;
  color: var(--ems-text);
  background: var(--ems-card);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.mfa-digit:focus {
  border-color: var(--ems-teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
.mfa-digit::selection {
  background: rgba(13, 148, 136, 0.2);
}
.mfa-separator {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ems-muted);
  margin: 0 2px;
}
[data-theme="dark"] .mfa-digit {
  background: var(--ems-surface);
  border-color: var(--ems-border);
  color: var(--ems-text);
}
[data-theme="dark"] .mfa-digit:focus {
  border-color: var(--ems-teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.25);
}

/* ── Filterable Select ──────────────────────────────── */
.filterable-select {
  position: relative;
}
.fs-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  max-height: 200px;
  overflow-y: auto;
  background: var(--ems-card);
  border: 1px solid var(--ems-border);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-top: 2px;
}
.fs-dropdown.show {
  display: block;
}
.fs-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.15s;
}
.fs-item:hover {
  background: var(--ems-surface);
}
[data-theme="dark"] .fs-dropdown {
  background: var(--ems-card);
  border-color: var(--ems-border);
}
[data-theme="dark"] .fs-item:hover {
  background: var(--ems-surface);
}

/* ===== Cliente Details — info card ===== */
.info-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--ems-border);
}
.info-list li:last-child { border-bottom: 0; }
.info-label {
  color: var(--ems-muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.info-label i { color: var(--ems-teal); }
.info-value {
  color: var(--ems-text);
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}
.doc-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ems-muted);
  margin-bottom: 0.3rem;
}
.doc-label i { color: var(--ems-teal); }
.id-photo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--ems-muted);
  font-size: 0.72rem;
  border-style: dashed;
}
.id-photo-empty i { font-size: 1.4rem; opacity: 0.5; }
a > .id-photo { transition: transform 0.15s ease, box-shadow 0.15s ease; }
a:hover > .id-photo {
  transform: translateY(-2px);
  box-shadow: var(--ems-shadow);
  border-color: var(--ems-teal);
}

/* ===== Calendar legend chips ===== */
.cal-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.cal-legend-teoria {
  background: var(--ems-cal-teoria-bg);
  color: var(--ems-cal-teoria-fg);
}
.cal-legend-practica {
  background: var(--ems-cal-practica-bg);
  color: var(--ems-cal-practica-fg);
}

/* ===== FullCalendar — modern restyle ===== */
.ems-calendar {
  --fc-border-color: var(--ems-border);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: var(--ems-surface);
  --fc-today-bg-color: color-mix(in srgb, var(--ems-teal) 12%, transparent);
  --fc-event-bg-color: var(--ems-teal);
  --fc-event-border-color: transparent;
  --fc-list-event-hover-bg-color: var(--ems-surface);
}
.ems-calendar .fc {
  color: var(--ems-text);
}
.ems-calendar .fc .fc-toolbar-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ems-navy);
  text-transform: capitalize;
}
html[data-theme="dark"] .ems-calendar .fc .fc-toolbar-title { color: var(--ems-text); }
.ems-calendar .fc .fc-button {
  background: var(--ems-surface);
  border: 1px solid var(--ems-border);
  color: var(--ems-text);
  font-weight: 700;
  text-transform: capitalize;
  padding: 0.35rem 0.75rem;
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.ems-calendar .fc .fc-button:hover {
  background: var(--ems-teal);
  border-color: var(--ems-teal);
  color: #fff;
}
.ems-calendar .fc .fc-button:focus,
.ems-calendar .fc .fc-button:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.25);
}
.ems-calendar .fc .fc-button-primary:not(:disabled).fc-button-active,
.ems-calendar .fc .fc-button-primary:not(:disabled):active {
  background: var(--ems-teal-dark);
  border-color: var(--ems-teal-dark);
  color: #fff;
}
.ems-calendar .fc .fc-button-group > .fc-button:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.ems-calendar .fc .fc-button-group > .fc-button:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.ems-calendar .fc .fc-col-header-cell {
  background: var(--ems-surface);
  padding: 0.55rem 0;
}
.ems-calendar .fc .fc-col-header-cell-cushion {
  color: var(--ems-muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.ems-calendar .fc .fc-daygrid-day {
  transition: background 0.15s ease;
}
.ems-calendar .fc .fc-daygrid-day:hover {
  background: color-mix(in srgb, var(--ems-teal) 6%, transparent);
}
.ems-calendar .fc .fc-daygrid-day-number {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ems-text);
  padding: 0.3rem 0.45rem;
}
.ems-calendar .fc .fc-day-today .fc-daygrid-day-number {
  background: var(--ems-teal);
  color: #fff;
  border-radius: 999px;
  min-width: 1.6rem;
  text-align: center;
}
.ems-calendar .fc .fc-daygrid-event {
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.74rem;
  font-weight: 600;
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.ems-calendar .fc .fc-daygrid-event:hover { filter: brightness(0.95); }
.ems-calendar .fc .fc-event.ems-ev-done { text-decoration: line-through; }
.ems-calendar .fc-theme-standard td,
.ems-calendar .fc-theme-standard th {
  border-color: var(--ems-border);
}
.ems-calendar .fc-theme-standard .fc-scrollgrid {
  border-color: var(--ems-border);
  border-radius: 12px;
  overflow: hidden;
}
.ems-calendar .fc .fc-list {
  border-radius: 12px;
  overflow: hidden;
}
.ems-calendar .fc .fc-list-day-cushion {
  background: var(--ems-surface);
  color: var(--ems-text);
}

/* ===== Curso — icono del card ===== */
.course-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--ems-chip-bg);
  color: var(--ems-teal);
  font-size: 1.1rem;
  flex: 0 0 auto;
}

/* ===== Edit highlight helpers ===== */
.border-teal { border: 1.5px solid var(--ems-teal) !important; }
.table-active,
.table > tbody > tr.table-active > td { background: var(--ems-surface) !important; }

.modal-documento .modal-content { min-height: 80vh; }
.modal-documento .doc-iframe {
  display: block;
  width: 100%;
  height: 70vh;
  border: 0;
  background: var(--ems-surface);
}

.doc-loading {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 32, 0.55);
  backdrop-filter: blur(2px);
}
.doc-loading[hidden] { display: none !important; }
.doc-loading-box {
  text-align: center;
  color: #fff;
  padding: 28px 32px;
  border-radius: 12px;
  background: rgba(21, 42, 74, 0.92);
  box-shadow: var(--ems-shadow);
}
.doc-loading-text {
  margin-top: 14px;
  font-weight: 600;
  font-size: 15px;
}

.pwd-rules {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--ems-border);
  border-radius: 8px;
  background: var(--ems-surface);
}
.pwd-rules li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.15rem 0;
  font-size: 0.85rem;
  color: var(--ems-muted);
}
.pwd-rules li.pwd-rules-title {
  font-weight: 700;
  color: var(--ems-text);
  margin-bottom: 0.35rem;
}
.pwd-rules li.is-ok { color: var(--ems-success); }
.pwd-rules li.is-bad { color: var(--ems-danger); }

.tenant-asset {
  border: 1px solid var(--ems-border);
  border-radius: 8px;
  background:
    linear-gradient(45deg, var(--ems-surface) 25%, transparent 25%),
    linear-gradient(-45deg, var(--ems-surface) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--ems-surface) 75%),
    linear-gradient(-45deg, transparent 75%, var(--ems-surface) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: var(--ems-card);
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
}
.tenant-asset img {
  max-width: 100%;
  max-height: 84px;
  object-fit: contain;
}
.tenant-asset.fondo {
  min-height: 120px;
}
.tenant-asset.fondo img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 4px;
}

.menu-order-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.menu-order-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--ems-border);
  border-radius: 8px;
  background: var(--ems-card);
  user-select: none;
}

.menu-order-item.is-group {
  background: var(--ems-surface);
}

.menu-order-item .grip {
  color: var(--ems-muted);
  cursor: grab;
}

.menu-order-item.is-dragging {
  opacity: 0.45;
}

.menu-order-btn {
  width: 2rem;
  padding-left: 0;
  padding-right: 0;
}

.menu-order-children {
  flex-basis: 100%;
  margin: 0.15rem 0 0.15rem 1.5rem;
}
