/* ============================================================
   I.S.E.F. Licencias — Capa de estilo institucional
   Sistema visual basado en ISEF Gestión:
   azul marino + rojo institucional, Ubuntu Sans,
   tarjetas con franja superior, tablas y formularios sobrios.
   Se carga después de styles.css para armonizar todo el sitio.
   ============================================================ */

/* Tipografía de Ubuntu (Ubuntu Sans / Ubuntu Sans Mono) */
@font-face {
  font-family: "Ubuntu Sans";
  src: url("fonts/UbuntuSans.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Ubuntu Sans";
  src: url("fonts/UbuntuSans-Italic.woff2") format("woff2");
  font-weight: 100 800;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Ubuntu Sans Mono";
  src: url("fonts/UbuntuSansMono.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Ubuntu Sans Mono";
  src: url("fonts/UbuntuSansMono-Italic.woff2") format("woff2");
  font-weight: 100 800;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Identidad institucional */
  --primary: #c8102e;
  --primary-dark: #a30d25;
  --primary-light: #fdf1f2;
  --success: #0f6b3d;
  --success-light: #e8f7ee;
  --warning: #b54708;
  --warning-light: #fef3e6;
  --danger: #b42318;
  --danger-light: #fef3f2;
  --info: #12325a;
  --info-light: #eef2f8;
  --navy: #0b1f3a;
  --navy-2: #12325a;

  --gray-50: #f8fafc;
  --gray-100: #f2f4f7;
  --gray-200: #e4e7ec;
  --gray-300: #d0d5dd;
  --gray-400: #98a2b3;
  --gray-500: #667085;
  --gray-600: #475467;
  --gray-700: #344054;
  --gray-800: #1c2430;
  --gray-900: #0b1f3a;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.08), 0 12px 24px -6px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, 0.18);
  --transition: all 0.18s ease;

  --font-ui: "Ubuntu Sans", "Ubuntu", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Ubuntu Sans", "Ubuntu", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Ubuntu Sans Mono", "Ubuntu Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --navbar-h: 58px;

  /* Compatibilidad con variables heredadas de styles.css */
  --primary-color: #0b1f3a;
  --secondary-color: #12325a;
  --accent-color: #0f6b3d;
  --danger-color: #b42318;
  --warning-color: #b54708;
  --background-color: #f6f7f9;
  --text-color: #1c2430;
  --border-color: #e4e7ec;
  --light-bg: #ffffff;
}

html {
  color-scheme: light;
}

html,
body {
  font-family: var(--font-ui) !important;
}

body {
  background: #f6f7f9 !important;
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

/* Scrollbar institucional */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ===== Layout ===== */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  min-height: calc(100vh - var(--navbar-h));
  overflow: visible !important;
  height: auto !important;
  background: radial-gradient(120% 90% at 100% 0%, #fff 0%, #f7f8fa 60%, #eef1f5 100%);
}

.content-wrapper > section + section {
  margin-top: 18px;
}

.page-title-bar {
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  backdrop-filter: saturate(180%) blur(8px);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: var(--navbar-h);
  z-index: 50;
}

.page-title-main {
  flex: 1;
  min-width: 0;
}

.page-eyebrow {
  margin: 0 0 3px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
}

.page-title {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--navy);
  margin: 0;
}

.page-subtitle {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--gray-500);
}

.page-title-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.top-bar-date {
  font-size: 13px;
  color: var(--gray-500);
  white-space: nowrap;
}

.content-wrapper {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 32px 48px;
}

.content-wrapper--wizard {
  max-width: 1180px;
  padding-bottom: 12px;
}

/* ===== Barra superior institucional ===== */
.top-navbar {
  background: linear-gradient(100deg, #071525 0%, #0d2748 55%, #123a66 100%);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: var(--navbar-h);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 8px 26px rgba(7, 21, 37, 0.18);
}

.top-navbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  pointer-events: none;
  background: linear-gradient(90deg, var(--primary) 0%, rgba(200, 16, 46, 0.35) 18%, rgba(200, 16, 46, 0) 46%);
}

.top-navbar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}

.top-navbar-brand:hover {
  opacity: 1;
}

.top-navbar-logo {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 3px;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.top-navbar-logo img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  object-fit: contain;
}

.top-navbar-title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}

.top-navbar-title h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  margin: 0;
}

.top-navbar-title small {
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  white-space: nowrap;
}

.top-navbar-nav-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.top-navbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.top-navbar .nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.top-navbar .nav-link:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.top-navbar .nav-link.active {
  background: rgba(255, 255, 255, 0.24) !important;
  color: #fff !important;
  border-left: 0 !important;
  padding-left: 12px !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.top-navbar .nav-link.active span {
  color: #fff !important;
  font-weight: 600 !important;
}

.top-navbar .nav-link .material-icons-outlined {
  font-size: 17px;
  line-height: 1;
}

.navbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: var(--transition);
}

.navbar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.navbar-icon-btn .material-icons-outlined {
  font-size: 19px;
}

/* Usuario en navbar */
.top-navbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.top-navbar-user .user-name {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.user-info:hover .user-avatar {
  transform: scale(1.05);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.18);
}

.user-details {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.user-role {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.78);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.role-admin { color: #ffb3bd; }
.role-teacher { color: #67e8f9; }
.role-student { color: #6ee7b7; }

.top-navbar-user .logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  padding: 8px;
  border: 0;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-size: 13px;
}

.top-navbar-user .logout-btn:hover {
  color: #fff;
  background: rgba(0, 0, 0, 0.18);
  opacity: 1;
}

.top-navbar-user .logout-btn .material-icons-outlined {
  font-size: 20px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}

.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 98;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.mobile-nav-overlay--visible {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.mobile-user-section {
  display: none;
}

/* ===== Tarjetas ===== */
.card,
.isef-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card::before,
.isef-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-2) 55%, var(--primary) 100%);
  pointer-events: none;
  z-index: 1;
}

.card-header,
.isef-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: #fff;
}

.card-header h3,
.isef-card-header h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--navy);
  margin: 0;
}

.card-body {
  padding: 24px;
}

.card-body--flush {
  padding: 0;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #d7dde6;
  opacity: 1;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue { background: #eef2f8; color: var(--navy-2); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--primary-light); color: var(--primary); }

.stat-info h4 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  color: var(--navy);
  line-height: 1.1;
  margin: 0;
}

.stat-info p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 500;
}

/* ===== Tablas ===== */
.isef-table {
  width: 100%;
  border-collapse: collapse;
}

.isef-table thead tr {
  background: var(--gray-50) !important;
}

.isef-table th {
  background: var(--gray-50) !important;
  padding: 12px 16px !important;
  text-align: left;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: var(--gray-500) !important;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--gray-200) !important;
  white-space: nowrap;
}

.isef-table td {
  padding: 12px 16px !important;
  font-size: 14px !important;
  color: var(--gray-700) !important;
  border-bottom: 1px solid var(--gray-100) !important;
  vertical-align: middle;
}

.isef-table tbody tr {
  transition: var(--transition);
}

.isef-table tbody tr:hover {
  background: var(--gray-50) !important;
  box-shadow: inset 3px 0 0 var(--primary);
}

.isef-table tbody tr:last-child td {
  border-bottom: none !important;
}

.isef-table .cell-strong {
  font-weight: 600;
  color: var(--gray-800) !important;
  white-space: nowrap;
}

.table-container {
  overflow-x: auto;
  max-width: 100%;
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  transition: all 0.25s ease;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: #9f1226; }
.badge-info { background: var(--info-light); color: var(--navy-2); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-primary { background: var(--info-light); color: var(--navy-2); border: 1px solid #d8e1ec; }

/* ===== Botones ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.5;
  touch-action: manipulation;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  opacity: 1;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 14px rgba(200, 16, 46, 0.16);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 8px 18px rgba(200, 16, 46, 0.22);
}

.btn-secondary {
  background: var(--gray-100);
  border-color: var(--gray-200);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: #e9edf2;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #0b5731;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #912018;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-warning:hover {
  background: #93370d;
}

.btn-info {
  background: var(--info-light);
  border-color: #d8e1ec;
  color: var(--navy-2);
}

.btn-info:hover {
  background: #e2e8f0;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

.btn-icon {
  padding: 8px;
  min-width: 36px;
  justify-content: center;
}

.btn .material-icons-outlined {
  font-size: 18px;
  line-height: 1;
}

/* Alineación de botones utilitarios con el sistema */
.hover\:bg-blue-700:hover {
  background-color: var(--primary-dark) !important;
}

.save-btn.bg-emerald-600,
.save-btn.bg-emerald-600:hover {
  background-color: var(--success) !important;
}

/* ===== Formularios ===== */
.content-wrapper label {
  color: var(--gray-700);
}

.form-group {
  margin-bottom: 20px;
}

.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--gray-800);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: var(--font-ui);
}

.content-wrapper input[type="text"],
.content-wrapper input[type="email"],
.content-wrapper input[type="tel"],
.content-wrapper input[type="date"],
.content-wrapper input[type="time"],
.content-wrapper input[type="password"],
.content-wrapper input[type="file"],
.content-wrapper input[type="number"],
.content-wrapper select,
.content-wrapper textarea,
.form-control {
  background-color: #fff !important;
  border: 1px solid var(--gray-200) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--gray-800) !important;
  font-family: var(--font-ui);
  box-shadow: none;
}

.content-wrapper input:focus,
.content-wrapper select:focus,
.content-wrapper textarea:focus,
.form-control:focus {
  outline: none !important;
  border-color: var(--navy-2) !important;
  box-shadow: 0 0 0 4px rgba(18, 50, 90, 0.10) !important;
}

.content-wrapper input::placeholder,
.content-wrapper textarea::placeholder {
  color: var(--gray-400);
}

select.form-control,
.content-wrapper select {
  cursor: pointer;
  color-scheme: light;
}

textarea.form-control,
.content-wrapper textarea {
  resize: vertical;
  min-height: 80px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #344054;
  margin-bottom: 7px;
}

.form-hint {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  background: #fff;
  padding: 16px 20px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.filter-bar .form-group {
  margin-bottom: 0;
  flex: 1 1 260px;
}

.filter-bar .search-box {
  max-width: 460px;
}

.filter-bar .search-box input {
  width: 100%;
}

.filter-bar .form-control {
  width: auto;
  min-width: 160px;
}

.filter-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
  line-height: 1.3;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

/* Buscador */
.search-box {
  position: relative;
}

.search-box > .material-icons-outlined {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 18px;
  pointer-events: none;
  transition: color 0.2s ease;
}

.search-box input {
  padding-left: 38px;
}

.page-title-bar-actions .search-box input {
  width: 280px;
  max-width: 100%;
}

.search-box:focus-within > .material-icons-outlined {
  color: var(--primary);
}

/* ===== Alertas ===== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 18px;
}

.alert .material-icons-outlined {
  font-size: 20px;
  line-height: 1.2;
  flex-shrink: 0;
}

.alert-warning {
  background: var(--warning-light);
  border-color: #f7d3ae;
  color: #92400e;
}

.alert-success {
  background: var(--success-light);
  border-color: #bfe8ce;
  color: var(--success);
}

.alert-error {
  background: var(--danger-light);
  border-color: #f3c3c9;
  color: #9f1226;
}

.alert-info {
  background: var(--info-light);
  border-color: #d8e1ec;
  color: var(--navy-2);
}

/* ===== Estado vacío ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}

.empty-state .material-icons-outlined,
.empty-state i {
  font-size: 48px;
  margin-bottom: 12px;
  display: inline-block;
}

.empty-state h3,
.empty-state p {
  margin: 0;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 400;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 14px;
  color: var(--gray-500);
}

/* ===== Stepper horizontal del formulario ===== */
.wizard-stepper-card {
  margin-bottom: 14px;
}

.wizard-stepper-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  flex-wrap: wrap;
  padding: 9px 20px;
  border-bottom: 1px solid var(--gray-200);
}

.wizard-stepper-head > div:first-child {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1px 10px;
  min-width: 0;
}

.wizard-stepper-kicker {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  white-space: nowrap;
}

.wizard-stepper-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
  color: var(--navy);
  line-height: 1.3;
  white-space: nowrap;
}

.wizard-stepper-hint {
  margin: 0;
  font-size: 12px;
  color: var(--gray-500);
  white-space: nowrap;
}

.wizard-stepper-head .wizard-progress-track {
  flex: 0 1 300px;
  min-width: 160px;
  margin-bottom: 0;
}

.wizard-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 12px;
}

.wizard-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--gray-600);
  text-decoration: none;
  transition: var(--transition);
  min-width: 0;
}

.wizard-link:hover {
  background: var(--gray-50);
  opacity: 1;
}

.wizard-link.active,
.wizard-link.wizard-current {
  background: var(--primary-light) !important;
  border-color: #f3c3c9;
}

.wizard-link .step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-500);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.wizard-link .step-circle .material-icons-outlined {
  font-size: 16px;
  color: inherit !important;
}

.wizard-link.wizard-current .step-circle {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 14px rgba(200, 16, 46, 0.2);
}

.wizard-link.wizard-done .step-circle {
  background: var(--success) !important;
  color: #fff !important;
}

.wizard-link .step-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.wizard-link .step-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wizard-link.wizard-current .step-name {
  color: var(--primary);
}

.wizard-link .step-status {
  font-size: 10.5px;
  color: var(--gray-400);
  min-height: 12px;
}

.wizard-link.wizard-done .step-status {
  color: var(--success) !important;
}

.wizard-progress-track {
  height: 8px;
  background: var(--gray-200);
  border-radius: 9999px;
  overflow: hidden;
}

.wizard-progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-2) 58%, var(--primary) 100%);
  transition: width 0.3s ease;
}

/* Encabezados de cada paso */
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.section-step {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(11, 31, 58, 0.16);
}

.step-heading {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--navy);
  margin: 0;
}

.isef-card + .isef-card {
  margin-top: 16px;
}

/* Barra de acciones del wizard */
.wizard-actionbar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  padding: 14px 32px 20px;
  background: linear-gradient(to top, #eef1f5 55%, rgba(238, 241, 245, 0));
  pointer-events: none;
}

.wizard-actionbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}

.wizard-actionbar-inner .btn {
  padding: 11px 22px;
}

/* ===== Modales ===== */
.modal {
  background: rgba(7, 21, 37, 0.55) !important;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
}

.modal-content {
  position: relative;
  background: #fff !important;
  padding: 28px !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--gray-200);
  box-shadow: 0 24px 60px rgba(7, 21, 37, 0.28) !important;
  overflow: hidden;
}

.modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-2) 55%, var(--primary) 100%);
}

.modal-content h2 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--navy);
}

.modal-content .btn {
  justify-content: center;
}

.loading-spinner {
  background: rgba(7, 21, 37, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.spinner {
  border-color: rgba(255, 255, 255, 0.25);
  border-top-color: var(--primary);
}

/* ===== Tarjetas de licencias ===== */
.license-card {
  position: relative;
  background: #fff !important;
  border: 1px solid var(--gray-200) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  overflow: hidden;
}

.license-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-2) 55%, var(--primary) 100%);
  pointer-events: none;
}

.license-card > *:first-child {
  margin-top: 2px;
}

.license-card h2,
.license-card .license-name {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--navy) !important;
  letter-spacing: -0.01em;
}

.license-card .license-date {
  color: var(--navy) !important;
  font-weight: 600;
}

/* ===== Componentes heredados: selección de funciones ===== */
.wizard-edit-chip {
  background: var(--info-light);
  color: var(--navy-2);
  border: 1px solid #d8e1ec;
}

.wizard-edit-chip:hover {
  background: #e2e8f0;
}

.casc-l1-btn,
.casc-l2-btn {
  border-color: var(--gray-200);
  background: var(--gray-50);
  color: var(--gray-700);
  border-radius: var(--radius-sm);
}

.casc-l1-btn:hover,
.casc-l2-btn:hover {
  border-color: var(--navy-2);
  background: var(--info-light);
}

.casc-l1-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

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

.casc-count {
  background: var(--primary);
  color: #fff;
}

.casc-l2-btn.active .casc-count {
  background: rgba(255, 255, 255, 0.28);
}

.casc-count-inline {
  background: var(--info-light);
  color: var(--navy-2);
  border: 1px solid #d8e1ec;
}

.casc-mini-btn {
  color: var(--primary);
  background: var(--primary-light);
  border: 1.5px solid #f3c3c9;
}

.casc-mini-btn:hover {
  background: #fbe3e6;
}

.casc-label {
  color: var(--gray-500);
}

.func-group-row {
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  color: var(--gray-700);
  border-radius: 8px;
}

.func-group-row:hover {
  border-color: var(--navy-2);
  background: var(--info-light);
}

.func-group-row.added {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.func-group-row.added .material-icons-outlined {
  color: var(--primary);
}

.func-chip {
  background: var(--info-light);
  color: var(--navy-2);
  border: 1.5px solid #d8e1ec;
}

.func-chip-sub {
  background: var(--success-light);
  color: var(--success);
  border-color: #bfe8ce;
}

.func-group-body {
  background: #fff;
}

/* Dropdowns de funciones / comisiones */
.funciones-dropdown,
.comision-dropdown {
  border-color: var(--gray-200);
  background: #fff;
  border-radius: var(--radius-sm);
}

.funciones-dropdown summary,
.comision-dropdown summary {
  color: var(--gray-700);
}

.funciones-dropdown[open] summary,
.comision-dropdown[open] summary {
  border-color: var(--navy-2);
  background: var(--info-light);
}

.funciones-list,
.comision-list {
  border-color: var(--gray-200);
}

.comision-item,
.funcion-checkbox-item {
  border-color: var(--gray-200) !important;
  background: var(--gray-50) !important;
}

.comision-item:hover,
.funcion-checkbox-item:hover {
  border-color: var(--navy-2) !important;
  background: var(--info-light) !important;
}

.comision-item:has(input[type="checkbox"]:checked),
.funcion-checkbox-item:has(input:checked) {
  border-color: var(--primary) !important;
  background: var(--primary-light) !important;
}

/* Tarjetas dinámicas de funciones */
.function-card {
  border-color: var(--gray-200) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
}

.function-card-header {
  background: var(--gray-50) !important;
  border-bottom: 1px solid var(--gray-200);
}

.function-card-header:hover {
  background: var(--info-light) !important;
}

#dynamicSection h3::before {
  background: linear-gradient(180deg, var(--navy) 0%, var(--primary) 100%);
}

/* Perfil banner */
.profile-banner {
  background: var(--info-light);
  border-color: #d8e1ec;
  color: var(--navy-2);
}

.profile-btn-primary {
  background: var(--primary);
}

.profile-btn-primary:hover {
  background: var(--primary-dark);
}

.profile-btn-ghost:hover {
  color: var(--navy);
}

/* ===== Vistas de monitor / tarjetas ===== */
.monitor-shell {
  max-width: 1440px;
}

.monitor-toolbar-card {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.monitor-updated {
  line-height: 1.2;
}

.monitor-updated p:first-child {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin: 0;
}

.monitor-updated p:last-child {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin: 2px 0 0;
}

/* ===== Utilidades ===== */
.fw-bold { font-weight: 700; }
.text-muted { color: var(--gray-500); }
.text-primary { color: var(--primary) !important; }
.text-navy { color: var(--navy) !important; }

/* ===== Responsive ===== */
@media (max-width: 980px) {
  .top-navbar {
    padding: 0 16px;
    height: 56px;
  }

  :root {
    --navbar-h: 56px;
  }

  .top-navbar-brand h2 {
    font-size: 16px;
  }

  .top-navbar-title small {
    font-size: 8.5px;
    letter-spacing: 0.10em;
  }

  .top-navbar-logo {
    width: 32px;
    height: 32px;
  }

  .top-navbar-nav-wrapper {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(160deg, #071525 0%, #0d2748 60%, #12325a 100%);
    z-index: 99;
    padding: 12px 16px 24px;
    overflow-y: auto;
  }

  .top-navbar-nav-wrapper.mobile-nav--open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .top-navbar-nav {
    flex-direction: column;
    width: 100%;
    gap: 2px;
    align-items: stretch;
  }

  .top-navbar .nav-link {
    padding: 12px 16px;
    font-size: 15px;
  }

  .top-navbar .nav-link.active {
    padding-left: 16px !important;
  }

  .top-navbar .nav-link .material-icons-outlined {
    font-size: 20px;
  }

  .mobile-menu-btn {
    display: block;
  }

  .mobile-nav-overlay {
    display: block;
  }

  .mobile-user-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 12px;
  }

  .mobile-user-section .user-info {
    color: #fff;
  }

  .mobile-user-section .logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
  }

  .mobile-user-section .logout-btn:hover {
    background: rgba(255, 255, 255, 0.18);
  }

  .top-navbar-user {
    display: none;
  }

  .page-title-bar {
    padding: 13px 16px;
    top: 56px;
  }

  .page-title-bar .page-eyebrow {
    font-size: 10.5px !important;
  }

  .page-title-bar .page-subtitle {
    font-size: 12.5px !important;
  }

  .page-title {
    font-size: 20px;
  }

  .top-bar-date {
    display: none;
  }

  .content-wrapper {
    padding: 18px 16px 40px;
  }

  .wizard-stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wizard-stepper-head .wizard-progress-track {
    flex-basis: 100%;
  }

  .wizard-actionbar {
    padding: 10px 16px 14px;
  }

  .wizard-actionbar-inner {
    padding: 12px;
  }

  .wizard-actionbar-inner .btn {
    padding: 10px 16px;
  }
}

@media (max-width: 600px) {
  .page-title-bar {
    align-items: flex-start;
  }

  .page-title-bar-actions {
    width: 100%;
  }

  .wizard-stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wizard-stepper-head {
    padding: 10px 14px;
  }

  .wizard-link {
    padding: 7px 10px;
  }

  .wizard-actionbar-inner > .flex {
    align-items: stretch;
  }

  .wizard-actionbar-inner .btn {
    flex: 1;
    justify-content: center;
  }

  .card-body {
    padding: 18px;
  }

  .filter-bar {
    padding: 14px;
  }

  .filter-actions {
    width: 100%;
    margin-left: 0;
  }

  .filter-actions .btn {
    flex: 1;
  }

  .modal {
    padding: 12px;
  }

  .modal-content {
    padding: 20px !important;
  }
}
