/* Diagnóstico de pasto — hub Potreros + modal #m-pasto-diag (scoped) */

/* ── Fila Vista general | Dashboard | Diagnosticar ── */
#pg-pot.potreros-serio-v1 .pot-hub-strip {
  display: grid !important;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  overflow-x: auto !important;
}

#pg-pot.potreros-serio-v1 .pot-hub-strip #pot-hub-btn-vista {
  grid-column: 1;
}

#pg-pot.potreros-serio-v1 .pot-hub-strip #pot-hub-btn-dashboard {
  grid-column: 2;
}

#pg-pot.potreros-serio-v1 .pot-hub-strip .pot-diag-cta {
  grid-column: 4;
  height: var(--manto-period-sel-h, 26px) !important;
  min-height: var(--manto-period-sel-min-h, 26px) !important;
  max-height: var(--manto-period-sel-max-h, 26px) !important;
  padding: 0 10px;
  gap: 5px;
  border-radius: 12px !important;
  font-size: var(--manto-period-sel-fs, 12px);
  font-weight: var(--manto-period-sel-fw, 600);
  line-height: 1.15;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#pg-pot.potreros-serio-v1 .pot-hub-strip .pot-diag-cta img {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── Modal NEW MODAL — marco 12px (sin Pebble Vida legacy) ── */
#m-pasto-diag.pasto-diag-modal.modal-nuevo > .mbox.bitacora-mbox,
#m-pasto-diag-det.pasto-diag-det-modal.modal-nuevo > .mbox.bitacora-mbox {
  padding: 0 !important;
  gap: 0 !important;
  border-radius: 12px !important;
  border: 1px solid #d1d9e2 !important;
  overflow: hidden !important;
  background: #ffffff !important;
  box-shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.28) !important;
  max-width: min(520px, 96vw);
}

#m-pasto-diag.pasto-diag-modal.modal-nuevo .modal-serio-body,
#m-pasto-diag-det.pasto-diag-det-modal.modal-nuevo .modal-serio-body {
  display: flex;
  flex-direction: column;
  background: var(--superficie-pagina, #f8fafc);
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 10px !important;
  gap: 8px !important;
}

/* .ani-serio-v2-card global trae margin-bottom:12px → sumaba ~20px con gap:8px */
#m-pasto-diag.pasto-diag-modal.bitacora-serio-v2 .modal-serio-body > .ani-serio-v2-card,
#m-pasto-diag-det.pasto-diag-det-modal.bitacora-serio-v2 .modal-serio-body > .ani-serio-v2-card {
  margin: 0 !important;
  margin-bottom: 0 !important;
}

#m-pasto-diag.pasto-diag-modal.modal-nuevo .pasto-diag-serio-bloque,
#m-pasto-diag-det.pasto-diag-det-modal.modal-nuevo .pasto-diag-serio-bloque {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 !important;
  margin-bottom: 0 !important;
}

#m-pasto-diag.pasto-diag-modal.modal-nuevo .pasto-diag-serio-bloque > .fg,
#m-pasto-diag-det.pasto-diag-det-modal.modal-nuevo .pasto-diag-serio-bloque > .fg {
  margin-bottom: 0 !important;
}

#m-pasto-diag.pasto-diag-modal.modal-nuevo .ani-serio-v2-footer-shell,
#m-pasto-diag-det.pasto-diag-det-modal.modal-nuevo .ani-serio-v2-footer-shell {
  background: var(--manto-newmodal-foot-bg-light, linear-gradient(168deg, #f1f5f9 0%, #e2e8f0 55%, #dbe2ea 100%));
  border: none !important;
  border-top: 1px solid var(--manto-newmodal-h-border-color-light, #94a3b8) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

#m-pasto-diag.pasto-diag-modal .modal-serio-body {
  gap: 8px !important;
}

#m-pasto-diag .pasto-diag-preview-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 160px;
  border: var(--borde-fino, 1px solid #cbd5e1);
  border-radius: 12px;
  background: var(--gris-50, #f8fafc);
  overflow: hidden;
}

#m-pasto-diag .pasto-diag-preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  color: var(--texto-suave, #64748b);
  font-size: 12px;
  font-weight: 700;
}

#m-pasto-diag .pasto-diag-preview-wrap.has-image .pasto-diag-preview-empty {
  display: none !important;
}

#m-pasto-diag .pasto-diag-preview-empty img {
  opacity: 0.85;
}

#m-pasto-diag .pasto-diag-preview {
  display: none;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  object-position: center;
}

#m-pasto-diag .pasto-diag-preview-wrap.has-image .pasto-diag-preview {
  display: block;
}

#m-pasto-diag .pasto-diag-preview[hidden] {
  display: none !important;
}

#m-pasto-diag .pasto-diag-status {
  font-size: 12px;
  font-weight: 700;
  color: var(--texto-suave, #64748b);
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--gris-100, #f1f5f9);
}

#m-pasto-diag .pasto-diag-status--busy {
  color: var(--texto-base, #334155);
}

#m-pasto-diag .pasto-diag-actions-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
}

#m-pasto-diag .pasto-diag-actions-row--pick {
  margin-top: 0;
}

#m-pasto-diag .pasto-diag-actions-row--pick .pasto-diag-file-btn {
  flex: 1 1 0;
  min-width: 0;
}

#m-pasto-diag .pasto-diag-actions-row--analyze {
  margin-top: 0;
}

#m-pasto-diag .pasto-diag-actions-row--analyze .pasto-diag-act-btn {
  flex: 1 1 100%;
  width: 100%;
}

#m-pasto-diag .pasto-diag-file-btn,
#m-pasto-diag .pasto-diag-act-btn {
  box-sizing: border-box;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  padding: 0 12px !important;
  gap: 6px !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  white-space: nowrap;
  cursor: pointer;
}

#m-pasto-diag .pasto-diag-file-btn {
  background: var(--manto-btn-gris-ok-bg) !important;
  border: var(--manto-btn-gris-ok-border) !important;
  color: var(--manto-btn-gris-ok-color) !important;
  box-shadow: var(--manto-btn-gris-ok-shadow) !important;
}

#m-pasto-diag .pasto-diag-file-btn__ico,
#m-pasto-diag .pasto-diag-act-btn img {
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0;
  margin: 0 !important;
  object-fit: contain;
}

#m-pasto-diag .pasto-diag-save-hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--texto-suave, #64748b);
}

#m-pasto-diag .pasto-diag-act-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#m-pasto-diag .pasto-diag-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#m-pasto-diag .pasto-diag-res-tit {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
  color: var(--texto-fuerte, #0f172a);
}

#m-pasto-diag .pasto-diag-res-bar-wrap {
  height: 8px;
  border-radius: 999px;
  background: var(--gris-200, #e2e8f0);
  overflow: hidden;
}

#m-pasto-diag .pasto-diag-res-bar {
  height: 100%;
  background: linear-gradient(90deg, #64748b, #334155);
  border-radius: 999px;
  width: 0;
  transition: width 0.35s ease;
}

#m-pasto-diag .pasto-diag-res-conf {
  font-size: 11px;
  font-weight: 800;
  color: var(--texto-suave, #64748b);
}

#m-pasto-diag .pasto-diag-res-meta,
#m-pasto-diag-det .pasto-diag-res-meta {
  font-size: 12px;
  line-height: 1.45;
  color: var(--texto-base, #334155);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#m-pasto-diag .pasto-diag-res-kv {
  line-height: 1.4;
}

#m-pasto-diag .pasto-diag-res-block,
#m-pasto-diag-det .pasto-diag-res-block {
  padding: 8px 10px;
  border: var(--borde-fino, 1px solid #cbd5e1);
  border-radius: 10px;
  background: var(--gris-0, #ffffff);
}

#m-pasto-diag .pasto-diag-res-block > strong {
  display: block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--texto-suave, #64748b);
  margin-bottom: 4px;
}

#m-pasto-diag .pasto-diag-res-block--campo,
#m-pasto-diag-det .pasto-diag-res-block--campo {
  background: var(--gris-50, #f8fafc);
  border-color: var(--gris-300, #cbd5e1);
}

#m-pasto-diag .pasto-diag-res-analisis,
#m-pasto-diag .pasto-diag-res-rec__txt,
#m-pasto-diag-det .pasto-diag-res-analisis,
#m-pasto-diag-det .pasto-diag-res-rec__txt {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--texto-base, #334155);
}

#m-pasto-diag .pasto-diag-res-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#m-pasto-diag .pasto-diag-res-list li {
  line-height: 1.45;
}

#m-pasto-diag .pasto-diag-estado {
  font-weight: 800;
  text-transform: uppercase;
  font-size: 11px;
}

#m-pasto-diag .pasto-diag-estado--sano {
  color: #15803d;
}

#m-pasto-diag .pasto-diag-estado--alerta {
  color: #b45309;
}

#m-pasto-diag .pasto-diag-estado--enfermo,
#m-pasto-diag .pasto-diag-estado--critico {
  color: #b91c1c;
}

#m-pasto-diag .pasto-diag-agronomo {
  color: #b91c1c;
  font-weight: 700;
}

#m-pasto-diag .pasto-diag-res-rec {
  font-size: 13px;
  line-height: 1.5;
  color: var(--texto-base, #334155);
  margin: 0;
}

#m-pasto-diag .pasto-diag-res-disc {
  font-size: 10px;
  color: var(--texto-muted, #94a3b8);
  margin: 0;
}

#m-pasto-diag .pasto-diag-btn-plaga {
  width: 100%;
  min-height: 36px;
  border-radius: 12px !important;
}

/* Historial en ficha potrero */
#pot-ficha-diag-wrap .pot-ficha-diag-actions {
  margin-bottom: 8px;
}

#pot-ficha-diag-wrap .pot-ficha-diag-cta {
  min-height: 36px;
  width: 100%;
}

.pot-ficha-diag-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pot-ficha-diag-empty {
  margin: 0;
  font-size: 12px;
  color: var(--texto-suave, #64748b);
}

.pot-ficha-diag-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: var(--borde-fino, 1px solid #cbd5e1);
  border-radius: 12px;
  background: var(--gris-0, #ffffff);
  cursor: pointer;
  box-shadow: var(--manto-serio-panel-inset, inset 0 1px 0 rgba(255, 255, 255, 0.6));
}

.pot-ficha-diag-card:hover {
  background: var(--gris-50, #f8fafc);
}

.pot-ficha-diag-card__img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  border: var(--borde-fino, 1px solid #cbd5e1);
}

.pot-ficha-diag-card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.pot-ficha-diag-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pot-ficha-diag-card__tit {
  font-size: 13px;
  font-weight: 800;
  color: var(--texto-fuerte, #0f172a);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pot-ficha-diag-card__meta {
  font-size: 11px;
  color: var(--texto-suave, #64748b);
}

.pasto-diag-chip-novedad,
.pasto-diag-chip-pending {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  width: fit-content;
}

.pasto-diag-chip-novedad {
  background: #ffedd5;
  color: #9a3412;
}

.pasto-diag-chip-pending {
  background: var(--gris-100, #f1f5f9);
  color: var(--texto-suave, #64748b);
}

#m-pasto-diag-det .pasto-diag-preview-wrap--det {
  min-height: 140px;
}

#m-pasto-diag-det .pasto-diag-det-fecha {
  margin: 0;
  font-size: 11px;
  color: var(--texto-muted, #94a3b8);
}

@media (max-width: 420px) {
  #m-pasto-diag .pasto-diag-actions-row--pick {
    flex-wrap: nowrap;
  }
}
