/* =========================================================================
   CIC CCTV - Hoja de Estilos Oficial (CIC OS)
   Estilo Metálico Esmeralda Táctico / Cian VMS y Obsidiana Ejecutivo
   Inspirado en el estándar de diseño de RegAs 3 y Marbetes 3
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
  --primary-red: #059669;
  --primary-red-hover: #047857;
  --primary-red-light: #ecfdf5;
  --metallic-red-gradient: linear-gradient(180deg, #065f46 0%, #059669 15%, #047857 50%, #022c22 100%);
  --metallic-red-active: linear-gradient(180deg, #047857 0%, #10b981 40%, #059669 60%, #022c22 100%);
  --chrome-ribbon: linear-gradient(180deg, #ffffff 0%, #f1f5f9 45%, #e2e8f0 100%);
  --font-main: 'Outfit', 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: #f8fafc;
  color: #0f172a;
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

/* Scrollbars personalizados estilo CIC */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.custom-scroll::-webkit-scrollbar { width: 5px; height: 5px; }
.custom-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }
.custom-scroll::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* =========================================================================
   BARRA DE TÍTULO NATIVA WINDOWS (Metal Tallado & Rojo Vino Metálico Ejecutivo)
   Altura fija estándar: 32px - Idéntica al estándar de la suite CIC OS
   ========================================================================= */
:root {
  --titlebar-height: 32px;
  --wine-darkest: #01110d;
  --wine-deep: #021c16;
  --wine-base: #032b22;
  --wine-light: #064e3b;
  --wine-ruby: #047857;
  --wine-accent: #10b981;
  --wine-highlight: #6ee7b7;
}

/* =========================================================================
   BARRA DE TÍTULO PRINCIPAL (ADN ESTILO REGAS 3 - ACABADO ROJO VINO METÁLICO)
   ========================================================================= */
.app-titlebar,
.metallic-wine-titlebar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--titlebar-height, 32px) !important;
  min-height: var(--titlebar-height, 32px) !important;
  max-height: var(--titlebar-height, 32px) !important;
  box-sizing: border-box;
  background: linear-gradient(180deg, #064e3b 0%, #032b22 45%, #021c16 75%, #01110d 100%) !important;
  border-bottom: 1px solid #010d0a !important;
  box-shadow: inset 0 1px 0 rgba(110, 231, 183, 0.25), 0 1px 4px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: max(0.6rem, env(titlebar-area-x, 0.6rem));
  padding-right: max(100px, calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100vw)));
  gap: 0.5rem;
  -webkit-app-region: drag;
  app-region: drag;
  user-select: none;
  overflow: visible;
  color: #ecfdf5;
}

/* Ocultar botones emulados cuando Windows renderiza sus controles nativos */
@media (display-mode: window-controls-overlay) {
  .titlebar-win-controls {
    display: none !important;
  }
}
body.wco-active .titlebar-win-controls {
  display: none !important;
}

/* 1. IDENTIDAD CORPORATIVA EN LA BARRA DE TÍTULO (Icono + RegSin 3 | CIC) */
.titlebar-brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: auto;
  margin-right: 0.25rem;
  padding-right: 0.6rem;
  border-right: 1px solid rgba(16, 185, 129, 0.3);
  height: 100%;
  user-select: none;
  overflow: visible;
  position: relative;
  z-index: 10;
  -webkit-app-region: drag;
  app-region: drag;
  flex-shrink: 0;
}

.brand-icon,
.titlebar-brand-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4) !important;
  object-fit: contain;
  position: static;
  margin: 0;
  transition: transform 0.15s ease;
  user-select: none;
  flex-shrink: 0;
}

.brand-icon:hover,
.titlebar-brand-icon:hover {
  transform: scale(1.08);
}

.titlebar-brand-text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.025em;
  color: #ecfdf5;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  user-select: none;
}

.titlebar-brand-text .brand-text-version,
.titlebar-brand-text .brand-version {
  color: #6ee7b7;
  font-weight: 700;
  font-size: 11px;
}

.titlebar-brand-text .brand-text-cic,
.titlebar-brand-text .brand-cic {
  font-size: 10px;
  color: rgba(167, 243, 208, 0.85);
  font-weight: 400;
  margin-left: 2px;
}

/* Badge indicador de estado del Backend (palomita verde si está conectado) */
.backend-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  cursor: pointer;
  margin-left: 0.35rem;
  white-space: nowrap;
  position: relative;
  z-index: 10;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}

.backend-status-badge.is-local,
.backend-status-badge.is-lan,
.backend-status-badge.is-public {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(5, 150, 105, 0.25) 100%);
  border: 1px solid rgba(52, 211, 153, 0.6);
  color: #d1fae5;
}

.backend-status-badge.is-local:hover,
.backend-status-badge.is-lan:hover,
.backend-status-badge.is-public:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.5) 0%, rgba(5, 150, 105, 0.45) 100%);
  border-color: rgba(110, 231, 183, 0.9);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.6);
  transform: scale(1.15);
}

.backend-status-badge.is-offline {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

.backend-status-icon {
  font-size: 0.75rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Botón PWA Install Badge */
.pwa-install-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  color: #fde68a;
  background: rgba(120, 53, 15, 0.5);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: 4px;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}
.pwa-install-pill:hover {
  background: rgba(180, 83, 9, 0.7);
  color: #ffffff;
}

/* 2. PANEL DE NAVEGACIÓN EN LA BARRA DE TÍTULO */
.titlebar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  padding: 0;
  border: none;
  -webkit-app-region: drag;
  app-region: drag;
  height: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 0 1 auto;
  min-width: 0;
  margin-right: auto;
  scrollbar-width: none;
}
.titlebar-nav::-webkit-scrollbar {
  display: none;
}

.nav-tab,
.titlebar-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  height: 22px;
  border-radius: 4px;
  background: transparent;
  color: rgba(167, 243, 208, 0.85);
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  white-space: nowrap;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}

.nav-icon {
  width: 12px;
  height: 12px;
  opacity: 0.85;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.nav-tab:hover,
.titlebar-tab-btn:hover {
  color: #ffffff;
  background: rgba(4, 120, 87, 0.35);
  border-color: rgba(16, 185, 129, 0.25);
}

.nav-tab:hover .nav-icon,
.titlebar-tab-btn:hover .nav-icon {
  opacity: 1;
  transform: translateY(-1px);
}

.nav-tab.active,
.titlebar-tab-btn.active {
  color: #ffffff;
  background: linear-gradient(180deg, #065f46 0%, #044332 50%, #02241b 100%);
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-bottom: 2px solid #10b981;
  box-shadow: inset 0 1px 0 rgba(167, 243, 208, 0.2), 0 2px 4px rgba(0, 0, 0, 0.35);
  font-weight: 700;
}

.nav-tab.active .nav-icon,
.titlebar-tab-btn.active .nav-icon {
  color: #a7f3d0;
  opacity: 1;
}

.nav-label {
  font-size: 11px;
}

/* Botón de Configuración (Engranaje compacto RegAs - Acabado Rojo Vino) */
.settings-btn,
.titlebar-settings-btn {
  height: 22px;
  width: 24px;
  min-width: 24px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  color: #a7f3d0 !important;
  background: transparent !important;
  padding: 0;
  margin-left: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-app-region: no-drag;
  app-region: no-drag;
  box-sizing: border-box;
}

.settings-btn .gear-icon,
.titlebar-settings-btn .gear-icon {
  width: 13px;
  height: 13px;
  transition: transform 0.3s ease;
}

.settings-btn:hover,
.titlebar-settings-btn:hover {
  background: rgba(4, 120, 87, 0.5) !important;
  color: #ffffff !important;
  border-color: rgba(52, 211, 153, 0.6) !important;
}

.settings-btn:hover .gear-icon,
.titlebar-settings-btn:hover .gear-icon {
  transform: rotate(45deg);
}

.settings-btn.active,
.titlebar-settings-btn.active {
  background: linear-gradient(180deg, #065f46 0%, #044332 50%, #02241b 100%) !important;
  color: #ffffff !important;
  border-color: rgba(16, 185, 129, 0.55) !important;
  box-shadow: inset 0 1px 0 rgba(167, 243, 208, 0.2), 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* 3. UTILIDADES: RELOJ, PERFIL DE USUARIO Y CONTROLES NATIVOS */
.titlebar-utils {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  -webkit-app-region: drag;
  app-region: drag;
  height: 100%;
  flex-shrink: 0;
}

/* =====================================================================
   WCO · ARRASTRE Y DOBLE CLIC EN ESPACIOS VACÍOS DE LA BARRA DE TÍTULO
   Permite tomar cualquier espacio libre de la barra de título en la PWA
   para arrastrar la ventana o redimensionarla (maximizar / restaurar)
   con doble clic, manteniendo interactivos todos los botones y menús.
   ===================================================================== */
.app-titlebar,
.app-titlebar .titlebar-brand,
.app-titlebar .titlebar-nav:not(.open),
.app-titlebar .titlebar-utils,
.app-titlebar .live-clock-container {
  -webkit-app-region: drag !important;
  app-region: drag !important;
}

.app-titlebar :is(
  button, a[href], input, select, textarea, label, summary, [role="button"],
  [role="tab"], [role="menu"], [role="menuitem"], [role="dialog"], [role="listbox"], [onclick], [contenteditable="true"],
  .nav-tab, .settings-btn, .backend-status-badge, .pwa-install-pill, .cf-tunnel-status-badge, .titlebar-cdi-btn, .titlebar-notif-wrapper, .titlebar-notif-popover,
  .theme-toggle-btn, .user-auth-widget, .user-profile-btn, .user-dropdown-menu, .titlebar-win-controls, .win-control-btn, .mobile-menu-toggle
) {
  -webkit-app-region: no-drag !important;
  app-region: no-drag !important;
}


.live-clock-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding-right: 0.45rem;
  border-right: 1px solid rgba(16, 185, 129, 0.25);
}

.clock-time {
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
}

.clock-date {
  font-size: 0.6rem;
  color: #6ee7b7;
}

/* --- PERFIL DE USUARIO EN LA BARRA DE TÍTULO (ROJO VINO METÁLICO) --- */
.user-auth-widget {
  position: relative;
  display: inline-flex;
  align-items: center;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(180deg, rgba(6, 95, 70, 0.5) 0%, rgba(2, 44, 34, 0.65) 100%);
  border: 1px solid rgba(16, 185, 129, 0.38);
  border-radius: 20px;
  padding: 3px 9px 3px 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  height: 24px;
  color: #ecfdf5;
  box-shadow: inset 0 1px 0 rgba(167, 243, 208, 0.18), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.user-profile-btn:hover {
  background: linear-gradient(180deg, rgba(4, 120, 87, 0.65) 0%, rgba(3, 60, 46, 0.75) 100%);
  border-color: rgba(52, 211, 153, 0.65);
  box-shadow: 0 0 10px rgba(5, 150, 105, 0.35);
}

.user-profile-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  flex-shrink: 0;
}

.user-profile-info-mini {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.05;
}

.user-profile-name-mini {
  font-size: 10px;
  font-weight: 700;
  color: #ecfdf5;
  max-width: 95px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-profile-role-badge {
  font-size: 8px;
  font-weight: 700;
  color: #6ee7b7;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.chevron-user-icon {
  color: #6ee7b7;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.user-profile-btn[aria-expanded="true"] .chevron-user-icon {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 240px;
  background: linear-gradient(180deg, #03261e 0%, #011410 100%);
  border: 1px solid rgba(16, 185, 129, 0.38);
  border-radius: 8px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(167, 243, 208, 0.15);
  z-index: 10000;
  padding: 8px 0;
  box-sizing: border-box;
  animation: fadeIn 0.15s ease;
}

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
}

.user-dropdown-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), 0 1px 3px rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  flex-shrink: 0;
}

.user-dropdown-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-dropdown-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ecfdf5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-email {
  font-size: 0.7rem;
  color: #a7f3d0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-role-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: #34d399;
  text-transform: uppercase;
  margin-top: 2px;
}

.user-dropdown-divider {
  height: 1px;
  background: rgba(16, 185, 129, 0.18);
  margin: 6px 0;
}

.user-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  background: none;
  border: none;
  color: #d1fae5;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
}

.user-dropdown-item:hover {
  background: rgba(5, 150, 105, 0.35);
  color: #ffffff;
}

.user-dropdown-item.user-dropdown-danger {
  color: #6ee7b7;
}

.user-dropdown-item.user-dropdown-danger:hover {
  background: rgba(5, 150, 105, 0.25);
  color: #ffffff;
}

/* 4. BOTONES NATIVOS DE VENTANA WINDOWS */
.titlebar-win-controls {
  display: flex;
  align-items: stretch;
  height: 100%;
  border-left: 1px solid rgba(16, 185, 129, 0.25);
  flex-shrink: 0;
}

.win-control-btn {
  width: 44px;
  height: 100%;
  min-height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  outline: none;
  color: #dfcad2;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}

.win-control-btn svg {
  width: 10px;
  height: 10px;
  pointer-events: none;
}

.win-control-btn:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.win-control-btn:active {
  background-color: rgba(255, 255, 255, 0.22);
}

.win-control-btn.btn-close:hover {
  background-color: #c42b1c !important;
  color: #ffffff !important;
}

.win-control-btn.btn-close:active {
  background-color: #a82315 !important;
}

/* Ribbon secundario cromado / platino */
.chrome-ribbon-bar {
  background: var(--chrome-ribbon);
  border-bottom: 1px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Tarjetas y Contenedores */
.glass-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}

.glass-card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.07);
}

/* Inputs Estándar */
.standard-input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  background-color: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 0.65rem;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s ease;
  outline: none;
  font-family: var(--font-main);
}

.standard-input:focus {
  border-color: #047857;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(190, 18, 60, 0.12);
}

/* Botones de Acción */
.btn-primary-red {
  background: linear-gradient(180deg, #047857 0%, #065f46 100%);
  color: #ffffff;
  border: 1px solid #064e3b;
  padding: 0.5rem 1rem;
  border-radius: 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary-red:hover {
  background: linear-gradient(180deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.4);
  transform: translateY(-1px);
}

.btn-primary-red:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 0.5rem 0.9rem;
  border-radius: 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

/* Badges de Estados */
.status-pill {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.status-custodia { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.status-reclamacion { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.status-entregado { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.status-pesquisa { background: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; }
.status-dictamen { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }
.status-concluido { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }

/* Cascada de Actualizaciones en Reportes */
.cascade-update-item {
  border-left: 2px dashed #059669;
  margin-left: 1.25rem;
  padding-left: 1.25rem;
  position: relative;
}

.cascade-update-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 1.25rem;
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background: #059669;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.3);
}

/* Signature Pad Canvas */
.signature-canvas {
  touch-action: none;
  cursor: crosshair;
  background: #ffffff;
  border: 1.5px dashed #cbd5e1;
  border-radius: 0.75rem;
}

/* Modales */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.hidden,
.reporte-modal-overlay.hidden,
.hidden {
  display: none !important;
}

.modal-content {
  background: #ffffff;
  border-radius: 1.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  max-width: 95vw;
  width: 100%;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}


/* =========================================================================
   VISIBILIDAD RESPONSIVA CCTV (Aislamiento de vistas Móvil vs Escritorio)
   ========================================================================= */
@media (max-width: 768px) {
  .cctv-desktop-only {
    display: none !important;
  }
}
@media (min-width: 769px) {
  .cctv-mobile-only {
    display: none !important;
  }
}

/* Reproductor CCTV en Vivo a Pantalla Completa (Ocupa todo el espacio bajo la Barra de Título) */
#cctv-live-modal {
  position: fixed !important;
  top: var(--titlebar-height, 34px) !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100vw !important;
  height: calc(100vh - var(--titlebar-height, 34px)) !important;
  z-index: 150 !important;
  background: #020617 !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  border-radius: 0 !important;
}

#cctv-live-modal.hidden {
  display: none !important;
}

#cctv-live-modal-dialog {
  width: 100% !important;
  height: 100% !important;
  max-width: 100vw !important;
  max-height: 100% !important;
  border-radius: 0 !important;
  border: none !important;
  background: #020617 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-shadow: none !important;
  animation: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Notificaciones Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  animation: toastIn 0.2s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   SUB-RIBBON DE AUDITORÍA HISTÓRICA (RegSin 3)
   ========================================================================= */
.hist-ribbon-bar {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
  border-bottom: 1px solid #cbd5e1;
  padding: 0.35rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 4px rgba(0, 0, 0, 0.03);
}

.hist-ribbon-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.hist-ribbon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.38rem 0.85rem;
  border-radius: 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: #475569;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.hist-ribbon-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.hist-ribbon-btn.active {
  background: linear-gradient(180deg, #064e3b 0%, #4c0519 100%);
  color: #ffffff;
  border-color: #360310;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 5px rgba(76, 5, 25, 0.35);
}

.hist-ribbon-btn.active .hist-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.hist-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  font-family: var(--font-mono);
  transition: all 0.15s ease;
}

/* Autocomplete suggestions dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  margin-top: 0.25rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  max-height: 14rem;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover, .autocomplete-item.active {
  background: #fef2f2;
  color: #991b1b;
}

/* =========================================================================
   ENCABEZADO INSTITUCIONAL FIJO ARRIBA DEL LIENZO (FORMATO WHATSAPP v2.0)
   ========================================================================= */
.canvas-header-block {
  width: 100%;
  max-width: 100%;
  padding: 1.25rem 2rem 1rem 2rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-bottom: 1.5px solid #cbd5e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  color: #334155;
  user-select: none;
  cursor: default;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .canvas-header-block {
    padding: 0.85rem 1rem 0.75rem 1rem;
    font-size: 10.5px;
  }
}

.canvas-header-title {
  text-align: left;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.canvas-header-grid p {
  margin: 0.2rem 0;
}

/* =========================================================================
   SUPER LIENZO DE REPSIN - ESTILOS ENRIQUECIDOS (TABLAS, IMÁGENES, ENLACES)
   ========================================================================= */

/* Tablas Estructuradas en Lienzo */
.rep-canvas-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 13px;
  background-color: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.rep-canvas-table th {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  color: #0f172a;
  font-weight: 800;
  padding: 8px 12px;
  text-align: left;
  border: 1px solid #cbd5e1;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rep-canvas-table td {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  color: #334155;
  vertical-align: top;
  min-width: 60px;
  line-height: 1.5;
}

.rep-canvas-table tr:nth-child(even) td {
  background-color: #f8fafc;
}

.rep-canvas-table td:focus, 
.rep-canvas-table th:focus {
  outline: 2px solid #b91c1c;
  background-color: #fef2f2 !important;
}

/* Enlaces Interactivos en Lienzo */
.rep-canvas-link,
a.rep-canvas-link,
#rep-editor a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 1px 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.rep-canvas-link:hover,
#rep-editor a:hover {
  color: #1d4ed8;
  background-color: #eff6ff;
  text-decoration: underline;
}

/* Imágenes Incrustadas en Lienzo (Modelo Responsivo tipo RegAs con flotado y redimensión) */
.rep-image-wrapper {
  position: relative;
  box-sizing: border-box;
  max-width: 100%;
  transition: width 0.12s ease-out;
}

.rep-image-wrapper[data-align="left"] {
  float: left !important;
  margin: 6px 20px 14px 0 !important;
  clear: left;
  text-align: left;
  display: block !important;
}

.rep-image-wrapper[data-align="right"] {
  float: right !important;
  margin: 6px 0 14px 20px !important;
  clear: right;
  text-align: right;
  display: block !important;
}

.rep-image-wrapper[data-align="center"],
.rep-image-wrapper:not([data-align]) {
  float: none !important;
  margin: 1.25rem auto !important;
  clear: both;
  text-align: center;
  display: block !important;
}

.rep-image-container {
  position: relative;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

.rep-embedded-image {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  display: block !important;
  box-sizing: border-box;
}

.rep-embedded-image:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.13);
}

.rep-image-toolbar {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  user-select: none;
}

.rep-image-container:hover .rep-image-toolbar,
.rep-image-container:focus-within .rep-image-toolbar,
.rep-image-wrapper:hover .rep-image-toolbar {
  opacity: 1 !important;
}

.rep-image-resize-handle {
  width: 14px;
  height: 14px;
  background-color: #4f46e5;
  border: 2px solid #ffffff;
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  cursor: nwse-resize;
  user-select: none;
}

.rep-image-wrapper[data-align="right"] .rep-image-resize-handle {
  left: 4px;
  right: auto;
  cursor: nesw-resize;
}

.rep-image-resize-handle:hover {
  background-color: #4338ca;
  transform: scale(1.2);
}

.rep-image-container:hover .rep-image-resize-handle,
.rep-image-container:focus-within .rep-image-resize-handle,
.rep-image-wrapper:hover .rep-image-resize-handle {
  opacity: 1 !important;
}

.rep-image-caption {
  word-break: break-word;
  user-select: text;
}

.rep-image-clear-both {
  clear: both !important;
  height: 1px !important;
  margin: 8px 0 !important;
  line-height: 0 !important;
  font-size: 0 !important;
  border: none !important;
}

/* Párrafos dentro del lienzo para flujo fluido de texto junto a imágenes */
#rep-editor p {
  min-height: 1.5em;
  margin: 0.35rem 0;
  line-height: 1.6;
}

/* Dropdowns del Ribbon */
.ribbon-dropdown {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  animation: ribbonDropFade 0.15s ease-out;
}

@keyframes ribbonDropFade {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Listas con Viñetas y Numeradas en Lienzo de Reportes */
#rep-editor ul:not(.rep-checklist) {
  list-style-type: disc !important;
  margin: 0.6rem 0 0.6rem 2rem !important;
  padding-left: 0.75rem !important;
  display: block !important;
}

#rep-editor ul:not(.rep-checklist) ul {
  list-style-type: circle !important;
  margin: 0.3rem 0 0.3rem 1.5rem !important;
}

#rep-editor ul:not(.rep-checklist) ul ul {
  list-style-type: square !important;
}

#rep-editor ol {
  list-style-type: decimal !important;
  margin: 0.6rem 0 0.6rem 2rem !important;
  padding-left: 0.75rem !important;
  display: block !important;
}

#rep-editor ol ol {
  list-style-type: lower-alpha !important;
  margin: 0.3rem 0 0.3rem 1.5rem !important;
}

#rep-editor ol ol ol {
  list-style-type: lower-roman !important;
}

#rep-editor li:not(.rep-task-item) {
  display: list-item !important;
  margin: 0.3rem 0 !important;
  line-height: 1.6 !important;
}

/* Listas con Casillas / Modo de Tareas */
.rep-checklist {
  list-style: none !important;
  padding-left: 0.25rem !important;
  margin: 0.75rem 0 !important;
}

.rep-checklist li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0;
  line-height: 1.5;
}

.rep-checklist input[type="checkbox"],
.rep-task-checkbox {
  width: 15px;
  height: 15px;
  accent-color: #059669;
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
}

.rep-task-text {
  flex: 1;
  outline: none;
  min-height: 1.25rem;
}

.rep-checklist li.completed span,
.rep-checklist li.completed .rep-task-text,
.rep-checklist li:has(input:checked) span,
.rep-checklist li:has(input:checked) .rep-task-text {
  text-decoration: line-through !important;
  opacity: 0.6 !important;
  color: #64748b !important;
}

/* Optimización de rendimiento para escritura en lienzo */
#rep-editor {
  text-rendering: optimizeSpeed;
}

/* Encabezados y Citas en Editor */
#rep-editor h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  margin: 1rem 0 0.5rem 0;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.25rem;
}

#rep-editor h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0.85rem 0 0.4rem 0;
}

#rep-editor h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #334155;
  margin: 0.75rem 0 0.35rem 0;
}

#rep-editor blockquote {
  border-left: 4px solid #b91c1c;
  background-color: #f8fafc;
  padding: 0.5rem 1rem;
  margin: 0.75rem 0;
  font-style: italic;
  color: #475569;
  border-radius: 0 8px 8px 0;
}

#rep-editor pre {
  background: #0f172a;
  color: #f8fafc;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-x: auto;
  margin: 0.75rem 0;
}

#rep-editor hr {
  border: 0;
  height: 1px;
  background: #cbd5e1;
  margin: 1.25rem 0;
}

/* Transiciones de Panel Dividido */
#rep-left-panel,
#rep-canvas-container,
#rep-link-panel {
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .no-print, header, .chrome-ribbon-bar, .hist-ribbon-bar, .modal-overlay, .toast-container, #rep-link-panel, .rep-image-toolbar, .rep-image-resize-handle {
    display: none !important;
  }
  #rep-left-panel {
    display: none !important;
  }
  #rep-canvas-container {
    width: 100% !important;
    max-width: 100% !important;
  }
  .print-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* =========================================================================
   TARJETA OFICIAL DE AUTENTICACIÓN FIREBASE AUTH / UBE (ESTILO REGAS 3)
   Acabado Metálico Rojo Vino Satinado
   ========================================================================= */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
}

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

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 18, 14, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.auth-modal-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, #03261e 0%, #011410 100%);
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(5, 150, 105, 0.2), inset 0 1px 0 rgba(167, 243, 208, 0.15);
  border-radius: 16px;
  padding: 2rem 2.25rem;
  box-sizing: border-box;
  animation: authCardEnter 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  color: #ecfdf5;
}

@keyframes authCardEnter {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-card-close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  color: #6ee7b7;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  transition: all 0.15s ease;
}

.auth-card-close-btn:hover {
  color: #ffffff;
  transform: scale(1.15);
}

.auth-card-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-brand-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 0.75rem;
}

.auth-logo-img {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
  object-fit: contain;
}

.auth-brand-text {
  text-align: left;
}

.auth-app-name {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.auth-app-tag {
  display: block;
  font-size: 0.72rem;
  color: #6ee7b7;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.auth-welcome-desc {
  font-size: 0.84rem;
  color: #a7f3d0;
  margin: 0;
  line-height: 1.45;
  opacity: 0.9;
}

.auth-alert-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.83rem;
  line-height: 1.4;
  background: rgba(5, 150, 105, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
}

.auth-alert-box.hidden {
  display: none !important;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #d1fae5;
}

.auth-label-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.auth-field-icon {
  position: absolute;
  left: 12px;
  color: #6ee7b7;
  pointer-events: none;
}

.auth-form-control {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 38px;
  background: rgba(2, 28, 22, 0.7);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.9rem;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.auth-form-control:focus {
  outline: none;
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.25);
  background: rgba(4, 47, 36, 0.9);
}

.btn-toggle-eye {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 0.95rem;
  color: #6ee7b7;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.btn-toggle-eye:hover {
  opacity: 1;
}

.auth-flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-remember-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  color: #a7f3d0;
  cursor: pointer;
}

.btn-auth-primary {
  height: 42px;
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================================
   BLOQUEO ESTRICTO DE AUTENTICACIÓN (LOGIN MANDATORIO)
   ========================================================================= */
body.app-auth-locked {
  overflow: hidden !important;
}

body.app-auth-locked #app-header,
body.app-auth-locked main,
body.app-auth-locked .app-dock-navigation,
body.app-auth-locked .tab-content,
body.app-auth-locked #toast-container {
  filter: blur(14px) brightness(0.5) !important;
  pointer-events: none !important;
  user-select: none !important;
}

body.app-auth-locked .auth-overlay {
  display: flex !important;
  z-index: 999999 !important;
}
  gap: 8px;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
  margin-top: 0.25rem;
}

.btn-auth-primary:hover {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.6);
  transform: translateY(-1px);
}

.btn-auth-primary:active {
  transform: translateY(0);
}

.btn-auth-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.auth-admin-restriction-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(4, 120, 87, 0.25);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.76rem;
  line-height: 1.4;
  color: #a7f3d0;
  margin-top: 0.5rem;
}

.auth-restriction-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

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

.auth-card-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.74rem;
  color: #6ee7b7;
  border-top: 1px solid rgba(16, 185, 129, 0.2);
  padding-top: 1rem;
  opacity: 0.85;
}

/* =========================================================================
   DOCK DE NAVEGACIÓN INFERIOR PARA DISPOSITIVOS MÓVILES (ESTÁNDAR SUITE CIC)
   ========================================================================= */
.mobile-dock {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-bottom, 8px));
  padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 8px));
  background: rgba(1, 20, 16, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.65);
  z-index: 99990;
  justify-content: space-around;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.dock-tab {
  flex: 1 1 0%;
  min-width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: rgba(167, 243, 208, 0.72);
  padding: 5px 2px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.dock-tab:active {
  transform: scale(0.92);
  background: rgba(4, 120, 87, 0.3);
}

.dock-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.2s ease;
}

.dock-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dock-tab.active {
  color: #10b981;
}

.dock-tab.active .dock-icon {
  transform: translateY(-2px) scale(1.12);
  stroke: #10b981;
  filter: drop-shadow(0 2px 8px rgba(16, 185, 129, 0.7));
}

.dock-tab.active .dock-label {
  font-weight: 800;
  color: #6ee7b7;
}

/* =========================================================================
   ADAPTACIÓN RESPONSIVA PROFUNDA - REGSIN 3 MÓVIL (<= 992px)
   ========================================================================= */
@media (max-width: 992px) {
  :root {
    --titlebar-height: 44px;
  }

  html, body {
    width: 100%;
    min-height: 100dvh !important;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    -webkit-text-size-adjust: 100%;
  }

  body {
    padding-bottom: calc(65px + env(safe-area-inset-bottom, 12px)) !important;
  }

  /* 1. Header y Titlebar Móvil */
  .app-titlebar {
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding-left: max(0.75rem, env(safe-area-inset-left, 0.75rem)) !important;
    padding-right: max(0.75rem, env(safe-area-inset-right, 0.75rem)) !important;
    gap: 0.5rem !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
  }

  .titlebar-brand {
    border-right: none !important;
    padding-right: 0 !important;
    margin-right: auto !important;
  }

  .brand-icon, .titlebar-brand-icon {
    width: 24px !important;
    height: 24px !important;
  }

  .titlebar-brand-text {
    font-size: 13px !important;
  }

  .titlebar-brand-text .brand-text-version {
    font-size: 13px !important;
  }

  /* Ocultar elementos exclusivos de escritorio */
  .titlebar-nav,
  .titlebar-win-controls,
  .live-clock-container {
    display: none !important;
  }

  /* Mostrar Dock Inferior Táctil */
  .mobile-dock {
    display: flex !important;
  }

  /* Usuario / Avatar compacto */
  .user-profile-info-mini,
  .chevron-user-icon {
    display: none !important;
  }

  .user-profile-btn {
    padding: 2px !important;
    border-radius: 50% !important;
    background: transparent !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
  }

  .user-profile-avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.75rem !important;
  }

  /* 2. Vistas Generales Desbloqueadas */
  section[id^="view-"] {
    height: auto !important;
    min-height: calc(100dvh - 44px - 65px) !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    padding-bottom: 2rem !important;
  }

  /* 3. Vista Reportes Móvil */
  #view-reportes {
    flex-direction: column !important;
    overflow: visible !important;
  }

  #rep-left-panel {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    border-right: none !important;
    border-bottom: 2px solid #e2e8f0 !important;
    overflow-y: visible !important;
    padding: 1rem 0.85rem !important;
  }

  #rep-right-panel,
  #view-reportes .canvas-container {
    width: 100% !important;
    height: auto !important;
    min-height: 500px !important;
    overflow-y: visible !important;
  }

  .canvas-ribbon-bar {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0.5rem !important;
    gap: 0.4rem !important;
  }

  .ribbon-action-btn,
  .ribbon-menu-btn {
    min-height: 36px !important;
    padding: 0.35rem 0.65rem !important;
  }

  /* 4. Vista Notificaciones Móvil */
  #view-notificaciones {
    flex-direction: column !important;
    overflow: visible !important;
  }

  #view-notificaciones > div:first-child {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
  }

  #notif-side-preview {
    width: 100% !important;
    height: auto !important;
    min-height: 400px !important;
    margin-top: 1rem !important;
  }

  /* 5. Vista Investigaciones (Kanban Móvil) */
  #view-investigaciones {
    overflow-y: visible !important;
  }

  .kanban-board-container,
  #inv-kanban-board {
    flex-direction: column !important;
    gap: 1rem !important;
    overflow: visible !important;
  }

  .kanban-col {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
  }

  /* 6. Vista CCTV Móvil */
  #view-cctv {
    padding: 0.5rem !important;
    overflow-y: visible !important;
  }

  .cctv-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* 7. Vista Objetos Extraviados e Historial */
  .table-responsive-wrapper,
  .table-container {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 8px !important;
  }

  .hist-ribbon-bar {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0.5rem !important;
  }

  /* 8. Vista Configuración */
  #view-configuracion {
    flex-direction: column !important;
    overflow: visible !important;
    padding: 0.75rem !important;
  }

  #view-configuracion > div:first-child {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    border-right: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }
}

/* =========================================================================
   ADAPTACIONES PARA SMARTPHONES ESTÁNDAR Y COMPACTOS (<= 640px)
   ========================================================================= */
@media (max-width: 640px) {
  /* Evitar auto-zoom molesto en iOS Safari asegurando 16px de font-size */
  input[type="text"],
  input[type="search"],
  input[type="password"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important;
    min-height: 44px !important;
  }

  /* Botones táctiles amplios (Touch target mínimo de 44px) */
  button.btn-primary,
  button.btn-secondary,
  button.btn-auth-primary,
  .mobile-touch-btn {
    min-height: 44px !important;
    font-size: 0.95rem !important;
    border-radius: 10px !important;
  }

  /* Modales convertidos en Bottom Sheet (SOLO cuando están abiertos / NO ocultos) */
  .modal-overlay:not(.hidden),
  .reporte-modal-overlay:not(.hidden) {
    padding: 0 !important;
    align-items: flex-end !important;
    display: flex !important;
    background: rgba(0, 0, 0, 0.65) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
  }

  .modal-overlay.hidden,
  .reporte-modal-overlay.hidden {
    display: none !important;
  }

  .modal-dialog,
  .modal-content,
  .reporte-modal,
  .auth-modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90dvh !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: none !important;
    animation: modalSlideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 0 !important;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 12px)) !important;
  }

  /* Toast posicionado sobre el Dock móvil */
  .toast-container {
    right: 0.75rem !important;
    left: 0.75rem !important;
    bottom: calc(65px + env(safe-area-inset-bottom, 10px)) !important;
    width: auto !important;
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================================
   CCTV LIVE VIEWER - ZOOM DIGITAL, PAN PROFESIONAL Y OPTIMIZACIÓN MÓVIL
   ========================================================================= */
#cctv-live-modal {
  z-index: 99995 !important;
  overscroll-behavior: none !important;
}

#cctv-live-viewport {
  touch-action: none !important;
  overscroll-behavior: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

#cctv-live-zoom-stage {
  transform-origin: center center;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

#cctv-live-viewport:fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  background-color: #000000 !important;
}

#cctv-live-stream-img {
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
}

@media (max-width: 1023px) {
  #cctv-live-modal:not(.hidden) {
    top: var(--titlebar-height, 44px) !important;
    height: calc(100dvh - var(--titlebar-height, 44px)) !important;
    max-height: calc(100dvh - var(--titlebar-height, 44px)) !important;
    padding: 0 !important;
    align-items: stretch !important;
  }

  #cctv-live-modal-dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    animation: none !important;
  }

  /* En pantallas móviles/tablets (<1024px) el panel lateral de Ficha/Bitácora se abre como drawer inferior sobre la mitad inferior sin aplastar el visor */
  #cctv-live-sidepanel:not(.hidden) {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 56% !important;
    max-height: 60dvh !important;
    z-index: 45 !important;
    border-radius: 16px 16px 0 0 !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.55) !important;
  }

  /* Flechas Anterior / Siguiente siempre visibles y cómodas al tacto en móvil */
  #cctv-live-viewport > button[onclick*="navigateLiveCamera"] {
    opacity: 0.9 !important;
    width: 38px !important;
    height: 38px !important;
  }
}

@media (max-width: 768px) {
  #view-recorridos > div {
    flex-direction: column !important;
  }

  #view-recorridos > div > div:first-child {
    width: 100% !important;
    max-height: 38dvh !important;
  }

  #cctv-live-bottom-toolbar {
    padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom, 4px)) !important;
    gap: 0.35rem !important;
  }
}





/* =========================================================================
   ANIMACIÓN VISUAL Y FEEDBACK DE EMISIÓN DE REPORTE OFICIAL
   ========================================================================= */
.rep-btn-loading {
  position: relative !important;
  overflow: hidden !important;
  pointer-events: none !important;
  cursor: wait !important;
  opacity: 0.88 !important;
}

.rep-btn-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.28) 50%,
    transparent 100%
  );
  animation: rep-btn-shimmer 1.3s infinite linear;
}

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

/* Drag & Drop activo en Paso 4 de Notificaciones Legales */
#notif-dropzone.notif-dropzone-active {
  border-color: #047857 !important;
  background-color: rgba(255, 228, 230, 0.85) !important;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
  transform: scale(1.01);
}

#notif-dropzone.notif-dropzone-active .notif-dropzone-icon {
  background-color: #047857 !important;
  color: #ffffff !important;
  transform: translateY(-2px) scale(1.08);
}
