@import url("fantasia-premium.css?v=20261013-3");
:root {
  --fx-primary: #6c2bd9;
  --fx-secondary: #9333ea;
  --fx-primary-strong: #5740e8; /* Color primario más fuerte */
  --fx-secondary-strong: #8d3ff2; /* Color secundario más fuerte */
  --fx-bg: #f3f6fb; /* Fondo principal */
  --fx-surface: #ffffff; /* Fondo de tarjetas y elementos principales */
  --fx-text: #0f172a; /* Color de texto principal */
  --fx-muted: #64748b; /* Color de texto secundario/apagado */
  --fx-border: #e2e8f0; /* Color de bordes */
  --fx-success: #16a34a;
  --fx-warning: #f59e0b;
  --fx-danger: #dc2626;
  --fx-sidebar-width: 250px;
  --fx-btn-shadow: 0 10px 24px rgba(108, 43, 217, 0.2);
}

html,
body {
  height: 100vh; /* Usar vh para altura completa del viewport */
  margin: 0;
  padding: 0;
  background: var(--fx-bg);
  color: var(--fx-text);
  font-size: 16px; /* Base para rem */
}

body { /* Usar clamp para un tamaño de fuente base responsivo */
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--fx-sidebar-width);
  background: var(--fx-surface);
  border-right: 1px solid var(--fx-border); /* Borde derecho */
  z-index: 1040;
  transition: left 0.3s ease;
}

/* Encabezado del sidebar */
.sidebar .sidebar-header {
  padding: 1rem 1rem 0.75rem;
}

.sidebar .logo-title {
  margin: 0;
  color: var(--fx-text);
  font-weight: 700; /* Fuente en negrita */
}

/* Make the brand image and title sit closer together */
.sidebar .navbar-brand .d-flex {
  gap: 0.35rem !important; /* Espacio entre elementos */
  align-items: center;
}

.sidebar .sidebar-body {
  height: calc(100% - 110px);
  overflow-y: auto;
}
/* Estilos de los enlaces de navegación */
.sidebar .nav-link {
  color: var(--fx-text);
  display: flex;
  align-items: center; /* Alinear verticalmente */
  gap: 0.5rem;
  border-radius: 0.65rem;
  margin: 0.125rem 0.75rem;
  padding: 0.65rem 0.75rem;
  font-weight: 600;
}

/* Ensure logo image is visible and sized consistently */
.sidebar .navbar-brand img {
  display: inline-block;
  width: 38px;
  height: 38px;
  object-fit: contain;
}
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(108, 43, 217, 0.11);
  color: var(--fx-primary);
}

.sidebar .nav-link svg {
  width: 18px;
  height: 18px;
}
/* Anula el margen de hope-ui para usar 'gap' de flexbox, asegurando un espaciado consistente */
/* Anula el margen de hope-ui para usar 'gap' de flexbox, asegurando un espaciado consistente */
.sidebar .nav-link .item-name {
  margin-left: 0 !important;
}
/* Contenido principal */
.main-content {
  margin-left: var(--fx-sidebar-width);
  min-height: 100vh;
  padding-top: calc(110px + env(safe-area-inset-top, 0px));
  transition: margin-left 0.3s ease;
}

/* Barra de navegación superior */
.iq-navbar.fx-navbar {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--fx-sidebar-width);
  display: flex;
  align-items: center; /* Alinear verticalmente */
  background: var(--fx-surface) !important;
  border-bottom: 1px solid var(--fx-border);
  padding-top: env(safe-area-inset-top, 0px);
}

.iq-navbar .navbar-inner {
  padding: 0.75rem 1rem;
  width: 100%; /* Asegurar que ocupe todo el ancho disponible */
}

.fx-navbar-main {
  display: flex;
  align-items: center; /* Alinear verticalmente */
}

.fx-navbar-main > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.fx-navbar-actions {
  display: flex;
  align-items: center; /* Alinear verticalmente */
  gap: 0.5rem;
  flex-wrap: wrap; /* Permitir que los elementos se envuelvan */
  justify-content: flex-end;
}
/* Campo de búsqueda */
.fx-search-input {
  max-width: 220px;
}

.content-inner {
  padding: 1rem;
}

/* Título de página */
.fx-page-title {
  margin: 0;
  font-size: clamp(1rem, 0.8rem + 1vw, 1.5rem); /* Tamaño de fuente responsivo */
  font-weight: 700; /* Fuente en negrita */
  line-height: 1.2;
}

.fx-subtitle {
  margin: 0;
  font-size: 0.88rem;
  color: var(--fx-muted);
}
/* Tarjetas generales */
.fx-card {
  background: var(--fx-surface);
  border: 1px solid var(--fx-border);
  border-radius: 1rem; /* Bordes redondeados */
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.fx-card .card-header {
  background: transparent;
  border-bottom: 1px solid var(--fx-border);
  padding: 1rem 1.25rem;
}
/* Cuerpo de la tarjeta */
.fx-card .card-body {
  padding: 1.25rem;
}
/* Etiquetas de métricas */
.metric-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.76rem;
  color: var(--fx-muted);
  font-weight: 700;
}
/* Valores de métricas */
.metric-value {
  margin: 0.35rem 0 0;
  font-size: clamp(1.2rem, 0.8rem + 2vw, 1.8rem); /* Tamaño de fuente responsivo */
  line-height: 1.1;
  font-weight: 700;
}

.metric-meta {
  margin: 0.35rem 0 0;
  font-size: 0.84rem;
  color: var(--fx-muted);
}
/* Botones */
.btn {
  border-radius: 0.92rem;
  min-height: 42px; /* Altura mínima */
  padding: 0.58rem 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.18s ease, box-shadow 0.22s ease, filter 0.22s ease,
    background-color 0.22s ease, color 0.22s ease, border-color 0.22s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
/* Botones pequeños */
.btn-sm {
  border-radius: 0.8rem;
  min-height: 38px; /* Altura mínima */
  padding: 0.42rem 0.82rem;
}

.btn:not(:disabled):not(.disabled):hover {
  transform: translateY(-1px);
}

.btn:not(:disabled):not(.disabled):active {
  transform: scale(0.98);
}
/* Foco del botón */
.btn:focus-visible {
  box-shadow: 0 0 0 0.22rem rgba(108, 43, 217, 0.22), var(--fx-btn-shadow);
}
/* Botón primario */
.btn-primary {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--fx-primary-strong), var(--fx-secondary-strong));
  box-shadow: var(--fx-btn-shadow);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  color: #fff;
  filter: brightness(1.07);
  box-shadow: 0 14px 30px rgba(108, 43, 217, 0.28);
}
/* Botón primario delineado */
.btn-outline-primary {
  border-color: rgba(108, 43, 217, 0.44);
  color: var(--fx-primary); /* Color primario */
  background: rgba(108, 43, 217, 0.08);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
  border-color: rgba(108, 43, 217, 0.62);
  color: #4e23a4;
  background: rgba(108, 43, 217, 0.16);
  box-shadow: 0 10px 24px rgba(108, 43, 217, 0.16);
}
/* Botón secundario delineado */
.btn-outline-secondary {
  border-color: rgba(100, 116, 139, 0.36);
  color: #334155; /* Color de texto */
  background: rgba(148, 163, 184, 0.12);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active {
  border-color: rgba(100, 116, 139, 0.58);
  color: #1e293b;
  background: rgba(148, 163, 184, 0.22);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}
/* Botón oscuro delineado */
.btn-outline-dark {
  border-color: rgba(15, 23, 42, 0.28);
  background: rgba(15, 23, 42, 0.08);
}

.btn-outline-dark:hover,
.btn-outline-dark:focus,
.btn-outline-dark:active {
  border-color: rgba(15, 23, 42, 0.48);
  background: rgba(15, 23, 42, 0.16);
}

/* Botón solo con icono */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
/* Icono dentro del botón */
.btn-icon svg { width: 18px; height: 18px; }
/* Controles de formulario */
.form-control,
.form-select,
textarea {
  border-color: var(--fx-border);
}

.form-control:focus,
.form-select:focus,
textarea:focus {
  border-color: var(--fx-primary);
  box-shadow: 0 0 0 0.2rem rgba(108, 43, 217, 0.15);
}
/* Insignias de estado */
.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.22rem 0.62rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: capitalize;
}
/* Estado pendiente */
.status-pendiente {
  background: rgba(220, 38, 38, 0.12);
  color: #991b1b;
}
/* Estado con abono */
.status-abono {
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.45);
}
/* Estado liquidado */
.status-liquidado {
  background: rgba(22, 163, 74, 0.14);
  color: #166534;
}

.fx-alert {
  border-radius: 0.75rem;
  font-size: 0.88rem;
  padding: 0.72rem 0.95rem;
}

.fx-alert.available {
  background: rgba(22, 163, 74, 0.12);
  color: #166534;
}

.fx-alert.busy {
  background: rgba(220, 38, 38, 0.12);
  color: #991b1b;
}

.fx-alert.neutral {
  background: rgba(148, 163, 184, 0.16);
  color: #334155;
}

.table thead th {
  color: var(--fx-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em; /* Espaciado entre letras */
}

.table td, /* Celdas de tabla */
.table th {
  vertical-align: middle;
}

.table-responsive {
  border-radius: 0 0 1rem 1rem;
}

/* Make responsive tables scrollable on small viewports and touch-friendly */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Ensure tables take full width but allow horizontal scroll on narrow devices */
.table {
  width: 100%;
  min-width: 0; /* prevent vendor defaults forcing min width */
}

/* Small-screen adjustments for contract month cards and tables */
@media (max-width: 575px) {
  .fx-month-card .card-header { padding: 0.6rem; }
  .fx-month-card .card-body { padding: 0.6rem; }

  /* Allow table cells to wrap on very small screens to avoid overflow */
  .table td, .table th { white-space: normal; word-break: break-word; font-size: 0.92rem; }

  /* Make action buttons fit */
  .table .btn { padding: 0.36rem 0.5rem; font-size: 0.82rem; }

  /* Reduce metric paddings to avoid pushing layout */
  .metric-value { font-size: clamp(1.05rem, 0.9rem + 1vw, 1.6rem); }
}

/* Medium screens: ensure month cards stack nicely */
@media (max-width: 991px) {
  #monthlyContractsGrid .col-xl-6 { width: 100%; }
  .fx-month-card .card-header h5 { font-size: 1rem; }
}

.fx-contract-folio-link {
  color: inherit; /* Heredar color */
  text-decoration: none;
}

.fx-contract-folio-link:hover,
.fx-contract-folio-link:focus {
  color: var(--fx-primary);
}

.fx-month-card .card-header {
  display: flex; /* Usar flexbox */
  align-items: center; /* Alinear verticalmente */
  justify-content: space-between;
  gap: 0.75rem; /* Espacio entre elementos */
  flex-wrap: wrap;
}

.fx-month-count {
  color: var(--fx-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.fx-month-empty {
  padding: 1.15rem 1.25rem;
}
/* Calendario */
#agendaCalendar {
  overflow: hidden;
}

.fx-empty {
  margin: 0;
  color: var(--fx-muted);
  font-style: italic;
}
/* Contenedor de opciones de servicio */
#serviceOptionsContainer {
  border: 1px solid var(--fx-border) !important;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f6fb 100%) !important; /* Fondo degradado */
}

.fx-menu-section + .fx-menu-section {
  margin-top: 1rem;
}

.fx-menu-section-head {
  display: flex;
  justify-content: space-between; /* Espacio entre elementos */
  align-items: baseline; /* Alinear a la línea base */
  flex-wrap: wrap;
  gap: 0.4rem; /* Espacio entre elementos */
  margin-bottom: 0.65rem;
}

.fx-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  /* Espacio entre elementos de la cuadrícula */
}

.fx-option-card {
  border: 1px solid var(--fx-border);
  border-radius: 0.95rem;
  background: #fff;
  padding: 0.72rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.fx-option-card:hover {
  border-color: rgba(108, 43, 217, 0.35);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.fx-option-card.active {
  border-color: rgba(108, 43, 217, 0.55);
  box-shadow: 0 10px 22px rgba(108, 43, 217, 0.16);
}
/* Parte superior de la tarjeta de opción */
.fx-option-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.fx-option-icon {
  width: 44px;
  height: 44px;
  border-radius: 0.8rem;
  background: linear-gradient(135deg, rgba(108, 43, 217, 0.14), rgba(147, 51, 234, 0.24)); /* Fondo degradado */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.fx-option-headings { /* Encabezados de opción */
  min-width: 0;
}

.fx-option-name {
  font-weight: 700;
  line-height: 1.2;
  color: var(--fx-text);
}
/* Texto de ayuda de la opción */
.fx-option-helper {
  color: var(--fx-muted);
  font-size: 0.76rem;
}

.fx-option-pill {
  margin-left: auto;
  align-self: flex-start;
  background: rgba(108, 43, 217, 0.14);
  color: var(--fx-primary); /* Color primario */
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 700;
}

.fx-option-footer {
  margin-top: 0.65rem;
  display: flex;
  justify-content: space-between;
  align-items: center; /* Alinear verticalmente */
  gap: 0.6rem;
}

.fx-option-price {
  font-weight: 700;
  font-size: 0.92rem;
  color: #166534;
}
/* Control de cantidad */
.fx-qty-control {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: #f8fafc;
  border: 1px solid var(--fx-border);
  border-radius: 999px;
  padding: 0.15rem;
}

.fx-qty-btn { /* Botón de cantidad */
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--fx-primary);
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fx-qty-btn:disabled {
  opacity: 0.45;
}

.fx-qty-value {
  min-width: 26px;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 700;
}

.docx-contract {
  position: relative; /* Posición relativa */
  isolation: isolate;
  font-family: "Times New Roman", Georgia, serif;
  color: #1f2937;
  font-size: 1rem;
  line-height: 1.5;
}

.docx-contract::before {
  content: "";
  position: absolute; /* Posición absoluta */
  inset: 0;
  background-image: url("../../LOGO-FANTASIA.webp");
  background-repeat: repeat-y;
  background-position: center 140px;
  background-size: min(320px, 62vw) auto;
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
}

.docx-contract > * {
  position: relative;
  z-index: 1;
}

.docx-contract p,
.docx-contract li {
  text-align: justify;
}

.docx-contract p {
  margin-bottom: 0.7rem;
}
/* Listas ordenadas */
.docx-contract ol {
  margin-bottom: 0.9rem;
  padding-left: 1.35rem;
}

/* Ajustes para pantallas pequeñas (iPhone) - evitar que el sidebar ocupe toda la pantalla */
@media (max-width: 991px) {
  :root { --fx-sidebar-width: 260px; }
  .sidebar {
    left: -100vw !important;
    width: min(var(--fx-sidebar-width), 78%);
    max-width: none !important;
    transition: left 0.22s ease, visibility 0.22s ease;
    visibility: hidden;
  }
  .sidebar.open, .sidebar.show {
    left: 0 !important;
    visibility: visible;
  }
  .sidebar + .main-content,
  .main-content {
    margin-left: 0 !important;
    padding: 1rem !important;
  }
  .iq-navbar.fx-navbar { left: 0 !important; }
  .sidebar .sidebar-body { max-height: calc(100vh - 110px); padding-bottom: env(safe-area-inset-bottom, 12px); overflow-y: auto; }

  /* Ajustes para la notch / safe-area y evitar solapamiento con el header */
  .iq-navbar.fx-navbar .navbar-inner {
    padding-top: calc(0.65rem + env(safe-area-inset-top, 0px));
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  }

  /* Ajustes para el botón del menú lateral (mobile) */
  .iq-navbar.fx-navbar .sidebar-toggle,
  .btn.sidebar-toggle.d-lg-none {
    position: relative !important;
    top: 0 !important;
    margin-top: 0 !important;
    margin-right: 0.5rem;
    z-index: 1060 !important;
    transform: none !important;
  }

  /* Ajuste del toggle dentro de la barra lateral (cuando se muestra en móvil) */
  .sidebar .sidebar-header {
    justify-content: center;
    position: relative;
  }
  .sidebar .sidebar-toggle {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    margin-left: 0 !important;
    z-index: 1065 !important;
    display: block;
  }

  .iq-navbar.fx-navbar .sidebar-toggle svg {
    width: 22px;
    height: 22px;
    display: block;
  }

  .sidebar .navbar-brand .d-flex { gap: 0.35rem !important; align-items: center; }
  /* internal sidebar label removed - keep hidden */
  .sidebar .sidebar-open-label { display: none !important; }

  /* Reducir tamaño y padding para que no tape el título */
  .iq-navbar.fx-navbar .btn.sidebar-toggle {
    padding: 0.35rem 0.6rem;
    min-height: 36px;
  }

  /* Asegurar que el título quede legible */
  .fx-navbar-main > div {
    margin-left: 0.25rem;
  }

  /* Alineación vertical del título: mantener centrado junto al toggle */
  .fx-page-title {
    display: block;
    margin-top: 0;
    line-height: 1.2;
  }

  .fx-page-cta {
    display: none !important;
  }
  .fx-navbar-actions {
    display: flex !important;
    gap: 0.35rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .fx-navbar-actions .btn {
    font-size: 0.82rem;
    padding: 0.35rem 0.6rem;
    min-height: 34px;
  }
}

.docx-contract li + li {
  margin-top: 0.35rem;
}

.docx-sign-table td {
  width: 33.3%;
  padding: 0.4rem 0.5rem;
  vertical-align: top;
  text-align: center; /* Alinear al centro */
}

.fc {
  font-size: 0.9rem;
}

.fc-event {
  border: 0;
  border-radius: 6px; /* Bordes redondeados */
  padding: 1px 3px;
}

.sidebar-toggle {
  cursor: pointer;
}

.fx-sidebar-backdrop { /* Fondo del sidebar */
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1039;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.fx-sidebar-backdrop.show {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 991px) {
  .sidebar,
  .sidebar.sidebar-mini,
  .sidebar.sidebar-mini.on-resize {
    width: min(86vw, 320px) !important;
    max-width: none !important;
    left: -100vw !important;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.18);
    -webkit-transform: none !important;
    transform: none !important;
    visibility: hidden;
    --sidebar-width: min(86vw, 320px) !important;
  }

  .sidebar.open,
  .sidebar.sidebar-mini.open {
    left: 0 !important;
    visibility: visible;
  }

  /* ── Forzar que sidebar-mini muestre títulos en mobile ── */
  .sidebar.sidebar-mini .navbar-brand .logo-title {
    -webkit-transform: none !important;
    transform: none !important;
    opacity: 1 !important;
  }

  .sidebar.sidebar-mini.sidebar-base .nav-item .nav-link:not(.static-item) span {
    -webkit-transform: none !important;
    transform: none !important;
    opacity: 1 !important;
    display: inline !important;
  }

  .sidebar.sidebar-mini.sidebar-base .nav-item .nav-link {
    padding: 0.65rem 0.75rem !important;
  }

  .sidebar.sidebar-mini.sidebar-base .nav-item .nav-link .item-name {
    margin-left: 0.5rem !important;
    flex: 1 !important;
  }

  .sidebar.sidebar-mini.sidebar-base .nav-item.static-item {
    padding-left: 0 !important;
  }

  .sidebar.sidebar-mini.sidebar-base .nav-item .nav-link.static-item {
    text-align: left !important;
    justify-content: flex-start !important;
  }

  .sidebar.sidebar-mini.sidebar-base .nav-item .nav-link.static-item .default-icon {
    display: block !important;
  }

  .sidebar.sidebar-mini.sidebar-base .nav-item .nav-link.static-item .mini-icon {
    display: none !important;
  }

  body.fx-sidebar-open {
    overflow: hidden;
  }

  /* Responsive adjustments for PDF viewer and document gallery (scoped to contratos page) */
  .contratos-page .pdf-viewer{width:100%;display:flex;justify-content:center}
  .contratos-page .pdf-viewer canvas{max-width:100% !important;height:auto !important;display:block}

  /* Document gallery responsive item: use flex-basis instead of fixed widths (scoped) */
  .contratos-page .doc-item{flex:1 1 220px;min-width:160px;max-width:320px;box-sizing:border-box}
  .contratos-page .doc-item img{width:100%;height:160px;object-fit:cover;border-radius:4px}

/* ---------------- Responsive Utilities & Fixes ---------------- */
/* Ensure images never deform */
img, picture, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Prevent text overflow */
* {
  word-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

/* Make form controls full width on small screens */
@media (max-width: 768px) {
  .form-control, .form-select, textarea {
    width: 100% !important;
    box-sizing: border-box;
  }
  .btn { min-height: 44px; padding: 0.6rem 1rem; }
}

/* Tables: allow horizontal scroll on small screens only when necessary */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; table-layout: auto; }

/* Modals adapt to viewport */
.modal-dialog { max-width: min(95vw, 900px); margin: 1.25rem auto; }
.modal-content { max-height: 90vh; overflow: auto; }

/* Cards and containers use max-width and responsive padding */
.fx-card { max-width: 100%; }
.content-inner { padding: clamp(0.5rem, 1vw, 1.25rem); }

/* Sidebar: collapse automatically on smaller viewports */
@media (max-width: 1200px) {
  .main-content { margin-left: 0 !important; }
  .iq-navbar.fx-navbar { left: 0 !important; }
}

/* Ensure sidebar toggle visible and touchable */
.sidebar-toggle { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }

/* Responsive grid helpers */
.fx-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.fx-col { flex: 1 1 0%; min-width: 0; }
.fx-col-auto { flex: 0 0 auto; }

/* Buttons spacing in mobile */
@media (max-width: 576px) {
  .fx-navbar-actions .btn { padding: 0.5rem 0.6rem; font-size: 0.9rem; }
}

/* Prevent horizontal scroll caused by fixed width elements */
/* Avoid forcing overflow-x hidden globally; use scoped fixes per-page */

/* PDF canvas responsive container (scoped) */
.contratos-page .pdf-viewer { width: 100%; max-width: 100%; overflow: hidden; }
.contratos-page .pdf-viewer canvas { width: 100% !important; height: auto !important; }

/* Breakpoints set as requested */
@media (min-width: 320px) { html { font-size: clamp(14px, 1.6vw, 16px); } }
@media (min-width: 375px) { html { font-size: clamp(14px, 1.55vw, 16px); } }
@media (min-width: 425px) { html { font-size: clamp(15px, 1.45vw, 16px); } }
@media (min-width: 576px) { html { font-size: clamp(15px, 1.25vw, 16px); } }
@media (min-width: 768px) { html { font-size: clamp(16px, 1.1vw, 17px); } }
@media (min-width: 992px) { html { font-size: clamp(16px, 1vw, 18px); } }
@media (min-width: 1200px) { html { font-size: clamp(16px, 0.9vw, 18px); } }
@media (min-width: 1400px) { html { font-size: clamp(17px, 0.8vw, 19px); } }

/* Accessibility: larger touch targets */
button, .btn, .btn-icon { touch-action: manipulation; }

/* Ensure forms and tables do not overflow inside sidebars */
.sidebar .table, .sidebar .form-control { max-width: 100%; }

/* Ensure fixed header does not overlap content on small screens */
@media (max-width: 768px) {
  .main-content { padding-top: calc(80px + env(safe-area-inset-top, 0px)); }
}

/* End responsive utilities */

  .sidebar + .main-content,
  .sidebar.sidebar-mini + .main-content,
  .main-content {
    margin-left: 0 !important;
    padding-top: calc(64px + env(safe-area-inset-top, 0px));
  }

  .iq-navbar.fx-navbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1030;
  }

  .content-inner {
    padding: 0.75rem;
  }

  .iq-navbar .navbar-inner {
    padding: calc(0.5rem + env(safe-area-inset-top, 0px)) 0.75rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
    gap: 0.6rem;
    /* --- INICIO CORRECCIÓN HEADER --- */
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    /* --- FIN CORRECCIÓN HEADER --- */
  }

  .iq-navbar .sidebar-toggle {
    margin-left: calc(6px + env(safe-area-inset-left, 0px));
    z-index: 1060;
    flex-shrink: 0; /* Evita que el botón se encoja */
  }

  .fx-navbar-main {
    /* --- INICIO CORRECCIÓN HEADER --- */
    flex: 1; /* Ocupa el espacio sobrante */
    min-width: 0; /* Permite que el título se trunque si es necesario */
    text-align: center; /* Centra el título */
    /* --- FIN CORRECCIÓN HEADER --- */
  }

  .fx-page-title {
    font-size: 1.1rem;
    margin: 0;
  }

  .fx-subtitle { display: none; }

  .fx-navbar-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
    /* --- INICIO CORRECCIÓN HEADER --- */
    justify-content: flex-end;
    /* --- FIN CORRECCIÓN HEADER --- */
  }

  .fx-navbar-actions .btn {
    min-height: 38px;
    padding: 0.4rem 0.75rem;
    font-size: 0.95rem;
    flex: 1 1 auto;
    text-align: center;
  }
  .fx-navbar-actions .btn-icon {
    flex: 0 0 auto;
  }

  /* Etiqueta que aparece dentro del sidebar cuando está abierto (móvil) */
  .sidebar .sidebar-open-label {
    display: none;
    margin-left: 0.5rem;
    font-weight: 700;
    color: var(--fx-text);
    font-size: 1rem;
  }

  .sidebar.open .sidebar-open-label {
    display: inline-block;
  }

  #contractForm .col-12.d-flex.flex-wrap.gap-2 .btn {
    min-height: 44px;
  }

  .fx-card .card-header,
  .fx-card .card-body {
    padding: 0.85rem;
  }

  .fx-page-title { font-size: 1.1rem; }

  .fx-subtitle { font-size: 0.82rem; }

  .metric-value { font-size: 1.35rem; }

  .table { font-size: 0.86rem; }

  .table thead th,
  .table td { white-space: nowrap; }

  .fc .fc-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .fc .fc-toolbar .fc-center,
  .fc .fc-toolbar .fc-left,
  .fc .fc-toolbar .fc-right {
    float: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  /* Fix fullcalendar squishing days */
  .fc-view-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }
  .fc-view {
    min-width: 600px;
  }
}

/* Scoped rules for contratos page to avoid global side-effects */
.contratos-page .table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: -ms-autohiding-scrollbar;
}

.contratos-page .table {
  width: 100%;
  min-width: 0;
}

.contratos-page .input-group .form-control {
  min-width: 0;
  width: 100%;
}

.contratos-page .table .btn {
  min-width: 44px; /* tactile target on mobile */
}

.contratos-page .content-inner img,
.contratos-page .content-inner svg,
.contratos-page .content-inner iframe,
.contratos-page .pdf-viewer canvas {
  max-width: 100%;
  height: auto;
}

/* Sticky headers only scoped to tables inside contratos page.
   Sticky will take effect when the table container scrolls vertically.
   Background and z-index set to avoid overlap with dropdowns. */
.contratos-page .table-responsive thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--fx-surface);
}

/* Fallback HTML para vista de contrato (contrato.html) */
#contractMainColumn .contract-html-fallback-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-align: left;
  overflow: hidden;
}

#contractMainColumn .contract-html-fallback-frame,
#contractMainColumn .contract-html-fallback {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 820px;
  height: calc(100vh - 220px);
  border: 1px solid var(--fx-border);
  border-radius: 0.75rem;
  background: #fff;
  overflow: auto;
}

@media (max-width: 991px) {
  #contractMainColumn .contract-html-fallback-frame,
  #contractMainColumn .contract-html-fallback {
    height: calc(100vh - 190px);
    min-height: 70vh;
  }
}

/* Cuando el PDF falla y se usa fallback HTML, el contrato debe ocupar todo el ancho útil. */
body.contract-html-fallback-active #contractPrimaryColumn {
  flex: 0 0 100%;
  max-width: 100%;
  width: 100%;
  min-width: 0;
}

body.contract-html-fallback-active #contractSidebarWrapper {
  display: none;
}

body.contract-html-fallback-active #contractContainer,
body.contract-html-fallback-active #contractMainColumn,
body.contract-html-fallback-active #contractMainColumn .contract-html-fallback-shell,
body.contract-html-fallback-active #contractMainColumn .contract-html-fallback-frame {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.contratos-page { min-width: 0; }

/* Scoped UI for plantilla page */
.plantilla-page {
  min-width: 0;
}

.plantilla-page .template-list {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
}

.plantilla-page .template-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  border-radius: 0.95rem;
  padding: 0.9rem 1rem;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.plantilla-page .template-item:hover {
  transform: translateY(-1px);
  border-color: rgba(13, 110, 253, 0.35);
  box-shadow: 0 8px 28px rgba(16, 24, 40, 0.08);
}

.plantilla-page .template-item.is-active {
  border-color: rgba(25, 135, 84, 0.45);
  background: linear-gradient(180deg, rgba(25, 135, 84, 0.06), rgba(255, 255, 255, 0.98));
}

.plantilla-page .template-item-title {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.plantilla-page .template-item-desc {
  font-size: 0.92rem;
  color: #6c757d;
}

.plantilla-page .template-item-meta {
  margin-top: 0.55rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.84rem;
  color: #6c757d;
}

.plantilla-page .template-documents-list {
  display: grid;
  gap: 0.75rem;
}

.plantilla-page .template-doc-group {
  display: grid;
  gap: 0.55rem;
}

.plantilla-page .template-doc-group-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: #343a40;
}

.plantilla-page .template-doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.75rem;
  background: #fff;
}

.plantilla-page .template-doc-item.pending {
  border-style: dashed;
  background: #fafcff;
}

.plantilla-page .template-section-card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 1rem;
  padding: 1rem;
  background: #fff;
}

.plantilla-page .section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: #212529;
}

.plantilla-page .section-toggle input {
  width: 1rem;
  height: 1rem;
}

.plantilla-page .template-preview-shell {
  width: 100%;
  min-height: 720px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 1rem;
  overflow: hidden;
  background: #fff;
}

.plantilla-page .template-preview-shell iframe {
  display: block;
  width: 100%;
  min-height: 720px;
  border: 0;
  background: #fff;
}

@media (max-width: 992px) {
  .plantilla-page .template-preview-shell,
  .plantilla-page .template-preview-shell iframe {
    min-height: 540px;
  }
}

@media (max-width: 576px) {
  .plantilla-page .template-item-meta,
  .plantilla-page .template-doc-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .plantilla-page .template-preview-shell,
  .plantilla-page .template-preview-shell iframe {
    min-height: 480px;
  }
}

@media (max-width: 767px) {
  .content-inner {
    padding: 0.5rem;
  }

  .fx-month-card .card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }

  .fx-page-title {
    font-size: 1rem;
  }

  .fx-subtitle {
    margin-top: 0.15rem;
    font-size: 0.77rem;
    line-height: 1.35;
  }

  .btn,
  .btn-sm {
    min-height: 46px;
    font-size: 0.95rem;
  }

  #contractForm .col-12.d-flex.flex-wrap.gap-2 {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 0.55rem !important;
  }

  #contractForm .col-12.d-flex.flex-wrap.gap-2 .btn,
  #paymentForm > .btn {
    width: 100%;
    justify-content: center;
  }

  #contractsTableBody .btn,
  #timelineTableBody .btn {
    min-height: 40px;
    font-size: 0.86rem;
    padding: 0.35rem 0.7rem;
  }

  .fx-search-input {
    width: 100%;
    max-width: 100%;
  }

  .fx-menu-grid {
    grid-template-columns: 1fr;
  }

  .fx-option-card {
    padding: 0.64rem;
  }

  .fx-option-icon {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  /* Scoped rules for formulario page */
  .formulario-page .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: -ms-autohiding-scrollbar;
  }

  .formulario-page .card { max-width: 100%; }

  .formulario-page .input-group .form-control { min-width: 0; width: 100%; }

  .formulario-page .content-inner img,
  .formulario-page .content-inner svg,
  .formulario-page .content-inner iframe { max-width: 100%; height: auto; }

  /* Ensure contract form controls behave on small screens */
  .formulario-page #contractForm .col-md-4,
  .formulario-page #contractForm .col-md-3,
  .formulario-page #contractForm .col-md-6 { min-width: 0; }

  .formulario-page #contractForm .input-group { width: 100%; }

  /* Documents preview thumbnails flow */
  .formulario-page #documentsPreview .position-relative { width: auto; }
  .formulario-page #documentsPreview img { width: 64px; height: 64px; object-fit: cover; }

  /* Search input and small controls full width on mobile */
  .formulario-page .fx-search-input { width: 100%; }

  .fx-option-name {
    font-size: 0.92rem;
  }

  .fx-option-helper {
    font-size: 0.72rem;
  }

  /* Contract document view: keep Letter-page layout on all screens */

  .fx-card {
    border-radius: 0.9rem;
  }

  .fx-card .card-header,
  .fx-card .card-body {
    padding: 0.75rem;
  }

  .fx-card .card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }
  .fx-card .card-header .text-end {
    text-align: left !important;
  }
  .fx-card .card-header > div.d-flex,
  .fx-card .card-header > div.w-100 {
    width: 100%;
    justify-content: flex-start !important;
  }

  .metric-label {
    font-size: 0.72rem;
  }

  .metric-value {
    font-size: 1.2rem;
  }

  /* ── Tablas: permitir scroll horizontal sin forzar min-width ── */
  .table {
    min-width: 0;
    font-size: 0.82rem;
    width: 100%;
  }

  .table thead th,
  .table td {
    white-space: nowrap;
    padding: 0.45rem 0.5rem;
  }

  /* Tablas con muchas columnas (contratos, cuentas) sí necesitan scroll */
  .table-responsive .table {
    min-width: 540px;
  }

  /* ── Ticket de servicios: tabla compacta que quepa en pantalla ── */
  #paymentSummary .table {
    min-width: 0 !important;
    font-size: 0.78rem;
  }

  #paymentSummary .table th,
  #paymentSummary .table td {
    padding: 0.3rem 0.35rem;
    white-space: normal;
    word-break: break-word;
  }

  #paymentSummary .table th:first-child,
  #paymentSummary .table td:first-child {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .status-badge {
    font-size: 0.68rem;
  }

  .fc {
    font-size: 0.82rem;
  }

  .fc .fc-button {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
  }

  .fc .fc-toolbar h2 {
    font-size: 1rem;
    margin: 0;
  }

  /* ── Metric cards: 2 columnas en móvil ── */
  .row > .col-sm-6.col-xl-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }

  /* ── Contract page wrapper: auto-fit en mobile ── */
  .contract-page-wrapper {
    width: 100% !important;
    padding: 4mm 2mm !important;
  }

  .contract-card-body {
    padding: 0.5rem !important;
  }

  .docx-contract {
    font-size: 0.82rem;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .docx-services-table {
    font-size: 0.75rem;
  }

  .docx-services-table td {
    padding: 0.2rem 0.3rem;
    word-break: break-word;
  }

  /* ── Override Word-exported fixed widths on mobile ── */
  .docx-contract table,
  .docx-contract table.MsoTableGrid {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: auto !important;
  }

  /* Se excluye .docx-sign-table para que no rompa el layout de las firmas y el QR */
  .docx-contract table:not(.docx-sign-table) td {
    width: auto !important;
    max-width: 100%;
    word-break: break-word;
  }

  .docx-contract p,
  .docx-contract li,
  .docx-contract span {
    word-break: break-word;
    overflow-wrap: break-word;
  }
}

@media print {
  .sidebar,
  .fx-sidebar-backdrop,
  .iq-navbar.fx-navbar,
  .print-hidden {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding-top: 0;
  }

  .fx-card {
    box-shadow: none;
    border: none;
  }

  .docx-contract::before {
    opacity: 0.06;
  }
}

/* Revertir ajuste del toggle: restaurar tamaño y posición más conservadores (móvil) */
@media (max-width: 991px) {
  .iq-navbar .sidebar-toggle {
    margin-left: calc(6px + env(safe-area-inset-left, 0px));
    margin-right: 0.5rem;
    transform: none;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .iq-navbar .sidebar-toggle svg {
    width: 22px;
    height: 22px;
  }
}

/* Centrar el botón 'Nuevo contrato' debajo del título */
.fx-page-cta {
  margin-top: 0.6rem;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.fx-page-cta .btn {
  min-width: 140px;
}
@media (max-width: 767px) {
  .fx-page-cta {
    margin-top: 0.55rem;
    justify-content: flex-start;
  }
  .fx-page-cta .btn {
    width: auto;
    max-width: none;
    display: inline-flex;
    margin: 0 !important;
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* ══════════════════════════════════════════════════════════════════
   EXTRA SMALL: Pantallas ≤ 480px (iPhone SE, teléfonos compactos)
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .content-inner {
    padding: 0.35rem;
  }

  .fx-card .card-header,
  .fx-card .card-body {
    padding: 0.65rem;
  }

  /* Métricas: 1 columna en pantallas muy chicas si es necesario */
  .row > .col-sm-6.col-xl-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .metric-value {
    font-size: 1.05rem;
  }

  .metric-label {
    font-size: 0.68rem;
  }

  .metric-meta {
    font-size: 0.74rem;
  }

  /* Tablas: permitir scroll pero más compactas */
  .table-responsive .table {
    min-width: 480px;
  }

  .table thead th,
  .table td {
    font-size: 0.75rem;
    padding: 0.35rem 0.4rem;
  }

  /* Ticket: compactar aún más en pantallas chicas */
  #paymentSummary {
    font-size: 0.82rem;
  }

  #paymentSummary .d-flex span,
  #paymentSummary .d-flex strong {
    font-size: 0.82rem;
  }

  #paymentSummary .table {
    font-size: 0.72rem;
  }

  #paymentSummary .table th:first-child,
  #paymentSummary .table td:first-child {
    max-width: 90px;
  }

  /* Formulario: campos más compactos */
  .form-control,
  .form-select,
  textarea {
    font-size: 0.9rem;
    padding: 0.45rem 0.6rem;
  }

  .form-label {
    font-size: 0.82rem;
  }

  /* FullCalendar optimizar para pantalla chica */
  .fc .fc-toolbar {
    font-size: 0.75rem;
  }

  .fc .fc-toolbar h2 {
    font-size: 0.88rem;
  }

  .fc .fc-daygrid-day-number {
    font-size: 0.75rem;
    padding: 2px 4px;
  }

  /* Service options: compactar más */
  .fx-option-card {
    padding: 0.5rem;
  }

  .fx-option-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .fx-option-name {
    font-size: 0.84rem;
  }

  .fx-qty-btn {
    width: 30px;
    height: 30px;
  }

  /* Botones: ajustar para touch en pantallas chicas */
  .btn {
    font-size: 0.88rem;
    padding: 0.5rem 0.85rem;
  }

  .btn-sm {
    font-size: 0.82rem;
    padding: 0.38rem 0.7rem;
  }

  /* Contrato: asegurar que se ve bien */
  .contract-page-wrapper {
    padding: 2mm 1mm !important;
  }

  .docx-contract {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .docx-services-table {
    font-size: 0.68rem;
  }

  .docx-sign-table {
    font-size: 0.68rem;
  }
}

/* ══════════════════════════════════════════════════════════════════
   GLOBAL RESPONSIVE UTILITIES
   ══════════════════════════════════════════════════════════════════ */

/* Prevent horizontal overflow on any screen */
html, body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

/* Smooth transitions for layout changes */
.row, .col-sm-6, .col-xl-3, .col-lg-4, .col-lg-5, .col-lg-7, .col-lg-8, .col-md-3, .col-md-4, .col-12 {
  transition: flex 0.2s ease, max-width 0.2s ease;
}

/* Make all images responsive by default */
img {
  max-width: 100%;
  height: auto;
}

/* Ensure card headers wrap properly on all screens */
.fx-card .card-header {
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Force word-break on long text everywhere */
.card-body,
.table td,
td {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Pagos ticket container: prevent overflow */
#paymentSummary {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Table responsive: smooth scroll indicator */
.table-responsive {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* ══════════════════════════════════════════════════════════════════
   ADMINISTRADOR DE SERVICIOS (Cards)
   ══════════════════════════════════════════════════════════════════ */
.fx-service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.fx-service-card {
  background: var(--fx-surface);
  border: 1px solid var(--fx-border);
  border-radius: 1rem;
  padding: 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.fx-service-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(108, 43, 217, 0.08);
  border-color: rgba(108, 43, 217, 0.3);
}

.fx-service-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fx-text);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.fx-service-price {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--fx-primary);
  margin-bottom: 1rem;
}

.fx-service-price span {
  font-size: 0.85rem;
  color: var(--fx-muted);
  font-weight: 600;
}

.fx-service-base-price {
  font-size: 0.85rem;
  font-weight: 600;
  color: #6c757d;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

.fx-service-base-price span {
  font-size: 0.75rem;
  color: var(--fx-muted);
  font-weight: 500;
}

.fx-service-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  border-top: 1px solid var(--fx-border);
  padding-top: 1rem;
}

.fx-service-actions .btn {
  flex: 1;
  min-height: 36px;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.3rem;
}

.fx-service-card.add-new {
  border: 2px dashed var(--fx-border);
  background: rgba(108, 43, 217, 0.02);
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  min-height: 160px;
  color: var(--fx-primary);
}

.fx-service-card.add-new:hover {
  background: rgba(108, 43, 217, 0.06);
  border-color: var(--fx-primary);
}

/* ══════════════════════════════════════════════════════════════════
   PÁGINA DE CONTRATO
   ══════════════════════════════════════════════════════════════════ */

.preview-sheet {
  background: #fff;
  box-shadow: 0 2px 16px 0 rgba(0,0,0,0.12), 0 1.5px 4px 0 rgba(0,0,0,0.10);
  border-radius: 8px;
  margin: 0 auto;
  padding: 24mm 16mm;
  width: 210mm;
  min-height: 297mm;
  max-width: 100%;
  position: relative;
  border: 1.2px solid #e0e0e0;
  overflow: auto; /* Permite scroll dentro de la hoja */
}

/* Clase de ayuda para preparar la hoja para la generación de PDF */
.printing-pdf-source {
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible !important;
}

.contract-controls {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.contract-print-btn {
  font-size: 1rem;
  padding: 10px 24px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fx-sidebar-widget {
  position: sticky;
  top: 20px;
  z-index: 10;
}

.fx-widget-title {
  color: #333;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1.5rem;
}

.fx-doc-card {
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.fx-doc-card:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}

.fx-doc-card .card-img-top {
  height: 220px;
  object-fit: cover;
  background-color: #f8f9fa;
}

.fx-doc-card .card-footer {
  font-size: 11px;
}

#fullscreen-image-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.85);
  z-index: 999999;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

#fullscreen-image-overlay.show {
  opacity: 1;
  visibility: visible;
}

#fullscreen-image-content {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  object-fit: contain;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.fx-lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
}

@media print {
  .preview-sheet { box-shadow: none !important; border: none !important; margin: 0 !important; padding: 0 !important; background: #fff !important; }
  .contract-controls { display: none !important; }
  #contractMainColumn { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }
  #contractSidebarColumn { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════
   PÁGINA PÚBLICA DE SERVICIOS
   ══════════════════════════════════════════════════════════════════ */

.fx-public-service-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fx-public-service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(108, 43, 217, 0.1);
}

.fx-public-service-card .card-title {
  font-weight: 700;
  color: var(--fx-text);
}

.fx-public-service-price {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--fx-primary);
  margin-top: 0.75rem;
}

/* ══════════════════════════════════════════════════════════════════
   SISTEMA DE TOASTS, MODALES Y BOTONES ANIMADOS (UX/UI MEJORADA)
   ══════════════════════════════════════════════════════════════════ */

#fx-toast-container,
#fx-notification-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 100005;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100% - 32px, 380px);
  pointer-events: none;
}

.fx-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #ffffff;
  color: #1e293b;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-left: 4px solid var(--fx-primary, #3a57e8);
  opacity: 0;
  transform: translateX(110%);
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.fx-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.fx-toast.fx-toast-hiding {
  opacity: 0;
  transform: translateX(110%);
}

.fx-toast-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.fx-toast-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.fx-toast-body {
  flex-grow: 1;
  min-width: 0;
}

.fx-toast-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 2px;
  color: #0f172a;
}

.fx-toast-content,
.fx-toast-message {
  font-size: 0.85rem;
  line-height: 1.4;
  color: #475569;
  word-break: break-word;
}

.fx-toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  transition: color 0.15s ease, transform 0.15s ease;
}

.fx-toast-close:hover {
  color: #334155;
  transform: scale(1.1);
}

/* Variantes de color para Toasts */
.fx-toast-success {
  border-left-color: #10b981;
}
.fx-toast-success .fx-toast-icon {
  color: #10b981;
}

.fx-toast-error {
  border-left-color: #ef4444;
}
.fx-toast-error .fx-toast-icon {
  color: #ef4444;
}

.fx-toast-warning {
  border-left-color: #f59e0b;
}
.fx-toast-warning .fx-toast-icon {
  color: #f59e0b;
}

.fx-toast-info {
  border-left-color: #3a57e8;
}
.fx-toast-info .fx-toast-icon {
  color: #3a57e8;
}

.fx-toast-loading {
  border-left-color: #6366f1;
}
.fx-toast-loading .fx-toast-icon {
  color: #6366f1;
}

/* Spinner sutil para toast y botones */
.fx-spinner {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.15em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: fx-spin 0.65s linear infinite;
}

@keyframes fx-spin {
  to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════════════════════════
   MODAL DE CONFIRMACIÓN MODERNO
   ══════════════════════════════════════════════════════════════════ */
.fx-confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100010;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.fx-confirm-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.fx-confirm-card {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.2), 0 0 1px 1px rgba(15, 23, 42, 0.05);
  transform: scale(0.95) translateY(8px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.fx-confirm-backdrop.show .fx-confirm-card {
  transform: scale(1) translateY(0);
}

.fx-confirm-header {
  padding: 20px 24px 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.fx-confirm-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fx-confirm-icon.danger {
  background: #fee2e2;
  color: #ef4444;
}

.fx-confirm-icon.warning {
  background: #fef3c7;
  color: #d97706;
}

.fx-confirm-icon.info {
  background: #e0e7ff;
  color: #4f46e5;
}

.fx-confirm-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.fx-confirm-body {
  padding: 0 24px 20px 24px;
  color: #475569;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-line;
}

.fx-confirm-footer {
  padding: 14px 24px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ══════════════════════════════════════════════════════════════════
   MICRO-ANIMACIONES Y ESTADOS DE BOTONES
   ══════════════════════════════════════════════════════════════════ */
.btn.fx-btn-loading,
button.fx-btn-loading {
  position: relative;
  pointer-events: none !important;
  opacity: 0.88;
  cursor: not-allowed !important;
}

.btn.fx-btn-success,
button.fx-btn-success {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
  transition: all 0.25s ease;
}

.btn.fx-btn-error,
button.fx-btn-error {
  background-color: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  transition: all 0.25s ease;
}

@media (max-width: 576px) {
  #fx-toast-container,
  #fx-notification-container {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
  }
  .fx-confirm-card {
    max-width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   FANTASIA UI pack: mini-mode, pestaña activa, breadcrumbs, paginador,
   carrusel de eventos y animaciones accesibles
   ═══════════════════════════════════════════════════════════════════ */

/* 1) Pestaña activa bien visible */
.sidebar .nav-link {
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.sidebar .nav-link.active {
  background: linear-gradient(135deg, #6c2bd9 0%, #8b5cf6 100%) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(108, 43, 217, 0.35);
  font-weight: 600;
}
.sidebar .nav-link.active svg {
  color: #fff !important;
}

/* 2) Modo mini en escritorio (collapse): solo iconos */
@media (min-width: 992px) {
  body.fx-mini .sidebar {
    width: 78px !important;
  }
  body.fx-mini .sidebar .logo-title,
  body.fx-mini .sidebar .item-name,
  body.fx-mini .sidebar .nav-item.static-item {
    display: none !important;
  }
  body.fx-mini .sidebar .navbar-brand {
    justify-content: center;
  }
  body.fx-mini .sidebar .nav-link {
    justify-content: center;
    padding: 0.7rem 0 !important;
  }
  body.fx-mini .sidebar .nav-link svg {
    width: 22px;
    height: 22px;
  }
  body.fx-mini .main-content {
    margin-left: 78px !important;
  }
  body.fx-mini .iq-navbar.fx-navbar {
    left: 78px;
  }
  .sidebar,
  .main-content,
  .iq-navbar.fx-navbar {
    transition: width 0.25s ease, margin-left 0.25s ease, left 0.25s ease;
  }
}

/* 3) Migas de pan */
.fx-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.9rem;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
}
.fx-crumb-link {
  color: #6c2bd9;
  text-decoration: none;
  font-weight: 600;
}
.fx-crumb-link:hover {
  text-decoration: underline;
}
.fx-crumb-sep {
  color: #a5adcb;
  font-weight: 700;
}
.fx-crumb-current {
  color: #334155;
  font-weight: 700;
}

/* 4) Paginador */
.fx-pager {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  justify-content: center;
  padding: 0.7rem 0.5rem;
  flex-wrap: wrap;
}
.fx-page-btn {
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0 0.5rem;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.fx-page-btn:hover:not(:disabled) {
  border-color: #6c2bd9;
  color: #6c2bd9;
}
.fx-page-btn.active {
  background: #6c2bd9;
  border-color: #6c2bd9;
  color: #fff;
}
.fx-page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.fx-pager-meta {
  color: #8a92a6;
  font-size: 0.78rem;
  margin-left: 0.4rem;
}

/* 5) Carrusel de próximos eventos (dashboard) */
.fx-carousel {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(120deg, #4c1d95 0%, #6d28d9 55%, #8b5cf6 100%);
  color: #fff;
  box-shadow: 0 10px 30px rgba(76, 29, 149, 0.28);
}
.fx-carousel::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
.fx-slide {
  display: none;
  padding: 1.1rem 1.25rem 2.6rem;
  animation: fxSlideIn 0.45s ease;
}
.fx-slide.active {
  display: block;
}
@keyframes fxSlideIn {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; }
}
.fx-slide-grid {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}
.fx-slide-date {
  text-align: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  padding: 0.5rem 0.9rem;
  min-width: 86px;
}
.fx-slide-date .day {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
}
.fx-slide-date .mon {
  font-size: 0.78rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fde68a;
}
.fx-slide-info {
  flex: 1;
  min-width: 200px;
}
.fx-slide-kicker {
  font-size: 0.72rem;
  letter-spacing: 2px;
  color: #e9d5ff;
  font-weight: 700;
}
.fx-slide-type {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0.1rem 0;
}
.fx-slide-client {
  font-size: 0.95rem;
  color: #f5f3ff;
}
.fx-slide-client a {
  color: #fff;
  font-weight: 700;
}
.fx-slide-count {
  background: #f59e0b;
  color: #4c1d95;
  font-weight: 800;
  border-radius: 20px;
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  white-space: nowrap;
}
.fx-car-btn {
  position: absolute;
  bottom: 10px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  z-index: 2;
  transition: background-color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fx-car-btn:hover {
  background: rgba(255, 255, 255, 0.32);
}
.fx-car-prev { right: 52px; }
.fx-car-next { right: 12px; }
.fx-dots {
  position: absolute;
  left: 1.25rem;
  bottom: 0.55rem;
  display: flex;
  gap: 0.3rem;
}
.fx-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  padding: 0;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.fx-dot.active {
  background: #fde68a;
  transform: scale(1.25);
}

/* 6) Animaciones accesibles y transiciones suaves */
.sidebar .nav-link svg,
.fx-option-card,
.fx-page-btn,
.fx-car-btn,
.fx-dot {
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
