/* Soportes — UI moderna (tokens Innar, motion, móvil) */
#view-reportes-pdx,
#view-armado-soportes {
  --sop-text: var(--innar-text, #0f172a);
  --sop-text-muted: var(--innar-text-muted, #64748b);
  --sop-border: var(--innar-border, #e2e8e7);
  --sop-surface: var(--innar-surface, #fff);
  --sop-focus: var(--c-primary, #8aa6a1);
  --sop-focus-ring: var(--innar-focus-ring, 0 0 0 3px rgba(138, 166, 161, 0.35));
}

#view-reportes-pdx.view-module:not(.hidden),
#view-armado-soportes.view-module:not(.hidden) {
  display: block;
  min-height: 100vh;
}

#view-reportes-pdx.view-module:not(.hidden) ~ .app-footer,
#view-armado-soportes.view-module:not(.hidden) ~ .app-footer {
  display: none;
}

.sop-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--innar-page-bg);
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--sop-text);
}

.sop-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 64px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.sop-topbar-left,
.sop-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sop-topbar-logo {
  height: 34px;
  width: auto;
}

.sop-topbar-center {
  text-align: center;
  flex: 1;
  min-width: 0;
}

.sop-topbar-divider {
  width: 1px;
  height: 28px;
  background: var(--sop-border);
  margin: 0 8px;
}

.sop-topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sop-text);
  letter-spacing: -0.02em;
}

.sop-topbar-sub {
  font-size: 0.78rem;
  color: var(--sop-text-muted);
  font-weight: 500;
}

.sop-mobile-only {
  display: none !important;
}

.sop-body {
  flex: 1;
  padding: 24px 28px 40px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Botones: ver innar-buttons.css (.sop-btn-* unificado) */

.sop-panel {
  background: var(--sop-surface);
  border: 1px solid var(--sop-border);
  border-radius: var(--innar-radius-lg, 16px);
  box-shadow: var(--innar-shadow-md);
  overflow: hidden;
}

.sop-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid #f1f5f9;
}

.sop-panel-head h2,
.sop-panel-head h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  flex: 1;
}

.sop-panel-body {
  padding: 20px;
}

.sop-search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 480px;
}

.sop-search-wrap i,
.sop-search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #94a3b8;
  pointer-events: none;
}

.sop-search {
  width: 100%;
  padding: 12px 14px 12px 44px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.95rem;
  background: #f8fafc;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.sop-search:focus {
  outline: none;
  border-color: var(--sop-focus);
  box-shadow: var(--sop-focus-ring);
  background: var(--sop-surface);
}

.sop-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}

.sop-toggle input {
  accent-color: var(--c-active, #8aa6a1);
  width: 16px;
  height: 16px;
}

.sop-toggle-hint {
  position: relative;
}

.sop-hint-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: help;
  flex-shrink: 0;
}

.sop-hint-badge:hover,
.sop-hint-badge:focus {
  background: #cbd5e1;
  color: #334155;
  outline: none;
}

/* Leyenda temas PDX */
.sop-tema-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.78rem;
  color: #64748b;
}

.sop-tema-legend-title {
  font-weight: 700;
  color: #475569;
  margin-right: 4px;
}

.sop-tema-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sop-tema-legend-item::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--sop-leg-color, #94a3b8);
}

.sop-tema-legend-item[data-tema="vtm"] { --sop-leg-color: #2563eb; }
.sop-tema-legend-item[data-tema="psg"] { --sop-leg-color: #7c3aed; }
.sop-tema-legend-item[data-tema="eeg"] { --sop-leg-color: #ca8a04; }
.sop-tema-legend-item[data-tema="actigrafia"] { --sop-leg-color: #0891b2; }
.sop-tema-legend-item[data-tema="neutral"] { --sop-leg-color: #64748b; }
.sop-tema-legend-item[data-tema="ordenes"] { --sop-leg-color: #0d9488; }

/* Resumen día / mes */
.sop-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.sop-summary-row.hidden { display: none; }

.sop-summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
}

.sop-summary-chip strong { color: #0f172a; }

.sop-summary-chip.ok {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.sop-summary-chip.warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.sop-badge-listo {
  background: #dcfce7;
  color: #166534;
}

.sop-badge-pendiente {
  background: #f1f5f9;
  color: #64748b;
}

/* Resultados búsqueda PDX */
.sop-search-results {
  margin-bottom: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.sop-search-results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.sop-search-results-head h4 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  flex: 1;
}

.sop-search-results-meta {
  font-size: 0.8rem;
  color: #64748b;
}

.sop-search-results-body {
  padding: 0;
}

/* Skeletons */
@keyframes sop-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.sop-skeleton-block {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: sop-shimmer 1.2s ease-in-out infinite;
  border-radius: 10px;
}

.sop-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.sop-skeleton-folder-card {
  height: 148px;
  border-radius: 14px;
}

.sop-skeleton-nav-item {
  height: 40px;
  margin-bottom: 4px;
  border-radius: 10px;
}

.sop-skeleton-table-row td {
  padding: 14px 16px;
}

.sop-skeleton-table-row .sop-skeleton-block {
  height: 14px;
  width: 70%;
}

.sop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.sop-folder-card {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.15s;
  overflow: hidden;
}

.sop-folder-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--sop-accent, #94a3b8);
}

.sop-folder-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
  border-color: #cbd5e1;
}

.sop-folder-card[data-tema="vtm"] { --sop-accent: #2563eb; }
.sop-folder-card[data-tema="psg"] { --sop-accent: #7c3aed; }
.sop-folder-card[data-tema="eeg"] { --sop-accent: #ca8a04; }
.sop-folder-card[data-tema="actigrafia"] { --sop-accent: #0891b2; }
.sop-folder-card[data-tema="neutral"] { --sop-accent: #64748b; }
.sop-folder-card[data-tema="ordenes"] { --sop-accent: #0d9488; }

.sop-folder-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--sop-accent) 12%, white);
  color: var(--sop-accent);
  margin-bottom: 12px;
}

.sop-folder-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
  line-height: 1.35;
  margin-bottom: 6px;
}

.sop-folder-meta {
  font-size: 0.8rem;
  color: #64748b;
}

.sop-folder-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--sop-border);
}

.sop-folder-card .sop-folder-actions .sop-btn {
  flex: 1;
  justify-content: center;
}

.sop-panel-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.sop-contenedores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.sop-contenedor-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 16px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sop-contenedor-card:hover {
  border-color: color-mix(in srgb, var(--c-mid) 40%, #e2e8f0);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.sop-contenedor-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--c-mid) 12%, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-mid);
  margin-bottom: 10px;
}
.sop-contenedor-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #0f172a;
}
.sop-contenedor-meta {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 4px;
}

.sop-dropzone-compact {
  padding: 16px 20px;
  min-height: auto;
}
.sop-dropzone-compact .sop-dropzone-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sop-pdx-format-help {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--innar-accent-soft);
  border: 1px solid var(--innar-accent-border);
  border-radius: 12px;
  font-size: 0.82rem;
  color: var(--sop-text-muted);
}

.sop-pdx-format-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--sop-text);
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.sop-pdx-format-pattern {
  margin: 0 0 8px;
}

.sop-pdx-format-pattern code {
  display: block;
  padding: 8px 10px;
  background: var(--sop-surface);
  border-radius: 8px;
  border: 1px solid var(--sop-border);
  font-size: 0.78rem;
  line-height: 1.45;
  word-break: break-word;
  color: var(--c-dark);
}

.sop-pdx-format-ejemplo {
  margin: 0 0 6px;
  font-size: 0.8rem;
}

.sop-pdx-format-nota {
  margin: 0;
  font-size: 0.78rem;
}

.sop-dropzone-label {
  font-weight: 600;
  color: var(--sop-text);
}

.sop-dropzone-hint {
  font-size: 0.8rem;
  color: var(--sop-text-muted);
  margin-top: 4px;
}

.sop-upload-preview {
  margin: 12px 0 16px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--sop-border);
  border-radius: 10px;
  font-size: 0.85rem;
}

.sop-upload-preview dt {
  font-weight: 600;
  color: var(--sop-text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  margin-top: 8px;
}

.sop-upload-preview dd {
  margin: 2px 0 0;
  color: var(--sop-text);
}

.sop-upload-warn {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.8rem;
}

.sop-pdx-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--c-mid) 6%, #fff);
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--c-mid) 12%, transparent);
}
.sop-pdx-filtro-texto { flex: 1 1 200px; min-width: 160px; margin: 0; }
.sop-pdx-filtro-sel { min-width: 140px; max-width: 220px; }
.sop-select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.875rem;
  background: #fff;
}
.sop-pdx-archivo-nombre {
  font-size: 0.78rem;
  color: #64748b;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.sop-pdx-meta-user {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 2px;
}
.sop-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.sop-dialog-pdf {
  max-width: min(96vw, 920px);
  width: 100%;
}
.sop-pdf-frame {
  width: 100%;
  height: min(72vh, 640px);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}
.sop-lote-table { width: 100%; font-size: 0.82rem; border-collapse: collapse; }
.sop-lote-table th, .sop-lote-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}
.sop-lote-table input[type="text"], .sop-lote-table input[type="date"] {
  width: 100%;
  min-width: 90px;
  padding: 6px 8px;
  font-size: 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}
.sop-lote-manual td { background: #fffbeb; }
.sop-hist-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.sop-hist-list li {
  padding: 10px 0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.85rem;
}
.sop-hist-list li:last-child { border-bottom: none; }
.sop-hist-tipo { font-weight: 600; color: #0f172a; }
.sop-hist-meta { color: #64748b; font-size: 0.78rem; margin-top: 2px; }
@media (max-width: 640px) {
  .sop-pdx-filtros { flex-direction: column; align-items: stretch; }
  .sop-pdx-filtro-sel { max-width: none; width: 100%; }
}

.sop-upload-ok {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 0.8rem;
}

.sop-estudio-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  background: color-mix(in srgb, var(--sop-estudio-color, #64748b) 14%, white);
  color: var(--sop-estudio-color, #475569);
}

.sop-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  margin-top: 10px;
}

.sop-badge-activa { background: #dcfce7; color: #166534; }
.sop-badge-gracia { background: #fef3c7; color: #92400e; }
.sop-badge-archivo { background: #f1f5f9; color: #475569; }

.sop-empty {
  text-align: center;
  padding: 48px 24px;
  color: #94a3b8;
}

.sop-empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  opacity: 0.45;
  color: #64748b;
}

.sop-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 16px;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

.sop-breadcrumb:hover { color: var(--c-active, #2563eb); }

/* Migas de pan / contexto */
.sop-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 0 0 16px;
  font-size: 0.84rem;
  color: #64748b;
}

.sop-breadcrumbs .sop-crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: default;
}

.sop-breadcrumbs .sop-crumb.is-link {
  cursor: pointer;
  color: var(--c-mid, #5a8a85);
}

.sop-breadcrumbs .sop-crumb.is-link:hover {
  background: rgba(138, 166, 161, 0.12);
}

.sop-breadcrumbs .sop-crumb.is-current {
  color: #0f172a;
  font-weight: 700;
}

.sop-breadcrumbs .sop-crumb-sep {
  color: #cbd5e1;
  user-select: none;
  padding: 0 2px;
}

.sop-context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.84rem;
  color: #475569;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.sop-context-bar .sop-context-label {
  font-weight: 700;
  color: #0f172a;
}

/* Progreso expediente FE */
.sop-exp-progress {
  margin: 0 0 16px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.sop-exp-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: #64748b;
}

.sop-exp-progress-head strong {
  color: #0f172a;
  font-size: 0.9rem;
}

.sop-exp-progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.sop-exp-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--c-mid, #5a8a85), var(--c-active, #8aa6a1));
  transition: width 0.35s ease;
}

.sop-exp-progress-fill.is-complete {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}

.sop-exp-progress-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.sop-exp-progress-slot {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #94a3b8;
}

.sop-exp-progress-slot.done {
  background: #dcfce7;
  color: #166534;
}

/* Importar PDX — resultados en modal */
.sop-import-results {
  max-height: 220px;
  overflow-y: auto;
  margin: 12px 0 4px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.sop-import-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.12s;
}

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

.sop-import-item:hover { background: #f8fafc; }

.sop-import-item.selected {
  background: var(--innar-accent-soft);
  outline: 2px solid var(--c-primary);
  outline-offset: -2px;
}

.sop-import-item-meta {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 2px;
}

.sop-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 28px;
  text-align: center;
  background: linear-gradient(180deg, #f8fafc, #fff);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 20px;
}

.sop-dropzone:hover,
.sop-dropzone.sop-dropzone-active {
  border-color: var(--sop-focus);
  background: var(--innar-accent-soft);
}

.sop-dropzone.sop-dropzone-disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}

.sop-dropzone-icon {
  color: var(--c-mid);
  margin-bottom: 8px;
}

.sop-table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.sop-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.sop-table th {
  text-align: left;
  padding: 12px 16px;
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sop-table td {
  padding: 14px 16px;
  border-top: 1px solid #f1f5f9;
  color: #334155;
}

.sop-table tbody tr:hover td {
  background: #fafbfc;
}

/* Armado soportes — sidebar fijo izquierda + contenido derecha */
.sop-armado-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
  min-height: calc(100vh - 64px);
  min-height: calc(100dvh - 64px);
  position: relative;
}

.sop-arm-sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--sop-border, #e2e8e7);
  box-shadow: none;
  border-radius: 0;
  min-height: 100%;
  overflow: hidden;
}

.sop-arm-sidebar-head {
  padding: 16px 18px 12px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.sop-arm-sidebar-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.sop-arm-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 20px;
}

.sop-arm-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 28px 40px;
  box-sizing: border-box;
}

.sop-arm-main .sop-context-bar {
  margin: 0;
}

.sop-arm-content-panel {
  flex: 1;
  min-height: 280px;
}

@media (max-width: 960px) {
  .sop-mobile-only {
    display: inline-flex !important;
  }

  .sop-armado-layout {
    flex-direction: column;
    min-height: 0;
  }

  .sop-arm-sidebar {
    position: fixed;
    left: 0;
    top: 64px;
    bottom: 0;
    width: min(300px, 88vw);
    max-width: 300px;
    z-index: 40;
    margin: 0;
    transform: translateX(-105%);
    transition: transform var(--motion-normal, 0.32s) var(--motion-ease-out, ease);
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.15);
    border-radius: 0;
  }

  .sop-armado-layout.sop-nav-open .sop-arm-sidebar {
    transform: translateX(0);
  }

  .sop-armado-layout.sop-nav-open .sop-nav-backdrop:not(.hidden) {
    display: block;
  }

  .sop-arm-main {
    padding: 16px;
    width: 100%;
  }

  .sop-arm-main .sop-context-bar {
    position: sticky;
    top: 64px;
    z-index: 15;
  }

  .sop-nav-list { max-height: 40vh; }
}

.sop-nav-block {
  margin-bottom: 16px;
}

.sop-nav-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin: 0 0 8px 4px;
}

.sop-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}

.sop-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  color: #334155;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}

.sop-nav-item:hover {
  background: #f1f5f9;
}

.sop-nav-item.active {
  background: var(--innar-accent-soft);
  border-color: var(--innar-accent-border);
  color: var(--c-dark);
  font-weight: 600;
}

.sop-nav-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.sop-nav-item-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.sop-nav-item-actions .sop-btn-sm {
  padding: 2px 6px;
}

.sop-nav-item-actions [data-dia-del] {
  color: #dc2626;
}

.sop-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.sop-slot-card {
  border-radius: 14px;
  padding: 16px;
  border: 2px solid #e2e8f0;
  background: #fafbfc;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s;
}

.sop-slot-card.ok {
  border-color: #86efac;
  background: linear-gradient(180deg, #f0fdf4, #fff);
}

.sop-slot-card.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.sop-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sop-slot-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: #0f172a;
}

.sop-slot-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
}

.sop-slot-card.ok .sop-slot-status {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.sop-slot-file {
  font-size: 0.78rem;
  color: #64748b;
  word-break: break-word;
  flex: 1;
}

.sop-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 16px 0;
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

/* Modales en body: tokens propios (fuera de #view-armado-soportes) */
.sop-dialog-backdrop {
  --sop-dialog-bg: #ffffff;
  --sop-dialog-text: #0f172a;
  --sop-dialog-muted: #475569;
  --sop-dialog-border: #e2e8f0;
  --sop-dialog-focus: var(--c-primary, #5a7d78);
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(4px);
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.sop-dialog-backdrop .sop-dialog {
  background: var(--sop-dialog-bg);
  color: var(--sop-dialog-text);
  border-radius: 16px;
  padding: 24px 24px 20px;
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(15, 23, 42, 0.06);
  border: 1px solid var(--sop-dialog-border);
}

.sop-dialog-backdrop .sop-dialog h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--sop-dialog-text);
}

.sop-dialog-backdrop .sop-dialog h3 [data-lucide],
.sop-dialog-backdrop .sop-dialog h3 svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--c-dark, #2d4a47);
}

.sop-dialog-lead {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--sop-dialog-border);
  border-radius: 10px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--sop-dialog-muted);
}

.sop-dialog-lead strong {
  color: var(--sop-dialog-text);
  font-weight: 700;
}

.sop-dialog-lead code {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0f172a;
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
}

.sop-dialog-backdrop .sop-field {
  margin-bottom: 0;
}

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

.sop-dialog-backdrop .sop-field label .sop-label-opt {
  font-weight: 500;
  color: var(--sop-dialog-muted);
}

.sop-dialog-backdrop .sop-field input,
.sop-dialog-backdrop .sop-field select,
.sop-dialog-backdrop .sop-field textarea {
  width: 100%;
  padding: 11px 14px !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 10px !important;
  font-size: 0.9375rem !important;
  font-weight: 500 !important;
  color: var(--sop-dialog-text) !important;
  background: #fff !important;
  min-height: 44px;
  box-sizing: border-box;
}

.sop-dialog-backdrop .sop-field input::placeholder {
  color: #94a3b8 !important;
  font-weight: 400 !important;
}

.sop-dialog-backdrop .sop-field input:focus,
.sop-dialog-backdrop .sop-field select:focus,
.sop-dialog-backdrop .sop-field textarea:focus {
  outline: none !important;
  border-color: var(--sop-dialog-focus) !important;
  box-shadow: 0 0 0 3px rgba(90, 125, 120, 0.28) !important;
}

.sop-dialog-backdrop .sop-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--sop-dialog-border);
}

.sop-dialog-backdrop .sop-dialog-actions .sop-btn {
  min-height: 40px;
  padding: 9px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.875rem;
}

/* Compat: reglas sin backdrop (por si se usan dentro del módulo) */
.sop-dialog {
  background: var(--sop-surface, #fff);
  border-radius: var(--innar-radius-lg, 16px);
  padding: 24px;
  max-width: 440px;
  width: 100%;
}

.sop-field {
  margin-bottom: 16px;
}

.sop-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.sop-field input,
.sop-field select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.9375rem;
  box-sizing: border-box;
}

.sop-field input:focus,
.sop-field select:focus {
  outline: none;
  border-color: var(--sop-focus, #5a7d78);
  box-shadow: var(--sop-focus-ring, 0 0 0 3px rgba(90, 125, 120, 0.28));
}

.sop-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

.sop-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.sop-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-size: 0.82rem;
  color: #475569;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sop-stat-chip strong {
  color: #0f172a;
}

.sop-pdx-theme .sop-topbar { border-bottom-color: color-mix(in srgb, var(--c-mid) 25%, transparent); }
.sop-arm-theme .sop-topbar { border-bottom-color: color-mix(in srgb, var(--c-dark) 20%, transparent); }

/* Drawer navegación móvil (armado) */
.sop-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 35;
  backdrop-filter: blur(2px);
}

.sop-nav-backdrop:not(.hidden) {
  display: block;
}

.sop-file-input-hidden {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

/* ── Móvil: topbar, paneles y tablas (PDX + Armado) ───────────────────────── */
@media (max-width: 768px) {
  .sop-topbar {
    flex-wrap: wrap;
    align-items: center;
    height: auto;
    min-height: 56px;
    padding: 8px 12px;
    gap: 8px 10px;
  }

  .sop-topbar-left {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
  }

  .sop-topbar-logo,
  .sop-topbar-divider {
    display: none;
  }

  .sop-topbar-center {
    order: 3;
    flex: 1 1 100%;
    text-align: left;
    padding-top: 2px;
  }

  .sop-topbar-sub {
    display: none;
  }

  .sop-topbar-title {
    font-size: 0.95rem;
  }

  .sop-topbar-right {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    max-width: 100%;
  }

  .sop-topbar-right .sop-btn {
    font-size: 0;
    line-height: 0;
    padding: 10px;
    min-width: 40px;
    min-height: 40px;
    gap: 0;
  }

  .sop-topbar-right .sop-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  .sop-topbar-left .sop-btn.sop-btn-sm {
    padding: 8px 10px;
    font-size: 0.82rem;
    line-height: 1.2;
    min-width: 0;
    min-height: 40px;
  }

  .sop-body {
    padding: 14px 12px 28px;
  }

  .sop-panel-head {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
  }

  .sop-panel-head-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .sop-panel-body {
    padding: 14px;
  }

  .sop-grid,
  .sop-folder-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .sop-folder-card {
    padding: 14px;
  }

  .sop-folder-actions {
    flex-wrap: wrap;
  }

  .sop-search-wrap {
    width: 100%;
  }

  .sop-panel-head .sop-btn {
    width: 100%;
    justify-content: center;
  }

  .sop-table-wrap {
    margin: 0 -2px;
    -webkit-overflow-scrolling: touch;
  }

  .sop-table-wrap::before {
    content: "← Desliza la tabla →";
    display: block;
    text-align: center;
    font-size: 0.72rem;
    color: #5a7d78;
    padding: 6px 8px 4px;
    font-weight: 600;
    background: #f0f7f6;
    border-radius: 12px 12px 0 0;
  }

  .sop-table {
    min-width: 520px;
  }

  .sop-table-pdx-archivos th:nth-child(4),
  .sop-table-pdx-archivos td:nth-child(4) {
    display: none;
  }

  .sop-table th,
  .sop-table td {
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  .sop-pdx-format-help {
    font-size: 0.85rem;
  }

  .sop-pdx-format-pattern code {
    font-size: 0.72rem;
    word-break: break-word;
  }

  .sop-dropzone {
    padding: 20px 14px;
  }

  .sop-slots {
    grid-template-columns: 1fr;
  }

  .sop-dialog-backdrop {
    padding: 12px;
    align-items: flex-end;
  }

  .sop-dialog-backdrop .sop-dialog {
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }

  .sop-breadcrumbs {
    font-size: 0.78rem;
  }
}

@media (max-width: 480px) {
  .sop-topbar-left .sop-btn.sop-btn-sm {
    font-size: 0;
    line-height: 0;
    padding: 10px;
    min-width: 40px;
  }

  .sop-topbar-left .sop-btn.sop-btn-sm svg {
    width: 20px;
    height: 20px;
  }

  .sop-topbar-right {
    flex: 1 1 100%;
    justify-content: stretch;
  }

  .sop-topbar-right .sop-btn {
    flex: 1;
    justify-content: center;
  }
}
