/* KindMX: ventana "PaVos automáticos" (boceto PavosMedida, ronda 9). */
.code-dialog { width: min(580px, calc(100% - 32px)); }
.code-dialog[open] { overflow: auto; }

/* Cabecera: imagen configurada (o el ícono V grande) sobre el fondo de la categoría */
.cd-head { position: relative; flex: none; display: flex; align-items: center; gap: 18px; min-height: 150px; padding: 20px 72px 20px 28px; background: var(--r-manual); color: var(--on-night); }
.cd-head.r-gold { background: var(--r-gold); }
.cd-head.r-icon { background: var(--r-icon); }
.cd-head.has-bg { background: var(--tile-bg); }
.cd-head .cd-icon { width: 84px; height: 84px; flex: none; }
.cd-head .cd-img { width: 110px; height: 110px; flex: none; object-fit: contain; border-radius: 12px; }
.cd-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cd-title h2 { font: 800 22px/1.15 var(--font-display); text-transform: uppercase; overflow-wrap: anywhere; }
.cd-title span { font-size: 15px; color: var(--on-night-soft); }
.cd-close { position: absolute; top: 14px; right: 14px; width: 42px; height: 42px; border: 0; background: rgba(255,255,255,.92); color: var(--ink); }

.cd-body { display: flex; flex-direction: column; gap: 20px; padding: 24px 28px 28px; }
.cd-amount { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cd-ask { font-size: 15px; font-weight: 600; color: var(--muted); }
.cd-big { display: flex; align-items: center; gap: 10px; }
.cd-big .icon { width: 34px; height: 34px; }
.cd-big b { font: 800 52px/1 var(--font-tight); color: var(--ink); font-variant-numeric: tabular-nums; }

/* Barra: input range nativo con estilo propio. --pct = parte llena. */
.cd-range { display: flex; flex-direction: column; gap: 8px; }
.cd-range input[type="range"] {
  --pct: 0%;
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer;
}
.cd-range input[type="range"]::-webkit-slider-runnable-track {
  height: 10px; border-radius: var(--r-pill);
  background: linear-gradient(to right, var(--accent) 0 var(--pct), var(--accent-soft) var(--pct) 100%);
}
.cd-range input[type="range"]::-moz-range-track { height: 10px; border-radius: var(--r-pill); background: var(--accent-soft); }
.cd-range input[type="range"]::-moz-range-progress { height: 10px; border-radius: var(--r-pill); background: var(--accent); }
.cd-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 28px; height: 28px; margin-top: -9px; border-radius: var(--r-pill);
  background: var(--paper); border: 3px solid var(--accent); box-shadow: 0 2px 6px rgba(29,19,64,.25);
}
.cd-range input[type="range"]::-moz-range-thumb {
  width: 28px; height: 28px; box-sizing: border-box; border-radius: var(--r-pill);
  background: var(--paper); border: 3px solid var(--accent); box-shadow: 0 2px 6px rgba(29,19,64,.25);
}
.cd-range input[type="range"]:focus { outline: none; }
.cd-range input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 6px var(--accent); }
.cd-range input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 6px var(--accent); }
.cd-ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Atajos */
.cd-presets { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cd-preset { height: 40px; padding: 0 16px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font: 700 15px var(--font-tight); font-variant-numeric: tabular-nums; cursor: pointer; }
.cd-preset:hover { border-color: var(--accent-line); }
.cd-preset[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-wash); color: var(--accent-ink); padding: 0 15px; }

/* Cantidad exacta */
.cd-exact { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-tile); background: var(--paper-soft); border: 1px solid var(--line-soft); }
.cd-exact label { flex: 1; font-weight: 600; font-size: 15px; }
.cd-exact .input { width: 128px; height: 44px; text-align: right; border: 2px solid var(--accent); font: 800 18px var(--font-tight); font-variant-numeric: tabular-nums; }
.cd-exact .input[aria-invalid="true"] { border-color: var(--bad); }
.cd-exact > span { font-weight: 700; color: var(--muted); }
.code-dialog .error-text { margin-top: -10px; }

.cd-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding-top: 4px; }
.cd-total { display: flex; flex-direction: column; }
.cd-total-label { font-size: 14px; color: var(--muted); }
.cd-total .price-total b { font-size: 38px; }

/* Celular: a pantalla completa, con la barra grande y fácil de tocar */
@media (max-width: 599px) {
  .code-dialog { width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; border-radius: 0; }
  .cd-head { min-height: 120px; padding: 16px 64px 16px 18px; gap: 14px; }
  .cd-head .cd-icon { width: 64px; height: 64px; }
  .cd-head .cd-img { width: 84px; height: 84px; }
  .cd-title h2 { font-size: 18px; }
  .cd-body { flex: 1; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
  .cd-big b { font-size: 46px; }
  .cd-range input[type="range"] { height: 44px; }
  .cd-range input[type="range"]::-webkit-slider-runnable-track { height: 14px; }
  .cd-range input[type="range"]::-moz-range-track, .cd-range input[type="range"]::-moz-range-progress { height: 14px; }
  .cd-range input[type="range"]::-webkit-slider-thumb { width: 38px; height: 38px; margin-top: -12px; }
  .cd-range input[type="range"]::-moz-range-thumb { width: 38px; height: 38px; }
  .cd-preset { height: 44px; }
  .cd-exact { flex-wrap: wrap; }
  .cd-exact label { flex-basis: 100%; }
  .cd-exact .input { flex: 1; width: auto; }
  .cd-foot { margin-top: auto; }
  .cd-foot .btn { flex: 1; }
}
