/* ============================================================================
   Alumne Flex — capa de interfaz.

   Esta hoja es COMÚN A TODOS LOS TEMAS y no contiene ni un color literal: todo
   sale de los tokens que aporta el tema activo (webroot/themes/<slug>/).
   Si necesitas un color nuevo, añádelo como token al tema, no aquí.

   Orden de carga en el layout:
     font/fonts.css → vendor/bootstrap → themes/<slug>/theme.css → este fichero

   Secciones:
     1. Puente con Bootstrap
     2. Base
     3. Tipografía y utilidades de texto
     4. Botones
     5. Formularios
     6. Tarjetas, paneles y superficies
     7. Tablas
     8. Badges, tags y estados
     9. Shell: sidebar, topbar, contenido
    10. Patrones: KPI, hero, listas, estado vacío
    11. Pantallas de autenticación
    12. Utilidades y responsive
   ============================================================================ */

/* ---------------------------------------------------------------------------
   1. Puente con Bootstrap
   Se remapean las variables de Bootstrap 5.3 a los tokens. A partir de aquí,
   los componentes de Bootstrap (modal, dropdown, offcanvas, alert, grid) salen
   ya con el lenguaje visual de Alumne Flex sin tocar su marcado.
   --------------------------------------------------------------------------- */
:root {
  --bs-primary: var(--action-primary);
  --bs-primary-rgb: 255, 90, 45;
  --bs-secondary: var(--text-muted);
  --bs-success: var(--status-success-solid);
  --bs-warning: var(--status-warning-solid);
  --bs-danger: var(--status-danger-solid);
  --bs-info: var(--status-info-solid);

  --bs-body-font-family: var(--font-sans);
  --bs-body-font-size: var(--type-body-size);
  --bs-body-font-weight: var(--weight-regular);
  --bs-body-line-height: var(--leading-normal);
  --bs-body-color: var(--text-body);
  --bs-body-bg: var(--surface-canvas);
  --bs-emphasis-color: var(--text-strong);
  --bs-secondary-color: var(--text-muted);
  --bs-tertiary-color: var(--text-subtle);
  --bs-border-color: var(--border-subtle);
  --bs-border-radius: var(--radius-control);
  --bs-border-radius-sm: var(--radius-sm);
  --bs-border-radius-lg: var(--radius-card);
  --bs-border-radius-xl: var(--radius-panel);
  --bs-border-radius-pill: var(--radius-pill);
  --bs-link-color: var(--text-link);
  --bs-link-hover-color: var(--text-link-hover);
  --bs-link-color-rgb: 245, 65, 31;
  --bs-focus-ring-color: rgba(255, 90, 45, .28);
  --bs-focus-ring-width: 3px;
  --bs-box-shadow: var(--shadow-md);
  --bs-box-shadow-sm: var(--shadow-sm);
  --bs-box-shadow-lg: var(--shadow-lg);
  --bs-font-monospace: var(--font-mono);
}

/* Bootstrap fija estos por componente, así que hay que repetirlos ahí. */
.modal { --bs-modal-bg: var(--surface-card); --bs-modal-border-color: var(--border-subtle);
  --bs-modal-border-radius: var(--radius-panel); --bs-modal-box-shadow: var(--shadow-xl);
  --bs-modal-header-border-color: var(--border-subtle); --bs-modal-footer-border-color: var(--border-subtle);
  --bs-modal-color: var(--text-body); }
.modal-backdrop { --bs-backdrop-bg: var(--surface-overlay); --bs-backdrop-opacity: 1; backdrop-filter: blur(3px); }
.dropdown-menu { --bs-dropdown-bg: var(--surface-card); --bs-dropdown-border-color: var(--border-subtle);
  --bs-dropdown-border-radius: var(--radius-card); --bs-dropdown-box-shadow: var(--shadow-md);
  --bs-dropdown-link-color: var(--text-body); --bs-dropdown-link-hover-bg: var(--action-ghost-hover);
  --bs-dropdown-link-hover-color: var(--text-strong); --bs-dropdown-link-active-bg: var(--surface-brand-soft);
  --bs-dropdown-link-active-color: var(--orange-700); --bs-dropdown-padding-y: 6px; --bs-dropdown-item-padding-y: 9px;
  --bs-dropdown-item-padding-x: 10px; --bs-dropdown-font-size: var(--text-sm); }
.dropdown-menu .dropdown-item { border-radius: var(--radius-sm); }
/* Los items son `display:block`, así que un icono de Lucide (que es un <svg>
   inline) queda ~2px por debajo del centro del texto. Con flex se centran, igual
   que ya hace Bootstrap con `.btn`. El icono no se estruja con textos largos. */
.dropdown-menu .dropdown-item { display: flex; align-items: center; gap: 8px; }
.dropdown-menu .dropdown-item > svg { flex: 0 0 auto; }
.offcanvas { --bs-offcanvas-bg: var(--surface-card); --bs-offcanvas-border-color: var(--border-subtle);
  --bs-offcanvas-color: var(--text-body); }
.tooltip { --bs-tooltip-bg: var(--surface-inverse); --bs-tooltip-color: var(--text-inverse);
  --bs-tooltip-border-radius: var(--radius-sm); --bs-tooltip-font-size: var(--text-2xs); --bs-tooltip-opacity: 1; }
.progress { --bs-progress-bg: var(--sand-200); --bs-progress-border-radius: var(--radius-pill);
  --bs-progress-bar-bg: var(--action-primary); --bs-progress-height: 8px; }

/* ---------------------------------------------------------------------------
   2. Base
   --------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { background: var(--surface-canvas); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--type-body-size);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-body);
  color: var(--text-body);
  background: var(--surface-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { color: var(--text-link-hover); text-decoration: underline; text-underline-offset: 3px; }

code, kbd, pre, samp { font-family: var(--font-mono); font-size: .92em; }

:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
::selection { background: var(--orange-200); color: var(--navy-800); }

hr { border: 0; border-top: 1px solid var(--border-subtle); opacity: 1; margin: var(--space-7) 0; }

/* ---------------------------------------------------------------------------
   3. Tipografía
   --------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-strong);
  letter-spacing: var(--tracking-heading);
  line-height: var(--leading-snug);
  font-weight: var(--weight-semibold);
  margin: 0;
}
h1 { font-size: var(--type-h1-size); letter-spacing: var(--tracking-display); }
h2 { font-size: var(--type-h2-size); letter-spacing: var(--tracking-display); }
h3 { font-size: var(--type-h3-size); }
h4 { font-size: var(--type-h4-size); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

.af-display { font-family: var(--font-display); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-display); }
.af-mono { font-family: var(--font-mono); }

/* Eyebrow: la única mayúscula del sistema. */
.af-eyebrow {
  font-size: var(--type-eyebrow-size);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-subtle);
  margin: 0;
}
.af-eyebrow-accent { color: var(--teal-600); }
.af-eyebrow-brand { color: var(--text-brand); }

.af-muted { color: var(--text-muted); }
.af-subtle { color: var(--text-subtle); }
.af-strong { color: var(--text-strong); }
.af-prose { max-width: var(--prose-max); line-height: var(--leading-relaxed); }

.af-code-inline {
  font-family: var(--font-mono); font-size: var(--text-xs);
  background: var(--sand-100); color: var(--text-body);
  padding: 1px 6px; border-radius: var(--radius-xs);
}

/* ---------------------------------------------------------------------------
   4. Botones
   --------------------------------------------------------------------------- */
.btn {
  --bs-btn-font-family: var(--font-sans);
  --bs-btn-font-size: var(--text-sm);
  --bs-btn-font-weight: var(--weight-semibold);
  --bs-btn-border-radius: var(--radius-control);
  --bs-btn-padding-y: 0;
  --bs-btn-padding-x: var(--space-5);
  --bs-btn-focus-box-shadow: var(--ring-focus);
  height: var(--control-h-md);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-3);
  letter-spacing: var(--tracking-label);
  white-space: nowrap;
  transition: var(--transition-control);
}
.btn:active { transform: scale(.975); }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn i[data-lucide] { flex: 0 0 auto; }

.btn-sm { --bs-btn-font-size: var(--text-xs); --bs-btn-padding-x: var(--space-4); height: var(--control-h-sm); gap: var(--space-2); }
.btn-lg { --bs-btn-font-size: var(--text-base); --bs-btn-padding-x: var(--space-7); height: var(--control-h-lg); }

/* Primario: el naranja de acción. Es el único botón con halo de marca. */
.btn-brand {
  --bs-btn-color: var(--action-primary-fg);
  --bs-btn-bg: var(--action-primary);
  --bs-btn-border-color: var(--action-primary);
  --bs-btn-hover-color: var(--action-primary-fg);
  --bs-btn-hover-bg: var(--action-primary-hover);
  --bs-btn-hover-border-color: var(--action-primary-hover);
  --bs-btn-active-bg: var(--action-primary-press);
  --bs-btn-active-border-color: var(--action-primary-press);
  --bs-btn-active-color: var(--action-primary-fg);
  --bs-btn-disabled-color: var(--action-primary-fg);
  --bs-btn-disabled-bg: var(--action-primary);
  --bs-btn-disabled-border-color: var(--action-primary);
  box-shadow: var(--shadow-brand);
}

/* Paginación integrada con la identidad de la plataforma: la página activa usa el
   naranja de marca (en vez del azul por defecto de Bootstrap) y los enlaces son
   neutros con acento de marca al pasar el ratón. Respeta «Marca rápida» y temas. */
.pagination {
  --bs-pagination-color: var(--text-body);
  --bs-pagination-bg: var(--surface-card);
  --bs-pagination-border-color: var(--border-subtle);
  --bs-pagination-hover-color: var(--action-primary);
  --bs-pagination-hover-bg: var(--action-ghost-hover);
  --bs-pagination-hover-border-color: var(--border-default);
  --bs-pagination-focus-color: var(--action-primary);
  --bs-pagination-focus-bg: var(--action-ghost-hover);
  --bs-pagination-focus-box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--action-primary) 30%, transparent);
  --bs-pagination-active-color: var(--action-primary-fg);
  --bs-pagination-active-bg: var(--action-primary);
  --bs-pagination-active-border-color: var(--action-primary);
  --bs-pagination-disabled-color: var(--text-subtle);
  --bs-pagination-disabled-bg: var(--surface-card);
  --bs-pagination-disabled-border-color: var(--border-subtle);
  gap: 4px;
}
.pagination .page-link {
  border-radius: var(--radius-sm);
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn-brand:hover { box-shadow: var(--shadow-brand); }

/* Secundario sólido: navy. Para acciones de sistema, no de marca. */
.btn-ink {
  --bs-btn-color: var(--text-inverse);
  --bs-btn-bg: var(--action-secondary);
  --bs-btn-border-color: var(--action-secondary);
  --bs-btn-hover-color: var(--text-inverse);
  --bs-btn-hover-bg: var(--action-secondary-hover);
  --bs-btn-hover-border-color: var(--action-secondary-hover);
  --bs-btn-active-bg: var(--action-secondary-hover);
  --bs-btn-active-color: var(--text-inverse);
}

.btn-outline-brand {
  --bs-btn-color: var(--text-body);
  --bs-btn-bg: var(--surface-card);
  --bs-btn-border-color: var(--border-default);
  --bs-btn-hover-color: var(--text-strong);
  --bs-btn-hover-bg: var(--action-ghost-hover);
  --bs-btn-hover-border-color: var(--border-default);
  --bs-btn-active-bg: var(--action-ghost-hover);
  --bs-btn-active-color: var(--text-strong);
  --bs-btn-active-border-color: var(--border-default);
}

.btn-ghost {
  --bs-btn-color: var(--text-muted);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--text-strong);
  --bs-btn-hover-bg: var(--action-ghost-hover);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--action-ghost-hover);
  --bs-btn-active-color: var(--text-strong);
  --bs-btn-active-border-color: transparent;
}

.btn-danger-soft {
  --bs-btn-color: var(--status-danger-fg);
  --bs-btn-bg: var(--status-danger-bg);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--status-danger-solid);
  --bs-btn-hover-border-color: var(--status-danger-solid);
  --bs-btn-active-bg: var(--status-danger-solid);
  --bs-btn-active-color: #fff;
}

/* Botón cuadrado que solo lleva icono. */
.af-icon-btn {
  width: 36px; height: 36px; padding: 0; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: var(--radius-control);
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: var(--transition-control);
}
.af-icon-btn:hover { background: var(--action-ghost-hover); color: var(--text-strong); }
.af-icon-btn:active { transform: scale(.975); }
.af-icon-btn-sm { width: 30px; height: 30px; }
.af-icon-btn-bordered { border-color: var(--border-subtle); background: var(--surface-card); }

/* ---------------------------------------------------------------------------
   5. Formularios
   --------------------------------------------------------------------------- */
.form-label {
  font-size: var(--type-label-size);
  font-weight: var(--weight-semibold);
  color: var(--text-strong);
  letter-spacing: var(--tracking-label);
  margin-bottom: var(--space-2);
}

.form-control, .form-select {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-body);
  background-color: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-control);
  min-height: var(--control-h-md);
  padding: var(--space-3) var(--space-4);
  transition: var(--transition-control);
}
.form-control::placeholder { color: var(--text-subtle); }
.form-control:focus, .form-select:focus {
  border-color: var(--border-brand);
  box-shadow: var(--ring-focus);
  background-color: var(--surface-card);
  color: var(--text-body);
}
.form-control:disabled, .form-select:disabled,
.form-control[readonly] {
  background-color: var(--surface-sunken);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 1;
}
textarea.form-control { min-height: 96px; line-height: var(--leading-normal); }
.form-control-sm, .form-select-sm { min-height: var(--control-h-sm); font-size: var(--text-xs); padding: var(--space-2) var(--space-3); }
.form-text { font-size: var(--text-2xs); color: var(--text-muted); margin-top: var(--space-2); }

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238B837A' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='m4 6 4 4 4-4'/%3e%3c/svg%3e");
  background-size: 16px 12px;
}

/* Campo con icono a la izquierda, como en el prototipo. */
.af-field { position: relative; }
.af-field-icon {
  position: absolute; left: var(--space-4); top: 50%; transform: translateY(-50%);
  color: var(--text-subtle); pointer-events: none; display: inline-flex;
}
.af-field-icon ~ .form-control { padding-left: 40px; }
.af-field-sm .af-field-icon { left: var(--space-3); }
.af-field-sm .af-field-icon ~ .form-control { padding-left: 34px; }

/* Ojito de contraseña. */
.af-password { position: relative; }
.af-password .form-control { padding-right: 44px; }
.af-password-toggle {
  position: absolute; top: 50%; right: var(--space-2); transform: translateY(-50%);
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--radius-pill);
  background: transparent; color: var(--text-subtle); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: var(--transition-control);
}
.af-password-toggle:hover { background: var(--action-ghost-hover); color: var(--text-strong); transform: translateY(-50%); }

.form-check-input {
  border-color: var(--border-default);
  background-color: var(--surface-card);
  width: 1.05em; height: 1.05em; margin-top: .18em;
}
.form-check-input:checked { background-color: var(--action-primary); border-color: var(--action-primary); }
.form-check-input:focus { border-color: var(--border-brand); box-shadow: var(--ring-focus); }
.form-check-label { font-size: var(--text-sm); color: var(--text-body); }
.form-switch .form-check-input:checked { background-color: var(--action-accent); border-color: var(--action-accent); }

.invalid-feedback { font-size: var(--text-2xs); color: var(--status-danger-fg); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--status-danger-solid); background-image: none; }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(229, 72, 77, .22); }
.error-message { font-size: var(--text-2xs); color: var(--status-danger-fg); margin-top: var(--space-2); }

/* Medidor de fuerza de contraseña. */
.af-password-rules {
  display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4);
  margin-top: var(--space-3); font-size: var(--text-2xs); color: var(--text-muted);
}
.af-password-rules span[data-password-rule] { display: inline-flex; align-items: center; gap: var(--space-2); }
.af-password-rules span[data-password-rule].is-met { color: var(--status-success-fg); font-weight: var(--weight-semibold); }

/* ---------------------------------------------------------------------------
   6. Tarjetas, paneles y superficies
   --------------------------------------------------------------------------- */
.af-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}
.af-panel {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-sm);
}
.af-card-body, .af-panel-body { padding: var(--gutter-card); }
.af-panel-body { padding: var(--gutter-panel); }

.af-card-interactive { transition: var(--transition-surface); }
.af-card-interactive:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.af-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-5) var(--gutter-panel);
  border-bottom: 1px solid var(--border-subtle);
}
.af-panel-head h2, .af-panel-head h3 { font-size: var(--text-base); }

/* Panel oscuro: la voz técnica del producto. Un gradiente ink por vista. */
.af-panel-ink {
  background: var(--gradient-ink);
  border-radius: var(--radius-panel);
  color: #fff;
  border: 0;
}
.af-panel-ink h1, .af-panel-ink h2, .af-panel-ink h3 { color: #fff; }
.af-panel-ink .af-muted { color: rgba(255, 255, 255, .7); }

/* Cuadrado con icono dentro, para dar peso a un glifo. */
.af-icon-box {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: var(--surface-brand-soft); color: var(--text-brand);
}
.af-icon-box-sm { width: 34px; height: 34px; }
.af-icon-box-accent { background: var(--surface-accent-soft); color: var(--teal-700); }
.af-icon-box-ai { background: var(--status-ai-bg); color: var(--status-ai-fg); }
.af-icon-box-success { background: var(--status-success-bg); color: var(--status-success-fg); }
.af-icon-box-warning { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.af-icon-box-danger { background: var(--status-danger-bg); color: var(--status-danger-fg); }

/* ---------------------------------------------------------------------------
   7. Tablas
   --------------------------------------------------------------------------- */
.af-table { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; }
.af-table th {
  font-size: var(--type-label-size); font-weight: var(--weight-semibold);
  color: var(--text-muted); letter-spacing: var(--tracking-label);
  text-align: left; padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
  white-space: nowrap;
}
.af-table th:first-child { border-top-left-radius: var(--radius-card); }
.af-table th:last-child { border-top-right-radius: var(--radius-card); }
.af-table td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm); color: var(--text-body); vertical-align: middle;
}
.af-table tbody tr:last-child td { border-bottom: 0; }
.af-table tbody tr { transition: background-color var(--dur-fast) var(--ease-standard); }
.af-table tbody tr:hover { background: var(--surface-sunken); }
.af-table .af-table-actions { display: flex; gap: var(--space-2); justify-content: flex-end; }
.af-table-wrap { overflow-x: auto; border-radius: var(--radius-card); }

/* En móvil la tabla se convierte en fichas apiladas. */
@media (max-width: 767.98px) {
  .af-table-stack thead { display: none; }
  .af-table-stack tbody tr {
    display: block; margin-bottom: var(--space-4);
    border: 1px solid var(--border-subtle); border-radius: var(--radius-card);
    background: var(--surface-card); padding: var(--space-2) 0;
  }
  .af-table-stack tbody td {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
    border-bottom: 0; padding: var(--space-3) var(--space-5);
  }
  .af-table-stack tbody td::before {
    content: attr(data-label);
    font-size: var(--type-label-size); font-weight: var(--weight-semibold);
    color: var(--text-muted); flex: 0 0 auto;
  }
  .af-table-stack tbody td:empty { display: none; }
  .af-table-stack .af-table-actions { justify-content: flex-start; }
}

/* ---------------------------------------------------------------------------
   8. Badges, tags y estados
   --------------------------------------------------------------------------- */
.af-badge {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-2xs); font-weight: var(--weight-semibold);
  padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill);
  background: var(--surface-sunken); color: var(--text-muted);
  letter-spacing: var(--tracking-label); white-space: nowrap;
}
.af-badge-brand   { background: var(--surface-brand-soft); color: var(--orange-700); }
.af-badge-accent  { background: var(--surface-accent-soft); color: var(--teal-700); }
.af-badge-success { background: var(--status-success-bg); color: var(--status-success-fg); }
.af-badge-warning { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.af-badge-danger  { background: var(--status-danger-bg); color: var(--status-danger-fg); }
.af-badge-info    { background: var(--status-info-bg); color: var(--status-info-fg); }
.af-badge-ai      { background: var(--status-ai-bg); color: var(--status-ai-fg); }
.af-badge-ink     { background: var(--surface-inverse); color: var(--text-inverse); }

.af-dot { width: 8px; height: 8px; border-radius: var(--radius-pill); flex: 0 0 auto; display: inline-block; }
.af-dot-success { background: var(--status-success-solid); }
.af-dot-warning { background: var(--status-warning-solid); }
.af-dot-danger  { background: var(--status-danger-solid); }
.af-dot-brand   { background: var(--action-primary); }
.af-dot-accent  { background: var(--action-accent); }

/* Avatar */
.af-avatar {
  width: 36px; height: 36px; flex: 0 0 auto; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
  background: var(--surface-brand-soft); color: var(--text-brand);
  font-family: var(--font-display); font-size: var(--text-sm); font-weight: var(--weight-semibold);
}
.af-avatar img { width: 100%; height: 100%; object-fit: cover; }
.af-avatar-sm { width: 32px; height: 32px; font-size: var(--text-2xs); }
.af-avatar-lg { width: 56px; height: 56px; font-size: var(--text-lg); }
.af-avatar-xl { width: 84px; height: 84px; font-size: var(--text-2xl); }

/* Mensajes flash */
.message {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4) var(--space-5); margin-bottom: var(--space-5);
  border-radius: var(--radius-card); font-size: var(--text-sm);
  border: 1px solid transparent; cursor: pointer;
}
.message.success { background: var(--status-success-bg); color: var(--status-success-fg); }
.message.error   { background: var(--status-danger-bg); color: var(--status-danger-fg); }
.message.warning { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.message.info, .message:not(.success):not(.error):not(.warning) {
  background: var(--status-info-bg); color: var(--status-info-fg);
}
.message.hidden { display: none; }

/* ---------------------------------------------------------------------------
   9. Shell
   --------------------------------------------------------------------------- */
.af-shell { display: flex; min-height: 100vh; background: var(--surface-canvas); }

.af-sidebar {
  width: var(--sidebar-w); flex: 0 0 auto;
  background: var(--surface-card);
  border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column;
  padding: var(--space-4) var(--space-4);
  overflow: hidden;
  position: sticky; top: 0; height: 100vh;
  transition: width var(--dur-slow) var(--ease-standard);
}
.af-sidebar-head {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-2) var(--space-6);
  min-height: 46px;
}
.af-sidebar-logo img { height: 42px; width: auto; }
.af-sidebar-mark { display: none; }
.af-sidebar-mark img { height: 28px; width: 28px; margin: 0 auto; }
/* Variante de logo según el tema: en oscuro se usan las versiones claras.
   El display va en cada variante (no en `.af-sidebar-mark img`) para que la regla
   de ocultado no la pise por especificidad y no salga el isotipo duplicado. */
.af-mark-light { display: block; }
.af-logo-dark, .af-mark-dark { display: none; }
:root[data-theme="dark"] .af-logo-light,
:root[data-theme="dark"] .af-mark-light { display: none; }
:root[data-theme="dark"] .af-logo-dark { display: inline; }
:root[data-theme="dark"] .af-mark-dark { display: block; }

.af-nav { display: flex; flex-direction: column; gap: var(--space-2); }
.af-nav-link {
  display: flex; align-items: center; gap: var(--space-3);
  height: 38px; padding: 0 var(--space-3);
  border-radius: var(--radius-control);
  color: var(--text-body); font-size: var(--text-sm); font-weight: var(--weight-medium);
  text-decoration: none; transition: var(--transition-control);
}
.af-nav-link:hover { background: var(--action-ghost-hover); color: var(--text-strong); text-decoration: none; }
.af-nav-link.active { background: var(--surface-brand-soft); color: var(--orange-700); font-weight: var(--weight-semibold); }
.af-nav-link i[data-lucide] { flex: 0 0 auto; }
.af-nav-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.af-sidebar-foot {
  margin-top: auto; padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}
.af-sidebar-user {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-2); border-radius: var(--radius-control);
  color: inherit; text-decoration: none; transition: var(--transition-control);
}
.af-sidebar-user:hover { background: var(--action-ghost-hover); text-decoration: none; }
.af-sidebar-user-name { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-sidebar-user-role { font-size: var(--text-3xs); color: var(--text-muted); }
.af-sidebar-version {
  font-family: var(--font-mono); font-size: var(--text-3xs); color: var(--text-subtle);
  padding: var(--space-3) var(--space-2) 0; letter-spacing: .02em;
}

/* Estado plegado: solo iconos. */
.af-shell.is-collapsed .af-sidebar { width: var(--sidebar-w-collapsed); padding-left: var(--space-3); padding-right: var(--space-3); }
.af-shell.is-collapsed .af-sidebar-logo,
.af-shell.is-collapsed .af-nav-link span,
.af-shell.is-collapsed .af-sidebar-user-info,
.af-shell.is-collapsed .af-sidebar-version { display: none; }
.af-shell.is-collapsed .af-sidebar-mark { display: block; }
.af-shell.is-collapsed .af-nav-link { justify-content: center; padding: 0; }
.af-shell.is-collapsed .af-sidebar-user { justify-content: center; }

.af-sidebar-toggle {
  position: fixed; top: 25px; left: calc(var(--sidebar-w) - 14px);
  width: 28px; height: 28px; z-index: 45;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
  background: var(--surface-card); color: var(--text-muted);
  box-shadow: var(--shadow-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: left var(--dur-slow) var(--ease-standard), color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}
.af-sidebar-toggle:hover { color: var(--text-strong); box-shadow: var(--shadow-md); }
.af-shell.is-collapsed .af-sidebar-toggle { left: calc(var(--sidebar-w-collapsed) - 14px); }

.af-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.af-topbar {
  height: var(--topbar-h); flex: 0 0 auto;
  display: flex; align-items: center; gap: var(--space-4);
  padding: 0 var(--gutter-panel);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-topbar);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  position: sticky; top: 0; z-index: 40;
}
.af-topbar-title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-semibold);
  color: var(--text-strong); letter-spacing: var(--tracking-heading); line-height: 1.15; margin: 0; }
.af-crumbs { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-2xs);
  color: var(--text-subtle); margin-bottom: 3px; list-style: none; padding: 0; }
.af-crumbs a { color: var(--text-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.af-crumbs a:hover { color: var(--text-strong); text-decoration: none; }
.af-crumbs .af-crumb-current { color: var(--text-body); font-weight: var(--weight-semibold); }

.af-topbar-search { width: 250px; }
.af-notif-dot {
  position: absolute; top: 5px; right: 6px; width: 8px; height: 8px;
  border-radius: var(--radius-pill); background: var(--action-primary);
  box-shadow: 0 0 0 2px var(--surface-card); pointer-events: none;
}

.af-content { flex: 1; padding: var(--space-8) var(--gutter-panel); }
.af-content-narrow { max-width: var(--content-max); margin: 0 auto; width: 100%; }

.af-page-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-5); flex-wrap: wrap; margin-bottom: var(--space-7); }
.af-page-head h1 { font-size: var(--text-3xl); }
.af-page-head p { color: var(--text-muted); font-size: var(--text-sm); margin: var(--space-2) 0 0; max-width: var(--prose-max); }

/* ---------------------------------------------------------------------------
   10. Patrones
   --------------------------------------------------------------------------- */
.af-kpi { padding: var(--space-5) var(--gutter-card); }
.af-kpi-label { font-size: var(--text-2xs); color: var(--text-muted); display: flex; align-items: center; gap: var(--space-2); }
.af-kpi-value { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: var(--weight-semibold);
  color: var(--text-strong); line-height: 1.05; margin: var(--space-3) 0 0; letter-spacing: var(--tracking-display); }
.af-kpi-foot { font-size: var(--text-2xs); color: var(--text-muted); margin-top: var(--space-2); display: flex; align-items: center; gap: var(--space-2); }
.af-kpi-trend-up { color: var(--status-success-fg); font-weight: var(--weight-semibold); }
.af-kpi-trend-down { color: var(--status-danger-fg); font-weight: var(--weight-semibold); }

.af-hero { padding: var(--space-7) var(--space-8); display: flex; flex-direction: column; gap: var(--space-4); }
.af-hero-title { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: var(--weight-semibold);
  color: #fff; line-height: 1.15; letter-spacing: var(--tracking-display); margin: 0; max-width: 24ch; }
.af-hero-sub { font-size: var(--text-sm); color: rgba(255, 255, 255, .7); max-width: 56ch; margin: 0; }
.af-hero-live {
  display: inline-flex; align-items: center; gap: var(--space-3); align-self: flex-start;
  background: rgba(255, 255, 255, .14); color: #fff;
  font-size: var(--text-3xs); font-weight: var(--weight-bold); letter-spacing: var(--tracking-eyebrow);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill); text-transform: uppercase;
}
.af-hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-top: auto; }
.af-hero-stat { background: rgba(255, 255, 255, .10); border: 1px solid var(--border-inverse);
  border-radius: var(--radius-md); padding: var(--space-4); }
.af-hero-stat-value { font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-semibold); color: #fff; }
.af-hero-stat-label { font-size: var(--text-3xs); color: rgba(255, 255, 255, .65); margin-top: 2px; }

/* Lista de dos líneas con marca de tiempo, como el «Pulso de hoy». */
.af-timeline { display: flex; flex-direction: column; gap: var(--space-4); }
.af-timeline-item { display: flex; gap: var(--space-3); align-items: flex-start; }
.af-timeline-time { font-family: var(--font-mono); font-size: var(--text-3xs); color: var(--text-subtle);
  width: 38px; flex: 0 0 auto; padding-top: 2px; }
.af-timeline-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-strong); line-height: 1.3; }
.af-timeline-sub { font-size: var(--text-2xs); color: var(--text-muted); margin-top: 1px; }

/* Lista de datos en ficha. */
.af-detail-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-5) var(--space-7); margin: 0; }
.af-detail-list dt { font-size: var(--type-eyebrow-size); font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--text-muted); }
.af-detail-list dd { margin: var(--space-1) 0 0; color: var(--text-strong); font-size: var(--text-sm); }

/* Estado vacío: borde discontinuo, según el sistema. */
.af-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--space-4); padding: var(--space-11) var(--space-7);
  border: 1px dashed var(--border-default); border-radius: var(--radius-card);
  background: var(--surface-card);
}
.af-empty h3 { font-size: var(--text-lg); }
.af-empty p { color: var(--text-muted); font-size: var(--text-sm); margin: 0; max-width: 46ch; }

/* Pasos del instalador. */
.af-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.af-step {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-card);
  background: var(--surface-card);
}
.af-step-number {
  width: 26px; height: 26px; flex: 0 0 auto; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-sunken); color: var(--text-muted);
  font-size: var(--text-2xs); font-weight: var(--weight-bold);
}
.af-step-text { flex: 1; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-body); }
.af-step-status { font-size: var(--text-2xs); color: var(--text-subtle); }
.af-step.is-current { border-color: var(--border-brand); box-shadow: var(--ring-focus); }
.af-step.is-current .af-step-number { background: var(--gradient-brand); color: #fff; }
.af-step.is-complete .af-step-number { background: var(--status-success-bg); color: var(--status-success-fg); }
.af-step.is-complete .af-step-status { color: var(--status-success-fg); font-weight: var(--weight-semibold); }

/* Recortador de foto. */
.af-cropper-preview {
  width: 84px; height: 84px; flex: 0 0 auto; border-radius: var(--radius-pill);
  background: var(--surface-sunken); border: 1px solid var(--border-subtle);
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
  color: var(--text-subtle);
}
.af-cropper-preview img { width: 100%; height: 100%; object-fit: cover; }
.af-cropper-stage {
  position: relative; width: 100%; aspect-ratio: 1; max-width: 340px; margin: 0 auto;
  overflow: hidden; border-radius: var(--radius-card); background: var(--navy-900); cursor: grab;
}
.af-cropper-stage:active { cursor: grabbing; }
.af-cropper-stage img { position: absolute; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; }
.af-cropper-mask {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(5, 15, 43, .62); border-radius: var(--radius-pill);
}

/* Recortador de imagen 16:9 (cursos y otros contenidos anchos). */
.af-imgcrop-preview {
  width: 220px; max-width: 100%; aspect-ratio: 16 / 9; flex: 0 0 auto;
  border-radius: var(--radius-card); background: var(--surface-sunken);
  border: 1px solid var(--border-subtle); overflow: hidden; color: var(--text-subtle);
  display: inline-flex; align-items: center; justify-content: center;
}
.af-imgcrop-preview img { width: 100%; height: 100%; object-fit: cover; }
.af-imgcrop-stage {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-width: 560px; margin: 0 auto;
  overflow: hidden; border-radius: var(--radius-card); background: var(--navy-900); cursor: grab;
}
.af-imgcrop-stage:active { cursor: grabbing; }
.af-imgcrop-stage img { position: absolute; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; }
.af-imgcrop-frame {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .85); border-radius: var(--radius-card);
}

/* Recortador de marca (logo / isotipo). Proporción variable vía --brand-ratio.
   Fondo a cuadros para que se vea la transparencia del PNG. */
.af-brandcrop-preview {
  height: 72px; aspect-ratio: var(--brand-ratio, 1 / 1); max-width: 100%; flex: 0 0 auto;
  border-radius: var(--radius-md); border: 1px solid var(--border-subtle); overflow: hidden;
  color: var(--text-subtle); display: inline-flex; align-items: center; justify-content: center;
  background-color: var(--surface-sunken);
  background-image:
    linear-gradient(45deg, rgba(128, 128, 128, .18) 25%, transparent 25%, transparent 75%, rgba(128, 128, 128, .18) 75%),
    linear-gradient(45deg, rgba(128, 128, 128, .18) 25%, transparent 25%, transparent 75%, rgba(128, 128, 128, .18) 75%);
  background-size: 14px 14px; background-position: 0 0, 7px 7px;
}
.af-brandcrop-preview img { width: 100%; height: 100%; object-fit: contain; }
.af-brandcrop-stage {
  position: relative; width: 100%; aspect-ratio: var(--brand-ratio, 1 / 1); max-width: 560px; margin: 0 auto;
  overflow: hidden; border-radius: var(--radius-card); cursor: grab;
  background-color: var(--navy-900);
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, .07) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .07) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, .07) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .07) 75%);
  background-size: 20px 20px; background-position: 0 0, 10px 10px;
}
.af-brandcrop-stage:active { cursor: grabbing; }
.af-brandcrop-stage img { position: absolute; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; }
.af-brandcrop-frame {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .85); border-radius: var(--radius-card);
}
.af-color-swatch {
  width: 40px; height: 38px; flex: 0 0 auto; padding: 2px; cursor: pointer;
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--surface-card);
}
.af-color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.af-color-swatch::-webkit-color-swatch { border: none; border-radius: calc(var(--radius-md) - 3px); }
.af-color-swatch::-moz-color-swatch { border: none; border-radius: calc(var(--radius-md) - 3px); }

/* Editor de texto enriquecido ligero. */
.af-rte { display: flex; flex-direction: column; gap: 0; }
.af-rte-toolbar {
  display: flex; flex-wrap: wrap; gap: var(--space-1);
  padding: var(--space-2); border: 1px solid var(--border-subtle);
  border-bottom: 0; border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--surface-sunken);
}
.af-rte-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-subtle); cursor: pointer;
}
.af-rte-btn:hover { background: var(--surface-1); color: var(--text-strong); border-color: var(--border-subtle); }
.af-rte-btn i { width: 16px; height: 16px; }
.af-rte-area {
  min-height: 180px; border-radius: 0 0 var(--radius-md) var(--radius-md);
  overflow-y: auto; line-height: 1.55;
}
.af-rte-area:focus { outline: none; box-shadow: none; }
.af-rte-area h3 { font-size: var(--text-lg); margin: .6em 0 .3em; }
.af-rte-area ul, .af-rte-area ol { padding-left: 1.4em; margin: .4em 0; }
.af-rte-area p { margin: 0 0 .6em; }
/* Editor de plantillas de correo: área enriquecida más alta para cuerpos largos. */
[data-email-template-editor] .af-rte-area { min-height: 420px; }

/* Códigos de sustitución (píxeles de shortcode). Compartidos por el editor de
   diplomas y el de plantillas de correo para que sean visualmente idénticos. */
.af-shortcode-pill {
  border: 1px solid var(--border-default);
  background: var(--surface-card);
  color: var(--text-body);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: var(--text-3xs);
  cursor: pointer;
  transition: var(--transition-control);
}
.af-shortcode-pill:hover { background: var(--surface-brand-soft); border-color: var(--border-brand); color: var(--text-strong); }
.af-shortcode-pill.is-copied { background: var(--status-success-bg); border-color: transparent; }

/* Buscador predictivo (configuración y plantillas de correo). */
.af-config-search { position: relative; max-width: 620px; }
.af-config-search-results {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 8px);
  list-style: none; margin: 0; padding: 6px;
  background: var(--surface-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-panel); box-shadow: var(--shadow-lg);
  max-height: 360px; overflow-y: auto;
}
.af-config-search-item {
  display: block; width: 100%; text-align: left; padding: 10px 12px;
  border: 0; background: transparent; border-radius: var(--radius-md);
  cursor: pointer; color: inherit;
}
.af-config-search-item:hover,
.af-config-search-item.is-active { background: var(--surface-brand-soft); }
.af-config-search-item .af-cs-opt { display: block; font-weight: 600; }
.af-config-search-item .af-cs-crumb {
  display: flex; align-items: center; gap: 4px;
  font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px;
}
.af-config-search-item mark {
  background: var(--surface-accent-soft); color: inherit;
  padding: 0 1px; border-radius: 3px;
}

/* Panel de asociación de participantes: lista seleccionable de usuarios. */
.min-h-0 { min-height: 0; }
.af-pick-list {
  overflow-y: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  background: var(--surface-1); padding: var(--space-2);
}
.af-pick-row {
  display: flex; align-items: center; gap: var(--space-3); width: 100%;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
  cursor: pointer; margin: 0;
}
.af-pick-row:hover { background: var(--surface-sunken); }
.af-pick-row input[type="checkbox"] { flex: 0 0 auto; }

/* Árbol de contenidos del curso (módulos, submódulos y materiales). */
.af-tree { --af-tree-indent: 20px; }
.af-tree-list { list-style: none; margin: 0; padding: 0; }
.af-tree-item .af-tree-list { padding-left: var(--af-tree-indent); }
.af-tree-item { margin: 0; }
.af-tree-row {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); margin-bottom: var(--space-2);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  background: var(--surface-1);
}
.af-tree-module > .af-tree-row { background: var(--surface-sunken); }
.af-tree-toggle {
  flex: 0 0 auto; width: 22px; height: 22px; padding: 0; border: 0; background: transparent;
  color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}
.af-tree-toggle:hover { background: var(--surface-1); color: var(--text-strong); }
/* Lucide reemplaza el <i> por un <svg>, así que la rotación anima sobre el svg. */
.af-tree-toggle i, .af-tree-toggle svg { width: 16px; height: 16px; transition: transform .2s ease; }
.af-tree-toggle-empty { pointer-events: none; }
.af-tree-count { flex: 0 0 auto; }
/* Módulo plegado: se oculta su contenido y el chevron gira hacia la derecha. */
.af-tree-collapsed > .af-tree-row .af-tree-toggle i,
.af-tree-collapsed > .af-tree-row .af-tree-toggle svg { transform: rotate(-90deg); }
.af-tree-collapsed > .af-tree-list { display: none; }

/* Selector de documentos: carpetas y migas. */
.af-pick-folder { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; color: inherit; }
.af-crumbs .af-crumb-link {
  border: 0; background: transparent; padding: 0; cursor: pointer;
  color: var(--text-link); font-size: var(--text-2xs); display: inline-flex; align-items: center; gap: 3px;
}
.af-crumbs .af-crumb-link:hover { text-decoration: underline; }
.af-crumbs .af-crumb-sep { color: var(--text-subtle); margin: 0 5px; font-size: var(--text-2xs); }
.af-tree-grip { cursor: grab; color: var(--text-subtle); display: inline-flex; flex: 0 0 auto; }
.af-tree-grip i { width: 16px; height: 16px; }
.af-tree-icon { display: inline-flex; flex: 0 0 auto; color: var(--text-muted); }
.af-tree-icon i { width: 17px; height: 17px; }
.af-tree-title { flex: 1 1 auto; min-width: 0; font-weight: var(--weight-medium); }
.af-tree-type { flex: 0 0 auto; }
.af-tree-actions { display: inline-flex; align-items: center; gap: var(--space-1); flex: 0 0 auto; }
.af-tree-dragging { opacity: .45; }
.af-tree-list.af-drop-hint { outline: 2px dashed var(--action-primary); outline-offset: 2px; border-radius: var(--radius-md); min-height: 14px; }
/* Al soltar dentro de un módulo se resalta su fila. */
.af-tree-module.af-drop-into > .af-tree-row { outline: 2px solid var(--action-primary); outline-offset: 1px; background: var(--surface-brand-soft); }
/* Los módulos vacíos conservan una pequeña zona para poder soltar dentro. */
.af-tree-module > .af-tree-list:empty { min-height: 12px; margin-bottom: var(--space-2); }

/* Zona de arrastre de ficheros (subida). */
.af-dropzone {
  border: 2px dashed var(--border-subtle); border-radius: var(--radius-md);
  padding: var(--space-6); text-align: center; cursor: pointer;
  color: var(--text-muted); transition: border-color .15s, background .15s;
}
.af-dropzone:hover { border-color: var(--action-primary); background: var(--surface-sunken); }

/* Barra de acciones en bloque sobre el listado de participantes. */
.af-bulkbar {
  display: flex; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  background: var(--surface-sunken);
}
.af-bulkbar.d-none { display: none !important; }

/* Miniatura de curso en el listado (proporción 16:9, altura de una fila). */
.af-course-thumb {
  flex: 0 0 auto; width: 64px; height: 36px; border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface-sunken); border: 1px solid var(--border-subtle);
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-subtle);
}
.af-course-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Overlay de carga a pantalla completa (bloquea la interacción durante un envío). */
.af-loading-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-overlay); backdrop-filter: blur(3px);
}
.af-loading-box {
  display: inline-flex; align-items: center; gap: var(--space-3);
  padding: var(--space-5) var(--space-6); border-radius: var(--radius-card);
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg); color: var(--text-strong);
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
}
.af-loading-box .spinner-border { color: var(--action-primary); width: 1.4rem; height: 1.4rem; }

/* Variante apilada del overlay, para esperas largas: al spinner se le suman un
   texto de apoyo, una barra de avance y una estimación de tiempo, de modo que la
   espera no parezca un cuelgue. */
.af-loading-box-block {
  flex-direction: column; gap: var(--space-2); text-align: center;
  max-width: 26rem; padding: var(--space-6);
}
.af-loading-box-block .spinner-border { width: 2rem; height: 2rem; margin-bottom: var(--space-2); }
.af-loading-box-block .af-loading-title { font-size: var(--text-md); }
.af-loading-box-block .af-loading-text {
  margin: 0; font-size: var(--text-2xs); font-weight: var(--weight-regular); color: var(--text-muted);
}
.af-loading-progress {
  width: 100%; height: 6px; margin-top: var(--space-2);
  border-radius: 999px; background: var(--surface-sunken); overflow: hidden;
}
.af-loading-progress > span {
  display: block; width: 0; height: 100%; border-radius: 999px;
  background: var(--action-primary); transition: width .4s linear;
}
.af-loading-eta {
  margin: 0; font-size: var(--text-2xs); color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

/* Árbol de estructura del itinerario: módulos con cursos como cards visuales. */
.af-itinerary-module-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  background: var(--surface-sunken); color: var(--brand-primary, #7B183F);
}
.af-itinerary-course-card {
  display: flex; align-items: stretch; height: 100%;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  overflow: hidden; text-decoration: none; color: var(--text-strong);
  background: var(--surface-card);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.af-itinerary-course-card:hover {
  border-color: var(--action-primary); box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  /* Solo resalta la card; nunca subraya ni tiñe el texto (anula a:hover global). */
  text-decoration: none; color: var(--text-strong);
}
.af-itinerary-course-card,
.af-itinerary-course-card:hover .af-itinerary-course-name { text-decoration: none; }
.af-itinerary-course-thumb {
  position: relative; flex: 0 0 88px; width: 88px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-sunken); color: var(--text-subtle); overflow: hidden;
}
.af-itinerary-course-thumb img { width: 100%; height: 100%; object-fit: cover; }
.af-itinerary-course-flag {
  position: absolute; left: 4px; top: 4px; margin: 0;
  font-size: 10px; padding: 2px 7px;
}
.af-itinerary-course-body {
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  gap: var(--space-2); padding: var(--space-3); min-width: 0;
}
.af-itinerary-course-name {
  font-weight: var(--weight-semibold); line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Editor de opciones de campo personalizado. */
.af-option-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: var(--space-3); margin-bottom: var(--space-3); }
@media (max-width: 575.98px) { .af-option-row { grid-template-columns: 1fr; } }

/* Grupo de campos personalizados. */
.af-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.af-fieldset > legend {
  float: none; width: auto; padding: 0; margin-bottom: var(--space-4);
  font-size: var(--type-eyebrow-size); font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--text-subtle);
}

/* Laboratorio de IA. El violeta marca todo lo generado por IA, nunca el naranja:
   el naranja es siempre una acción del usuario. */
.af-ai-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--space-5); align-items: start; }
.af-ai-chat { display: flex; flex-direction: column; min-height: 420px; }
.af-ai-messages { flex: 1; overflow-y: auto; padding: var(--gutter-card); display: flex; flex-direction: column; gap: var(--space-5); }
.af-ai-empty { margin: auto; text-align: center; color: var(--text-muted); }
.af-ai-mark {
  width: 46px; height: 46px; margin: 0 auto var(--space-4);
  display: grid; place-items: center; border-radius: var(--radius-md);
  background: var(--status-ai-bg); color: var(--status-ai-fg);
  font-family: var(--font-display); font-weight: var(--weight-bold); font-size: var(--text-sm);
}
.af-ai-message { display: flex; flex-direction: column; gap: var(--space-2); }
.af-ai-message-meta { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-2xs); color: var(--text-subtle); }
.af-ai-message-body {
  padding: var(--space-4) var(--space-5); border-radius: var(--radius-card);
  background: var(--surface-sunken); font-size: var(--text-sm); line-height: var(--leading-relaxed);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.af-ai-message.is-ai .af-ai-message-body { background: var(--status-ai-bg); color: var(--status-ai-fg); }
.af-ai-composer {
  display: flex; align-items: flex-end; gap: var(--space-3);
  padding: var(--space-4) var(--gutter-card); border-top: 1px solid var(--border-subtle);
}
.af-ai-composer textarea { resize: none; min-height: var(--control-h-md); max-height: 160px; }
.af-ai-attachment {
  display: flex; align-items: center; gap: var(--space-3);
  margin: 0 var(--gutter-card) var(--space-3);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--surface-accent-soft); color: var(--teal-700); font-size: var(--text-2xs);
}
.af-ai-image-output img { width: 100%; border-radius: var(--radius-card); display: block; }

@media (max-width: 991.98px) { .af-ai-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------------------
   11. Autenticación
   --------------------------------------------------------------------------- */
.af-auth {
  position: relative; min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-8) var(--space-5);
  background: var(--navy-800); overflow: auto;
}
.af-auth-bg { position: absolute; inset: 0; opacity: .5; pointer-events: none; }
/* Imagen de fondo aportada por el tema (zona loginBackground).
   Va en su propio contenedor (z-index:0) para pintarse bajo la tarjeta SIN
   crear un stacking context en .af-auth-inner: si lo tuviera, atraparía el
   modal de Bootstrap por debajo de su backdrop (inyectado en <body>). */
.af-auth-bgwrap { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.af-auth-bgimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Velo suave sobre la imagen (no sobre la tarjeta) para dar contraste al fondo. */
.af-auth-bgwrap::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 60% at 50% 45%, rgba(8, 24, 64, .18), rgba(8, 24, 64, 0) 70%); }
.af-auth-inner { position: relative; width: min(408px, 100%); }
.af-auth-card {
  background: var(--surface-card);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-xl);
  padding: var(--space-8);
}
.af-auth-wide { width: min(560px, 100%); }
.af-auth-logo { height: 36px; width: auto; display: block; margin: 0 auto var(--space-7); }
.af-auth-title { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: var(--weight-semibold);
  color: var(--text-strong); letter-spacing: var(--tracking-heading); margin: 0; text-align: center; }
.af-auth-sub { font-size: var(--text-sm); color: var(--text-muted); text-align: center; margin: var(--space-3) 0 var(--space-7); }
.af-auth-host { font-family: var(--font-mono); }
.af-auth-foot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2);
  margin-top: var(--space-6); color: rgba(255, 255, 255, .5); font-size: var(--text-2xs); text-align: center;
}
.af-auth-foot-text { max-width: 30ch; }
.af-auth-foot-copy { color: rgba(255, 255, 255, .38); }
.af-auth-sep { display: flex; align-items: center; gap: var(--space-4); color: var(--text-subtle); font-size: var(--text-2xs); }
.af-auth-sep::before, .af-auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--border-subtle); }

/* ---------------------------------------------------------------------------
   12. Utilidades y responsive
   --------------------------------------------------------------------------- */
.af-stack { display: flex; flex-direction: column; gap: var(--space-5); }
.af-stack-sm { display: flex; flex-direction: column; gap: var(--space-3); }
.af-row { display: flex; align-items: center; gap: var(--space-3); }
.af-grid-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); }
.af-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
.af-grid-hero { display: grid; grid-template-columns: 1.9fr 1fr; gap: var(--space-5); align-items: stretch; }

.af-theme-swatch {
  display: inline-flex; border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border-subtle); flex: 0 0 auto;
}
.af-theme-swatch span { width: 16px; height: 28px; display: block; }

.af-theme-option { cursor: pointer; }
.af-theme-option .af-card { transition: var(--transition-control); height: 100%; }
.af-theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.af-theme-option input:checked + .af-card { border-color: var(--border-brand); box-shadow: var(--ring-focus); }
.af-theme-option input:focus-visible + .af-card { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

@media (max-width: 1199.98px) {
  .af-grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .af-grid-hero { grid-template-columns: 1fr; }
  .af-hero-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 991.98px) {
  .af-sidebar, .af-sidebar-toggle { display: none; }
  .af-content { padding: var(--space-6) var(--space-5); }
  .af-topbar { padding: 0 var(--space-5); }
  .af-topbar-search { display: none; }
}

@media (max-width: 767.98px) {
  .af-grid-kpi, .af-grid-2 { grid-template-columns: 1fr; }
  .af-hero-stats { grid-template-columns: repeat(2, 1fr); }
  .af-page-head h1 { font-size: var(--text-2xl); }
  .af-hero-title { font-size: var(--text-2xl); }
  .af-auth-card { padding: var(--space-6); }
  .af-detail-list { grid-template-columns: 1fr; }
}

/* La sidebar en móvil se sirve como offcanvas de Bootstrap. */
.af-offcanvas-nav .af-sidebar {
  display: flex; width: 100%; height: auto; position: static;
  border-right: 0; padding: 0;
}
.af-offcanvas-nav .af-sidebar-head { display: none; }

@media print {
  .af-sidebar, .af-topbar, .af-sidebar-toggle, .af-table-actions { display: none !important; }
  .af-content { padding: 0; }
  .af-card, .af-panel { box-shadow: none; }
  /* Los tooltips/popovers de Bootstrap se anclan al body y no llevan .af-no-print,
     así que hay que ocultarlos explícitamente o se cuelan en la impresión. */
  .tooltip, .popover, .offcanvas-backdrop, .modal-backdrop { display: none !important; }
}

/* === Notificaciones internas (campana de la barra superior) === */
.af-notif-badge {
  position: absolute; top: -2px; right: -2px; background: var(--action-primary, #FF5A2D); color: #fff;
  font-size: 10px; line-height: 1; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600;
}
.af-notif-list { max-height: min(60vh, 420px); overflow-y: auto; }
/* La fila es el contenedor; dentro van el contenido (que puede ser un enlace) y
   los botones de acción. Un botón no puede ir dentro del enlace: no sería HTML
   válido y el enlace se llevaría el clic. */
.af-notif-item {
  display: flex; gap: .4rem; align-items: flex-start; padding: .7rem 1rem;
  color: inherit; border-bottom: 1px solid var(--border-subtle);
}
.af-notif-item:last-child { border-bottom: none; }
.af-notif-item:hover { background: var(--surface-subtle, rgba(0,0,0,.04)); }
.af-notif-item-main {
  display: flex; gap: .6rem; align-items: flex-start; text-decoration: none; color: inherit;
  flex: 1 1 auto; min-width: 0;
}
.af-notif-item-icon { flex: 0 0 auto; align-self: center; color: var(--text-muted); }
.af-notif-item-icon i, .af-notif-item-icon svg { width: 18px; height: 18px; }
.af-notif-item-body { display: flex; flex-direction: column; min-width: 0; }
/* El título y la píldora de estado comparten línea y envuelven si no caben. */
.af-notif-item-head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.af-notif-item-title { font-weight: 600; font-size: var(--text-sm); }
/* Marca de «sin leer»: una píldora discreta, no un fondo de color. */
.af-notif-unread-pill { flex: 0 0 auto; }
.af-notif-item-text { font-size: var(--text-xs); color: var(--text-muted); overflow-wrap: anywhere; }
.af-notif-item-time { font-size: var(--text-2xs); color: var(--text-muted); margin-top: .15rem; }

/* Acciones de la fila: son `.af-icon-btn.af-icon-btn-sm` del sistema de diseño,
   así que aquí solo se colocan. En escritorio se atenúan hasta pasar por encima;
   en táctil no hay `hover`, así que se dejan siempre visibles. */
.af-notif-item-actions {
  display: flex; gap: var(--space-1); flex: 0 0 auto; align-self: center;
  opacity: .45; transition: opacity .15s ease;
}
.af-notif-item:hover .af-notif-item-actions,
.af-notif-page-item:hover .af-notif-item-actions,
.af-notif-item-actions:focus-within { opacity: 1; }
@media (hover: none) { .af-notif-item-actions { opacity: 1; } }
.af-notif-item-actions .af-icon-btn i, .af-notif-item-actions .af-icon-btn svg { width: 16px; height: 16px; }

/* Filtros del historial. */
.af-notif-filters { display: flex; gap: .35rem; flex-wrap: wrap; }
.af-notif-filter {
  font-size: var(--text-xs); text-decoration: none; color: var(--text-muted);
  padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border-subtle);
}
.af-notif-filter:hover { color: var(--text-strong, inherit); }
.af-notif-filter.is-active {
  color: var(--action-primary, #FF5A2D); border-color: var(--action-primary, #FF5A2D);
  background: color-mix(in srgb, var(--action-primary, #FF5A2D) 8%, transparent);
}

.af-notif-page-list { list-style: none; margin: 0; padding: 0; }
/* Icono, contenido y acciones centrados entre sí: la fila se lee como una línea,
   no como tres elementos colgando de arriba. Lo que distingue una notificación
   sin leer es su píldora, no un fondo de color. */
.af-notif-page-item {
  display: flex; gap: var(--space-4); align-items: center;
  padding: .85rem 0; border-bottom: 1px solid var(--border-subtle);
}
.af-notif-page-item:last-child { border-bottom: none; }
.af-notif-page-icon { flex: 0 0 auto; color: var(--text-muted); line-height: 0; }
.af-notif-page-icon i, .af-notif-page-icon svg { width: 22px; height: 22px; }
.af-notif-page-item.is-unread > i, .af-notif-page-item.is-unread > svg { color: var(--action-primary, #FF5A2D) !important; }

/* ---------------------------------------------------------------------------
   Burbuja flotante (FAB)
   Especificada en 2_UI_DOCS/UI.md. z-index 60: por encima del shell (topbar 40,
   plegado de la barra lateral 45) y por debajo del off-canvas y los modales de
   Bootstrap, que son quienes deben taparla cuando se abren.
   --------------------------------------------------------------------------- */
.af-fab {
  position: fixed; right: var(--space-7); bottom: var(--space-7); z-index: 60;
  width: 52px; height: 52px; border: 0; border-radius: var(--radius-pill);
  background: var(--gradient-brand); color: #fff; box-shadow: var(--shadow-brand);
  display: grid; place-items: center; cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.af-fab:hover { transform: translateY(-2px); }
.af-fab:focus-visible { outline: 2px solid var(--action-primary); outline-offset: 3px; }

/* ---------------------------------------------------------------------------
   Historial de versiones de un complemento
   Listado secuencial, de lo más reciente a lo más antiguo. Se lee en vertical:
   nada de rejilla de tarjetas, que obliga a saltar la vista para seguir el hilo.
   --------------------------------------------------------------------------- */
.af-plugin-versions { list-style: none; margin: 0; padding: 0; }
.af-plugin-version { padding: var(--space-4) 0; border-top: 1px solid var(--border-subtle); }
.af-plugin-version:first-child { border-top: 0; padding-top: 0; }
.af-plugin-version:last-child { padding-bottom: 0; }
.af-plugin-version-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-3); margin-bottom: var(--space-2);
}
.af-plugin-version-number {
  font-family: var(--font-display); font-weight: var(--weight-semibold);
  font-size: var(--text-sm); color: var(--text-strong);
}
.af-plugin-version-date { font-size: var(--text-2xs); color: var(--text-muted); flex: 0 0 auto; }
.af-plugin-version-notes {
  margin: 0; font-size: var(--text-xs); color: var(--text-muted);
  line-height: var(--leading-relaxed);
}

/* ---------------------------------------------------------------------------
   Organigrama — recursos del grupo y seguimiento

   Los cursos y los itinerarios asociados se identifican por su carátula y su
   nombre, no por una rejilla de columnas: con dos o tres elementos, una tabla
   gastaba más espacio del que informaba. De ahí la fila tipo tarjeta.

   El árbol del modal de seguimiento usa el mismo lenguaje que el reproductor:
   verde superado, ámbar en proceso, gris sin empezar.
   --------------------------------------------------------------------------- */
.af-orgres-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card); background: var(--surface-card);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.af-orgres-row:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong, var(--border-subtle)); }
.af-orgres-thumb {
  flex: 0 0 auto; width: 64px; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius-md); background: var(--surface-sunken);
}
.af-orgres-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.af-orgres-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.af-orgres-title {
  font-weight: var(--weight-semibold); font-size: var(--text-sm); color: var(--text-strong);
  text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
a.af-orgres-title:hover { color: var(--action-primary); text-decoration: underline; }
.af-orgres-sub {
  font-size: var(--text-2xs); color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.af-orgres-pill { flex: 0 0 auto; }

/* Árbol de contenidos del seguimiento */
.af-track-tree { display: flex; flex-direction: column; gap: 1px; }
.af-track-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md);
  background: var(--surface-card);
}
.af-track-row + .af-track-row { border-top: 1px solid var(--border-subtle); border-radius: 0; }
.af-track-row-module { background: var(--surface-sunken); font-weight: var(--weight-semibold); }
.af-track-mark { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; }
.af-track-mark-completed { color: var(--status-success-fg); }
.af-track-mark-started { color: var(--status-warning-fg); }
.af-track-mark-pending { color: var(--text-muted); opacity: .55; }
.af-track-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: var(--space-2); }
.af-track-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); }
.af-track-type { font-size: var(--text-2xs); color: var(--text-muted); flex: 0 0 auto; }
.af-track-meta {
  flex: 0 0 auto; display: flex; align-items: center; gap: var(--space-4);
  font-size: var(--text-2xs); color: var(--text-muted); text-align: right;
}
.af-track-meta span { min-width: 5.5rem; display: inline-block; }
@media (max-width: 640px) {
  .af-track-meta { display: none; }
}

/* Campana de distribución del avance (interactiva) */
.af-bell-bucket { cursor: pointer; }
.af-bell-bucket rect.af-bell-hit { fill: transparent; }
.af-bell-bucket:hover rect.af-bell-hit,
.af-bell-bucket.is-active rect.af-bell-hit { fill: var(--action-primary); fill-opacity: .10; }
.af-bell-bucket.is-active text { fill: var(--action-primary); font-weight: var(--weight-semibold); }
tr.af-row-dimmed { opacity: .32; }
tr.af-row-highlight { background: color-mix(in srgb, var(--action-primary) 9%, transparent); }

/* ---------------------------------------------------------------------------
   Traza del error de verificación de correo

   El icono va junto al botón de verificar de su canal, no en un aviso aparte:
   en esa pantalla se configuran tres canales a la vez y hay que ver de un vistazo
   cuál es el que ha fallado.
   --------------------------------------------------------------------------- */
.af-mail-trace-btn {
  color: var(--status-danger-fg);
  border-color: color-mix(in srgb, var(--status-danger-fg) 40%, transparent);
  background: var(--status-danger-bg);
}
.af-mail-trace-btn:hover {
  color: var(--status-danger-fg);
  border-color: var(--status-danger-fg);
}
