:root {
  --bg: #050816;
  --bg-elevated: #070c1f;
  --bg-soft: #0b1327;
  --accent: #28e0b9;
  --accent-soft: rgba(40, 224, 185, 0.12);
  --text-main: #e5f0ff;
  --text-muted: #7b8aa8;
  --border-subtle: #1b2340;
  --danger: #ff4d6a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    background: radial-gradient(circle at top left, #243764 0, #0b1220 40%, #050816 100%);
  color: var(--text-main);
}

.hidden {
  display: none !important;
}

#login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, rgba(40, 224, 185, 0.15), transparent 55%), #02030a;
  z-index: 20;
}

.login-card {
  background: rgba(5, 12, 34, 0.95);
  border-radius: 20px;
  padding: 32px 36px;
  width: 360px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.login-subtitle {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.login-card label {
  font-size: 13px;
  margin-bottom: 4px;
  display: block;
}

.login-card input {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: #050816;
  color: var(--text-main);
}

.login-card button {
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(90deg, #28e0b9, #38bdf8);
  color: #020617;
  font-weight: 600;
  cursor: pointer;
}

.login-hint {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.error-text {
  margin-top: 6px;
  font-size: 12px;
  color: var(--danger);
  min-height: 16px;
}

.shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border-subtle);
  background: radial-gradient(circle at top, rgba(40, 224, 185, 0.12), transparent 60%), #020617;
  display: flex;
  flex-direction: column;
  padding: 16px 14px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px 16px;
}

.logo-circle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0, #38bdf8, #28e0b9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #020617;
}

.logo-title {
  font-size: 13px;
  font-weight: 600;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.nav {
  flex: 1;
  margin-top: 6px;
}

.nav-section-title {
  margin: 12px 8px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.nav-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: 4px;
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--text-main);
}

.sidebar-footer {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

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

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, #38bdf8, #22c55e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #020617;
  font-weight: 600;
}

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

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.logout-btn {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  padding: 6px 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.main {
  padding: 18px 22px 24px;
  overflow: auto;
}

.main-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.breadcrumbs {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
}

.main-header h1 {
  margin: 4px 0 0;
  font-size: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  border: 1px solid var(--border-subtle);
  margin-left: 6px;
  color: var(--text-muted);
}

.pill-green {
  border-color: rgba(40, 224, 185, 0.7);
  color: #a7f3d0;
}

.header-actions {
  display: flex;
  gap: 8px;
}
.search-input {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: #020617;
  color: var(--text-main);
  font-size: 12px;
  padding: 7px 32px 7px 10px;
  min-width: 220px;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.btn-primary {
  border-radius: 999px;
  padding: 8px 14px;
  border: none;
  background: linear-gradient(90deg, #28e0b9, #38bdf8);
  color: #020617;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost {
  border-radius: 999px;
  padding: 8px 14px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-main);
  font-size: 12px;
  cursor: pointer;
}

.top-kpis {
  background: radial-gradient(circle at top left, rgba(40, 224, 185, 0.16), transparent 55%), var(--bg-elevated);
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
  padding: 14px 16px 16px;
  margin-bottom: 14px;
}

.top-kpis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.top-kpis-header h2 {
  font-size: 14px;
  margin: 0;
}

.badge-live {
  font-size: 11px;
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.15);
  border-radius: 999px;
  padding: 3px 9px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.kpi-card {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
}

.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 18px;
  font-weight: 600;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(280px, 0.9fr);
  gap: 14px;
  align-items: flex-start;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.module-card {
  background: var(--bg-elevated);
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  padding: 10px 12px 12px;
  font-size: 12px;
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.module-header h3 {
  margin: 0;
  font-size: 13px;
}

.module-card p {
  margin: 0 0 6px;
  color: var(--text-muted);
}

.link-btn {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}

.crud-panel {
  background: var(--bg-elevated);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  padding: 14px 14px 10px;
}

.crud-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.crud-header h2 {
  margin: 0;
  font-size: 14px;
}

.crud-header p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}
.crud-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.crud-header-actions .btn-ghost,
.crud-header-actions .btn-primary {
  white-space: nowrap;
}

.crud-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 12px;
  border-radius: 12px;
  background: #020617;
}

.crud-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crud-item {
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  padding: 10px 10px 8px;
  background: #020617;
}

.crud-item-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

.crud-item-title {
  font-size: 13px;
  font-weight: 500;
}

.crud-item-meta {
  font-size: 10px;
  color: var(--text-muted);
}

.crud-item-body {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.tag {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  padding: 2px 7px;
  font-size: 10px;
  color: var(--text-muted);
}

.crud-item-actions {
  display: flex;
  gap: 6px;
}

.btn-xs {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  padding: 3px 7px;
  cursor: pointer;
}

.btn-danger {
  border-color: rgba(248, 113, 113, 0.8);
  color: #fecaca;
}

.crud-form {
  margin-top: 10px;
  border-top: 1px dashed var(--border-subtle);
  padding-top: 10px;
}

.crud-form h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.crud-form label {
  display: block;
  font-size: 11px;
  margin-bottom: 3px;
}

.crud-form input,
.crud-form textarea,
.crud-form select {
  width: 100%;
  background: #020617;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 12px;
  padding: 7px 8px;
  margin-bottom: 8px;
}

.crud-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.content-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-card {
  background: var(--bg-elevated);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  padding: 12px 12px 10px;
  font-size: 12px;
}
/* ---- Billing revenue side-card ---- */

#billing-report-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.billing-kpi-row {
  display: flex;
  gap: 10px;
}

.billing-kpi {
  flex: 1;
  padding: 8px 10px;
  border-radius: 12px;
  background: radial-gradient(circle at top left,
    rgba(0, 255, 200, 0.12),
    rgba(0, 0, 20, 0.9)
  );
  border: 1px solid rgba(0, 255, 200, 0.25);
}

.billing-kpi-label {
  font-size: 11px;
  opacity: 0.8;
  margin-bottom: 4px;
}

.billing-kpi-value {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.billing-filter label {
  font-size: 12px;
  opacity: 0.85;
}

.billing-filter input {
  margin-top: 4px;
  width: 100%;
}

.billing-report-list {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  max-height: 320px;
  overflow-y: auto;
  font-size: 12px;
}

.billing-report-row {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}

.billing-report-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.billing-report-row-title {
  font-weight: 500;
}

.billing-report-row-meta {
  opacity: 0.8;
  font-size: 11px;
}

.billing-report-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 255, 157, 0.08);
  border: 1px solid rgba(0, 255, 157, 0.4);
}

.billing-report-empty {
  font-size: 12px;
  opacity: 0.75;
}

.side-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.side-header h3 {
  margin: 0;
  font-size: 13px;
}

.side-text {
  margin: 0 0 8px;
  color: var(--text-muted);
}

.btn-full {
  width: 100%;
  margin-top: 6px;
  margin-bottom: 6px;
}
.backup-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.file-input-label {
  text-align: center;
  cursor: pointer;
}

.backup-status {
  font-size: 12px;
  color: var(--text-muted);
  min-height: 18px; /* deja espacio aunque no haya mensaje */
}

#ai-prompt {
  width: 100%;
  background: #020617;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px;
  font-size: 12px;
  resize: vertical;
}

.ai-output {
  min-height: 40px;
  font-size: 11px;
  color: var(--text-muted);
}
.ai-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

/* El botón "Ask AI" se expande y el de voz queda más compacto */
.ai-actions-row .btn-primary.btn-full {
  flex: 1;
}

/* Botón de voz redondito */
.ai-voice-btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* Efecto cuando está escuchando */
.ai-voice-btn.listening {
  animation: pulse-glow 1s infinite;
}

/* Animación de glow */
@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.6);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(56, 189, 248, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
  }
}

.plans-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.plans-list li {
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-subtle);
}

.plans-list li:last-child {
  border-bottom: none;
}

.plan-name {
  font-size: 12px;
}

.plan-meta {
  font-size: 10px;
  color: var(--text-muted);
}

@media (max-width: 768px) { 
  /* Layout general: una sola columna */
  .shell {
    grid-template-columns: 1fr;
  }

  /* Sidebar como panel deslizante */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    max-width: 80vw;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.26s ease, box-shadow 0.26s ease;
    box-shadow: none;
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.95);
  }

  /* Fondo oscuro clicable cuando el menú está abierto */
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.98));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
    z-index: 20;
    display: block;
  }

  .sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: all;
  }

  /* Contenido principal con algo menos de padding para pantallas pequeñas */
  .main {
    padding: 16px 14px 22px;
  }

  .main-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .search-wrapper {
    flex: 1;
  }

  /* Botón de menú visible en móvil */
  .mobile-menu-toggle {
    display: inline-flex;
  }

  /* Login más compacto en móviles */
  .login-card {
    width: 100%;
    max-width: 360px;
    padding: 24px 18px 22px;
  }

  .login-floating-images {
    display: none; /* si quieres simplificar el fondo en iPhone */
  }

  .login-screen {
    padding: 16px;
  }
}

/* Desktop: ocultamos capa de fondo y botón de menú */
@media (min-width: 769px) {
  .sidebar-backdrop {
    display: none;
  }

  .mobile-menu-toggle {
    display: none;
  }
}


/* --- Sidebar hierarchy & icons 2.0 --- */
.nav-section-title {
  margin: 18px 10px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(148, 163, 184, 0.9);
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.nav-section-title::before {
  content: "";
  width: 18px;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  opacity: 0.8;
}

/* Layout general del item de menú */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  border: none;
  background: transparent;
  position: relative;
  overflow: hidden;
  color: var(--text-muted);
  cursor: pointer;
}

/* Glow sutil al pasar el mouse */
.nav-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at left, rgba(56, 189, 248, 0.22), transparent 55%);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.nav-item:hover::before {
  opacity: 1;
  transform: translateX(0);
}

/* Estado activo: píldora elevada */
.nav-item.active {
  background: rgba(15, 23, 42, 0.96);
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.3),
    0 12px 28px rgba(15, 23, 42, 0.95);
  color: var(--text-main);
}

/* Texto del título del módulo */
.nav-item > span:last-child {
  position: relative;
  z-index: 1;
  flex: 1;
  text-align: left;
}

/* Icono redondo con glow */
.nav-icon {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: radial-gradient(circle at 30% 20%, #2dd4bf, #0ea5e9);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.95);
  color: #0b1120;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

/* Hover sobre el item: icono flotando un poco */
.nav-item:hover .nav-icon {
  transform: translateY(-1px) scale(1.05);
  filter: brightness(1.12);
}

/* Activo: icono con pulso suave */
.nav-item.active .nav-icon {
  animation: nav-pulse 1.6s ease-in-out infinite;
  box-shadow:
    0 0 0 1px rgba(248, 250, 252, 0.9),
    0 12px 32px rgba(8, 47, 73, 0.95);
}

/* Pulso muy suave para no molestar */
@keyframes nav-pulse {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.06);
    filter: brightness(1.25);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}


/* --- Dashboard appointment alerts --- */
.appointments-alerts {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 16px;
  background: radial-gradient(circle at top left, rgba(0, 255, 200, 0.18), rgba(0, 0, 0, 0.7));
  border: 1px solid rgba(0, 255, 200, 0.2);
  font-size: 13px;
}

.appointments-alerts-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: #e6f9ff;
}

.appointments-alerts-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.appointments-alerts-list li {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 0;
}

.appointments-alerts-list li + li {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.appt-time {
  font-family: monospace;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 255, 200, 0.35);
}

.appt-main {
  font-weight: 500;
}

.appt-sub {
  opacity: 0.8;
  font-size: 12px;
}

/* ---- Date & Time fields contrast ---- */
.crud-extra-group input[type="date"],
.crud-extra-group input[type="time"] {
  background: #050b1a;
  border: 1px solid rgba(0, 255, 200, 0.55);
  color: #e8f6ff;
  padding-right: 38px; /* espacio para el icono */
}

.crud-extra-group input[type="date"]:focus,
.crud-extra-group input[type="time"]:focus {
  outline: none;
  box-shadow: 0 0 0 1px rgba(0, 255, 200, 0.7);
}

/* icono de calendario / reloj más claro en navegadores WebKit (Chrome, Edge, etc.) */
.crud-extra-group input[type="date"]::-webkit-calendar-picker-indicator,
.crud-extra-group input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.6);
  opacity: 0.9;
}

/* Firefox: usar cursor e icono más visible */
.crud-extra-group input[type="date"],
.crud-extra-group input[type="time"] {
  cursor: pointer;
}

/* --- Floating AI card bottom-right (usa la side-card original) --- */
/* === AI assistant como widget fijo abajo a la derecha === */
#floating-ai {
  position: fixed;
  /* esquina inferior derecha de la ventana */
  top: auto;
  right: 24px;
  bottom: 24px;
  left: auto;

  width: 420px;
  max-width: min(420px, 92vw);
  max-height: 70vh;
  z-index: 9999;

  background: var(--bg-elevated);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 0 22px rgba(0, 0, 0, 0.7);
}

/* En móviles, que ocupe casi todo el ancho inferior */
@media (max-width: 768px) {
  #floating-ai {
    right: 10px;
    left: 10px;
    bottom: 10px;
    width: auto;
    max-width: 100%;
  }
}

/* === GLASSMORPHISM & MOTION PARA DASHBOARD === */

/* Base glass para los bloques principales */
.module-card,
.kpi-card,
.crud-panel,
.side-card,
#floating-ai {
  position: relative;
  overflow: hidden;

  background:
    radial-gradient(circle at top left, rgba(40, 224, 185, 0.14), transparent 55%),
    rgba(8, 14, 35, 0.88);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);

  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease,
    background 0.25s ease;
}

/* Brillo dinámico en borde */
.module-card::before,
.kpi-card::before,
.crud-panel::before,
.side-card::before,
#floating-ai::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: conic-gradient(
    from 180deg,
    rgba(56, 189, 248, 0.0),
    rgba(56, 189, 248, 0.4),
    rgba(45, 212, 191, 0.5),
    rgba(129, 140, 248, 0.45),
    rgba(56, 189, 248, 0.0)
  );
  opacity: 0;
  mix-blend-mode: screen;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

/* “Reflejo” que cruza el card */
.module-card::after,
.kpi-card::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -60%;
  width: 60%;
  height: 180%;
  background: linear-gradient(
    120deg,
    rgba(248, 250, 252, 0.0),
    rgba(248, 250, 252, 0.16),
    rgba(248, 250, 252, 0.0)
  );
  opacity: 0;
  transform: translateX(0);
  pointer-events: none;
}

/* Hover principal: elevación + brillo */
.module-card:hover,
.kpi-card:hover,
.crud-panel:hover,
.side-card:hover,
#floating-ai:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(56, 189, 248, 0.5);
  border-color: rgba(56, 189, 248, 0.75);
  background:
    radial-gradient(circle at top left, rgba(40, 224, 185, 0.20), transparent 50%),
    rgba(8, 14, 35, 0.98);
}

.module-card:hover::before,
.kpi-card:hover::before,
.crud-panel:hover::before,
.side-card:hover::before,
#floating-ai:hover::before {
  opacity: 0.9;
}

/* Barrido de luz sólo en los módulos del grid y KPIs */
.module-card:hover::after,
.kpi-card:hover::after {
  opacity: 1;
  animation: card-shimmer 1.1s ease-out forwards;
}

@keyframes card-shimmer {
  0% {
    transform: translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translateX(220%);
    opacity: 0;
  }
}

/* Aparición suave en el dashboard (stagger por índice) */
.module-card {
  animation: card-fade-up 0.7s ease-out both;
  animation-delay: calc(var(--card-index, 0) * 90ms);
}

@keyframes card-fade-up {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Pequeña respiración continua para que parezcan “vivos” */
.kpi-card {
  animation: kpi-breathe 12s ease-in-out infinite alternate;
}

@keyframes kpi-breathe {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-4px);
  }
}

/* Ajustes responsive extra para iPad / iPhone */
@media (max-width: 1024px) {
  .main {
    padding: 14px 14px 20px;
  }

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

  .crud-panel {
    margin-top: 10px;
  }
}

@media (max-width: 768px) {
  .main {
    padding: 12px 10px 18px;
  }

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

  .module-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    width: 92vw;
    padding: 22px 18px;
  }
}

@media (max-width: 480px) {
  .main-header {
    flex-direction: column;
    gap: 10px;
  }

  .search-input {
    min-width: 0;
    width: 100%;
  }
}
/* === FIX: AI Assistant position === */

#floating-ai,
.ai-card,
.ai-assistant-card {
  position: relative !important;
  margin-top: 24px !important;
  align-self: flex-start !important;
}

/* Empujar el AI más abajo en pantallas grandes */
@media (min-width: 1280px) {
  #floating-ai,
  .ai-card,
  .ai-assistant-card {
    margin-top: 40px !important;
  }
}

/* Correcciones para tablets e iPads */
@media (max-width: 1024px) {
  #floating-ai,
  .ai-card,
  .ai-assistant-card {
    margin-top: 20px !important;
  }
}

/* Para móviles: centrar y ponerlo debajo del grid */
@media (max-width: 768px) {
  #floating-ai,
  .ai-card,
  .ai-assistant-card {
    margin-top: 14px !important;
    width: 100% !important;
  }
}
/* === FIX: Convert AI Assistant into a right-side floating widget === */

#floating-ai,
.ai-card,
.ai-assistant-card {
  position: absolute !important;
  top: 190px !important;          /* Ajusta si quieres más arriba/abajo */
  right: 40px !important;         /* Más a la derecha */
  width: 420px !important;        /* Tamaño ideal */
  z-index: 50 !important;
}

/* Que nunca se solape con el contenido */
.main {
  padding-right: 480px !important; /* Deja un carril libre para el AI */
}

/* Para pantallas medianas (iPad horizontal) */
@media (max-width: 1200px) {
  #floating-ai,
  .ai-card,
  .ai-assistant-card {
    position: relative !important;
    top: 0 !important;
    right: 0 !important;
    width: 100% !important;
    margin-top: 20px !important;
  }

  .main {
    padding-right: 20px !important;
  }
}

/* Para móviles y iPad vertical */
@media (max-width: 768px) {
  #floating-ai,
  .ai-card,
  .ai-assistant-card {
    width: 100% !important;
    margin: 16px 0 !important;
  }
}
/* === AUTO-LAYOUT SMART ALIGNMENT FOR AI WIDGET === */

.dashboard-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

/* Contenedor izquierdo: grid de módulos */
.dashboard-left {
  flex: 1 1 auto;
  min-width: 0; 
}

/* AI Card siempre a la derecha, bien alineado */
#floating-ai,
.ai-card,
.ai-assistant-card {
  flex: 0 0 420px;     /* ancho fijo ideal */
  align-self: flex-start;
  position: sticky;
  top: 120px;          /* se mantiene visible mientras haces scroll */
  margin-left: 16px;
}

/* GRID del dashboard se convierte en dashboard-left automáticamente */
.module-grid,
.kpi-grid,
.crud-panel {
  width: 100%;
}

/* Responsive tablets */
@media (max-width: 1200px) {

  .dashboard-container {
    flex-direction: column;
  }

  #floating-ai,
  .ai-card,
  .ai-assistant-card {
    width: 100% !important;
    position: relative;
    top: 0;
    flex: none;
    margin-left: 0;
    margin-top: 20px;
  }
}

/* Responsive móviles */
@media (max-width: 768px) {
  #floating-ai,
  .ai-card,
  .ai-assistant-card {
    width: 100% !important;
    margin-top: 18px;
  }
}
/* === OVERRIDE: Alinear AI Assistant dentro de la columna derecha === */

#floating-ai {
  position: sticky;         /* sigue visible al hacer scroll, pero dentro del aside */
  top: 120px;               /* distancia desde el top del viewport */
  bottom: auto;
  right: auto;
  left: auto;

  width: 100%;
  max-width: 420px;
  max-height: none;

  margin-left: auto;        /* se pega al lado derecho dentro de content-side */
  margin-top: 0;
  z-index: 10;

  /* mantenemos el estilo glass original */
}

/* Tablets / pantallas medianas: que se ponga debajo del contenido, full width */
@media (max-width: 1024px) {
  #floating-ai {
    position: relative;
    top: auto;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-top: 20px;
  }
}

/* Móviles: full width también */
@media (max-width: 768px) {
  #floating-ai {
    position: relative;
    top: 400px;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-top: 18px;
  }
}
/* === FORZAR AI ASSISTANT A LA ESQUINA INFERIOR DERECHA === */
#floating-ai {
  position: fixed !important;
  right: 24px !important;
  bottom: 24px !important;
  top: auto !important;
  left: auto !important;

  width: 420px !important;
  max-width: min(420px, 92vw) !important;
  max-height: 70vh !important;
  margin: 0 !important;
  z-index: 9999 !important;
}

/* En móviles, que ocupe casi todo el ancho inferior */
@media (max-width: 768px) {
  #floating-ai {
    right: 10px !important;
    left: 10px !important;
    bottom: 10px !important;
    width: auto !important;
    max-width: 100% !important;
  }
}
/* === Floating pet cards en la pantalla de login === */

/* aseguramos que nada se salga visualmente */
#login-screen {
  overflow: hidden;
}

/* contenedor que ocupa todo el fondo del login */
.login-orbit {
  position: absolute;
  inset: 0;
  pointer-events: none;           /* no bloquea el click del login */
  z-index: 0;
}

/* el login-card queda por encima de las tarjetas animadas */
.login-card {
  position: relative;
  z-index: 1;
}

/* estilo base de cada card de mascota */
.pet-card {
  position: absolute;
  width: 210px;
  height: 130px;
  border-radius: 18px;
  overflow: hidden;

  background:
    radial-gradient(circle at top left, rgba(40, 224, 185, 0.25), transparent 60%),
    rgba(5, 12, 34, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  opacity: 0.95;

  /* transiciones PRO */
  transform-style: preserve-3d;
  transition:
    transform 0.9s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.9s ease,
    opacity 0.9s ease;
}

/* glow suave por detrás */
.pet-card::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.35), transparent 65%);
  opacity: 0;
  transition: opacity 0.9s ease;
  pointer-events: none;
  z-index: -1;
}

/* imagen dentro del card */
.pet-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.06);
}

/* efecto hover: zoom leve + 3D + más brillo */
.pet-card:hover {
  transform: translate3d(0, -6px, 20px) scale(1.04) rotate3d(1, 1, 0, 4deg);
  box-shadow:
    0 26px 60px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(148, 163, 184, 0.65);
  opacity: 1;
}

.pet-card:hover::before {
  opacity: 1;
}

/* --- POSICIONES: más separadas para hasta 9 imágenes --- */

/* esquina superior izquierda */
.pet-card-1 {
  top: 10%;
  left: 6%;
  animation: petFloatA 24s ease-in-out infinite alternate;
}

.pet-card-5 {
  top: 30%;
  left: 15%;
  animation: petFloatE 28s ease-in-out infinite alternate;
}

/* esquina superior derecha */
.pet-card-2 {
  top: 11%;
  right: 7%;
  animation: petFloatB 26s ease-in-out infinite alternate;
}

.pet-card-6 {
  top: 31%;
  right: 16%;
  animation: petFloatF 30s ease-in-out infinite alternate;
}

/* esquina inferior izquierda */
.pet-card-3 {
  bottom: 25%;
  left: 8%;
  animation: petFloatC 25s ease-in-out infinite alternate;
}

.pet-card-7 {
  bottom: 9%;
  left: 18%;
  animation: petFloatG 29s ease-in-out infinite alternate;
}

/* esquina inferior derecha */
.pet-card-4 {
  bottom: 23%;
  right: 9%;
  animation: petFloatD 32s ease-in-out infinite alternate;
}

.pet-card-8 {
  bottom: 8%;
  right: 18%;
  animation: petFloatH 27s ease-in-out infinite alternate;
}

/* una extra centrada abajo (opcional) */
.pet-card-9 {
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  animation: petFloatI 31s ease-in-out infinite alternate;
}

/* --- ANIMACIONES “OTRO NIVEL” (flotado + ligero 3D) --- */

@keyframes petFloatA {
  0%   { transform: translate3d(0, 0, 0) scale(1.0) rotate3d(0, 1, 0, 0deg); }
  50%  { transform: translate3d(32px, -18px, 10px) scale(1.03) rotate3d(0, 1, 0, 6deg); }
  100% { transform: translate3d(18px, 20px, 0) scale(1.02) rotate3d(0, 1, 0, -4deg); }
}

@keyframes petFloatB {
  0%   { transform: translate3d(0, 0, 0) scale(1.0) rotate3d(1, 0, 0, 0deg); }
  50%  { transform: translate3d(-34px, 18px, 14px) scale(1.04) rotate3d(1, 0, 0, -5deg); }
  100% { transform: translate3d(-10px, -22px, 0) scale(1.02) rotate3d(1, 0, 0, 3deg); }
}

@keyframes petFloatC {
  0%   { transform: translate3d(0, 0, 0) scale(1.0) rotate3d(0, 0, 1, 0deg); }
  50%  { transform: translate3d(26px, -24px, 8px) scale(1.03) rotate3d(0, 0, 1, 5deg); }
  100% { transform: translate3d(-12px, -10px, 0) scale(1.01) rotate3d(0, 0, 1, -4deg); }
}

@keyframes petFloatD {
  0%   { transform: translate3d(0, 0, 0) scale(1.0) rotate3d(0, 1, 1, 0deg); }
  50%  { transform: translate3d(-30px, -16px, 12px) scale(1.04) rotate3d(0, 1, 1, -6deg); }
  100% { transform: translate3d(-6px, 24px, 0) scale(1.02) rotate3d(0, 1, 1, 4deg); }
}

/* extras para las nuevas tarjetas (movimientos distintos) */

@keyframes petFloatE {
  0%   { transform: translate3d(0, 0, 0) scale(1.0); }
  50%  { transform: translate3d(18px, -26px, 8px) scale(1.03) rotate3d(1, 0, 1, 5deg); }
  100% { transform: translate3d(-10px, 8px, 0) scale(1.01); }
}

@keyframes petFloatF {
  0%   { transform: translate3d(0, 0, 0) scale(1.0); }
  50%  { transform: translate3d(-20px, 24px, 10px) scale(1.03) rotate3d(0, 1, 1, -4deg); }
  100% { transform: translate3d(6px, -10px, 0) scale(1.01); }
}

@keyframes petFloatG {
  0%   { transform: translate3d(0, 0, 0) scale(1.0); }
  50%  { transform: translate3d(24px, 14px, 6px) scale(1.03) rotate3d(1, 1, 0, 4deg); }
  100% { transform: translate3d(-8px, -18px, 0) scale(1.01); }
}

@keyframes petFloatH {
  0%   { transform: translate3d(0, 0, 0) scale(1.0); }
  50%  { transform: translate3d(-22px, 10px, 8px) scale(1.03) rotate3d(0, 1, 0, 5deg); }
  100% { transform: translate3d(10px, -16px, 0) scale(1.01); }
}

@keyframes petFloatI {
  0%   { transform: translate3d(-50%, 0, 0) scale(1.0); }
  50%  { transform: translate3d(-50%, -18px, 12px) scale(1.04) rotate3d(1, 0, 1, -4deg); }
  100% { transform: translate3d(-50%, -8px, 0) scale(1.02); }
}
/* === EXTRA FX para los pet-cards del login (no rompe nada) === */

.login-orbit .pet-card {
  transform-origin: center center;
  transition:
    transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.6s ease,
    opacity 0.6s ease;
}

/* Glow suave animado detrás de cada card */
.login-orbit .pet-card::before {
  content: "";
  position: absolute;
  inset: -35%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.45), transparent 65%);
  opacity: 0.0;
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: -1;
  animation: petCardGlow 9s ease-in-out infinite alternate;
}

/* Brillo + profundidad al pasar el mouse */
.login-orbit .pet-card:hover {
  animation-play-state: paused;          /* pausa el flotado mientras pasas el mouse */
  transform: translate3d(0, -10px, 0) scale(1.05);
  box-shadow:
    0 26px 60px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(148, 163, 184, 0.75);
  opacity: 1;
}

.login-orbit .pet-card:hover::before {
  opacity: 1;
}

/* Pequeña rotación aleatoria según posición (sin tocar tu layout) */
.login-orbit .pet-card:nth-child(odd):hover {
  transform: translate3d(0, -10px, 0) scale(1.05) rotate3d(0, 0, 1, 3deg);
}

.login-orbit .pet-card:nth-child(even):hover {
  transform: translate3d(0, -10px, 0) scale(1.05) rotate3d(0, 0, 1, -3deg);
}

/* Glow que “respira” continuamente detrás de las tarjetas */
@keyframes petCardGlow {
  0% {
    opacity: 0.05;
    transform: scale(0.9);
  }
  50% {
    opacity: 0.25;
    transform: scale(1.05);
  }
  100% {
    opacity: 0.12;
    transform: scale(1.0);
  }
}
/* === Animated taglines en el login (modo PRO) === */

.login-taglines {
  position: absolute;
  inset: 0;
  pointer-events: none;   /* no tapa el login */
  z-index: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

/* estilo base de cada frase */
.login-tagline {
  position: absolute;
  max-width: 260px;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.75);
  text-shadow: 0 0 18px rgba(15, 23, 42, 0.9);

  opacity: 0;
  transform: translate3d(0, 12px, 0);
  white-space: normal;

  animation:
    taglineFadeIn 1.3s ease forwards,
    taglineGlow 12s ease-in-out infinite alternate;
}

/* posiciones: dispersas por la pantalla alrededor del login */
.login-tagline-1 {
  top: 14%;
  left: 10%;
  animation-delay: 0.4s, 0s;
  animation-name: taglineFadeIn, taglineDriftA, taglineGlow;
  animation-duration: 1.3s, 26s, 12s;
  animation-timing-function: ease, ease-in-out, ease-in-out;
  animation-iteration-count: 1, infinite, infinite;
  animation-direction: normal, alternate, alternate;
}

.login-tagline-2 {
  top: 20%;
  right: 12%;
  text-align: right;
  animation-delay: 0.7s, 2s, 0.6s;
  animation-name: taglineFadeIn, taglineDriftB, taglineGlow;
  animation-duration: 1.3s, 28s, 12s;
  animation-timing-function: ease, ease-in-out, ease-in-out;
  animation-iteration-count: 1, infinite, infinite;
  animation-direction: normal, alternate, alternate;
}

.login-tagline-3 {
  bottom: 24%;
  left: 13%;
  animation-delay: 1.0s, 4s, 1.2s;
  animation-name: taglineFadeIn, taglineDriftC, taglineGlow;
  animation-duration: 1.3s, 30s, 12s;
  animation-timing-function: ease, ease-in-out, ease-in-out;
  animation-iteration-count: 1, infinite, infinite;
  animation-direction: normal, alternate, alternate;
}

.login-tagline-4 {
  bottom: 18%;
  right: 16%;
  text-align: right;
  animation-delay: 1.3s, 6s, 1.8s;
  animation-name: taglineFadeIn, taglineDriftD, taglineGlow;
  animation-duration: 1.3s, 32s, 12s;
  animation-timing-function: ease, ease-in-out, ease-in-out;
  animation-iteration-count: 1, infinite, infinite;
  animation-direction: normal, alternate, alternate;
}

/* aparición suave */
@keyframes taglineFadeIn {
  0% {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
  }
  100% {
    opacity: 0.9;
    transform: translate3d(0, 0, 0);
  }
}

/* drift sutil diferente para cada frase */
@keyframes taglineDriftA {
  0%   { transform: translate3d(0, 0, 0); }
  50%  { transform: translate3d(14px, -10px, 0); }
  100% { transform: translate3d(-6px, 4px, 0); }
}

@keyframes taglineDriftB {
  0%   { transform: translate3d(0, 0, 0); }
  50%  { transform: translate3d(-12px, 10px, 0); }
  100% { transform: translate3d(6px, -6px, 0); }
}

@keyframes taglineDriftC {
  0%   { transform: translate3d(0, 0, 0); }
  50%  { transform: translate3d(10px, -8px, 0); }
  100% { transform: translate3d(-8px, -4px, 0); }
}

@keyframes taglineDriftD {
  0%   { transform: translate3d(0, 0, 0); }
  50%  { transform: translate3d(-14px, -10px, 0); }
  100% { transform: translate3d(4px, 6px, 0); }
}

/* brillo que “respira” */
@keyframes taglineGlow {
  0% {
    text-shadow: 0 0 12px rgba(15, 23, 42, 0.9);
    color: rgba(148, 163, 184, 0.7);
  }
  50% {
    text-shadow:
      0 0 22px rgba(56, 189, 248, 0.65),
      0 0 40px rgba(15, 23, 42, 0.95);
    color: rgba(226, 232, 240, 0.96);
  }
  100% {
    text-shadow: 0 0 16px rgba(15, 23, 42, 0.95);
    color: rgba(148, 163, 184, 0.8);
  }
}

/* en móviles: no saturar la pantalla */
@media (max-width: 900px) {
  .login-taglines {
    display: none;
  }
}
/* === FRASES FLOTANTES ANIMADAS === */
.floating-phrase {
    position: absolute;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 1px;
    padding: 8px 20px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #cbd5e1;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0.9;
    animation-timing-function: linear;
}

/* Animación principal: movimiento de izquierda a derecha */
@keyframes floatHorizontal {
    0%   { transform: translateX(-20vw); }
    50%  { transform: translateX(20vw); }
    100% { transform: translateX(-20vw); }
}

/* Variantes con distinta altura + velocidad */
.phrase1 {
    top: 10%;
    left: 10%;
    animation: floatHorizontal 18s infinite;
}

.phrase2 {
    bottom: 20%;
    left: 15%;
    animation: floatHorizontal 22s infinite reverse;
}

.phrase3 {
    top: 55%;
    right: 10%;
    animation: floatHorizontal 26s infinite;
}
/* === Fondo con imagen dentro del login-card === */

/* Reforzamos que el card puede tener un pseudo-elemento adentro */
.login-card {
  position: relative;
  overflow: hidden; /* para que la imagen no se salga de las esquinas redondeadas */
}

/* Capa de imagen de fondo, por debajo del contenido */
.login-card::before {
  content: "";
  position: absolute;
  inset: 0;

  /* PON AQUÍ TU IMAGEN */
  background-image: url("img/login-bg.jpg"); /* cambia la ruta/archivo */
  background-size: cover;
  background-position: center;

  opacity: 0.22;          /* intensidad del fondo */
  filter: blur(6px);       /* blur suave para que no moleste al texto */
  transform: scale(1.05);  /* un pelín más grande para que el blur no deje bordes */
  z-index: 0;
}

/* Todo el contenido del card por encima de la imagen */
.login-card > * {
  position: relative;
  z-index: 1;
}
.main-header .header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}


/* ============================
   FINAL RESPONSIVE FIX – MOBILE & TABLET
   ============================ */

/* iPhone / móviles pequeños */
@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 14px 12px 24px;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .content-side {
    margin-top: 16px;
  }

  /* Login: que quepa bien en la pantalla */
  #login-screen {
    padding: 16px 12px;
  }

  .login-card {
    width: 100%;
    max-width: 420px;
  }
}

/* iPad vertical / tablets y pantallas medias */
@media (max-width: 1024px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .content-side {
    margin-top: 16px;
  }
}

/* Normalizar la card de AI para que NUNCA tape el contenido */
#floating-ai {
  position: static !important;
  inset: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  margin: 16px 0 0 !important;
}

/* En pantallas grandes, que quede sticky bonito en la columna derecha */
@media (min-width: 1200px) {
  .content-side {
    align-items: flex-start;
  }

  #floating-ai {
    position: sticky !important;
    top: 110px !important;
    width: 100% !important;
    max-width: 420px !important;
    margin-top: 0 !important;
  }
}
/* Floating Action Button — Premium Look */
#fab-button {
  position: absolute;
  top: 40px;
  right: 40px;
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 26px;
  color: white;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0,0,0,0.35);
  transition: all 0.25s ease;
  z-index: 999999;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
}

#fab-button:hover {
  transform: scale(1.12) translateY(-2px);
  box-shadow: 0 12px 35px rgba(0,0,0,0.45);
}

/* Floating Menu */
#fab-menu {
  position: absolute;
  top: 110px;
  right: 38px;
  background: rgba(25, 25, 30, 0.6);
  backdrop-filter: blur(12px);
  padding: 12px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  width: 180px;
  gap: 10px;
  animation: slideFadeIn 0.25s ease;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  z-index: 999999;
}

#fab-menu button {
  background: rgba(255,255,255,0.1);
  color: white;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
}

#fab-menu button:hover {
  background: rgba(255,255,255,0.2);
  transform: translateX(3px);
}

/* Icons inside menu buttons */
.fab-icon {
  font-size: 16px;
}

/* Animation */
@keyframes slideFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- FIXED FULLSCREEN MODAL LAYER --- */
.modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.55);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999999 !important;
  animation: fadeIn .25s ease;
}

/* --- CENTERED GLASS CARD FOR FORMS --- */
.modal-content {
  width: 420px;
  max-width: 90%;
  background: rgba(25, 25, 30, 0.55);
  padding: 25px 28px;
  border-radius: 18px;
  box-shadow: 0 15px 45px rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(14px);
  color: white;
  animation: popIn .25s ease;
}

/* Text fields in modal */
.modal-content input {
  width: 100%;
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.1);
  color: white;
}

/* Form button */
.modal-content button[type="submit"] {
  width: 100%;
  background: linear-gradient(135deg,#00d2ff,#3a7bd5);
  padding: 10px;
  border: none;
  margin-top: 5px;
  border-radius: 12px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: .25s ease;
}
.modal-content button[type="submit"]:hover {
  opacity: .85;
}

/* Close button */
.modal-content .close-modal {
  margin-top: 15px;
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  cursor: pointer;
  transition: .25s ease;
}
.modal-content .close-modal:hover {
  background: rgba(255,255,255,0.25);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { transform: scale(.85); opacity: 0;}
  to { transform: scale(1); opacity: 1;}
}
/* ==== LOGOUT HEADER SOLO EN MÓVILES / TABLETS ==== */
/* En pantallas tipo laptop / desktop, escondemos el logout del header,
   porque ya existe en el sidebar inferior. */
@media (min-width: 1024px) {
  .header-actions #logout-btn {
    display: none;
  }
}
/* Para posicionar el botón de cierre dentro de la card */
.modal-content {
  position: relative;
}

/* Botón X de cierre */
.modal-close-x {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  transition: background 0.2s ease, transform 0.2s ease;
}

.modal-close-x:hover {
  background: rgba(0, 0, 0, 0.6);
  transform: scale(1.05);
}

/* Banner informativo dentro del modal */
.portal-banner {
  margin: 8px 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 210, 255, 0.10);
  border: 1px solid rgba(0, 210, 255, 0.55);
  font-size: 13px;
  line-height: 1.5;
}
/* === Developer badge – bottom-right === */
#developer-badge {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  border: 1px solid rgba(148, 163, 184, 0.45);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* efecto hover sutil */
#developer-badge:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: translateY(-2px);
  transition: all 0.22s ease;
}

/* Ajuste para móviles (que no moleste) */
@media (max-width: 640px) {
  #developer-badge {
    right: 10px;
    bottom: 10px;
    padding: 8px 12px;
    font-size: 12px;
  }
}
/* === Developer badge – bottom-right === */
#developer-badge {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  border: 1px solid rgba(148, 163, 184, 0.45);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dev-badge { cursor: pointer; }
.dev-icon { font-size: 17px; }

/* Hover */
#developer-badge:hover {
  background: rgba(0,0,0,0.7);
  transform: translateY(-2px);
  transition: all 0.25s ease;
}

/* Mobile adjustment */
@media (max-width: 640px) {
  #developer-badge {
    right: 10px;
    bottom: 10px;
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* === About Developer Modal === */
.about-dev-card {
  max-width: 420px;
  padding: 24px;
  text-align: center;
}

.dev-contact-box {
  margin-top: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
}

.dev-footer-note {
  margin-top: 18px;
  opacity: 0.65;
  font-size: 13px;
}
/* === Developer QR Box === */
.dev-qr-box {
  margin-top: 16px;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#dev-qr {
  width: 150px;
  height: 150px;
}

.qr-caption {
  font-size: 12px;
  opacity: 0.7;
}
/* === Developer badge – bottom-right === */
#developer-badge {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  border: 1px solid rgba(148, 163, 184, 0.45);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dev-badge {
  cursor: pointer;
}

.dev-icon {
  font-size: 17px;
}

/* Hover */
#developer-badge:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: translateY(-2px);
  transition: all 0.25s ease;
}

/* Mobile */
@media (max-width: 640px) {
  #developer-badge {
    right: 10px;
    bottom: 10px;
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* === About Developer Modal === */
.about-dev-card {
  max-width: 420px;
  padding: 24px;
  text-align: center;
}

.dev-contact-box {
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
}

.dev-footer-note {
  margin-top: 18px;
  opacity: 0.65;
  font-size: 13px;
}
/* === Developer QR Box === */
.dev-qr-box {
  margin-top: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dev-qr-img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  image-rendering: pixelated;
}

.qr-caption {
  font-size: 12px;
  opacity: 0.7;
  text-align: center;
}

@media (max-width: 640px) {
  .dev-qr-img {
    width: 130px;
    height: 130px;
  }
}

/* === Developer QR Box === */
.dev-qr-box {
  margin-top: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dev-qr-img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  image-rendering: pixelated;
}

.qr-caption {
  font-size: 12px;
  opacity: 0.7;
  text-align: center;
}

@media (max-width: 640px) {
  .dev-qr-img {
    width: 130px;
    height: 130px;
  }
}
/* ================================
   Sidebar compact – <= 1280px
================================ */
@media (max-width: 1280px) {
  /* Sidebar un poquito más estrecha */
  .sidebar {
    width: 220px;
  }

  /* Títulos MAIN / BUSINESS un poco más pequeños */
  .nav-section-title {
    margin: 14px 10px 6px;
    font-size: 10px;
    letter-spacing: 0.14em;
  }

  /* Items más compactos */
  .nav-item {
    padding: 6px 10px;
    gap: 0.55rem;
  }

  /* Iconos ligeramente más pequeños */
  .nav-icon {
    width: 22px;
    height: 22px;
    font-size: 14px;
  }

  /* Texto del menú algo más compacto */
  .nav-item > span:last-child {
    font-size: 14px;
  }

  /* Logout del sidebar también compacto */
  .logout-btn {
    padding: 8px 10px;
    font-size: 13px;
  }
}
/* ================================
   Sidebar "icon-only" – tablets / small laptops
   (iPad vertical & similares)
================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  /* La grid deja una columna estrecha para el sidebar */
  .shell {
    grid-template-columns: 80px minmax(0, 1fr);
  }

  /* Sidebar estrecho con solo iconos por defecto */
  .sidebar {
    width: 80px;
    padding: 16px 8px;
    align-items: center;
    position: relative;
    z-index: 15;
    transition: width 0.22s ease, box-shadow 0.22s ease, padding 0.22s ease;
  }

  /* Logo solo círculo (se oculta el texto) */
  .sidebar-header {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }

  .sidebar-header .logo-title,
  .sidebar-header .logo-subtitle {
    display: none;
  }

  /* Ocultamos títulos MAIN / BUSINESS en modo compacto */
  .nav-section-title {
    display: none;
  }

  /* Items centrados con solo icono visible */
  .nav-item {
    justify-content: center;
    padding: 8px 0;
  }

  .nav-item > span:last-child {
    display: none; /* texto del menú oculto */
  }

  /* Logout también un poco más compacto */
  .logout-btn {
    width: 100%;
    font-size: 12px;
    padding: 7px 0;
  }

  /* ========= EXPANSIÓN AL HOVER ========= */
  .sidebar:hover {
    width: 240px;
    padding: 16px 14px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.85);
  }

  .sidebar:hover .sidebar-header {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .sidebar:hover .logo-title,
  .sidebar:hover .logo-subtitle {
    display: block;
  }

  .sidebar:hover .nav-section-title {
    display: flex;
  }

  .sidebar:hover .nav-item {
    justify-content: flex-start;
    padding: 8px 12px;
  }

  .sidebar:hover .nav-item > span:last-child {
    display: inline; /* vuelve a mostrarse el texto */
  }
}
