/*
 * Design System del backoffice admin — eleventa branding.
 * Basado en la guia de implementacion de design system premium.
 * Colores: branding-eleventa-5. Fuente: Montserrat.
 */

/* ── Fuente Montserrat ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

/* ── Variables de marca eleventa ───────────────────────────────────── */
:root {
  --ev-font: 'Montserrat', ui-sans-serif, system-ui, sans-serif;

  /* Principales */
  --ev-blue: #459bf1;
  --ev-blue-hover: #3a87d6;
  --ev-blue-secondary: #5477e0;
  --ev-blue-medium: #4d89e9;

  /* Claros */
  --ev-blue-light: #7fb9f2;
  --ev-blue-pastel: #bad6f3;
  --ev-blue-bg: #eaf3fd;

  /* Grises */
  --ev-gray-50: #f9fafb;
  --ev-gray-light: #f4f4f4;
  --ev-gray-100: #ebebeb;
  --ev-gray-200: #d9d9d9;
  --ev-gray-300: #c4c4c4;
  --ev-gray-blue: #9aa8b3;
  --ev-gray-medium: #474747;
  --ev-gray-dark: #333333;

  /* Semanticos */
  --ev-green: #40c867;
  --ev-green-dark: #059669;
  --ev-green-bg: #ecfdf5;
  --ev-red: #e53e3e;
  --ev-red-hover: #c53030;
  --ev-red-bg: #fef2f2;
  --ev-amber: #d97706;
  --ev-amber-bg: #fffbeb;
  --ev-purple: #7c3aed;
  --ev-purple-bg: #f3e8ff;
  --ev-yellow: #efcf48;
  --ev-pink: #fc4c86;

  /* Neutros */
  --ev-white: #ffffff;

  /* Radius — escala contextual */
  --ev-radius-sm: 6px;
  --ev-radius: 8px;
  --ev-radius-lg: 12px;
  --ev-radius-xl: 16px;
  --ev-radius-pill: 9999px;

  /* Sombras */
  --ev-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --ev-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --ev-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --ev-shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.25);
  --ev-shadow-glow: 0 10px 15px -3px rgba(69, 155, 241, 0.2);

  /* Espaciado referencia */
  --ev-space-xs: 4px;
  --ev-space-sm: 8px;
  --ev-space-md: 16px;
  --ev-space-lg: 24px;
  --ev-space-xl: 32px;
}

/* ── Base ──────────────────────────────────────────────────────────── */
.admin-body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: var(--ev-font);
}

/* ── App container (Administrate wrapper — neutralizar) ─────────── */
.app-container {
  display: block;
  max-width: 100%;
  min-height: auto;
  padding: 0;
}

/* ── Navegacion de Administrate (oculta, usamos sidebar propio) ──── */
.navigation { display: none; }

/* ── Flashes de Administrate (ocultos, usamos los del layout) ───── */
.flashes { display: none; }

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════ */

.ev-sidebar {
  background: var(--ev-gray-dark);
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 260px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  overflow-y: auto;
  border-right: 1px solid var(--ev-gray-medium);
}

.ev-sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.ev-sidebar-header a {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ev-sidebar-header img {
  height: 24px;
  flex-shrink: 0;
}

.ev-sidebar-app-name {
  font-size: 0.65rem;
  color: var(--ev-gray-blue);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.ev-sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ev-sidebar-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.ev-sidebar-section-title {
  padding: 0 12px;
  margin-bottom: 8px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(154,168,179,0.6);
}

/* Nav links */
.ev-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--ev-radius);
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  transition: all 150ms ease;
}

.ev-nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
}

.ev-nav-link--active {
  background: rgba(69, 155, 241, 0.12);
  color: var(--ev-blue-light);
  box-shadow: inset 0 0 0 1px rgba(69, 155, 241, 0.15);
}

.ev-nav-link--active:hover {
  background: rgba(69, 155, 241, 0.18);
  color: var(--ev-blue-light);
}

/* Icono de nav */
.ev-nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.5;
}

.ev-nav-link--active .ev-nav-icon {
  opacity: 0.9;
}

/* Footer del sidebar */
.ev-sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 16px;
  background: rgba(0,0,0,0.15);
}

.ev-sidebar-footer-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ev-sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--ev-radius-pill);
  background: rgba(69, 155, 241, 0.15);
  border: 1px solid rgba(69, 155, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ev-blue-light);
  flex-shrink: 0;
}

.ev-sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.ev-sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ev-sidebar-user-role {
  font-size: 0.65rem;
  color: var(--ev-gray-blue);
  text-transform: capitalize;
}

.ev-sidebar-logout {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--ev-font);
  padding: 4px 8px;
  border-radius: var(--ev-radius-sm);
  transition: all 150ms ease;
}

.ev-sidebar-logout:hover {
  color: var(--ev-red);
  background: rgba(229, 62, 62, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════
   CONTENIDO PRINCIPAL
   ═══════════════════════════════════════════════════════════════════ */

.ev-content-wrapper {
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ev-content-bg {
  background: var(--ev-gray-light);
}

.ev-main {
  flex: 1;
  padding: var(--ev-space-xl);
  max-width: 1280px;
}

/* ── Flash / Toast ────────────────────────────────────────────────── */
.ev-flash {
  padding: 12px 24px;
  font-size: 0.875rem;
  font-family: var(--ev-font);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ev-flash-notice {
  background: var(--ev-green-bg);
  color: #065f46;
  border-bottom: 1px solid #a7f3d0;
}

.ev-flash-alert {
  background: var(--ev-red-bg);
  color: #991b1b;
  border-bottom: 1px solid #fecaca;
}

/* ═══════════════════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════════════════ */

.ev-page-header {
  margin-bottom: var(--ev-space-lg);
}

.ev-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ev-gray-dark);
  letter-spacing: -0.025em;
  font-family: var(--ev-font);
}

.ev-page-subtitle {
  font-size: 0.8rem;
  color: var(--ev-gray-blue);
  margin-top: 4px;
}

.ev-page-back {
  font-size: 0.8rem;
  color: var(--ev-gray-blue);
  text-decoration: none;
  transition: color 150ms ease;
}

.ev-page-back:hover {
  color: var(--ev-blue);
}

/* ═══════════════════════════════════════════════════════════════════
   MAIN CONTENT (Administrate)
   ═══════════════════════════════════════════════════════════════════ */

.main-content {
  background-color: var(--ev-white);
  border-radius: var(--ev-radius-lg);
  border: 1px solid var(--ev-gray-200);
  box-shadow: var(--ev-shadow-sm);
  min-width: 0;
  padding-bottom: 1rem;
  overflow-x: auto;
  font-family: var(--ev-font);
}

.main-content__header {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--ev-gray-100);
  background: rgba(249, 250, 251, 0.5);
  border-radius: var(--ev-radius-lg) var(--ev-radius-lg) 0 0;
}

.main-content__page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ev-gray-dark);
  margin-right: auto;
  font-family: var(--ev-font);
  letter-spacing: -0.025em;
}

.main-content__body {
  padding: 16px 24px;
}

.main-content__body--flush {
  padding-left: 0;
  padding-right: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   TABLAS (Administrate)
   ═══════════════════════════════════════════════════════════════════ */

table {
  border-collapse: collapse;
  font-size: 0.875rem;
  font-family: var(--ev-font);
  text-align: left;
  width: 100%;
}

table a {
  color: var(--ev-blue);
  text-decoration: none;
}

table a:hover {
  color: var(--ev-blue-hover);
}

thead {
  background: rgba(249, 250, 251, 0.5);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

th {
  font-weight: 600;
  color: var(--ev-gray-blue);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  padding: 16px 24px;
  border-bottom: 1px solid var(--ev-gray-100);
  white-space: nowrap;
}

td {
  padding: 16px 24px;
  color: var(--ev-gray-dark);
  border-bottom: 1px solid var(--ev-gray-100);
  vertical-align: middle;
}

th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }

tr { border-bottom: none; }

tbody tr {
  transition: background-color 150ms ease;
}

tbody tr:hover {
  background: rgba(234, 243, 253, 0.5);
}

td img { max-height: 2rem; }

/* ── Celdas de Administrate ──────────────────────────────────────── */
.cell-label a { color: var(--ev-gray-medium); }
.cell-label:hover a { color: var(--ev-blue); }
.cell-label--asc, .cell-label--desc { font-weight: 700; }
.cell-label--action-button { white-space: nowrap; width: 1rem; }

.cell-label__sort-indicator svg {
  color: var(--ev-gray-blue);
  height: 13px;
  width: 13px;
}

/* ═══════════════════════════════════════════════════════════════════
   BOTONES (Administrate)
   ═══════════════════════════════════════════════════════════════════ */

.main-content button,
.main-content [type="button"],
.main-content [type="submit"],
.main-content .button {
  appearance: none;
  background: var(--ev-blue);
  border: none;
  border-radius: var(--ev-radius);
  color: var(--ev-white);
  cursor: pointer;
  display: inline-block;
  font-family: var(--ev-font);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  padding: 10px 16px;
  text-decoration: none;
  transition: all 150ms ease;
  box-shadow: var(--ev-shadow-glow);
}

.main-content button:hover,
.main-content [type="submit"]:hover,
.main-content .button:hover {
  background: var(--ev-blue-hover);
  color: var(--ev-white);
}

.main-content button:active,
.main-content [type="submit"]:active {
  transform: scale(0.98);
}

.main-content button:disabled,
.main-content [type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.main-content .button--alt {
  background: var(--ev-white);
  border: 1px solid var(--ev-gray-300);
  color: var(--ev-gray-dark);
  box-shadow: var(--ev-shadow-sm);
}

.main-content .button--alt:hover {
  background: var(--ev-gray-50);
  color: var(--ev-gray-dark);
  border-color: var(--ev-blue);
}

.main-content .button--danger {
  background: var(--ev-red);
  box-shadow: 0 10px 15px -3px rgba(229, 62, 62, 0.2);
}

.main-content .button--danger:hover {
  background: var(--ev-red-hover);
  color: var(--ev-white);
}

/* Links tipo boton */
.main-content .link,
.main-content a.link {
  background: none;
  border: none;
  color: var(--ev-blue);
  padding: 0;
  font-weight: 500;
  box-shadow: none;
}

.main-content a.link:hover,
.main-content .link:hover {
  color: var(--ev-blue-hover);
  background: none;
}

.main-content a.link--danger,
.main-content .link--danger {
  color: var(--ev-red);
}

.main-content a.link--danger:hover,
.main-content .link--danger:hover {
  color: var(--ev-red-hover);
}

/* ═══════════════════════════════════════════════════════════════════
   FORMULARIOS (Administrate)
   ═══════════════════════════════════════════════════════════════════ */

.main-content label {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--ev-gray-dark);
  font-family: var(--ev-font);
  margin: 0 0 6px;
}

.main-content input[type="color"],
.main-content input[type="date"],
.main-content input[type="datetime-local"],
.main-content input[type="email"],
.main-content input[type="month"],
.main-content input[type="number"],
.main-content input[type="password"],
.main-content input[type="search"],
.main-content input[type="tel"],
.main-content input[type="text"],
.main-content input[type="time"],
.main-content input[type="url"],
.main-content input[type="week"],
.main-content input:not([type]),
.main-content textarea,
.main-content select {
  appearance: none;
  background: var(--ev-white);
  border: 1px solid var(--ev-gray-300);
  border-radius: var(--ev-radius);
  padding: 10px 12px;
  font-size: 0.875rem;
  font-family: var(--ev-font);
  color: var(--ev-gray-dark);
  width: 100%;
  box-shadow: var(--ev-shadow-sm);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.main-content input:hover,
.main-content textarea:hover,
.main-content select:hover {
  border-color: var(--ev-blue-light);
}

.main-content input:focus,
.main-content textarea:focus,
.main-content select:focus {
  border-color: var(--ev-blue);
  outline: none;
  box-shadow: 0 0 0 2px rgba(69, 155, 241, 0.2);
}

.main-content input:disabled,
.main-content textarea:disabled,
.main-content select:disabled {
  background: var(--ev-gray-50);
  color: var(--ev-gray-blue);
  cursor: not-allowed;
}

.main-content select {
  appearance: auto;
}

/* ── Field unit (Administrate form layout) ────────────────────────── */
.field-unit {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 24px;
  width: 100%;
}

.field-unit__label {
  text-align: right;
  width: calc(15% - 1rem);
  margin-left: 1rem;
  padding-top: 10px;
  font-size: 0.875rem;
  color: var(--ev-gray-medium);
}

.field-unit__field {
  flex-grow: 1;
  margin-left: 2rem;
}

.field-unit__hint {
  font-size: 0.8rem;
  color: var(--ev-gray-blue);
  margin-left: calc(15% + 2rem);
  width: 100%;
  margin-top: 4px;
}

.field-unit--required label::after {
  color: var(--ev-red);
  content: " *";
}

.field-unit--nested {
  border: 1px solid var(--ev-gray-200);
  border-radius: var(--ev-radius);
  margin-left: 7.5%;
  max-width: 60rem;
  padding: 12px;
  width: 100%;
}

.form-actions {
  margin-left: calc(15% + 2rem);
}

/* ── Atributos (vista show) ──────────────────────────────────────── */
.attribute-label {
  clear: left;
  float: left;
  text-align: right;
  width: calc(20% - 1rem);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ev-gray-blue);
  font-family: var(--ev-font);
  margin-bottom: 1rem;
  margin-top: 0.25em;
}

.attribute-data {
  float: left;
  margin-left: 2rem;
  margin-bottom: 1rem;
  width: calc(80% - 1rem);
  word-break: break-word;
  font-size: 0.875rem;
  color: var(--ev-gray-dark);
  font-family: var(--ev-font);
}

.attribute--nested {
  border: 1px solid var(--ev-gray-200);
  border-radius: var(--ev-radius);
  padding: 12px;
}

.preserve-whitespace {
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ── Busqueda (Administrate) ─────────────────────────────────────── */
.search {
  margin-left: auto;
  margin-right: 1rem;
  max-width: 18rem;
  position: relative;
  width: 100%;
}

.search__input {
  border-radius: var(--ev-radius-pill) !important;
  padding-left: 2.5rem !important;
  padding-right: 2.5rem !important;
  font-size: 0.875rem !important;
  border-color: var(--ev-gray-300) !important;
}

.search__input:focus {
  border-color: var(--ev-blue) !important;
  box-shadow: 0 0 0 2px rgba(69, 155, 241, 0.2) !important;
}

.search__eyeglass-icon {
  height: 1rem;
  width: 1rem;
  left: 1rem;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ev-gray-blue);
}

.search__clear-link {
  height: 1rem;
  width: 1rem;
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
}

.search__clear-icon {
  color: var(--ev-gray-blue);
  height: 1rem;
  width: 1rem;
}

.search__clear-icon:hover { color: var(--ev-blue); }

.search__tooltip { margin-right: 1rem; }
.search__tooltip svg { color: var(--ev-gray-blue); height: 20px; width: 20px; }
.search__tooltip svg:hover { color: var(--ev-blue); }

.search__tooltip-popover {
  background: var(--ev-gray-dark);
  border-color: var(--ev-gray-dark);
  border-radius: var(--ev-radius);
  color: var(--ev-gray-light);
  padding: 1rem;
}

/* ── Paginacion (Administrate) ───────────────────────────────────── */
.pagination {
  margin-top: 1rem;
  padding: 12px 24px;
  text-align: center;
  font-size: 0.875rem;
  font-family: var(--ev-font);
}

.pagination .first,
.pagination .prev,
.pagination .page,
.pagination .next,
.pagination .last {
  margin: 4px;
}

.pagination a {
  color: var(--ev-blue);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--ev-radius-sm);
}

.pagination a:hover {
  background: var(--ev-blue-bg);
}

.pagination .current {
  font-weight: 700;
  color: var(--ev-gray-dark);
  background: var(--ev-blue-bg);
  padding: 4px 8px;
  border-radius: var(--ev-radius-sm);
}

/* ── Typography base ─────────────────────────────────────────────── */
.main-content {
  font-family: var(--ev-font);
  color: var(--ev-gray-dark);
}

.main-content a {
  color: var(--ev-blue);
  text-decoration: none;
}

.main-content a:hover {
  color: var(--ev-blue-hover);
}

.main-content hr {
  border: none;
  border-top: 1px solid var(--ev-gray-100);
  margin: 1rem 0;
}

/* ═══════════════════════════════════════════════════════════════════
   COMPONENTES CUSTOM — ev-*
   ═══════════════════════════════════════════════════════════════════ */

/* ── ev-table ─────────────────────────────────────────────────────── */
.ev-table-container {
  background: var(--ev-white);
  border: 1px solid var(--ev-gray-200);
  border-radius: var(--ev-radius-xl);
  box-shadow: var(--ev-shadow-sm);
  overflow: hidden;
}

.ev-table {
  border-collapse: collapse;
  font-family: var(--ev-font);
  font-size: 0.875rem;
  text-align: left;
  width: 100%;
}

.ev-table thead {
  background: rgba(249, 250, 251, 0.5);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ev-table th {
  font-weight: 600;
  color: var(--ev-gray-blue);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  padding: 16px 24px;
  border-bottom: 1px solid var(--ev-gray-100);
  white-space: nowrap;
}

.ev-table td {
  padding: 16px 24px;
  color: var(--ev-gray-dark);
  border-bottom: 1px solid var(--ev-gray-100);
  vertical-align: middle;
}

.ev-table th:first-child,
.ev-table td:first-child { padding-left: 24px; }
.ev-table th:last-child,
.ev-table td:last-child { padding-right: 24px; }

.ev-table tbody tr {
  transition: background-color 150ms ease;
}

.ev-table tbody tr:hover {
  background: rgba(234, 243, 253, 0.5);
}

.ev-table tbody tr:last-child td {
  border-bottom: none;
}

.ev-table-empty {
  text-align: center;
  padding: 48px 24px !important;
  color: var(--ev-gray-300);
}

.ev-table-empty p {
  margin-top: 12px;
  font-size: 0.875rem;
  color: var(--ev-gray-blue);
}

/* ── ev-badge ─────────────────────────────────────────────────────── */
.ev-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ev-font);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: var(--ev-radius-sm);
  white-space: nowrap;
  line-height: 1.5;
}

.ev-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Variantes */
.ev-badge--green {
  background: var(--ev-green-bg);
  color: var(--ev-green-dark);
  border: 1px solid #a7f3d0;
}
.ev-badge--green .ev-badge-dot { background: var(--ev-green-dark); }

.ev-badge--blue {
  background: var(--ev-blue-bg);
  color: var(--ev-blue);
  border: 1px solid var(--ev-blue-pastel);
}
.ev-badge--blue .ev-badge-dot { background: var(--ev-blue); }

.ev-badge--red {
  background: var(--ev-red-bg);
  color: var(--ev-red);
  border: 1px solid #fecaca;
}
.ev-badge--red .ev-badge-dot { background: var(--ev-red); }

.ev-badge--amber {
  background: var(--ev-amber-bg);
  color: var(--ev-amber);
  border: 1px solid #fde68a;
}
.ev-badge--amber .ev-badge-dot { background: var(--ev-amber); }

.ev-badge--purple {
  background: var(--ev-purple-bg);
  color: var(--ev-purple);
  border: 1px solid #ddd6fe;
}
.ev-badge--purple .ev-badge-dot { background: var(--ev-purple); }

.ev-badge--gray {
  background: var(--ev-gray-light);
  color: var(--ev-gray-medium);
  border: 1px solid var(--ev-gray-200);
}
.ev-badge--gray .ev-badge-dot { background: var(--ev-gray-blue); }

/* ── ev-filter-pill ───────────────────────────────────────────────── */
.ev-filter-pill {
  display: inline-block;
  font-family: var(--ev-font);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--ev-radius-pill);
  border: 1px solid var(--ev-gray-200);
  background: var(--ev-white);
  color: var(--ev-gray-medium);
  text-decoration: none;
  transition: all 150ms ease;
  cursor: pointer;
}

.ev-filter-pill:hover {
  border-color: var(--ev-blue-light);
  color: var(--ev-blue);
  background: var(--ev-blue-bg);
}

.ev-filter-pill--active {
  background: var(--ev-blue);
  color: var(--ev-white);
  border-color: var(--ev-blue);
}

.ev-filter-pill--active:hover {
  background: var(--ev-blue-hover);
  color: var(--ev-white);
  border-color: var(--ev-blue-hover);
}

/* ── ev-card ──────────────────────────────────────────────────────── */
.ev-card {
  background: var(--ev-white);
  border: 1px solid var(--ev-gray-200);
  border-radius: var(--ev-radius-lg);
  box-shadow: var(--ev-shadow-sm);
  font-family: var(--ev-font);
  overflow: hidden;
}

.ev-card-header {
  padding: 16px 24px;
  background: rgba(249, 250, 251, 0.5);
  border-bottom: 1px solid var(--ev-gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ev-card-header-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ev-gray-dark);
  letter-spacing: -0.01em;
}

.ev-card-body {
  padding: 24px;
}

.ev-card-footer {
  padding: 16px 24px;
  background: var(--ev-gray-50);
  border-top: 1px solid var(--ev-gray-100);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Card legacy (sin header/body/footer) */
.ev-card--simple {
  padding: 24px;
}

/* ═══════════════════════════════════════════════════════════════════
   FORMULARIOS CUSTOM — ev-form-*
   ═══════════════════════════════════════════════════════════════════ */

.ev-form-label {
  display: block;
  font-family: var(--ev-font);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ev-gray-dark);
  margin-bottom: 6px;
}

.ev-form-hint {
  font-size: 0.75rem;
  color: var(--ev-gray-blue);
  margin-top: 4px;
}

.ev-form-input {
  display: block;
  width: 100%;
  border: 1px solid var(--ev-gray-300);
  border-radius: var(--ev-radius);
  padding: 10px 12px;
  font-size: 0.875rem;
  font-family: var(--ev-font);
  color: var(--ev-gray-dark);
  background: var(--ev-white);
  box-shadow: var(--ev-shadow-sm);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.ev-form-input:hover {
  border-color: var(--ev-blue-light);
}

.ev-form-input:focus {
  border-color: var(--ev-blue);
  box-shadow: 0 0 0 2px rgba(69, 155, 241, 0.2);
}

.ev-form-input:disabled {
  background: var(--ev-gray-50);
  color: var(--ev-gray-blue);
  cursor: not-allowed;
}

.ev-form-input--error {
  border-color: #fca5a5;
}

.ev-form-input--error:focus {
  border-color: var(--ev-red);
  box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.2);
}

/* Select */
.ev-form-select {
  display: block;
  width: 100%;
  border: 1px solid var(--ev-gray-300);
  border-radius: var(--ev-radius);
  padding: 10px 12px;
  font-size: 0.875rem;
  font-family: var(--ev-font);
  color: var(--ev-gray-dark);
  background: var(--ev-white);
  box-shadow: var(--ev-shadow-sm);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  cursor: pointer;
}

.ev-form-select:hover { border-color: var(--ev-blue-light); }

.ev-form-select:focus {
  border-color: var(--ev-blue);
  box-shadow: 0 0 0 2px rgba(69, 155, 241, 0.2);
}

/* Textarea */
.ev-form-textarea {
  display: block;
  width: 100%;
  border: 1px solid var(--ev-gray-300);
  border-radius: var(--ev-radius);
  padding: 10px 12px;
  font-size: 0.875rem;
  font-family: var(--ev-font);
  color: var(--ev-gray-dark);
  background: var(--ev-white);
  box-shadow: var(--ev-shadow-sm);
  outline: none;
  resize: vertical;
  min-height: 80px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.ev-form-textarea:focus {
  border-color: var(--ev-blue);
  box-shadow: 0 0 0 2px rgba(69, 155, 241, 0.2);
}

/* Checkbox */
.ev-form-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  accent-color: var(--ev-blue);
  cursor: pointer;
}

/* Grupo de campos */
.ev-form-group {
  margin-bottom: 24px;
}

/* Grid de formulario 2 columnas */
.ev-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 640px) {
  .ev-form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Seccion de formulario con separador */
.ev-form-section {
  margin-bottom: 32px;
}

.ev-form-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--ev-gray-100);
}

.ev-form-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ev-gray-blue);
}

.ev-form-section-icon {
  width: 16px;
  height: 16px;
  color: var(--ev-blue);
}

/* Sub-seccion resaltada */
.ev-form-highlight {
  padding: 16px;
  background: rgba(234, 243, 253, 0.3);
  border: 1px solid rgba(186, 214, 243, 0.5);
  border-radius: var(--ev-radius);
}

/* Errores de formulario */
.ev-form-errors {
  margin-bottom: 24px;
  padding: 12px 16px;
  border-radius: var(--ev-radius);
  background: var(--ev-red-bg);
  border: 1px solid #fecaca;
  color: var(--ev-red);
  font-size: 0.875rem;
}

.ev-form-errors ul {
  list-style: disc inside;
  margin: 0;
  padding: 0;
}

.ev-form-errors li {
  margin: 4px 0;
}

/* ── ev-radio ─────────────────────────────────────────────────────── */
.ev-radio-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--ev-gray-200);
  border-radius: var(--ev-radius);
  cursor: pointer;
  transition: all 150ms ease;
}

.ev-radio-option:hover {
  border-color: var(--ev-blue-light);
  background: rgba(234, 243, 253, 0.3);
}

.ev-radio-option:has(.ev-radio:checked) {
  border-color: var(--ev-blue);
  background: var(--ev-blue-bg);
}

.ev-radio {
  accent-color: var(--ev-blue);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   BOTONES CUSTOM — ev-btn-*
   ═══════════════════════════════════════════════════════════════════ */

.ev-btn-primary {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ev-blue);
  color: var(--ev-white);
  border: none;
  border-radius: var(--ev-radius);
  padding: 10px 16px;
  font-family: var(--ev-font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  box-shadow: var(--ev-shadow-glow);
}

.ev-btn-primary:hover {
  background: var(--ev-blue-hover);
}

.ev-btn-primary:active {
  transform: scale(0.98);
}

.ev-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ev-btn-secondary {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ev-white);
  color: var(--ev-gray-dark);
  border: 1px solid var(--ev-gray-300);
  border-radius: var(--ev-radius);
  padding: 10px 16px;
  font-family: var(--ev-font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
  box-shadow: var(--ev-shadow-sm);
}

.ev-btn-secondary:hover {
  background: var(--ev-gray-50);
  border-color: var(--ev-blue);
}

.ev-btn-secondary:active {
  transform: scale(0.98);
}

.ev-btn-danger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ev-red);
  color: var(--ev-white);
  border: none;
  border-radius: var(--ev-radius);
  padding: 10px 16px;
  font-family: var(--ev-font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  box-shadow: 0 10px 15px -3px rgba(229, 62, 62, 0.2);
}

.ev-btn-danger:hover {
  background: var(--ev-red-hover);
}

.ev-btn-danger:active {
  transform: scale(0.98);
}

.ev-btn-ghost {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--ev-gray-medium);
  border: none;
  border-radius: var(--ev-radius);
  padding: 10px 16px;
  font-family: var(--ev-font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
}

.ev-btn-ghost:hover {
  background: var(--ev-gray-100);
  color: var(--ev-gray-dark);
}

.ev-btn-icon {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--ev-gray-blue);
  border: none;
  border-radius: var(--ev-radius);
  padding: 8px;
  cursor: pointer;
  transition: all 150ms ease;
}

.ev-btn-icon:hover {
  background: var(--ev-gray-100);
  color: var(--ev-gray-medium);
}

/* ── ev-action (links en tablas) ──────────────────────────────────── */
.ev-action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ev-blue);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--ev-radius-sm);
  transition: all 150ms ease;
}

.ev-action-link:hover {
  background: var(--ev-blue-bg);
}

.ev-action-danger {
  transition: all 150ms ease;
  border-radius: var(--ev-radius-sm);
}

.ev-action-danger:hover {
  background: var(--ev-red-bg);
}

/* ═══════════════════════════════════════════════════════════════════
   DROPDOWNS Y MENUS
   ═══════════════════════════════════════════════════════════════════ */

/* Wrapper para dropdown — usa Stimulus controller (data-controller="dropdown") */
.ev-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.ev-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--ev-radius);
  border: 1px solid var(--ev-gray-100);
  background: var(--ev-white);
  cursor: pointer;
  color: var(--ev-gray-blue);
  transition: background 150ms, border-color 150ms, color 150ms;
}

.ev-dropdown-trigger:hover {
  background: var(--ev-gray-50);
  border-color: var(--ev-gray-200);
  color: var(--ev-gray-dark);
}

.ev-dropdown-trigger svg { pointer-events: none; }

/* Panel del dropdown — posición absoluta respecto al wrapper */
.ev-dropdown-wrapper .ev-dropdown {
  position: absolute;
  right: 0;
  z-index: 9999;
  width: 200px;
}

/* Ocultar con clase hidden (Stimulus toggle) */
.ev-dropdown.hidden {
  display: none !important;
}

.ev-dropdown {
  z-index: 9999;
  width: 192px;
  background: var(--ev-white);
  border: 1px solid var(--ev-gray-100);
  border-radius: var(--ev-radius);
  box-shadow: var(--ev-shadow-xl);
  padding: 4px 0;
  animation: ev-dropdown-in 100ms ease-out;
}

.ev-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-family: var(--ev-font);
  color: var(--ev-gray-dark);
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.ev-dropdown-item:hover {
  background: var(--ev-gray-50);
}

.ev-dropdown-item--danger {
  color: var(--ev-red);
}

.ev-dropdown-item--danger:hover {
  background: var(--ev-red-bg);
}

/* Los button_to de Rails generan un <form> wrapper — neutralizarlo dentro del dropdown */
.ev-dropdown form {
  margin: 0;
  padding: 0;
}

.ev-dropdown-separator {
  height: 1px;
  background: var(--ev-gray-100);
  margin: 4px 0;
}

@keyframes ev-dropdown-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   MODALES
   ═══════════════════════════════════════════════════════════════════ */

.ev-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ev-fade-in 200ms ease;
}

.ev-modal {
  width: 100%;
  max-width: 448px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--ev-white);
  border-radius: var(--ev-radius-lg);
  box-shadow: var(--ev-shadow-xl);
  animation: ev-modal-in 200ms ease-out;
}

.ev-modal--lg {
  max-width: 672px;
}

.ev-modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--ev-gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ev-modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ev-gray-dark);
}

.ev-modal-close {
  color: var(--ev-gray-blue);
  padding: 4px;
  border-radius: var(--ev-radius);
  border: none;
  background: none;
  cursor: pointer;
  transition: all 150ms ease;
}

.ev-modal-close:hover {
  color: var(--ev-gray-medium);
  background: var(--ev-gray-100);
}

.ev-modal-body {
  padding: 24px;
}

.ev-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--ev-gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

@keyframes ev-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ev-modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   TOOLTIPS
   ═══════════════════════════════════════════════════════════════════ */

.ev-tooltip {
  position: fixed;
  z-index: 9999;
  width: 320px;
  background: var(--ev-white);
  border-radius: var(--ev-radius-lg);
  box-shadow: var(--ev-shadow-xl);
  border: 1px solid var(--ev-gray-100);
  padding: 20px;
  animation: ev-tooltip-in 150ms ease-out;
}

.ev-tooltip::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--ev-blue), var(--ev-blue-secondary), var(--ev-purple));
  border-radius: var(--ev-radius-lg) var(--ev-radius-lg) 0 0;
}

@keyframes ev-tooltip-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   COMBOBOX / MULTI-SELECT
   ═══════════════════════════════════════════════════════════════════ */

/* Combobox (busqueda con seleccion) */
.ev-combobox {
  position: relative;
}

.ev-combobox-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ev-gray-300);
  border-radius: var(--ev-radius);
  padding: 0 12px;
  background: var(--ev-white);
  box-shadow: var(--ev-shadow-sm);
  transition: border-color 150ms ease, box-shadow 150ms ease;
  cursor: text;
}

.ev-combobox-trigger:focus-within {
  border-color: var(--ev-blue);
  box-shadow: 0 0 0 2px rgba(69, 155, 241, 0.2);
}

.ev-combobox-icon {
  width: 18px;
  height: 18px;
  color: var(--ev-gray-blue);
  flex-shrink: 0;
}

.ev-combobox-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 0.875rem;
  font-family: var(--ev-font);
  color: var(--ev-gray-dark);
  outline: none;
}

.ev-combobox-clear {
  padding: 4px;
  border-radius: var(--ev-radius-pill);
  border: none;
  background: none;
  color: var(--ev-gray-blue);
  cursor: pointer;
  transition: all 150ms ease;
}

.ev-combobox-clear:hover {
  background: var(--ev-gray-100);
  color: var(--ev-gray-medium);
}

.ev-combobox-dropdown {
  position: absolute;
  z-index: 50;
  width: 100%;
  margin-top: 4px;
  background: var(--ev-white);
  border: 1px solid var(--ev-gray-200);
  border-radius: var(--ev-radius);
  box-shadow: var(--ev-shadow-xl);
  max-height: 240px;
  overflow-y: auto;
  animation: ev-dropdown-in 100ms ease-out;
}

.ev-combobox-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 0.875rem;
  font-family: var(--ev-font);
  color: var(--ev-gray-dark);
  cursor: pointer;
  transition: background 150ms ease;
}

.ev-combobox-option:hover {
  background: var(--ev-gray-50);
}

.ev-combobox-option--selected {
  background: var(--ev-blue-bg);
  color: var(--ev-blue);
  font-weight: 500;
}

/* Multi-select */
.ev-multiselect {
  position: relative;
}

.ev-multiselect-trigger {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--ev-gray-300);
  border-radius: var(--ev-radius);
  padding: 6px 12px;
  background: var(--ev-white);
  box-shadow: var(--ev-shadow-sm);
  transition: border-color 150ms ease, box-shadow 150ms ease;
  cursor: text;
}

.ev-multiselect-trigger:focus-within {
  border-color: var(--ev-blue);
  box-shadow: 0 0 0 2px rgba(69, 155, 241, 0.2);
}

.ev-multiselect-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--ev-radius-pill);
  background: var(--ev-blue-bg);
  color: var(--ev-blue);
  border: 1px solid var(--ev-blue-pastel);
  font-size: 0.75rem;
  font-weight: 500;
}

.ev-multiselect-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: var(--ev-radius-pill);
  border: none;
  background: none;
  color: var(--ev-blue);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  transition: background 150ms ease;
}

.ev-multiselect-tag-remove:hover {
  background: rgba(69, 155, 241, 0.15);
}

.ev-multiselect-input {
  flex: 1;
  min-width: 80px;
  border: none;
  background: transparent;
  padding: 4px 0;
  font-size: 0.875rem;
  font-family: var(--ev-font);
  color: var(--ev-gray-dark);
  outline: none;
}

.ev-multiselect-dropdown {
  position: absolute;
  z-index: 50;
  width: 100%;
  margin-top: 4px;
  background: var(--ev-white);
  border: 1px solid var(--ev-gray-200);
  border-radius: var(--ev-radius);
  box-shadow: var(--ev-shadow-xl);
  max-height: 240px;
  overflow-y: auto;
  animation: ev-dropdown-in 100ms ease-out;
}

.ev-multiselect-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.875rem;
  font-family: var(--ev-font);
  color: var(--ev-gray-dark);
  cursor: pointer;
  transition: background 150ms ease;
}

.ev-multiselect-option:hover {
  background: var(--ev-gray-50);
}

/* ═══════════════════════════════════════════════════════════════════
   BARRA DE BUSQUEDA CUSTOM
   ═══════════════════════════════════════════════════════════════════ */

.ev-search {
  position: relative;
  max-width: 448px;
}

.ev-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--ev-gray-blue);
  pointer-events: none;
}

.ev-search-input {
  display: block;
  width: 100%;
  border: 1px solid var(--ev-gray-300);
  border-radius: var(--ev-radius);
  padding: 10px 12px 10px 40px;
  font-size: 0.875rem;
  font-family: var(--ev-font);
  color: var(--ev-gray-dark);
  background: var(--ev-white);
  box-shadow: var(--ev-shadow-sm);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.ev-search-input::placeholder {
  color: var(--ev-gray-blue);
}

.ev-search-input:focus {
  border-color: var(--ev-blue);
  box-shadow: 0 0 0 2px rgba(69, 155, 241, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════
   UTILIDADES
   ═══════════════════════════════════════════════════════════════════ */

/* Texto monoespaciado */
.ev-mono {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  font-size: 0.8rem;
  color: var(--ev-gray-medium);
  background: var(--ev-gray-light);
  padding: 4px 8px;
  border-radius: var(--ev-radius-sm);
}

/* ═══════════════════════════════════════════════════════════════════
   DETAIL ROWS (pares label/value para vistas show)
   ═══════════════════════════════════════════════════════════════════ */

.ev-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--ev-gray-light);
  font-size: 0.85rem;
}

.ev-detail-row:last-child {
  border-bottom: none;
}

.ev-detail-label {
  color: var(--ev-gray-blue);
  font-weight: 400;
}

.ev-detail-value {
  color: var(--ev-gray-dark);
  font-weight: 500;
  text-align: right;
}

/* Oculto con accesibilidad */
.ev-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Esconder en mobile */
@media (max-width: 768px) {
  .ev-sidebar { display: none; }
  .ev-content-wrapper { margin-left: 0; }
}
