/* ===============================================
   SISTEMA DE ESTILOS GLOBALES - SestIA

   Este archivo contiene SOLO estilos para:
   - Variables CSS globales (pueden usarse en módulos)
   - Estilos del layout principal (header, footer, nav)
   - Estilos de autenticación (#auth-section)
   - Modales globales del sistema (.modal, .legal-modal)

   ⚠️ IMPORTANTE PARA DESARROLLADORES DE MÓDULOS:
   Los módulos NO deben depender de selectores globales
   como .btn, .card, input, etc. definidos aquí.

   Cada módulo debe usar su propio namespace CSS.
   Ver: WEB/modules/template/README.md
   =============================================== */

:root{
  --bg:#ffffff;
  --panel:#fefefe;
  --panel-2:#f1f5f9;
  --text:#0f172a;
  --muted:#64748b;
  --brand:#2563eb;
  --brand-light:#3b82f6;
  --accent:#111827;
  --danger:#ef4444;
  --border:#e1e7ef;
  --shadow-sm:0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --banner-image:none;
  
  /* Variables de Diseño UI */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-pro: 'IBM Plex Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-friendly: 'Nunito', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-app: var(--font-sans);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* Font utility classes */
.font-default { font-family: var(--font-sans) !important; }
.font-pro { font-family: var(--font-pro) !important; }
.font-friendly { font-family: var(--font-friendly) !important; }

/* Theme-driven body font override */
body[data-font="pro"] { font-family: var(--font-pro); }
body[data-font="friendly"] { font-family: var(--font-friendly); }
*{ box-sizing:border-box }
html,body{ height:100% }
body{
  margin:0; 
  font-family: var(--font-sans);
  background: linear-gradient(135deg, var(--panel-2) 0%, var(--border) 100%);
  color:var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.hidden{ display:none }

#app{ display:flex; flex-direction:column; min-height:100vh }

/* ===============================================
   BOOT GATE Y CARGA DE RUTAS
   =============================================== */

body.app-booting {
  overflow: hidden;
}

body.app-booting #app {
  visibility: hidden;
}

.app-boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg) 0%, var(--panel-2) 100%);
  transition: opacity 0.25s ease;
}

body:not(.app-booting) .app-boot-overlay {
  opacity: 0;
  pointer-events: none;
}

.app-boot-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 16px);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}

.app-boot-text {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.app-boot-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: appBootSpin 0.8s linear infinite;
}

.app-boot-spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

@keyframes appBootSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.route-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 3500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--panel, white) 80%, transparent);
  backdrop-filter: blur(2px);
}

.route-loading-overlay.hidden {
  display: none !important;
}

.app-boot-overlay.hidden {
  display: none !important;
}

.route-loading-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow-md);
  color: var(--text);
}

.route-loading-card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ===============================================
   HEADER MODERNO Y MINIMALISTA
   =============================================== */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sui-header-padding, 14px 28px);
  background: var(--sui-header-bg, linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%));
  border-bottom: var(--sui-header-border, 1px solid var(--border));
  box-shadow: var(--sui-header-shadow, var(--shadow-lg));
  backdrop-filter: blur(var(--sui-header-blur, 14px));
  -webkit-backdrop-filter: blur(var(--sui-header-blur, 14px));
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* ✨ Transiciones suaves para show/hide */
  opacity: 1;
  transform: translateY(0);
  max-height: 100px;
  overflow: visible; /* Cambiar a visible para permitir dropdown */
}

.app-header.hidden {
  /* ✨ Animación elegante de salida */
  opacity: 0;
  transform: translateY(-100%);
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.app-header:hover {
  box-shadow: 0 8px 32px rgba(var(--brand-rgb), 0.08);
}

/* Header Left - Logo Section */
.header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-section {
  display: flex;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(var(--brand-rgb), 0.05) 0%, rgba(var(--brand-light-rgb), 0.02) 100%);
  border: 1px solid rgba(var(--brand-rgb), 0.1);
  transition: all 0.3s ease;
}

.logo-container:hover {
  background: linear-gradient(135deg, rgba(var(--brand-rgb), 0.08) 0%, rgba(var(--brand-light-rgb), 0.04) 100%);
  border-color: rgba(var(--brand-rgb), 0.2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.logo-image {
  height: 32px;
  width: 32px;
  object-fit: contain;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-subtitle {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Navigation */
.main-navigation {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.nav-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.nav-item:hover::before {
  opacity: 0.08;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color: white;
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.nav-item.active::before {
  display: none;
}

.nav-item.active .nav-indicator {
  opacity: 1;
  transform: scale(1);
}

.nav-item-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-icon {
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  z-index: 1;
  position: relative;
}

.nav-text {
  z-index: 1;
  position: relative;
}

.nav-indicator {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
}

.coming-soon-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-sm);
  z-index: 1;
  position: relative;
}

/* Header Right - User Section */
.header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.user-section {
  display: flex;
  align-items: center;
  gap: var(--sui-header-gap, 16px);
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--sui-header-user-gap, 10px);
  padding: var(--sui-header-user-padding, 5px 14px 5px 5px);
  border-radius: var(--sui-header-user-radius, 999px);
  background: var(--sui-header-user-bg, var(--panel-2));
  border: var(--sui-header-user-border, 1px solid var(--border));
  transition: all 0.2s ease;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}

button.user-info { line-height: 1; }

.user-menu-chevron {
  color: var(--muted);
  margin-left: 2px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.sui-dropdown.is-open .user-menu-chevron {
  transform: rotate(180deg);
}

.user-info:hover {
  background: var(--sui-header-user-hover-bg, color-mix(in srgb, var(--brand) 6%, var(--panel-2)));
  border-color: var(--sui-header-user-hover-border, color-mix(in srgb, var(--brand) 35%, var(--border)));
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.user-info:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.user-avatar {
  position: relative;
  width: var(--sui-header-avatar-size, 34px);
  height: var(--sui-header-avatar-size, 34px);
  border-radius: var(--sui-header-avatar-radius, 999px);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--sui-header-avatar-ring, 0 0 0 2px var(--panel));
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.user-avatar::after {
  content: '';
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: var(--sui-header-presence-size, 12px);
  height: var(--sui-header-presence-size, 12px);
  border-radius: 999px;
  background: var(--sui-header-presence-bg, var(--success));
  border: var(--sui-header-presence-ring, 2px solid var(--panel));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 12%, transparent);
  pointer-events: none;
}

.user-avatar.is-offline::after { background: var(--muted, #94a3b8); }
.user-avatar.is-busy::after { background: var(--warning, #f59e0b); }
.user-avatar.no-presence::after { display: none; }

.user-avatar-img {
  border-radius: var(--sui-header-avatar-radius, 999px);
  overflow: hidden;
}

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

.user-avatar-img.hidden {
  display: none;
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-email {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.user-role {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-button,
#notifications-btn.sui-btn,
#online-users-btn.sui-btn {
  width: var(--sui-header-action-size, 38px);
  height: var(--sui-header-action-size, 38px);
  border-radius: var(--sui-header-action-radius, 10px);
  border: var(--sui-header-action-border, 1px solid transparent);
  background: var(--sui-header-action-bg, transparent);
  color: var(--sui-header-action-color, var(--muted));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  position: relative;
  overflow: visible;
}

.action-button:hover,
#notifications-btn.sui-btn:hover:not(:disabled),
#online-users-btn.sui-btn:hover:not(:disabled) {
  background: var(--sui-header-action-hover-bg, color-mix(in srgb, var(--brand) 9%, transparent));
  color: var(--sui-header-action-hover-color, var(--brand));
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: none;
}

.action-button:active,
#notifications-btn.sui-btn:active,
#online-users-btn.sui-btn:active {
  transform: translateY(0);
}

/* .logout-button legacy — header logout removed in favor of user-menu-dropdown */

.logout-text {
  font-size: 0.875rem;
  font-weight: 600;
}

/* Notification Badge */
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  border: 2px solid var(--panel);
  animation: pulse 2s infinite;
}

.notification-badge.hidden {
  display: none;
}

#notification-badge.sui-badge-count {
  animation: pulse 2s infinite;
  z-index: 2;
}

#online-users-badge.sui-badge-count {
  background: var(--sui-presence-badge-bg, var(--danger, #ef4444));
  z-index: 2;
}

/* Notification Center Panel */
.sdk-notification-panel {
  position: fixed;
  top: var(--sui-notif-panel-top, 86px);
  right: var(--sui-notif-panel-right, 22px);
  width: min(var(--sui-notif-panel-width, 420px), calc(100vw - 24px));
  max-height: var(--sui-notif-panel-max-height, 70vh);
  display: none;
  flex-direction: column;
  background: var(--sui-notif-panel-bg, var(--panel, #fff));
  border: var(--sui-notif-panel-border, 1px solid var(--border, #e2e8f0));
  border-radius: var(--sui-notif-panel-radius, 14px);
  box-shadow: var(--sui-notif-panel-shadow, var(--shadow-xl));
  backdrop-filter: blur(var(--sui-notif-panel-backdrop-blur, 0px));
  z-index: 1300;
  overflow: hidden;
  transform-origin: top right;
  animation: notifPanelIn var(--sui-transition-normal, 0.2s ease);
}

.sdk-notification-panel.active {
  display: flex;
}

.sdk-notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: var(--sui-notif-header-padding, 0.85rem 1rem);
  border-bottom: var(--sui-notif-header-border, 1px solid var(--border, #e2e8f0));
}

.sdk-notif-header h3 {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 750;
  letter-spacing: -0.015em;
  color: var(--sui-notif-title-color, var(--text, #0f172a));
}

.sdk-notif-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sdk-notif-actions button {
  border: var(--sui-notif-action-border, 1px solid var(--border, #e2e8f0));
  background: var(--sui-notif-action-bg, var(--panel-2, #f8fafc));
  color: var(--sui-notif-time-color, var(--muted, #64748b));
  border-radius: var(--sui-notif-action-radius, 8px);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.32rem 0.62rem;
  cursor: pointer;
  transition: background var(--sui-transition-fast, 0.15s ease),
              border-color var(--sui-transition-fast, 0.15s ease),
              transform var(--sui-transition-fast, 0.15s ease);
}

.sdk-notif-actions button:hover {
  background: var(--sui-notif-action-hover-bg, var(--panel-2, #f8fafc));
  border-color: var(--sui-notif-action-hover-border, var(--border, #e2e8f0));
}

#sdk-notif-close {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.sdk-notif-list {
  overflow: auto;
  padding: var(--sui-notif-list-padding, 0.5rem);
}

.sdk-notif-item {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: var(--sui-notif-item-border, 1px solid var(--border, #e2e8f0));
  border-radius: var(--sui-notif-item-radius, 10px);
  background: var(--sui-notif-item-bg, var(--panel, #fff));
  padding: var(--sui-notif-item-padding, 0.65rem 0.75rem);
  margin-bottom: 0.5rem;
  cursor: pointer;
  overflow: hidden;
  transition: background var(--sui-transition-fast, 0.15s ease),
              border-color var(--sui-transition-fast, 0.15s ease),
              transform var(--sui-transition-fast, 0.15s ease),
              box-shadow var(--sui-transition-fast, 0.15s ease);
}

.sdk-notif-item:hover {
  background: var(--sui-notif-item-hover-bg, var(--panel-2, #f8fafc));
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}

/* Type-colored left strip (replaces brand-only unread strip) */
.sdk-notif-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--sdk-notif-accent, transparent);
}

.sdk-notif-item[data-type="info"]    { --sdk-notif-accent: var(--info, #0ea5e9); }
.sdk-notif-item[data-type="success"] { --sdk-notif-accent: var(--success, #10b981); }
.sdk-notif-item[data-type="warning"] { --sdk-notif-accent: var(--warning, #f59e0b); }
.sdk-notif-item[data-type="danger"]  { --sdk-notif-accent: var(--danger, #ef4444); }

.sdk-notif-item.is-read::before { opacity: 0.45; }

.sdk-notif-item.is-unread {
  background: var(--sui-notif-item-unread-bg, color-mix(in srgb, var(--brand, #4f46e5) 6%, var(--panel, #fff)));
}

/* Type icon */
.sdk-notif-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  margin-top: 1px;
}

.sdk-notif-icon--info    { color: var(--info, #0ea5e9); background: color-mix(in srgb, var(--info, #0ea5e9) 12%, transparent); }
.sdk-notif-icon--success { color: var(--success, #10b981); background: color-mix(in srgb, var(--success, #10b981) 12%, transparent); }
.sdk-notif-icon--warning { color: var(--warning, #f59e0b); background: color-mix(in srgb, var(--warning, #f59e0b) 14%, transparent); }
.sdk-notif-icon--danger  { color: var(--danger, #ef4444); background: color-mix(in srgb, var(--danger, #ef4444) 12%, transparent); }

.sdk-notif-body {
  flex: 1;
  min-width: 0;
}

/* Unread dot on title */
.sdk-notif-item.is-unread .sdk-notif-item-header h4::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--sdk-notif-accent, var(--brand));
  vertical-align: middle;
}

/* Meta row: module chip + CTA */
.sdk-notif-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.sdk-notif-module {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel-2, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  color: var(--muted, #64748b);
}

.sdk-notif-cta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brand, #3b82f6);
  margin-left: auto;
}

.sdk-notif-item-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.sdk-notif-item-header h4 {
  margin: 0;
  font-size: var(--sui-notif-title-size, 0.94rem);
  font-weight: var(--sui-notif-title-weight, 700);
  color: var(--sui-notif-title-color, var(--text, #0f172a));
  line-height: 1.25;
  letter-spacing: -0.01em;
  max-width: 75%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sdk-notif-time {
  font-size: var(--sui-notif-time-size, 0.72rem);
  color: var(--sui-notif-time-color, var(--muted, #64748b));
  font-weight: 600;
  flex: 0 0 auto;
}

.sdk-notif-message {
  margin: 0.35rem 0 0;
  color: var(--sui-notif-message-color, var(--muted, #64748b));
  font-size: var(--sui-notif-message-size, 0.84rem);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.sdk-notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: var(--sui-notif-empty-color, var(--muted, #64748b));
  padding: 2.5rem 1rem;
  gap: 4px;
}

.sdk-notif-empty-icon {
  color: var(--muted, #94a3b8);
  opacity: 0.5;
  margin-bottom: 6px;
}

.sdk-notif-empty-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.sdk-notif-empty-desc {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted, #64748b);
}

/* Presence panel over shared SDK notification panel */
.sdk-presence-panel {
  right: var(--sui-presence-panel-right, 84px);
  width: min(var(--sui-presence-panel-width, 390px), calc(100vw - 24px));
}

@keyframes notifPanelIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===============================================
   HEADER RESPONSIVE
   =============================================== */

@media (max-width: 1200px) {
  .app-header {
    padding: 16px 24px;
  }
  
  .logo-container {
    gap: 12px;
    padding: 6px 12px;
  }
  
  .brand-name {
    font-size: 1.125rem;
  }
  
  .nav-item {
    padding: 10px 16px;
    gap: 10px;
  }
  
  .user-details {
    display: none; /* Ocultar detalles del usuario en pantallas medianas */
  }
}

@media (max-width: 960px) {
  .app-header {
    padding: 12px 20px;
    flex-wrap: wrap;
    gap: 16px;
  }
  
  .header-left,
  .header-right {
    flex: 1;
  }
  
  .main-navigation {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 12px;
  }
  
  .nav-wrapper {
    width: 100%;
    justify-content: center;
  }
  
  .logo-container {
    gap: 10px;
    padding: 4px 8px;
  }
  
  .brand-name {
    font-size: 1rem;
  }
  
  .brand-subtitle {
    font-size: 0.6875rem;
  }
  
  .nav-item {
    flex: 1;
    justify-content: center;
    padding: 8px 12px;
    font-size: 0.8125rem;
  }
  
  .nav-text {
    display: none; /* Solo mostrar íconos en móvil */
  }
  
  .coming-soon-badge {
    display: none;
  }
  
  .user-info {
    gap: 8px;
    padding: 6px 12px;
  }
  
  .user-avatar {
    width: 32px;
    height: 32px;
  }
  
  .action-button {
    width: 40px;
    height: 40px;
  }

  #notifications-btn.sui-btn {
    width: 40px;
    height: 40px;
  }

  #online-users-btn.sui-btn {
    width: 40px;
    height: 40px;
  }
  
  .logout-text {
    display: none; /* Solo mostrar ícono en móvil */
  }
  
  .logout-button {
    width: 40px;
    padding: 0;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 10px 16px;
    gap: 12px;
  }
  
  .logo-container {
    gap: 8px;
    padding: 4px 6px;
    border-radius: 12px;
  }
  
  .brand-name {
    font-size: 0.9375rem;
  }
  
  .brand-subtitle {
    display: none;
  }
  
  .main-navigation {
    margin-top: 8px;
  }
  
  .nav-wrapper {
    padding: 6px;
    border-radius: 12px;
  }
  
  .nav-item {
    padding: 6px 10px;
    border-radius: 8px;
  }
  
  .nav-icon svg {
    width: 18px;
    height: 18px;
  }
  
  .user-info {
    padding: 4px 8px;
    gap: 6px;
  }
  
  .user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }
  
  .user-avatar svg {
    width: 16px;
    height: 16px;
  }
  
  .header-actions {
    gap: 6px;
  }
  
  .action-button {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  #notifications-btn.sui-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  #online-users-btn.sui-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  
  .action-button svg {
    width: 16px;
    height: 16px;
  }
  
  .notification-badge {
    width: 16px;
    height: 16px;
    font-size: 0.5625rem;
    top: -2px;
    right: -2px;
  }

  #notification-badge.sui-badge-count {
    min-width: var(--sui-badge-count-size, 16px);
    height: var(--sui-badge-count-size, 16px);
    line-height: var(--sui-badge-count-size, 16px);
    font-size: var(--sui-badge-count-font-size, 0.5625rem);
    top: -2px;
    right: -2px;
  }

  .sdk-notification-panel {
    top: 74px;
    right: 8px;
    width: calc(100vw - 16px);
    max-height: 64vh;
  }

  .sdk-presence-panel {
    top: 74px;
    right: 8px;
    width: calc(100vw - 16px);
    max-height: 64vh;
  }

  .sdk-notif-item-header h4 {
    max-width: 68%;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

/* Navegación móvil con mejor UX */
@media (max-width: 480px) {
  .app-header {
    padding: 8px 12px;
  }
  
  .logo-image {
    height: 24px;
    width: 24px;
  }
  
  .brand-name {
    font-size: 0.875rem;
  }
  
  .nav-wrapper {
    gap: 4px;
    padding: 4px;
  }
  
  .nav-item {
    padding: 4px 8px;
    min-width: 44px; /* Área táctil mínima */
  }
}

/* ===============================================
   MENÚ DESPLEGABLE DE MÓDULOS
   =============================================== */

.dropdown-container {
  position: relative;
  display: flex;
  align-items: center;
  z-index: 1001; /* Mayor que el header para crear contexto de apilamiento */
}

.nav-dropdown-trigger {
  background: transparent !important;
  border: none !important;
  cursor: pointer;
  position: relative;
}

.nav-dropdown-trigger:hover::before {
  opacity: 0.08;
}

.nav-dropdown-trigger.active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%) !important;
  color: white !important;
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.nav-dropdown-trigger.active::before {
  display: none;
}

.nav-dropdown-trigger.active .nav-indicator {
  opacity: 1;
  transform: scale(1);
}

.dropdown-arrow {
  display: flex;
  align-items: center;
  margin-left: 4px;
  transition: transform 0.2s ease;
  z-index: 1;
  position: relative;
}

.nav-dropdown-trigger.active .dropdown-arrow {
  transform: rotate(180deg);
}

/* Menú desplegable */
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  min-width: 280px;
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999; /* Z-index muy alto para estar por encima de todo */
  margin-top: 8px;
  padding: 8px;
  max-height: 0;
  overflow: hidden;
}

.nav-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  max-height: 400px;
}

/* Items del menú desplegable */
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  margin-bottom: 4px;
}

.nav-dropdown-item:last-child {
  margin-bottom: 0;
}

.nav-dropdown-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nav-dropdown-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.nav-dropdown-item:hover::before {
  opacity: 0.08;
}

.nav-dropdown-item.active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color: white;
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.nav-dropdown-item.active::before {
  display: none;
}

.nav-dropdown-item.nav-item-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-dropdown-item .nav-icon {
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  z-index: 1;
  position: relative;
}

.nav-dropdown-item .nav-text {
  z-index: 1;
  position: relative;
}

.nav-dropdown-item .coming-soon-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-sm);
  z-index: 1;
  position: relative;
  margin-left: auto;
}

/* Estados especiales para touch devices */
@media (pointer: coarse) {
  .nav-item,
  .nav-dropdown-trigger,
  .nav-dropdown-item,
  .action-button,
  #online-users-btn.sui-btn,
  #notifications-btn.sui-btn,
  .footer-nav-link {
    min-height: 44px; /* Área táctil recomendada */
    min-width: 44px;
  }
  
  .nav-item:hover,
  .nav-dropdown-trigger:hover,
  .nav-dropdown-item:hover,
  .action-button:hover,
  #online-users-btn.sui-btn:hover,
  #notifications-btn.sui-btn:hover {
    transform: none; /* Desactivar hover transforms en touch */
  }
  
  .nav-item:active,
  .nav-dropdown-trigger:active,
  .nav-dropdown-item:active,
  .action-button:active,
  #online-users-btn.sui-btn:active,
  #notifications-btn.sui-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
  
  /* En touch devices, usar click en lugar de hover */
  .dropdown-container:focus-within .nav-dropdown,
  .nav-dropdown-trigger:focus + .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: 400px;
  }
}

.app-main{ 
  flex:1; 
  display:flex; 
  align-items: center;
  justify-content: center;
  padding:24px;
  min-height: 70vh;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ✨ Login fullscreen cuando header está oculto */
.app-header.hidden ~ .app-main {
  min-height: 100vh;
  padding-top: 20px;
}

/* App Outlet - Contenido principal del módulo */
#app-outlet {
  margin-top: 32px;
  margin-bottom: 32px;
  flex: 1;
}

/* App Outlet Responsive */
@media (max-width: 960px) {
  #app-outlet {
    margin-top: 24px;
    margin-bottom: 24px;
  }
}

@media (max-width: 640px) {
  #app-outlet {
    margin-top: 16px;
    margin-bottom: 16px;
  }
}

.card{
  width:100%; 
  max-width:420px; 
  margin:48px auto; 
  padding:32px; 
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  border:1px solid var(--border); 
  border-radius:20px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ✨ Login card optimizada cuando header está oculto */
.app-header.hidden ~ .app-main .card {
  margin: 0 auto;
  transform: scale(1.02);
  box-shadow: 0 20px 40px rgba(var(--brand-rgb), 0.15);
}
.card h2{
  margin-top: 0;
  margin-bottom: 24px;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}
/* ===============================================
   FORMULARIOS DE LOGIN/AUTH
   Solo afectan al formulario de autenticación
   Los módulos usan sus propios estilos
   =============================================== */
#auth-section label{
  display:block;
  font-size:14px;
  color:var(--text);
  font-weight: 500;
  margin:16px 0 6px;
}
#auth-section input[type="email"],
#auth-section input[type="password"],
#auth-section input[type="text"]{
  width:100%;
  padding:14px 16px;
  border-radius:12px;
  border:2px solid var(--border);
  background:var(--panel-2);
  color:var(--text);
  font-size: 16px;
  transition: all .2s ease;
  box-shadow: var(--shadow-sm);
}

/* Estilos para modales de autenticación */
.modal input[type="email"],
.modal input[type="password"],
.modal input[type="text"]{
  width:100%;
  padding:14px 16px;
  border-radius:12px;
  border:2px solid var(--border);
  background:var(--panel-2);
  color:var(--text);
  font-size: 16px;
  transition: all .2s ease;
  box-shadow: var(--shadow-sm);
}

#auth-section input[type="email"]:focus,
#auth-section input[type="password"]:focus,
#auth-section input[type="text"]:focus,
.modal input[type="email"]:focus,
.modal input[type="password"]:focus,
.modal input[type="text"]:focus{
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  transform: translateY(-1px);
}
.btn{ 
  padding:14px 20px; 
  border-radius:12px; 
  border:2px solid var(--border); 
  color:var(--text); 
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  cursor:pointer; 
  transition: all .2s ease;
  font-weight: 500;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.btn:active{ transform:translateY(2px) scale(0.98) }
.btn-primary{ 
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color:#fff; 
  border-color:transparent; 
  box-shadow: var(--shadow-md);
  font-weight: 600;
}
.btn-primary:hover{
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.btn-secondary{ 
  background: linear-gradient(135deg, var(--panel-2) 0%, var(--border) 100%);
  border-color: var(--border);
}
.btn:hover{ 
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Animaciones mejoradas */
@keyframes fadeInUp {
  from { opacity:0; transform: translateY(8px); }
  to { opacity:1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity:0; transform: translateX(-20px); }
  to { opacity:1; transform: translateX(0); }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.conversation-item{ animation: fadeInUp .2s ease both }
.nav-link{ animation: slideIn .3s ease both }
.card{ animation: fadeInUp .4s ease both }
.error{ color:var(--danger); margin-top:8px; min-height:20px }

/* 🎯 Banner Premium - Optimizado para legibilidad de texto */
.banner{ 
  border-bottom:1px solid var(--border); 
  background: linear-gradient(
    135deg, 
    rgba(var(--brand-rgb),0.85) 0%,     /* Marca semi-transparente fuerte */
    rgba(var(--brand-light-rgb),0.75) 50%,   /* Gradiente medio */
    rgba(17,24,39,0.80) 100%     /* Gris oscuro para contraste */
  ), var(--banner-image); 
  background-size:cover; 
  background-position:center;
  position: relative;
  overflow: hidden;
  min-height: 44px;
  height: clamp(44px, 7vh, 72px);
  transition: height 0.2s ease, opacity 0.2s ease;
}


/* Overlay adicional para máxima legibilidad */
.banner::before{
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.2); /* Sombra sutil para contraste */
  z-index: 1;
}

/* Shimmer effect sutil */
.banner::after{
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.08) 50%, transparent 70%);
  animation: shimmer 3s ease-in-out infinite;
  z-index: 1;
}

.banner-inner{ 
  padding:10px 20px; 
  position: relative; 
  z-index: 2; 
  display: flex;
  align-items: center;
  height: 100%;
}

/* Texto con máximo contraste y legibilidad */
.banner-text{ 
  color: #ffffff !important;           /* Blanco puro */
  font-weight: 600;                    /* Semi-bold */
  font-size: 0.92rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5); /* Sombra fuerte */
  letter-spacing: 0.025em;             /* Mejor legibilidad */
  opacity: 1 !important;               /* Máxima opacidad */
}

/* Ajustes responsive del banner */
@media (min-width: 768px) {
  .banner { height: clamp(48px, 8vh, 84px); }
}

@media (min-width: 1200px) {
  .banner { height: clamp(52px, 8vh, 96px); }
}

/* Responsive text sizing para móviles */
@media (max-width: 768px) {
  .banner-text { 
    font-size: 0.875rem; 
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  }
}

/* ===============================================
   MODALES LEGALES - TÉRMINOS Y PRIVACIDAD
   =============================================== */

.legal-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.legal-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.modal-content {
  position: relative;
  background: linear-gradient(135deg, var(--panel) 0%, #fafbfc 100%);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  max-width: 700px;
  max-height: 90vh;
  width: 90%;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.legal-modal.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color: white;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 0;
  max-height: calc(90vh - 100px);
  overflow-y: auto;
}

.legal-content {
  padding: 32px;
  line-height: 1.6;
}

.legal-content h3 {
  color: var(--brand);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 32px 0 16px 0;
}

.legal-content h3:first-child {
  margin-top: 0;
}

.legal-content p {
  margin: 16px 0;
  color: var(--text);
}

.legal-content ul {
  margin: 16px 0;
  padding-left: 24px;
}

.legal-content li {
  margin: 8px 0;
  color: var(--text);
}

.legal-footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  background: linear-gradient(135deg, var(--panel-2) 0%, rgba(248, 250, 252, 0.8) 100%);
  border-radius: 16px;
  padding: 24px;
}

.legal-footer p {
  margin: 4px 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ✨ Estilos especiales para botón home */
.nav-item-home {
  position: relative;
}

.nav-item-home .nav-icon {
  background: linear-gradient(135deg, rgba(var(--brand-rgb), 0.1) 0%, rgba(var(--brand-light-rgb), 0.05) 100%);
  border: 1px solid rgba(var(--brand-rgb), 0.2);
  border-radius: 8px;
  padding: 2px;
}

/* Responsive modales */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }
  
  .modal-header {
    padding: 20px 24px;
  }
  
  .modal-header h2 {
    font-size: 1.25rem;
  }
  
  .legal-content {
    padding: 24px 20px;
  }
  
  .legal-content h3 {
    font-size: 1.125rem;
  }
}
/* ===============================================
   FOOTER MODERNO Y MINIMALISTA
   =============================================== */

.app-footer {
  border-top: 1px solid var(--border);
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  backdrop-filter: blur(20px);
  margin-top: auto;
  box-shadow: 0 -4px 20px rgba(var(--brand-rgb), 0.04);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  gap: 32px;
}

/* Footer Left */
.footer-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-logo-image {
  height: 24px;
  width: 24px;
  object-fit: contain;
  border-radius: 6px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-brand-name {
  font-weight: 700;
  font-size: 1rem;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-version {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color: white;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.625rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.footer-description {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  max-width: 300px;
}

/* Footer Center */
.footer-center {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.footer-navigation {
  display: flex;
  gap: 24px;
}

.footer-nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.footer-nav-link:hover {
  color: var(--brand);
  background: rgba(37, 99, 235, 0.05);
  transform: translateY(-1px);
}

.footer-nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--brand);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.footer-nav-link:hover::after {
  width: 80%;
}

/* Footer Right */
.footer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.footer-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: all 0.3s ease;
}

.status-indicator:hover {
  background: rgba(16, 185, 129, 0.05);
  border-color: #10b981;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

.status-online {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.status-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.footer-time {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 4px 8px;
  background: var(--panel-2);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.footer-time:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: rgba(37, 99, 235, 0.05);
  transform: translateY(-1px);
}

/* Footer Bottom */
.footer-bottom {
  border-top: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.02) 0%, rgba(59, 130, 246, 0.01) 100%);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-credits {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.heart-icon {
  color: #ef4444;
  animation: heartbeat 2s ease-in-out infinite;
}

.footer-tech {
  display: flex;
  align-items: center;
}

.tech-stack {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Animaciones del footer */
@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Footer Responsive */
@media (max-width: 960px) {
  .footer-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
    padding: 20px 24px;
  }
  
  .footer-left,
  .footer-center,
  .footer-right {
    align-items: center;
    text-align: center;
  }
  
  .footer-navigation {
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
  }
  
  .footer-status {
    align-items: center;
  }
  
  .footer-description {
    text-align: center;
    max-width: 100%;
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    padding: 16px 24px;
  }
}

@media (max-width: 640px) {
  .footer-inner {
    padding: 16px 20px;
    gap: 20px;
  }
  
  .footer-navigation {
    gap: 12px;
  }
  
  .footer-nav-link {
    padding: 6px 10px;
    font-size: 0.8125rem;
  }
  
  .footer-logo {
    justify-content: center;
  }
  
  .footer-bottom {
    padding: 12px 20px;
  }
  
  .footer-credits,
  .tech-stack {
    font-size: 0.6875rem;
  }
}
/* Estilos específicos de Livechat pasaron a modules/livechat/styles.css */

/* ==== MEJORAS DEL LOGIN ==== */
.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h2 {
  margin-bottom: 8px;
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0;
  font-weight: 500;
}

.form-field {
  margin-bottom: 24px;
}

.form-field:last-of-type {
  margin-bottom: 32px;
}

.form-field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  padding: 16px 48px 16px 16px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 16px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}

.input-wrapper input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.input-wrapper input.success {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08);
}

.input-icon {
  position: absolute;
  right: 16px;
  color: var(--muted);
  pointer-events: none;
  transition: all 0.2s ease;
}

.input-wrapper input:focus + .input-icon {
  color: var(--brand);
}

.password-toggle {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  z-index: 2;
}

.password-toggle:hover {
  color: var(--text);
  background: rgba(var(--brand-rgb, 37, 99, 235), 0.08);
}

.password-toggle:focus {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.field-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 6px;
  min-height: 16px;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.field-error.show {
  opacity: 1;
  transform: translateY(0);
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}

/* Checkbox personalizado */
.checkbox-container {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 0.875rem;
  color: var(--text);
}

.checkbox-container input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  margin-right: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
}

.checkbox-container input:checked + .checkmark {
  background: var(--brand);
  border-color: var(--brand);
}

.checkbox-container input:checked + .checkmark::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: 600;
}

.checkbox-container:hover .checkmark {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.checkbox-label {
  font-weight: 500;
}

.forgot-password {
  color: var(--brand);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.forgot-password:hover {
  color: var(--accent);
  text-decoration: underline;
}

.btn-login {
  width: 100%;
  position: relative;
  overflow: hidden;
  font-size: 16px;
  padding: 16px 24px;
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: 0.025em;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-sm);
}

.btn-login:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-login:not(:disabled):active {
  transform: translateY(0);
}

.btn-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.btn-spinner svg {
  animation: spin 1s linear infinite;
}

.btn-text {
  transition: opacity 0.2s ease;
}

.btn-login.loading .btn-text {
  opacity: 0;
}

.btn-login.loading .btn-spinner {
  display: block;
}

.error-banner {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(220, 38, 38, 0.05) 100%);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
  padding: 16px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 24px;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 0;
  max-height: 0;
  overflow: hidden;
}

.error-banner.show {
  opacity: 1;
  transform: translateY(0);
  min-height: auto;
  max-height: 200px;
  margin-bottom: 0;
}

.error-banner:empty {
  display: none;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.form-field.shake input {
  animation: shake 0.4s ease-in-out;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .form-options {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  
  .checkbox-container {
    justify-content: center;
  }
  
  .forgot-password {
    text-align: center;
  }
  
  .card {
    margin: 24px auto;
    padding: 24px;
  }
}

/* ===============================================
   MODALES DE AUTENTICACIÓN
   =============================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--panel);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal.active .modal-content {
  transform: scale(1);
}

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

.modal-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--panel-2);
  color: var(--text);
}

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

.modal-body p {
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.modal-actions .btn {
  min-width: 120px;
}

/* Mensajes de éxito */
.success-message {
  text-align: center;
  padding: 24px;
}

.success-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.success-message h4 {
  color: var(--text);
  margin: 0 0 8px 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.success-message p {
  color: var(--muted);
  margin: 0 0 24px 0;
}

/* Requisitos de contraseña */
.password-requirements {
  margin: 16px 0;
  padding: 16px;
  background: var(--panel-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.requirement {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.875rem;
}

.requirement:last-child {
  margin-bottom: 0;
}

.requirement-icon {
  font-size: 1rem;
  min-width: 20px;
}

/* ===============================================
   SHELL 2.1 - Header, dropdown y densidad visual
   =============================================== */

.app-header {
  align-items: center;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--panel) 92%, var(--brand)) 0%, var(--panel) 54%, color-mix(in srgb, var(--panel-2) 88%, var(--accent)) 100%);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 74%, var(--brand));
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
  gap: 18px;
  max-height: none;
  padding: 12px 20px;
}

.logo-container {
  background: color-mix(in srgb, var(--panel) 88%, var(--brand));
  border: 1px solid color-mix(in srgb, var(--border) 72%, var(--brand));
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
  gap: 12px;
  padding: 7px 10px;
}

.logo-image {
  height: 34px;
  width: 34px;
}

.brand-name {
  font-size: 1.06rem;
  line-height: 1.05;
}

.brand-subtitle {
  font-size: 0.68rem;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-wrapper {
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  border-color: color-mix(in srgb, var(--border) 72%, var(--brand));
  border-radius: 999px;
  gap: 6px;
  padding: 5px;
}

.nav-item {
  border-radius: 999px;
  gap: 8px;
  padding: 9px 14px;
}

.nav-item.active-route,
.nav-dropdown-trigger.active-route {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%) !important;
  color: #fff !important;
  box-shadow: 0 10px 22px rgba(var(--brand-rgb), 0.22);
}

.nav-dropdown-trigger.menu-open {
  background: var(--panel) !important;
  color: var(--brand) !important;
  box-shadow: var(--shadow-md);
}

.nav-dropdown-trigger.menu-open .dropdown-arrow,
.nav-dropdown-trigger.active-route .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-indicator {
  display: none;
}

.nav-dropdown {
  left: 50%;
  right: auto;
  min-width: min(420px, calc(100vw - 24px));
  padding: 10px;
  transform: translate(-50%, -8px);
}

.nav-dropdown.active {
  max-height: min(70vh, 560px);
  overflow-y: auto;
  transform: translate(-50%, 0);
}

.nav-dropdown-item {
  align-items: center;
  border: 1px solid transparent;
  gap: 12px;
  margin-bottom: 6px;
  padding: 10px 12px;
}

.nav-dropdown-item:hover {
  border-color: color-mix(in srgb, var(--border) 65%, var(--brand));
  transform: translateX(0);
}

.nav-dropdown-item.active {
  transform: translateX(0);
}

.nav-dropdown-item .nav-icon {
  align-items: center;
  background: color-mix(in srgb, var(--brand) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--border));
  border-radius: 13px;
  color: var(--brand);
  flex: 0 0 auto;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.nav-dropdown-item.active .nav-icon {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.28);
  color: #fff;
}

.nav-dropdown-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.nav-dropdown-item .nav-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-dropdown-meta {
  color: var(--muted);
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-dropdown-item.active .nav-dropdown-meta {
  color: rgba(255,255,255,0.78);
}

.user-info {
  background: color-mix(in srgb, var(--panel) 84%, var(--brand));
  border-color: color-mix(in srgb, var(--border) 75%, var(--brand));
  border-radius: 999px;
  padding: 6px 10px 6px 6px;
}

.user-avatar {
  border-radius: 999px;
  height: 34px;
  width: 34px;
}

.user-avatar-initial {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}

.header-actions {
  gap: 6px;
}

.action-button,
#notifications-btn.sui-btn,
#online-users-btn.sui-btn {
  border-width: 1px;
  height: 38px;
  width: 38px;
}

.logout-button {
  border-radius: 999px;
  height: 38px;
  padding: 0 13px;
}

body.shell-density-compact .app-header {
  padding: 8px 14px;
}

body.shell-density-compact .logo-container,
body.shell-density-compact .user-info {
  padding-block: 4px;
}

body.shell-density-compact .nav-item {
  padding: 7px 11px;
}

body.shell-density-comfortable .app-main {
  padding: 28px;
}

body.shell-density-clear .app-main {
  padding: 34px;
}

body.shell-density-clear .nav-wrapper,
body.shell-density-clear .user-info,
body.shell-density-clear .logo-container {
  background: var(--panel);
}

@media (min-width: 1120px) {
  body.shell-layout-sidebar .app-header {
    align-items: stretch;
    bottom: 0;
    flex-direction: column;
    gap: 14px;
    justify-content: flex-start;
    left: 0;
    max-height: none;
    overflow-y: auto;
    padding: 18px 14px;
    position: fixed;
    top: 0;
    width: 280px;
  }

  body.shell-layout-sidebar .header-left,
  body.shell-layout-sidebar .main-navigation,
  body.shell-layout-sidebar .header-right,
  body.shell-layout-sidebar .user-section,
  body.shell-layout-sidebar .dropdown-container,
  body.shell-layout-sidebar .nav-wrapper {
    width: 100%;
  }

  body.shell-layout-sidebar .header-left,
  body.shell-layout-sidebar .header-right {
    flex: 0 0 auto;
  }

  body.shell-layout-sidebar .logo-container {
    justify-content: flex-start;
    width: 100%;
  }

  body.shell-layout-sidebar .main-navigation {
    flex: 0 0 auto;
    justify-content: stretch;
    margin-top: 0;
    order: initial;
  }

  body.shell-layout-sidebar .nav-wrapper {
    align-items: stretch;
    border-radius: 18px;
    flex-direction: column;
    max-height: none;
    overflow: visible;
  }

  body.shell-layout-sidebar .dropdown-container,
  body.shell-layout-sidebar .nav-dropdown-trigger,
  body.shell-layout-sidebar .nav-item {
    justify-content: flex-start;
    min-width: 0;
    width: 100%;
  }

  body.shell-layout-sidebar .dropdown-container {
    display: block;
  }

  body.shell-layout-sidebar .nav-dropdown {
    background: transparent;
    border: 0;
    box-shadow: none;
    left: 0;
    margin-top: 6px;
    max-height: 0;
    min-width: 100%;
    padding: 0;
    position: static;
    transform: none;
    width: 100%;
  }

  body.shell-layout-sidebar .nav-dropdown.active {
    max-height: none;
    opacity: 1;
    overflow: visible;
    transform: none;
    visibility: visible;
  }

  body.shell-layout-sidebar .nav-dropdown-item {
    margin-bottom: 6px;
    padding: 9px 10px;
  }

  body.shell-layout-sidebar .nav-dropdown-item:hover,
  body.shell-layout-sidebar .nav-dropdown-item.active {
    transform: none;
  }

  body.shell-layout-sidebar .nav-dropdown-item .nav-icon {
    height: 34px;
    width: 34px;
  }

  body.shell-layout-sidebar .user-section {
    align-items: stretch;
    flex-direction: column;
    margin-top: auto;
  }

  body.shell-layout-sidebar .user-info {
    border-radius: 18px;
  }

  body.shell-layout-sidebar .header-actions {
    justify-content: space-between;
  }

  /* Presence + Notification panels anchor next to the sidebar button.
     Exact top/left are set inline by JS (positionPanelForSidebar). */
  body.shell-layout-sidebar .sdk-notification-panel,
  body.shell-layout-sidebar .sdk-presence-panel {
    transform-origin: top left;
    max-height: min(70vh, calc(100vh - 32px));
  }

  body.shell-layout-sidebar .user-details {
    display: flex;
    min-width: 0;
  }

  body.shell-layout-sidebar .user-email,
  body.shell-layout-sidebar .user-role {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.shell-layout-sidebar .app-header:not(.hidden) ~ .app-main {
    margin-left: 280px;
    width: calc(100% - 280px);
  }

  /* User pill pushed to bottom, footer below it */
  body.shell-layout-sidebar .user-section {
    margin-top: auto;
  }

  body.shell-layout-sidebar .sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    flex: 0 0 auto;
    margin-top: 10px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    color: var(--muted);
  }

  body.shell-layout-sidebar .sidebar-footer-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
  }

  body.shell-layout-sidebar .sidebar-footer-version {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--panel-2);
    border: 1px solid var(--border);
  }
}

/* Sidebar footer hidden in default (top header) layout */
.sidebar-footer {
  display: none;
}

@media (max-width: 960px) {
  .app-header {
    padding: 10px 14px;
  }

  .header-left,
  .header-right {
    flex: 0 1 auto;
  }

  .main-navigation {
    margin-top: 0;
    order: 3;
  }

  .nav-wrapper {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .nav-dropdown {
    left: 50%;
    position: fixed;
    top: 104px;
  }

  .nav-dropdown.active {
    transform: translate(-50%, 0);
  }

  .nav-dropdown-item .nav-text {
    display: block;
  }
}

@media (max-width: 640px) {
  .app-header {
    gap: 8px;
  }

  .logo-text {
    max-width: 120px;
  }

  .user-info {
    padding-right: 6px;
  }

  .nav-dropdown {
    top: 118px;
  }
}

.requirement-text {
  color: var(--muted);
}

.requirement.valid .requirement-text {
  color: #10b981;
}

.requirement.invalid .requirement-text {
  color: #f59e0b;
}

/* Responsive para modales */
@media (max-width: 480px) {
  .modal-content {
    width: 95%;
    margin: 20px;
  }
  
  .modal-header,
  .modal-body {
    padding-left: 20px;
    padding-right: 20px;
  }
  
  .modal-actions {
    flex-direction: column;
  }
  
  /* Estilos para invitaciones */
  .invitation-info {
    text-align: center;
    margin-bottom: 24px;
  }

  .invitation-info p {
    margin: 8px 0;
    color: var(--text-2);
  }

  .invitation-info .role-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin: 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .invitation-info .role-badge.doctor {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-light) 100%);
    color: white;
  }

  .invitation-info .role-badge.admin {
    background: linear-gradient(135deg, var(--warning) 0%, var(--warning-light) 100%);
    color: white;
  }

  .invitation-info .role-badge.superadmin {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-light) 100%);
    color: white;
  }

  .invitation-info .role-badge.viewer {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
    color: white;
  }

  .success-message {
    text-align: center;
    padding: 32px;
  }

  .success-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: scaleIn 0.5s ease;
  }

  @keyframes scaleIn {
    from {
      transform: scale(0);
    }
    to {
      transform: scale(1);
    }
  }

  .success-message h4 {
    color: var(--success);
    margin: 16px 0 8px;
  }

  .success-message p {
    color: var(--text-2);
    margin: 8px 0 24px;
  }

  .modal-actions .btn {
    min-width: auto;
    width: 100%;
  }
}

/* ===============================================
   MOBILE VERTICAL - Shell de alta calidad tactil
   =============================================== */

@media (max-width: 760px) {
  html,
  body {
    min-height: 100%;
    overflow-x: hidden;
  }

  body {
    background:
      radial-gradient(circle at 12% 0%, rgba(var(--brand-rgb), 0.12), transparent 34%),
      linear-gradient(180deg, var(--panel-2) 0%, var(--bg) 52%, var(--panel-2) 100%);
  }

  .app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    padding: 10px max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left));
    border-radius: 0 0 22px 22px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
  }

  .header-left,
  .header-right {
    min-width: 0;
  }

  .header-left {
    align-self: center;
  }

  .header-right {
    justify-self: end;
  }

  .logo-container {
    max-width: 100%;
    min-width: 0;
    padding: 6px 8px;
  }

  .logo-image {
    height: 30px;
    width: 30px;
  }

  .logo-text {
    min-width: 0;
  }

  .brand-name,
  .brand-subtitle {
    max-width: min(46vw, 220px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-name {
    font-size: 1rem;
  }

  .brand-subtitle {
    display: block;
    font-size: 0.64rem;
  }

  .user-section {
    gap: 7px;
  }

  .user-info {
    gap: 0;
    padding: 4px;
  }

  .user-details {
    display: none;
  }

  .user-avatar {
    height: 34px;
    width: 34px;
  }

  .header-actions {
    gap: 5px;
  }

  .action-button,
  #notifications-btn.sui-btn,
  #online-users-btn.sui-btn,
  .logout-button {
    border-radius: 999px;
    height: 36px;
    min-height: 36px;
    min-width: 36px;
    width: 36px;
  }

  .logout-button {
    padding: 0;
  }

  .logout-text {
    display: none;
  }

  .main-navigation {
    grid-column: 1 / -1;
    margin-top: 0;
    min-width: 0;
    order: initial;
    width: 100%;
  }

  .nav-wrapper {
    border-radius: 18px;
    display: flex;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 5px;
    scroll-padding-inline: 6px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    width: 100%;
  }

  .nav-wrapper::-webkit-scrollbar {
    display: none;
  }

  .nav-item,
  .nav-dropdown-trigger {
    flex: 0 0 auto;
    min-height: 40px;
    min-width: max-content;
    padding: 8px 12px;
    scroll-snap-align: start;
  }

  .main-navigation .nav-text {
    display: inline;
    font-size: 0.8rem;
  }

  .dropdown-container {
    flex: 0 0 auto;
    position: static;
  }

  .dropdown-arrow {
    margin-left: 0;
  }

  .nav-dropdown {
    border-radius: 22px;
    left: max(10px, env(safe-area-inset-left));
    min-width: 0;
    padding: 10px;
    position: fixed;
    right: max(10px, env(safe-area-inset-right));
    top: 112px;
    transform: translateY(-8px);
    width: auto;
    z-index: 2400;
  }

  .nav-dropdown.active,
  .dropdown-container:focus-within .nav-dropdown,
  .nav-dropdown-trigger:focus + .nav-dropdown {
    max-height: calc(100dvh - 130px);
    overflow-y: auto;
    transform: translateY(0);
  }

  .nav-dropdown-item {
    border-radius: 16px;
    margin-bottom: 7px;
    min-height: 56px;
    padding: 10px;
  }

  .nav-dropdown-item .nav-icon {
    height: 36px;
    width: 36px;
  }

  .nav-dropdown-copy {
    overflow: hidden;
  }

  .nav-dropdown-item .nav-text {
    display: block;
    font-size: 0.9rem;
  }

  .nav-dropdown-meta {
    font-size: 0.72rem;
  }

  .app-header:not(.hidden) ~ .app-main {
    align-items: stretch;
    justify-content: flex-start;
    min-height: calc(100dvh - 118px);
    padding: 10px;
  }

  #shell {
    min-width: 0;
  }

  #app-outlet {
    margin: 12px 0;
    min-width: 0;
  }

  .banner {
    border-radius: 18px;
    height: auto;
    min-height: 40px;
  }

  .banner-inner {
    justify-content: center;
    min-height: 40px;
    padding: 8px 12px;
  }

  .banner-text {
    display: -webkit-box;
    font-size: 0.78rem;
    line-height: 1.25;
    overflow: hidden;
    text-align: center;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .app-footer {
    border-radius: 20px 20px 0 0;
    margin-top: 14px;
    padding: 18px 14px max(18px, env(safe-area-inset-bottom));
  }

  .footer-inner,
  .footer-bottom {
    gap: 12px;
  }

  .footer-left,
  .footer-center,
  .footer-right {
    min-width: 0;
    width: 100%;
  }

  .footer-navigation {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .sdk-notification-panel,
  .sdk-presence-panel {
    border-radius: 20px;
    left: 10px;
    max-height: calc(100dvh - 124px);
    right: 10px;
    top: 112px;
    width: auto;
  }

  .legal-modal {
    align-items: flex-end;
    padding: 0;
  }

  .legal-modal .modal-content {
    border-radius: 24px 24px 0 0;
    max-height: 88dvh;
    width: 100%;
  }

  .legal-modal .modal-header {
    padding: 18px 18px 14px;
  }

  .legal-content {
    padding: 20px;
  }
}

@media (max-width: 420px) {
  .brand-subtitle {
    display: none;
  }

  .logo-container {
    border-radius: 999px;
  }

  .nav-dropdown {
    top: 106px;
  }

  .main-navigation .nav-text {
    font-size: 0.76rem;
  }

  .nav-item,
  .nav-dropdown-trigger {
    padding-inline: 10px;
  }

  .app-header:not(.hidden) ~ .app-main {
    padding: 8px;
  }
}

/* Mobile data surfaces: keep tables usable without blowing up the viewport. */
@media (max-width: 760px) {
  .sui-table-wrapper,
  .metrics-table-container,
  .modal-table-container,
  .table-responsive {
    -webkit-overflow-scrolling: touch;
    border-radius: 18px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .sui-table,
  .metrics-table,
  .audit-table {
    min-width: 680px;
  }

  .sui-table th,
  .sui-table td,
  .metrics-table th,
  .metrics-table td,
  .audit-table th,
  .audit-table td {
    padding: 10px 12px;
  }

  .sui-card,
  .card,
  .sdk-card {
    max-width: 100%;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }
}


