/* V41 - Detalles oscuros completos y acciones de modales sin recortes. */

/* Incidencias: las vistas de detalle tienen reglas claras propias. Esta capa
   se carga al final y adapta todas sus superficies sin tocar el tema claro. */
html[data-theme="dark"] .ticket-problem-card,
html[data-theme="dark"] .ticket-muted-panel,
html[data-theme="dark"] .ticket-summary-item,
html[data-theme="dark"] .ticket-section details,
html[data-theme="dark"] .ticket-section .detail-body,
html[data-theme="dark"] .ticket-section .work-row,
html[data-theme="dark"] .ticket-section .timeline-card,
html[data-theme="dark"] .ticket-main-layout .work-row,
html[data-theme="dark"] .ticket-main-layout .timeline-card {
  background:#162434!important;
  background-image:none!important;
  border-color:#30475b!important;
  color:#edf4fb!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .ticket-section details > summary {
  background:#132231!important;
  background-image:none!important;
  color:#f2f7fb!important;
  border-color:#30475b!important;
}
html[data-theme="dark"] .ticket-section details[open] > summary {
  background:#1a2d3e!important;
}
html[data-theme="dark"] .ticket-main-layout :is(
  .ticket-desc,
  .card-title,
  h2,
  h3,
  h4,
  b,
  strong,
  p
),
html[data-theme="dark"] .ticket-summary-item b {
  color:#edf4fb!important;
}
html[data-theme="dark"] .ticket-main-layout :is(
  .card-subtitle,
  .muted,
  .small,
  .ticket-section summary small
),
html[data-theme="dark"] .ticket-summary-item span {
  color:#a9bacb!important;
}
html[data-theme="dark"] .ticket-main-layout hr {
  border:0!important;
  border-top:1px solid #30475b!important;
  background:transparent!important;
}
html[data-theme="dark"] .ticket-main-layout .photo-row img {
  border-color:#3b5368!important;
}

/* Albaranes locales y sincronizados: la vista incluye CSS blanco dentro del
   propio contenido, por lo que se fuerza una superficie oscura posterior. */
html[data-theme="dark"] .delivery-print-wrap .delivery-doc {
  background:#162434!important;
  background-image:none!important;
  border-color:#30475b!important;
  color:#edf4fb!important;
  box-shadow:0 18px 45px rgba(0,0,0,.24)!important;
}
html[data-theme="dark"] .delivery-print-wrap .delivery-doc-head {
  border-color:#30475b!important;
}
html[data-theme="dark"] .delivery-print-wrap :is(.delivery-info-box,.delivery-line) {
  background:#101d2a!important;
  background-image:none!important;
  border-color:#30475b!important;
  color:#edf4fb!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .delivery-print-wrap :is(
  .delivery-doc-title h1,
  .delivery-doc h2,
  .delivery-doc h3,
  .delivery-doc b,
  .delivery-doc strong,
  .delivery-summary,
  .delivery-doc p
) {
  color:#edf4fb!important;
}
html[data-theme="dark"] .delivery-print-wrap :is(.delivery-doc-title p,.delivery-doc .muted,.delivery-doc small) {
  color:#a9bacb!important;
}
html[data-theme="dark"] .delivery-print-wrap .delivery-stel-note {
  background:#3a2d18!important;
  background-image:none!important;
  border-color:#765a2b!important;
  color:#ffe0a5!important;
}

/* Panel de usuarios: cabecera, formulario y acciones forman una columna real.
   Ningun boton queda por debajo del borde ni fuera del area visible. */
.user-modal-v14 {
  display:flex!important;
  flex-direction:column!important;
  max-height:min(92dvh,900px)!important;
  overflow:hidden!important;
  padding:0!important;
  box-sizing:border-box!important;
}
.user-modal-v14 > h2,
.user-modal-v14 > .card-subtitle {
  flex:0 0 auto!important;
}
.user-modal-v14 > form {
  flex:1 1 auto!important;
  min-height:0!important;
  max-height:none!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior:contain!important;
  padding-bottom:0!important;
  scrollbar-gutter:stable!important;
}
.user-modal-v14 .form-actions {
  bottom:0!important;
  box-sizing:border-box!important;
  padding-bottom:calc(14px + env(safe-area-inset-bottom,0px))!important;
}
.user-modal-v14 > .modal-extra-actions {
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:8px!important;
  flex:0 0 auto!important;
  width:100%!important;
  margin:0!important;
  padding:12px 26px calc(18px + env(safe-area-inset-bottom,0px))!important;
  border-top:1px solid var(--gtic-line)!important;
  border-radius:0 0 27px 27px!important;
  background:#fff!important;
  box-sizing:border-box!important;
  overflow:visible!important;
}
.user-modal-v14 > .modal-extra-actions form,
.user-modal-v14 > .modal-extra-actions .btn {
  width:100%!important;
  min-width:0!important;
  margin:0!important;
  box-sizing:border-box!important;
}
html[data-theme="dark"] .user-modal-v14 > .modal-extra-actions {
  background:#101d2a!important;
  border-color:#30475b!important;
}
html[data-theme="dark"] .user-modal-v14 > form {
  background:#162434!important;
}

@media(max-width:760px) {
  .user-modal-v14 {
    max-height:calc(100dvh - 18px)!important;
  }
  .user-modal-v14 > .modal-extra-actions {
    grid-template-columns:1fr!important;
    padding:10px 16px calc(14px + env(safe-area-inset-bottom,0px))!important;
    border-radius:0 0 22px 22px!important;
  }
  .user-modal-v14 > form {
    padding-inline:16px!important;
  }
  .user-modal-v14 .form-actions {
    margin-inline:-16px!important;
    padding-inline:16px!important;
  }
}

/* La impresion del albaran se mantiene blanca aunque el usuario use oscuro. */
@media print {
  html[data-theme="dark"] .delivery-print-wrap .delivery-doc,
  html[data-theme="dark"] .delivery-print-wrap :is(.delivery-info-box,.delivery-line) {
    background:#fff!important;
    color:#172033!important;
    border-color:#d8e2ea!important;
    box-shadow:none!important;
  }
  html[data-theme="dark"] .delivery-print-wrap :is(
    .delivery-doc-title h1,
    .delivery-doc h2,
    .delivery-doc h3,
    .delivery-doc b,
    .delivery-doc strong,
    .delivery-summary,
    .delivery-doc p
  ) {
    color:#172033!important;
  }
  html[data-theme="dark"] .delivery-print-wrap :is(.delivery-doc-title p,.delivery-doc .muted,.delivery-doc small) {
    color:#64748b!important;
  }
}
