/*
 * vynexa.css
 * Variables globales y estilos base de Vynexa Admin.
 * Componentes compartidos: static/css/vynexa-components.css
 */

:root {
  /* Colores principales */
  --color-primary: #6c3dff;
  --color-primary-dark: #5429e0;
  --color-primary-light: #ede8ff;

  /* Sidebar (referencia panel: fondo carbón) */
  --color-sidebar-bg: #1a1c23;
  --color-sidebar-text: rgba(255, 255, 255, 0.65);
  --color-sidebar-active: rgba(108, 61, 255, 0.25);
  /* Alias usado en especificaciones de diseño */
  --color-sidebar-active-bg: var(--color-sidebar-active);
  --color-sidebar-active-text: #ffffff;

  /* Fondos */
  --color-bg: #f8f9fc;
  --color-card: #ffffff;
  --color-border: #e8eaf1;

  /* Textos */
  --color-text-primary: #111827;
  --color-text-secondary: #6b7280;

  /* Semánticos */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;

  /* Tipografía */
  --font-base: 'Inter', system-ui, sans-serif;

  /* Espaciado */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Sombras */
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);

  --login-bg: #0b0a15;
  --login-card-border: #2a2a3a;
  --login-muted: #a0a0b0;
  --login-input-border: #3a3a4a;
  /* Mismo tono que el wrap del input: el autofill de Chrome usa sombra interior para anular su fondo. */
  --login-input-inner-bg: rgba(22, 22, 37, 0.85);
  --login-link: #7c4dff;
  --dash-panel-shadow: 0 10px 40px rgba(15, 23, 42, 0.06);

  /* Scrollbars: finos, minimalistas, tono marca (superficie clara) */
  --scrollbar-size: 6px;
  --scrollbar-radius: 999px;
  --scrollbar-track: color-mix(in srgb, var(--color-border) 72%, var(--color-bg));
  --scrollbar-thumb: color-mix(in srgb, var(--color-primary) 30%, var(--color-border));
  --scrollbar-thumb-hover: color-mix(in srgb, var(--color-primary) 48%, var(--color-border));
  /* Scrollbars en sidebar / login (fondo oscuro) */
  --scrollbar-track-dark: rgba(255, 255, 255, 0.05);
  --scrollbar-thumb-dark: rgba(255, 255, 255, 0.2);
  --scrollbar-thumb-dark-hover: rgba(255, 255, 255, 0.32);

  /* Topbar (cabecera módulos — referencia Dashboard) */
  --color-topbar-search-border-hover: color-mix(in srgb, var(--color-border) 55%, var(--color-text-secondary));
  --color-topbar-heading: #0f172a;
  --color-topbar-muted: #64748b;
  --color-topbar-actions-icon: #94a3b8;
  --radius-topbar-module: 8px;
  --size-topbar-module-icon: 40px;
  --size-topbar-action-btn: 40px;
  /* Cabecera alineada al lienzo (sin franja blanca); buscador sigue en tarjeta */
  --color-topbar-bg: var(--color-bg);
  /* Ancho único del buscador del topbar en todos los módulos */
  --topbar-search-max-width: 560px;
  --topbar-search-vw-cap: 46vw;
}

html,
body {
  height: 100%;
}

body.app-body {
  margin: 0;
  font-family: var(--font-base);
  background: var(--color-bg);
  color: var(--color-text-primary);
}

/*
 * Scrollbars en toda la app: Firefox (scrollbar-color) + WebKit.
 * Superficies oscuras (sidebar, login) se redefinen debajo.
 */
*,
*::before,
*::after {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: var(--scrollbar-radius);
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--scrollbar-radius);
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--color-sidebar-bg);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 14px;
}

.sidebar-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    145deg,
    var(--color-primary) 0%,
    var(--color-info) 100%
  );
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-brand-mark:has(img) {
  background: transparent;
  overflow: hidden;
}

.sidebar-brand-mark img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.sidebar-brand-title {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 14px;
}

.sidebar-brand-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-sidebar-text);
  margin-top: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb-dark) var(--scrollbar-track-dark);
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
  margin: 4px 0;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb-dark);
  border-radius: var(--scrollbar-radius);
  border: 1px solid transparent;
  background-clip: padding-box;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-dark-hover);
  background-clip: padding-box;
}

/* Login: mismo criterio minimalista sobre fondo oscuro */
.login-body,
.login-body * {
  scrollbar-color: var(--scrollbar-thumb-dark) var(--scrollbar-track-dark);
}

.login-body *::-webkit-scrollbar-track {
  background: var(--scrollbar-track-dark);
}

.login-body *::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb-dark);
}

.login-body *::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-dark-hover);
}

.sidebar-nav .nav-link {
  color: rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  padding: 11px 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  line-height: 1.25;
}

.sidebar-nav .nav-link i {
  font-size: 18px;
  opacity: 0.95;
}

.sidebar-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: rgba(108, 61, 255, 0.25);
  color: #fff;
}

.sidebar-nav .nav-link.nav-highlight:not(.active) {
  color: rgba(255, 255, 255, 0.85);
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
  margin-top: 12px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-user-chevron {
  margin-left: auto;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.45);
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.sidebar-user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

a.sidebar-user.sidebar-user--link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

a.sidebar-user.sidebar-user--link:hover {
  background: color-mix(in srgb, var(--color-primary) 22%, rgba(255, 255, 255, 0.05));
}

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

.topbar-default {
  min-height: 72px;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-search-wrap {
  min-width: 0;
}

.topbar-search-wide {
  width: 100%;
  max-width: 560px;
  position: relative;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: #f3f4f8;
  padding: 0 16px;
  height: 46px;
}

.topbar-search-icon {
  color: #9ca3af;
  font-size: 18px;
}

.topbar-search input {
  background: transparent !important;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.topbar-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  position: relative;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.topbar-icon-btn:hover {
  border-color: #e5e7eb;
  color: var(--color-text-primary);
}

.btn-logout {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.btn-logout:hover {
  border-color: #e5e7eb;
  color: var(--color-text-primary);
}

.topbar-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.content-wrap {
  flex: 1;
  padding: 16px 28px 32px;
}

.page-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 6px;
}

.page-subtitle {
  margin: 0 0 24px;
  color: var(--color-text-secondary);
}

.card-vynexa {
  background: var(--color-card);
  border-radius: 14px;
  border: 1px solid var(--color-border);
  box-shadow: var(--dash-panel-shadow);
}

.kpi-card {
  padding: 20px;
}

.kpi-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}

.kpi-trend {
  font-size: 13px;
  color: var(--color-success);
}

.table thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  border-bottom-color: var(--color-border) !important;
}

.client-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.progress.thin {
  height: 6px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.ok {
  background: var(--color-success);
}

.status-dot.warn {
  background: var(--color-warning);
}

.status-dot.err {
  background: var(--color-error);
}

.wizard-progress .step {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.wizard-progress .step.active {
  color: var(--color-primary);
  font-weight: 700;
}

.wizard-summary {
  border-radius: 12px;
  border: 1px solid var(--color-border);
  padding: 16px;
  background: #fafafa;
}

.login-body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--login-bg);
  color: #fff;
  position: relative;
  overflow-x: hidden;
}

.login-bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}

.login-bg-glow--1 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(108, 61, 255, 0.55) 0%, transparent 70%);
  top: -120px;
  left: -80px;
}

.login-bg-glow--2 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(91, 63, 232, 0.45) 0%, transparent 70%);
  bottom: -100px;
  right: -60px;
}

.login-bg-glow--3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.35) 0%, transparent 70%);
  top: 40%;
  right: 10%;
}

.login-bg-pattern {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.login-center {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px 80px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #1e1b2e;
  border-radius: 16px;
  padding: 40px;
  border: 1px solid var(--login-card-border);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-brand-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #fff;
}

.login-title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  color: #fff;
}

.login-sub {
  margin: 0 0 28px;
  font-size: 14px;
  text-align: center;
  color: var(--login-muted);
}

.login-alert {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 18px;
}

.login-field {
  margin-bottom: 18px;
}

.login-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
}

.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--login-input-border);
  background: var(--login-input-inner-bg);
}

.login-input-icon {
  font-size: 18px;
  color: var(--login-muted);
  flex-shrink: 0;
}

.login-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 15px;
}

.login-input::placeholder {
  color: rgba(160, 160, 176, 0.45);
}

/* Anula el fondo azul claro del autofill (Chrome, Edge, Safari) en el login oscuro. */
.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover,
.login-input:-webkit-autofill:focus,
.login-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--login-input-inner-bg) inset;
  box-shadow: 0 0 0 1000px var(--login-input-inner-bg) inset;
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
  transition:
    background-color 99999s ease-out,
    color 99999s ease-out;
}

.login-input:autofill,
.login-input:autofill:hover,
.login-input:autofill:focus {
  box-shadow: 0 0 0 1000px var(--login-input-inner-bg) inset;
  -webkit-text-fill-color: #fff;
  color: #fff;
  caret-color: #fff;
}

.login-toggle-pwd {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--login-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-toggle-pwd:hover {
  color: #fff;
}

.login-field-error {
  margin-top: 6px;
  font-size: 12px;
  color: #fca5a5;
}

.login-row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.login-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin: 0;
  position: relative;
}

.login-check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.login-check-ui {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: #6c3dff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #6c3dff;
}

.login-check-ui i {
  font-size: 14px;
  color: #fff;
  font-weight: 700;
  opacity: 0;
}

.login-check input:checked + .login-check-ui i {
  opacity: 1;
}

.login-check input:not(:checked) + .login-check-ui {
  background: transparent;
  border: 1px solid var(--login-input-border);
}

.login-check input:not(:checked) + .login-check-ui i {
  opacity: 0;
}

.login-check-label {
  font-size: 14px;
  color: #fff;
}

.login-link-muted {
  font-size: 13px;
  color: var(--login-link);
  text-decoration: none;
}

.login-link-muted:hover {
  text-decoration: underline;
}

.login-submit {
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 8px;
  background: #6c3dff;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.login-submit:hover {
  background: #5429e0;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 26px 0 18px;
  color: var(--login-muted);
  font-size: 13px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(160, 160, 176, 0.25);
}

.login-divider span {
  white-space: nowrap;
}

.login-access {
  text-align: center;
}

.login-access a {
  font-size: 14px;
  font-weight: 600;
  color: var(--login-link);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.login-access a:hover {
  text-decoration: underline;
}

.login-page-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  margin: 0;
  padding: 18px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--login-muted);
}

/* ── Pantallas extra de auth (reset, access request) ─────────────────────── */

.login-card--wide {
  max-width: 620px;
}

.login-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

@media (max-width: 540px) {
  .login-grid-2 {
    grid-template-columns: 1fr;
  }
}

.login-grid-2 .login-field {
  margin-bottom: 0;
}

.login-textarea {
  height: auto;
  min-height: 96px;
  padding: 12px 14px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--login-input-border);
  background: var(--login-input-inner-bg);
  color: #fff;
  font: inherit;
  resize: vertical;
}

.login-textarea::placeholder {
  color: rgba(160, 160, 176, 0.45);
}

.login-input.login-textarea {
  height: auto;
}

.login-help {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--login-muted);
}

.login-link-forgot,
.login-access-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--login-link, #b8a3ff);
  text-decoration: none;
}

.login-link-forgot:hover,
.login-access-link:hover {
  text-decoration: underline;
}

.login-alert--success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}

.login-alert--info {
  background: rgba(108, 61, 255, 0.14);
  border-color: rgba(108, 61, 255, 0.4);
  color: #d4c5ff;
}

.login-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 4px 0 20px;
  text-align: center;
}

.login-success-icon {
  font-size: 44px;
  color: #6c3dff;
}

.login-success-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--login-muted);
}

.login-submit--link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 50px;
  padding: 0 16px;
}

.login-submit--link:hover {
  color: #fff;
  text-decoration: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Topbar módulos (1 fila + CTA opcional)
   Fondo = lienzo (--color-topbar-bg); pill de búsqueda blanca; iconos sin relleno
   ═══════════════════════════════════════════════════════════════════════════ */

.vynexa-topbar {
  background: var(--color-topbar-bg);
  /* Sin borde ni sombra: lienzo continuo con .main-area / .content-wrap */
  border-bottom: none;
  box-shadow: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 24px;
  row-gap: 0;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-sizing: border-box;
}

.vynexa-topbar:has(.vynexa-topbar-cta-row .vynexa-topbar-cta) {
  row-gap: 12px;
  padding-bottom: 16px;
}

.vynexa-topbar-left {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  min-width: 0;
}

.vynexa-topbar-icon {
  width: var(--size-topbar-module-icon);
  height: var(--size-topbar-module-icon);
  border-radius: var(--radius-topbar-module);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.vynexa-topbar-title-block {
  min-width: 0;
}

.vynexa-topbar-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-topbar-heading);
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.vynexa-topbar-subtitle {
  font-size: 13px;
  color: var(--color-topbar-muted);
  margin: 4px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vynexa-topbar-center {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.vynexa-topbar-search-form {
  width: min(var(--topbar-search-max-width), var(--topbar-search-vw-cap));
  max-width: 100%;
  flex: 0 1 auto;
  box-sizing: border-box;
}

/*
 * Si algún template añade utilidades Bootstrap (p. ej. .w-100), el buscador debe
 * mantener el mismo ancho (.w-100 usa width:100% !important).
 */
.vynexa-topbar-search-form.w-100 {
  width: min(var(--topbar-search-max-width), var(--topbar-search-vw-cap)) !important;
  max-width: 100% !important;
}

.vynexa-topbar-search-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0 18px;
  height: 44px;
  width: 100%;
  box-sizing: border-box;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.vynexa-topbar-search-pill:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.vynexa-topbar-search-icon {
  color: var(--color-topbar-muted);
  font-size: 17px;
  flex-shrink: 0;
}

.vynexa-topbar-search-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--color-text-primary);
  width: 100%;
  min-width: 0;
  font-family: var(--font-base);
}

.vynexa-topbar-search-input::placeholder {
  color: color-mix(in srgb, var(--color-topbar-muted) 92%, var(--color-card));
}

.vynexa-topbar-right {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.vynexa-topbar-icons-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.vynexa-topbar-avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-decoration: none;
  border: 2px solid var(--color-primary-light);
  transition: border-color 0.15s ease;
  flex-shrink: 0;
}

.vynexa-topbar-avatar-btn:hover {
  border-color: var(--color-primary);
}

.vynexa-topbar-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.vynexa-topbar-avatar-initials {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--color-primary);
}

.vynexa-topbar-logout-form {
  display: inline-flex;
  margin: 0;
}

.vynexa-topbar-cta-row {
  grid-column: 1 / -1;
  grid-row: 2;
  display: none;
  justify-content: flex-end;
  width: 100%;
}

.vynexa-topbar-cta-row:has(.vynexa-topbar-cta) {
  display: flex;
}

.vynexa-topbar-icon-btn {
  width: var(--size-topbar-action-btn);
  height: var(--size-topbar-action-btn);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-topbar-actions-icon);
  font-size: 1.125rem;
  cursor: pointer;
  position: relative;
  box-shadow: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

a.vynexa-topbar-icon-btn,
a.vynexa-topbar-icon-btn--link {
  text-decoration: none;
}

.vynexa-topbar-icon-btn:hover {
  background: color-mix(in srgb, var(--color-card) 42%, var(--color-topbar-bg));
  border-color: color-mix(in srgb, var(--color-border) 55%, var(--color-topbar-actions-icon));
  color: color-mix(in srgb, var(--color-topbar-actions-icon) 35%, var(--color-text-primary));
}

.vynexa-topbar-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--color-error);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 999px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.vynexa-topbar-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease;
  font-family: var(--font-base);
}

.vynexa-topbar-cta:hover {
  background: var(--color-primary-dark);
  color: #fff;
}

button.vynexa-topbar-cta:disabled,
.vynexa-topbar-cta[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 991px) {
  .vynexa-topbar {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    padding: 12px 16px;
    column-gap: 12px;
    row-gap: 12px;
  }

  .vynexa-topbar-left {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
  }

  .vynexa-topbar-center {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    justify-content: stretch;
  }

  .vynexa-topbar-search-form {
    width: 100%;
    max-width: none;
  }

  .vynexa-topbar-right {
    grid-column: 1;
    grid-row: 3;
    width: 100%;
    justify-content: flex-end;
  }

  .vynexa-topbar-icons-row {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .vynexa-topbar-cta-row {
    grid-column: 1;
    grid-row: 4;
  }

  .vynexa-topbar-cta-row:has(.vynexa-topbar-cta) {
    justify-content: stretch;
  }

  .vynexa-topbar-cta-row .vynexa-topbar-cta {
    width: 100%;
    justify-content: center;
  }
}
