/* Compatibilidad por modelo y WhatsApp · Formulario de consulta */

.compat-dialog {
  --compat-green: #1fa855;
  --compat-green-dark: #128c4a;
  --compat-green-soft: #ecf9f1;
  --compat-ink: #1f2933;
  --compat-muted: #5f6b76;
  --compat-line: #d9dee3;
  --compat-error: #c62828;
  --compat-accent: #e8590c;

  box-sizing: border-box;
  width: calc(100% - 32px);
  max-width: 540px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: var(--compat-ink);
  box-shadow: 0 24px 64px rgba(15, 23, 42, .28);
  overflow: auto;
  overscroll-behavior: contain;
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
}
.compat-dialog::backdrop { background: rgba(15, 23, 42, .55); }
.compat-dialog *, .compat-dialog *::before, .compat-dialog *::after { box-sizing: border-box; }
.compat-dialog [hidden] { display: none !important; }
html.compat-lock { overflow: hidden; }

@media (max-width: 600px) {
  .compat-dialog {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    max-height: 94vh;
    max-height: 94dvh;
  }
}

.compat-sheet { padding: 20px 22px 22px; }
@media (max-width: 600px) { .compat-sheet { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); } }

.compat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.compat-kicker {
  margin: 0 0 2px;
  color: var(--compat-green-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.compat-title { margin: 0; font-size: 20px; line-height: 1.25; font-weight: 700; color: var(--compat-ink); text-transform: none; }
.compat-dialog .compat-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin: -4px -6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f1f3f5;
  color: var(--compat-ink);
  font-size: 24px;
  line-height: 36px;
  cursor: pointer;
}
.compat-dialog .compat-close:hover { background: #e5e8eb; }

.compat-product {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 14px 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f6f7f8;
}
.compat-product-name { font-weight: 600; }
.compat-product-meta { color: var(--compat-muted); font-size: 13px; }

.compat-intro { margin: 0 0 14px; color: var(--compat-muted); }

.compat-field { margin: 0 0 14px; }
.compat-label { display: block; margin: 0 0 6px; font-weight: 600; font-size: 14px; color: var(--compat-ink); }
.compat-req { color: var(--compat-error); }
.compat-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--compat-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  vertical-align: 1px;
}

.compat-dialog .compat-input {
  display: block;
  width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--compat-line);
  border-radius: 10px;
  background: #fff;
  color: var(--compat-ink);
  font: inherit;
  font-size: 16px; /* evita el zoom automático en iOS */
  box-shadow: none;
  appearance: auto;
}
.compat-dialog textarea.compat-input { min-height: 84px; resize: vertical; }
.compat-dialog .compat-input:focus { outline: 0; border-color: var(--compat-green); box-shadow: 0 0 0 3px rgba(31, 168, 85, .2); }
.compat-dialog .compat-input[aria-invalid="true"] { border-color: var(--compat-error); box-shadow: 0 0 0 3px rgba(198, 40, 40, .12); }
.compat-dialog .compat-input:disabled { background: #f1f3f5; color: var(--compat-muted); }
.compat-brand-other { margin-top: 8px !important; }

.compat-error { margin: 6px 0 0; color: var(--compat-error); font-size: 13px; font-weight: 600; }

.compat-field--key {
  padding: 14px;
  border: 2px solid var(--compat-accent);
  border-radius: 12px;
  background: #fff8f3;
}
.compat-dialog .compat-input--model { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em; }
.compat-dialog .compat-input--model::placeholder { font-family: inherit; font-family: system-ui, sans-serif; letter-spacing: 0; }

.compat-help { margin: 10px 0 0; font-size: 13px; color: var(--compat-ink); }
.compat-help-title { margin: 0 0 4px; font-weight: 700; }
.compat-help-list { margin: 0 0 6px; padding-left: 18px; }
.compat-help-list li { margin: 0 0 2px; }
.compat-help-generic { margin: 0 0 6px; color: var(--compat-muted); }
.compat-dialog .compat-help-link { font-weight: 700; color: var(--compat-green-dark); text-decoration: underline; }

.compat-check { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 14px; font-weight: 500; cursor: pointer; }
.compat-check input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; }
.compat-nomodel-note { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: #fff; font-size: 13px; color: var(--compat-muted); }

.compat-more { margin: 0 0 14px; border-top: 1px solid var(--compat-line); padding-top: 12px; }
.compat-dialog .compat-more-title { margin: 0 0 10px; font-weight: 700; color: var(--compat-ink); }
.compat-dialog .compat-more-opt { font-weight: 400; color: var(--compat-muted); }

.compat-photos { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--compat-green-soft); font-size: 14px; }
.compat-photos p { margin: 0; }

.compat-dialog .compat-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--compat-btn-radius, 6px);
  background: var(--compat-green);
  background: var(--compat-btn-bg, linear-gradient(90deg, #34d36b 0%, #2bbd61 100%));
  color: var(--compat-btn-color, #fff);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .14);
  cursor: pointer;
}
.compat-dialog .compat-submit:hover, .compat-dialog .compat-submit:focus-visible {
  background: var(--compat-green-dark);
  background: var(--compat-btn-bg-hover, linear-gradient(90deg, #2bbd61 0%, #23a855 100%));
  color: var(--compat-btn-color, #fff);
}
.compat-dialog .compat-submit .compat-ico { width: 20px; height: 20px; }
.compat-dialog .compat-submit .compat-ico-font {
  width: auto;
  height: auto;
  margin: 0;
  color: inherit;
  font-size: 1.2em;
  font-style: normal;
  line-height: 1;
}
.compat-dialog .compat-submit .compat-ico-font::before,
.compat-dialog .compat-submit .compat-ico-font::after { margin-left: 0; margin-right: 0; }
.compat-dialog .compat-ico-img { object-fit: contain; }
.compat-dialog .compat-ico-white { filter: var(--compat-btn-icon-filter, brightness(0) invert(1)); }
.compat-dialog .compat-ico-line path,
.compat-dialog .compat-ico-line circle { fill: none; stroke: currentColor; }
.compat-dialog .compat-secondary {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--compat-line);
  border-radius: 12px;
  background: #fff;
  color: var(--compat-ink);
  font: inherit;
  cursor: pointer;
}
.compat-legal { margin: 10px 0 0; color: var(--compat-muted); font-size: 12px; text-align: center; }
.compat-legal a { color: inherit; text-decoration: underline; }

.compat-done { padding: 12px 0 0; text-align: center; }
.compat-done-icon {
  width: 56px; height: 56px; margin: 0 auto 10px;
  border-radius: 50%; background: var(--compat-green); color: #fff;
  font-size: 30px; line-height: 56px; font-weight: 700;
}
.compat-done-title { margin: 0 0 6px; font-size: 20px; outline: 0; }
.compat-done-steps { display: inline-block; margin: 6px 0 16px; padding-left: 20px; text-align: left; }
.compat-done-steps li { margin: 0 0 4px; }

@media (prefers-reduced-motion: no-preference) {
  .compat-dialog[open] { animation: compat-in .18s ease-out; }
  @keyframes compat-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}

/* Comprobación de compatibilidad */
.compat-match { margin: 10px 0 0; padding: 12px; border-radius: 10px; font-size: 14px; }
.compat-match--ok { background: #e7f7ee; border: 1px solid #9fdcb8; }
.compat-match--no { background: #fff; border: 1px dashed #c9a27a; }
.compat-match--maybe { background: #fff8e1; border: 1px solid #f0c36d; }
.compat-match--maybe .compat-match-title { color: #7a4b00; }
.compat-match-title { margin: 0 0 4px; font-weight: 700; }
.compat-match--ok .compat-match-title { color: #0b6b37; }
.compat-match-text { margin: 0; }
.compat-match-note { margin: 8px 0 0; color: var(--compat-muted); font-size: 13px; }
.compat-match-note:empty { display: none; }
.compat-dialog .compat-cart {
  display: block;
  width: 100%;
  min-height: 46px;
  margin: 10px 0 0;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--compat-ink);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.compat-dialog .compat-cart:hover, .compat-dialog .compat-cart:focus-visible { background: #000; }
.compat-kicker .compat-ico { width: 15px; height: 15px; margin-right: 2px; vertical-align: -3px; }

/* v1.2: mayúsculas, ejemplos y etiqueta de muestra */
.compat-dialog .compat-input--model { text-transform: uppercase; }
.compat-dialog .compat-input--model::placeholder { text-transform: none; }

.compat-examples { margin: 0 0 10px; }
.compat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.compat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid #f0c9ad;
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  line-height: 1.3;
}
.compat-chip-brand { color: var(--compat-muted); font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.compat-chip-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; }

.compat-sample { margin: 0 0 12px; }
.compat-plate {
  padding: 8px 10px;
  border: 2px solid #334155;
  border-radius: 6px;
  background: #fffdf5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.compat-plate-brand { margin: 0 0 4px !important; font-family: inherit; font-weight: 700; letter-spacing: .06em; font-size: 12px; }
.compat-plate-row { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; border-top: 1px dashed #cbd5e1; color: #94a3b8; }
.compat-plate-row b { font-weight: 600; }
.compat-plate-row em { margin-left: auto; font-style: normal; font-weight: 700; color: #b42318; }
.compat-plate-key { min-width: 92px; }
.compat-plate-row--ok { margin: 0 -6px; padding: 4px 6px; border-radius: 4px; border-top-color: transparent; background: #e7f7ee; color: var(--compat-ink); }
.compat-plate-row--ok b { font-weight: 800; }
.compat-plate-row--ok em { color: #0b6b37; }
.compat-sample-hint { margin: 6px 0 0; color: var(--compat-muted); font-size: 12.5px; }

/* v1.2.1: blindaje frente a estilos de la plantilla */
.compat-dialog,
.compat-dialog p,
.compat-dialog label,
.compat-dialog .compat-label,
.compat-dialog .compat-help,
.compat-dialog .compat-field { text-align: left; }
.compat-dialog .compat-label { float: none; width: auto; max-width: none; padding: 0; }
.compat-dialog ul.compat-help-list,
.compat-dialog ol.compat-done-steps { list-style: disc outside; margin: 0 0 6px; padding: 0 0 0 20px; }
.compat-dialog ol.compat-done-steps { list-style-type: decimal; }
.compat-dialog ul.compat-help-list > li,
.compat-dialog ol.compat-done-steps > li { display: list-item; list-style: inherit; margin: 0 0 2px; padding: 0; background: none; }
.compat-dialog ul.compat-help-list > li::before { content: none; }
.compat-dialog .compat-done { text-align: center; }
.compat-dialog .compat-done ol { text-align: left; }

.compat-dialog .compat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.compat-dialog .compat-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 9px; border: 1px solid #f0c9ad; border-radius: 999px; background: #fff; font-size: 13px; line-height: 1.3; white-space: nowrap; }
.compat-dialog .compat-plate { display: block; padding: 8px 10px; border: 2px solid #334155; border-radius: 6px; background: #fffdf5; }
.compat-dialog .compat-plate-row { display: flex; align-items: baseline; gap: 8px; }
.compat-dialog .compat-plate-key { flex: 0 0 auto; min-width: 92px; }
.compat-dialog .compat-plate-row b { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.compat-dialog .compat-plate-row em { flex: 0 0 auto; }
.compat-dialog .compat-plate span, .compat-dialog .compat-plate b, .compat-dialog .compat-plate em { font-size: inherit; line-height: 1.35; }
.compat-dialog .compat-chip-brand { font-size: 11px; }
.compat-dialog .compat-chip-code { font-size: 13px; font-weight: 700; }

/* v1.3: secciones plegables, esquemas, subtipos, avisos de formato, buscador y aviso de carrito */
.compat-dialog .compat-sec { margin: 12px 0 0; border-top: 1px solid #f0c9ad; padding-top: 8px; }
.compat-dialog .compat-sec > summary {
  display: list-item; cursor: pointer; padding: 4px 0; font-weight: 700; font-size: 14px; color: var(--compat-ink); list-style: revert;
}
.compat-dialog .compat-sec[open] > summary { margin-bottom: 8px; }

.compat-dialog .compat-where { display: grid; grid-template-columns: 132px 1fr; gap: 12px; align-items: start; }
.compat-dialog .compat-where:has(.compat-diagram[hidden]) { grid-template-columns: 1fr; }
@media (max-width: 380px) { .compat-dialog .compat-where { grid-template-columns: 1fr; } }
.compat-dialog .compat-diagram { margin: 0; padding: 4px; border: 1px solid #f0c9ad; border-radius: 8px; background: #fff; }
.compat-dialog .compat-diagram img { display: block; width: 100%; height: auto; }

.compat-dialog ol.compat-spots { margin: 0; padding: 0; list-style: none; counter-reset: compatspot; }
.compat-dialog ol.compat-spots > li { position: relative; display: block; margin: 0 0 8px; padding: 0 0 0 28px; counter-increment: compatspot; font-size: 13px; }
.compat-dialog ol.compat-spots > li::before {
  content: counter(compatspot); position: absolute; left: 0; top: 0;
  width: 20px; height: 20px; border-radius: 50%; background: var(--compat-accent); color: #fff;
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}

.compat-dialog .compat-subtypes { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.compat-dialog .compat-subtype {
  padding: 6px 12px; border: 1px solid #c9ced4; border-radius: 999px; background: #fff; color: var(--compat-ink);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.compat-dialog .compat-subtype[aria-pressed="true"] { border-color: var(--compat-accent); background: var(--compat-accent); color: #fff; }

.compat-dialog .compat-format { margin: 6px 0 0; padding: 6px 10px; border-radius: 8px; font-size: 13px; }
.compat-dialog .compat-format--ok { background: #e7f7ee; color: #0b6b37; }
.compat-dialog .compat-format--warn { background: #fff4d6; color: #7a4b00; }
.compat-dialog .compat-format--info { background: #eef4fb; color: #1d4f86; }

.compat-dialog .compat-plate-photo { margin: 0 0 6px; }
.compat-dialog .compat-plate-photo img { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid #e3e7eb; }
.compat-dialog .compat-not { margin: 8px 0 0; font-size: 12.5px; color: var(--compat-muted); }
.compat-dialog .compat-safety { margin: 8px 0 6px; font-size: 12.5px; color: var(--compat-muted); }

.compat-dialog .compat-nomodel-note p { margin: 0 0 6px; }
.compat-dialog .compat-nomodel-note ul.compat-help-list { margin-bottom: 6px; }

.compat-dialog .compat-guard { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #fff4d6; color: #7a4b00; font-weight: 600; }
.compat-dialog .compat-skip {
  display: block; width: 100%; margin: 10px 0 0; padding: 8px; border: 0; background: none;
  color: var(--compat-muted); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer;
}

/* Modelos de la lista de compatibles enlazados a su página (descripción del producto) */
a.compat-ml { color: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
a.compat-ml:hover, a.compat-ml:focus { color: #128c4a; text-decoration-style: solid; }
