/* ==========================================================================
   Montaigne Fix — Mundana Navy & Gold Design System & Viewport Breakout
   Basado en la Guía de Estilo y Maquetación para Shortcodes en WordPress (estilo.md)
   ========================================================================== */

/* 1. NEUTRALIZACIÓN DE DESBORDAMIENTO HORIZONTAL EN EL DOCUMENTO */
html {
  overflow-x: clip;
}

body:has(.mf-full-width) {
  overflow-x: clip;
}

/* 2. FORZAR ANCHO COMPLETO EN CONTENEDORES DE TEMAS POPULARES (Astra, Gutenberg, Divi, etc.) */
body:has(.mf-full-width) .entry-content,
body:has(.mf-full-width) .site-content,
body:has(.mf-full-width) .ast-container,
body:has(.mf-full-width) .ast-separate-container,
body:has(.mf-full-width) .ast-article-single,
body:has(.mf-full-width) .ast-plain-container,
body:has(.mf-full-width) .content-area,
body:has(.mf-full-width) .site-main,
body:has(.mf-full-width) main,
body:has(.mf-full-width) #main,
body:has(.mf-full-width) #primary,
body:has(.mf-full-width) #content,
body:has(.mf-full-width) .site,
body:has(.mf-full-width) #page,
body:has(.mf-full-width) article,
body:has(.mf-full-width) article.page,
body:has(.mf-full-width) .wp-site-blocks,
body:has(.mf-full-width) .wp-block-post-content,
body:has(.mf-full-width) .wp-block-group,
body:has(.mf-full-width) .wp-block-shortcode,
body:has(.mf-full-width) .container,
body:has(.mf-full-width) .container-fluid {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
}

/* Neutralizar restricciones de temas basados en bloques (FSE / Gutenberg) */
body:has(.mf-full-width) .is-layout-constrained > :not(.alignleft):not(.alignright),
body:has(.mf-full-width) .is-layout-flow > :not(.alignleft):not(.alignright) {
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* 3. FÓRMULA MATEMÁTICA DE RUPTURA DE CONTENEDOR (VIEWPORT BREAKOUT) */
.mf-full-width {
  width: calc(100vw - 100px) !important;
  max-width: calc(100vw - 100px) !important;
  position: relative !important;
  left: 50% !important;
  right: 50% !important;
  margin-left: calc(-50vw + 50px) !important;
  margin-right: calc(-50vw + 50px) !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* Portátiles compactos (992px a 1199px): 30px por cada lado */
@media (max-width: 1199px) {
  .mf-full-width {
    width: calc(100vw - 60px) !important;
    max-width: calc(100vw - 60px) !important;
    margin-left: calc(-50vw + 30px) !important;
    margin-right: calc(-50vw + 30px) !important;
  }
}

/* Tablets (768px a 991px): 20px por cada lado */
@media (max-width: 991px) {
  .mf-full-width {
    width: calc(100vw - 40px) !important;
    max-width: calc(100vw - 40px) !important;
    margin-left: calc(-50vw + 20px) !important;
    margin-right: calc(-50vw + 20px) !important;
  }
}

/* Móviles (< 768px): Restablecer flujo normal con padding mínimo */
@media (max-width: 768px) {
  .mf-full-width {
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 10px !important;
  }
}

/* 4. VARIABLES CORPORATIVAS MUNDANA STUDIO */
:root {
  --mf-navy: #0f2238;
  --mf-navy-light: #1e3a5f;
  --mf-gold: #d4af37;
  --mf-gold-light: #fdf6d8;
  --mf-bg: #f8fafc;
  --mf-card-bg: #ffffff;
  --mf-text: #1e293b;
  --mf-text-muted: #64748b;
  --mf-border: #e2e8f0;
  --mf-red: #e11d48;
  --mf-green: #10b981;
  --mf-amber: #f59e0b;
  --mf-radius: 8px;
}

.mf-frontend-wrapper {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--mf-text);
  box-sizing: border-box;
  line-height: 1.5;
  margin-top: 15px;
  margin-bottom: 30px;
}

.mf-frontend-wrapper * {
  box-sizing: border-box;
}

/* 5. TARJETA BASE Y SEPARACIÓN VERTICAL (RITMO DE AIRE) */
.mf-card {
  background: var(--mf-card-bg);
  border-radius: var(--mf-radius);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
  border: 1px solid #e1e8ed;
  padding: 28px 32px;
  width: 100%;
  margin: 0 auto;
}

.mf-card-header {
  border-bottom: 1px solid #e1e8ed;
  padding-bottom: 18px;
  margin-bottom: 26px; /* Separación ampliada para evitar sensación de asfixia */
}

.mf-brand-tag {
  color: var(--mf-gold);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 6px;
}

.mf-card-header h2 {
  color: var(--mf-navy);
  margin: 0 0 6px 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.mf-sede-title {
  color: var(--mf-text-muted);
  font-size: 14px;
  margin: 0;
}

/* 6. REJILLA DE FORMULARIOS ADAPTATIVA (CSS GRID) */
.mf-row {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
  width: 100%;
}

.mf-col-1 { grid-template-columns: 1fr; }
.mf-col-2 { grid-template-columns: repeat(2, 1fr); }
.mf-col-3 { grid-template-columns: repeat(3, 1fr); }
.mf-col-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 992px) {
  .mf-col-4, .mf-col-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 650px) {
  .mf-col-4, .mf-col-3, .mf-col-2 {
    grid-template-columns: 1fr;
  }
}

/* 7. CAMPOS DE ENTRADA CON ERGONOMÍA TÁCTIL */
.mf-field-group {
  margin-bottom: 0;
}

.mf-field-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--mf-navy);
  margin-bottom: 8px;
}

.mf-req {
  color: var(--mf-red);
}

.mf-input, .mf-textarea, .mf-select {
  width: 100%;
  min-height: 42px; /* Cumple WCAG táctil */
  padding: 10px 14px;
  border: 1.5px solid var(--mf-border);
  border-radius: 6px;
  font-size: 15px;
  color: var(--mf-text);
  background: #fff;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.mf-textarea {
  min-height: 90px;
}

.mf-input:focus, .mf-textarea:focus, .mf-select:focus {
  outline: none;
  border-color: var(--mf-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.mf-help-text {
  display: block;
  font-size: 12px;
  color: var(--mf-text-muted);
  margin-top: 6px;
}

.mf-field-checkbox {
  margin: 22px 0;
  font-size: 13px;
  color: var(--mf-text-muted);
  line-height: 1.6;
}

.mf-field-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 8px;
  cursor: pointer;
}

/* 8. BOTONES INTERACTIVOS CON FEEDBACK TÁCTIL */
.mf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  white-space: nowrap !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.mf-btn:active {
  transform: scale(0.98);
}

.mf-btn-primary {
  background: var(--mf-navy);
  color: #ffffff;
}

.mf-btn-primary:hover {
  background: var(--mf-navy-light);
}

.mf-btn-secondary {
  background: #f1f5f9;
  color: var(--mf-navy);
  border: 1px solid var(--mf-border);
}

.mf-btn-secondary:hover {
  background: #e2e8f0;
}

.mf-btn-danger {
  background: var(--mf-red);
  color: #ffffff;
}

.mf-btn-danger:hover {
  background: #be123c;
}

.mf-btn-lg {
  min-height: 48px;
  font-size: 16px;
  padding: 12px 28px;
  width: 100%;
}

.mf-btn-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde047;
}
.mf-btn-warning:hover, .mf-btn-warning.active {
  background: #f59e0b;
  color: #ffffff;
  border-color: #d97706;
}

.mf-btn-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.mf-btn-success:hover, .mf-btn-success.active {
  background: #16a34a;
  color: #ffffff;
  border-color: #15803d;
}

.mf-btn-primary.active {
  background: #0284c7;
  border-color: #0369a1;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.3);
}

.mf-btn-logout {
  font-size: 13px;
  font-weight: 600;
  color: var(--mf-red);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  margin-left: 10px;
  border: 1px solid transparent;
  transition: background-color 0.15s;
}

.mf-btn-logout:hover {
  background: #ffe4e6;
  border-color: #fecdd3;
}

/* 9. REJILLA AUTOAJUSTABLE DE FILTROS DE BÚSQUEDA */
.mf-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 15px;
  margin-bottom: 22px;
  align-items: center;
}

.mf-filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .mf-filter-actions {
    grid-column: 1 / -1;
  }
}

/* Cabecera ergonómica del panel de equipo (H13) */
.mf-team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--mf-border);
}

.mf-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.mf-user-greeting {
  color: var(--mf-navy);
}

.mf-badge-role {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
}

.mf-sede-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mf-btn-logout {
  color: #dc2626;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #fee2e2;
  background: #fef2f2;
}

.mf-btn-logout:hover {
  background: #fee2e2;
}

@media (max-width: 768px) {
  .mf-team-header {
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 10px;
  }
  .mf-sede-selector-wrapper select {
    min-height: 36px;
    padding: 4px 8px;
    font-size: 13px;
  }
}

/* 10. PESTAÑAS (TABS) ERGONÓMICAS */
.mf-team-nav, .mf-header-nav, .mf-subtabs, .mf-shopping-subtabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mf-tab-btn, .mf-nav-tab, .mf-subtab-btn {
  min-height: 40px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  border: 1.5px solid var(--mf-border);
  background: #ffffff;
  border-radius: 6px;
  cursor: pointer;
  color: var(--mf-text-muted);
  white-space: nowrap !important;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.mf-tab-btn:hover, .mf-nav-tab:hover, .mf-subtab-btn:hover {
  border-color: var(--mf-navy-light);
  color: var(--mf-navy);
}

.mf-tab-btn.active, .mf-nav-tab.active, .mf-subtab-btn.active {
  background: var(--mf-navy);
  color: #ffffff;
  border-color: var(--mf-navy);
  box-shadow: 0 2px 4px rgba(15, 34, 56, 0.2);
}

.mf-counter-badge {
  background: var(--mf-red);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: 6px;
}

/* 11. REJILLA DINÁMICA DE TARJETAS DE INCIDENCIA */
.mf-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
  margin-top: 15px;
}

@media (max-width: 600px) {
  .mf-cards-grid {
    grid-template-columns: 1fr;
  }
}

.mf-ticket-card {
  border: 1px solid var(--mf-border);
  border-radius: var(--mf-radius);
  padding: 18px 20px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease, max-height 0.2s ease;
}

.mf-ticket-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.07);
}

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

.mf-card-toggle-btn {
  background: #f1f5f9;
  border: 1px solid var(--mf-border);
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 8px;
  font-size: 13px;
  color: var(--mf-navy);
  font-weight: 700;
  line-height: 1.4;
  margin-left: 6px;
  touch-action: manipulation;
  transition: background 0.15s ease;
}

.mf-card-toggle-btn:hover {
  background: #e2e8f0;
}

/* H13: Tarjetas colapsables para smartphone / alta densidad */
.mf-ticket-card.mf-card-collapsed {
  padding: 12px 16px;
}

.mf-ticket-card.mf-card-collapsed .mf-card-body-full,
.mf-ticket-card.mf-card-collapsed .mf-card-actions {
  display: none !important;
}

.mf-ticket-card.mf-card-collapsed .mf-card-body-summary {
  display: block !important;
  font-size: 13px;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 2px 0 0 0;
}

.mf-ticket-card .mf-card-body-summary {
  display: none;
}

@media (max-width: 768px) {
  .mf-ticket-card {
    padding: 14px 16px;
  }
  .mf-card-code {
    font-size: 14px;
  }
}

.mf-card-code {
  font-weight: 800;
  font-size: 16px;
  color: var(--mf-navy);
  background: var(--mf-bg);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--mf-border);
}

/* Badges */
.mf-badge-p1 { background: #ffe4e6; color: #be123c; font-weight: 800; padding: 3px 9px; border-radius: 4px; font-size: 11px; letter-spacing: 0.5px; }
.mf-badge-p2 { background: #fef3c7; color: #b45309; font-weight: 700; padding: 3px 9px; border-radius: 4px; font-size: 11px; }
.mf-badge-p3 { background: #f1f5f9; color: #475569; padding: 3px 9px; border-radius: 4px; font-size: 11px; }

.mf-badge-status {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap !important;
}

.status-nuevo { background: #e0f2fe; color: #0369a1; }
.status-asignado { background: #fef9c3; color: #854d0e; }
.status-en_curso { background: #fed7aa; color: #9a3412; }
.status-en_espera { background: #f1f5f9; color: #475569; }
.status-resuelto { background: #dcfce7; color: #15803d; }
.status-cerrado { background: #f8fafc; color: #94a3b8; }
.status-rechazado { background: #fee2e2; color: #991b1b; }

.mf-card-body p {
  margin: 6px 0;
  font-size: 14px;
  color: #334155;
}

.mf-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--mf-border);
  flex-wrap: wrap;
  align-items: center;
}

/* 12. TABLAS DE DATOS CON SCROLL TÁCTIL SUAVE */
.mf-table-responsive {
  width: 100%;
  overflow-x: auto;
  margin-top: 15px;
  -webkit-overflow-scrolling: touch;
}

.mf-table {
  width: 100% !important;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
  background: #ffffff;
}

.mf-table th {
  background: #f8fafc;
  color: var(--mf-navy);
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 2px solid var(--mf-border);
  white-space: nowrap;
}

.mf-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.mf-table tr:hover td {
  background: #fafcff;
}

.mf-table th:last-child,
.mf-table td:last-child {
  white-space: nowrap !important;
}

/* 13. TARJETAS KPI DE ESTADÍSTICAS */
.mf-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
  margin-top: 15px;
}

.mf-kpi-card {
  background: #ffffff;
  border: 1px solid var(--mf-border);
  border-left: 4px solid var(--mf-navy);
  border-radius: var(--mf-radius);
  padding: 18px 22px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.mf-kpi-card .num {
  font-size: 30px;
  font-weight: 800;
  color: var(--mf-navy);
  line-height: 1.1;
}

.mf-kpi-card .lbl {
  font-size: 12px;
  color: var(--mf-text-muted);
  margin-top: 6px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.mf-stats-tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 22px;
  margin-top: 20px;
}

@media (max-width: 600px) {
  .mf-stats-tables-grid {
    grid-template-columns: 1fr;
  }
}

.mf-stats-block {
  background: #ffffff;
  border: 1px solid var(--mf-border);
  border-radius: var(--mf-radius);
  padding: 20px;
}

.mf-stats-block h4 {
  margin: 0 0 14px 0;
  color: var(--mf-navy);
  font-size: 16px;
  font-weight: 700;
}

/* 14. PREVISUALIZACIÓN DE FOTOS */
.mf-photo-dropzone {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.mf-photo-previews {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mf-photo-thumb {
  position: relative;
  width: 85px;
  height: 85px;
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid var(--mf-border);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.mf-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mf-photo-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  background: rgba(15, 34, 56, 0.75);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.mf-photo-remove:hover {
  background: var(--mf-red);
}

/* 15. MODALES Y LIGHTBOX */
.mf-modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 34, 56, 0.65);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
}

.mf-modal-content {
  background: #ffffff;
  border-radius: var(--mf-radius);
  max-width: 520px;
  width: 92%;
  padding: 32px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  text-align: center;
  border: 1px solid var(--mf-border);
}

.mf-modal-icon {
  width: 56px;
  height: 56px;
  background: #dcfce7;
  color: #15803d;
  font-size: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.mf-ticket-code {
  font-size: 26px;
  font-weight: 800;
  color: var(--mf-navy);
  background: var(--mf-bg);
  padding: 12px 20px;
  border-radius: 6px;
  border: 2px dashed var(--mf-gold);
  margin: 18px 0;
  letter-spacing: 1px;
}

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

.mf-lightbox-content {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mf-lightbox-content img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
  user-select: none;
}

.mf-lightbox-close {
  position: absolute;
  top: -38px;
  right: 0;
  color: #ffffff;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s ease;
  z-index: 12;
}

.mf-lightbox-close:hover {
  color: var(--mf-gold);
}

.mf-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 34, 56, 0.72);
  backdrop-filter: blur(4px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, transform 0.15s ease, color 0.2s ease, border-color 0.2s ease;
  z-index: 10;
}

.mf-lightbox-nav:hover {
  background: rgba(15, 34, 56, 0.95);
  border-color: var(--mf-gold);
  color: var(--mf-gold);
}

.mf-lightbox-nav:active {
  transform: translateY(-50%) scale(0.92);
}

.mf-lightbox-prev {
  left: -24px;
}

.mf-lightbox-next {
  right: -24px;
}

.mf-lightbox-counter {
  position: absolute;
  bottom: -34px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 34, 56, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 14px;
  letter-spacing: 0.8px;
  white-space: nowrap;
  z-index: 10;
}

@media (max-width: 768px) {
  .mf-lightbox-prev {
    left: 8px;
  }
  .mf-lightbox-next {
    right: 8px;
  }
  .mf-lightbox-nav {
    width: 42px;
    height: 42px;
    font-size: 18px;
    background: rgba(15, 34, 56, 0.85);
  }
}

/* 16. SPINNER Y MENSAJES */
.mf-loading {
  padding: 24px;
  text-align: center;
  color: var(--mf-text-muted);
  font-weight: 600;
}

.mf-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(15, 34, 56, 0.2);
  border-radius: 50%;
  border-top-color: var(--mf-navy);
  animation: mf-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

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

.mf-empty-msg {
  padding: 36px;
  text-align: center;
  color: var(--mf-text-muted);
  font-size: 15px;
  background: var(--mf-bg);
  border-radius: 6px;
  border: 1px dashed var(--mf-border);
}

/* ==========================================================================
   18. UX/UI REDESIGN (BOCETO MÓVIL MONTAIGNE FIX & REVISIÓN UX_UI)
   ========================================================================== */

/* Cabecera compacta 56px Navy */
.mf-compact-header {
  height: 56px !important;
  background: var(--mf-navy) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 14px !important;
  border-radius: 12px 12px 0 0 !important;
  color: #ffffff !important;
  margin-bottom: 0 !important;
  border-bottom: 2px solid var(--mf-gold) !important;
}

.mf-header-title {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.mf-header-brand {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
}

.mf-header-sub {
  font-size: 11px;
  font-weight: 600;
  color: #e3c27a;
}

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

.mf-badge-sandbox-pill {
  font-size: 10px;
  font-weight: 700;
  color: #0f2238;
  background: #fcd34d;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.mf-btn-header-tool,
.mf-btn-logout-compact {
  height: 38px;
  padding: 0 10px;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff !important;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}

.mf-btn-header-tool:hover,
.mf-btn-logout-compact:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Menú desplegable de Ajustes */
.mf-settings-dropdown-wrapper {
  position: relative;
}

.mf-settings-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: #ffffff;
  border: 1px solid var(--mf-border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(15, 34, 56, 0.15);
  min-width: 190px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 4px;
}

.mf-settings-item {
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--mf-text);
  font: 500 13px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-align: left;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mf-settings-item:hover {
  background: #f1f5f9;
  color: var(--mf-navy);
}

.mf-settings-back-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--mf-border);
  margin-bottom: 14px;
}

/* Barra de Pestañas Principales (4 pestañas) */
.mf-main-tabs-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #ffffff;
  border-bottom: 1px solid var(--mf-border);
}

.mf-team-nav {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.mf-main-tab {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0 4px;
}

.mf-main-tab.active {
  font-weight: 700;
  color: var(--mf-navy);
  border-bottom-color: #c9a24b;
}

.mf-tab-badge {
  font-size: 11px;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
  border-radius: 999px;
  padding: 1px 7px;
}

.mf-main-tab.active .mf-tab-badge {
  background: var(--mf-navy);
  color: #ffffff;
}

.mf-tab-badge.danger {
  background: #dc2626 !important;
  color: #ffffff !important;
}

/* Barra de Filtros en Chips Horizontales */
.mf-chips-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  white-space: nowrap;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  -webkit-overflow-scrolling: touch;
}

.mf-chips-bar::-webkit-scrollbar {
  display: none;
}

.mf-chip-select {
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font: 500 13px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1e293b;
  cursor: pointer;
  outline: none;
}

.mf-chip-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font: 500 13px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1e293b;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mf-chip-btn.active {
  background: var(--mf-navy);
  border-color: var(--mf-navy);
  color: #ffffff;
  font-weight: 600;
}

.mf-search-inline-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mf-chip-input {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #0f2238;
  font-size: 13px;
  min-width: 180px;
  outline: none;
}

.mf-btn-clear-search {
  height: 28px;
  width: 28px;
  border-radius: 50%;
  border: 0;
  background: #e2e8f0;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* Subfiltros en la pestaña Cerradas */
.mf-subfilters-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #edf2f7;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
}

.mf-subfilter-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-right: 4px;
}

.mf-subfilter-chip {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font: 500 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #334155;
  cursor: pointer;
}

.mf-subfilter-chip.active {
  background: var(--mf-navy);
  color: #ffffff;
  border-color: var(--mf-navy);
  font-weight: 600;
}

/* Contenedor de Tarjetas Compactas */
.mf-cards-compact-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
}

/* Tarjeta de Incidencia Compacta */
.mf-ticket-card-compact {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.mf-ticket-card-compact:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 34, 56, 0.08);
}

.mf-ticket-card-compact.mf-card-expanded {
  border: 1px solid #94a3b8;
  border-radius: 14px;
  padding: 14px;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(15, 34, 56, 0.10);
  background: #ffffff;
}

.mf-compact-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mf-card-code {
  font-size: 14px;
  font-weight: 700;
  color: var(--mf-navy);
}

.mf-badge-prio {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}

.mf-badge-prio.prio-p1 {
  background: #fee2e2;
  color: #991b1b;
}

.mf-badge-prio.prio-p2 {
  background: #ffedd5;
  color: #9a3412;
}

.mf-badge-prio.prio-p3 {
  background: #e2e8f0;
  color: #334155;
}

.mf-badge-prio.prio-none {
  display: none;
}

.mf-badge-assigned {
  font-size: 11px;
  font-weight: 600;
  background: #ede9fe;
  color: #5b21b6;
  padding: 2px 8px;
  border-radius: 999px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mf-badge-assigned.unassigned {
  background: #f1f5f9;
  color: #64748b;
}

.mf-flex-spacer {
  flex-grow: 1;
}

.mf-card-expand-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: #f1f5f9;
  border-radius: 6px;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.mf-card-expanded .mf-card-expand-btn {
  transform: rotate(180deg);
}

.mf-compact-location {
  font-size: 13.5px;
  font-weight: 600;
  color: #1e293b;
}

.mf-compact-desc {
  font-size: 13px;
  color: #475569;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mf-card-expanded .mf-compact-desc {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

/* Contenido de la Tarjeta Desplegada */
.mf-expanded-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.mf-expanded-meta {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mf-expanded-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mf-expanded-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.5px;
}

.mf-btn-group-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.mf-btn-status-toggle {
  height: 44px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font: 600 13px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mf-btn-status-toggle.active[data-status="en_curso"] {
  background: #fef3c7;
  border-color: #92400e;
  color: #92400e;
  font-weight: 700;
}

.mf-btn-status-toggle.active[data-status="en_espera"] {
  background: #ffe4e6;
  border-color: #9f1239;
  color: #9f1239;
  font-weight: 700;
}

.mf-btn-status-toggle.active[data-status="resuelto"] {
  background: #166534;
  border-color: #166534;
  color: #ffffff;
  font-weight: 700;
}

.mf-expanded-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.mf-prio-toggle-group {
  display: flex;
  gap: 4px;
}

.mf-prio-btn {
  height: 44px;
  width: 44px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font: 700 13px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.mf-prio-btn.active.p1 {
  background: #fee2e2;
  border-color: #991b1b;
  border-width: 2px;
  color: #991b1b;
}

.mf-prio-btn.active.p2 {
  background: #ffedd5;
  border-color: #9a3412;
  border-width: 2px;
  color: #9a3412;
}

.mf-prio-btn.active.p3 {
  background: #e2e8f0;
  border-color: #334155;
  border-width: 2px;
  color: #334155;
}

.mf-expanded-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.mf-btn-main-action {
  flex-grow: 1;
  height: 44px;
  border-radius: 10px;
  border: 0;
  background: var(--mf-navy);
  font: 700 13.5px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.15s ease;
}

.mf-btn-main-action:hover {
  opacity: 0.92;
}

.mf-btn-more-actions {
  width: 92px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font: 600 13.5px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1e293b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.mf-btn-more-actions:hover {
  background: #f1f5f9;
}

/* Tarjeta de Técnico en fila única con botón de acción rápida */
.mf-team-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mf-team-card-info {
  flex-grow: 1;
  min-width: 0;
}

.mf-team-quick-btn {
  flex-shrink: 0;
  width: 96px;
  height: 48px;
  border-radius: 10px;
  border: 0;
  background: var(--mf-navy);
  font: 700 13px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mf-team-quick-btn.outline {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--mf-navy);
}

.mf-team-quick-btn.resolve {
  background: #166534;
  color: #ffffff;
}

/* Bloque embebido de Materiales en la tarjeta del técnico */
.mf-embedded-materials {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mf-embedded-mat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.mf-btn-team-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

/* BOTTOM SHEET MODAL (MENÚ DESLIZANTE DESDE ABAJO) */
.mf-bottom-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 34, 56, 0.58);
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: mf-fade-in 0.2s ease-out;
}

.mf-bottom-sheet-panel {
  background: #ffffff;
  width: 100%;
  max-width: 480px;
  border-radius: 20px 20px 0 0;
  padding: 10px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
  animation: mf-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 85vh;
  overflow-y: auto;
}

.mf-bottom-sheet-handle {
  width: 40px;
  height: 5px;
  border-radius: 999px;
  background: #cbd5e1;
  align-self: center;
  margin-bottom: 6px;
}

.mf-bottom-sheet-header {
  padding: 0 4px 10px;
  border-bottom: 1px solid #e2e8f0;
}

.mf-bottom-sheet-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--mf-navy);
}

.mf-bottom-sheet-subtitle {
  font-size: 12px;
  color: #64748b;
}

.mf-bottom-sheet-actions {
  display: flex;
  flex-direction: column;
}

.mf-bs-item {
  height: 52px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  font: 500 14px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1e293b;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.mf-bs-item:hover {
  background: #f1f5f9;
}

.mf-bs-item.danger {
  color: #b91c1c;
  font-weight: 600;
  border-top: 1px solid #e2e8f0;
  margin-top: 4px;
}

.mf-bs-icon {
  font-size: 18px;
  width: 24px;
  display: inline-flex;
  justify-content: center;
}

.mf-bs-cancel {
  margin-top: 8px;
  height: 46px;
  border-radius: 12px;
  background: #f1f5f9;
  font-weight: 600;
  font-size: 14px;
  color: var(--mf-navy);
  border: 0;
  cursor: pointer;
}

@keyframes mf-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes mf-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Enlaces clicables de la lista de la compra */
.mf-shop-ticket-link {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--mf-navy);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
}

.mf-shop-ticket-link:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

/* Responsividad en pantallas pequeñas (<640px) */
@media (max-width: 640px) {
  .mf-card {
    padding: 12px !important;
    border-radius: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
  }
  .mf-compact-header {
    border-radius: 0 !important;
  }
  .mf-hide-mobile {
    display: none !important;
  }
  .mf-main-tab {
    font-size: 12px !important;
    gap: 4px !important;
  }
  .mf-tab-badge {
    padding: 1px 5px !important;
    font-size: 10px !important;
  }
}

/* 17. AISLAMIENTO PARA IMPRESIÓN Y GENERACIÓN DE PDF (@media print) */
@media print {
  @page {
    margin: 12mm 15mm 15mm 15mm;
    size: A4 portrait;
  }

  html, body {
    background: #ffffff !important;
    color: #111827 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  /* Ocultar elementos de navegación y cabecera del tema de WordPress */
  #wpadminbar,
  header,
  footer,
  nav,
  aside,
  .site-header,
  .site-footer,
  #masthead,
  #colophon,
  .main-navigation,
  .sidebar,
  .mf-header-nav,
  .mf-filters-grid,
  .mf-card-actions,
  .mf-filter-actions,
  .mf-btn,
  button {
    display: none !important;
    visibility: hidden !important;
  }

  .mf-full-width {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    left: 0 !important;
    right: 0 !important;
  }

  .mf-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .mf-ticket-card,
  .mf-stats-block,
  tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}
