/* ==========================================================================
   BBDmPrep — «Preparar» (BESC → Direct Marketing)
   ==========================================================================
   Design reference: CollectUI 78ded8a0-af2c-4bd4-ba8b-0c35f5c00262 — Alex
   Vanderzon's Aave compound-interest calculator. The measurement taken from it
   is restraint: **68% of its 11s timeline is held completely still**, and the
   change energy sits in ONE band (the readout) while the controls below never
   move. So here the cost band is the only thing that transitions — ~600ms
   linear for a value that counts, `--bb-ease-strong` for a discrete flip like
   GSM-7 → UCS-2 — and the mapper, the group list and the textarea hold still.
   Palette is this app's own `--bb-*`; nothing is imported from the reference.

   Every number is `var(--bb-mono)` + tabular-nums, per DESIGN.md.
   ========================================================================== */

.dmp { display: flex; flex-direction: column; gap: 14px; }

/* --- the cost band — the one animated surface ---------------------------- */
.dmp-band {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 16px 18px;
  border: 1px solid var(--bb-line);
  border-radius: var(--bb-r-card);
  background: var(--bb-surface);
  box-shadow: var(--bb-sh-card);
}
.dmp-bigs { display: flex; align-items: flex-end; gap: 26px; flex-wrap: wrap; flex: 1; min-width: 0; }
.dmp-big { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dmp-k {
  font-size: 10.5px; font-weight: 650; letter-spacing: .06em;
  text-transform: uppercase; color: var(--bb-ink-3);
}
.dmp-v {
  font-family: var(--bb-display); font-variant-numeric: tabular-nums;
  font-size: 30px; font-weight: 700; line-height: 1; color: var(--bb-ink);
  /* The value COUNTS, so it eases linearly — the reference fits `linear`
     (R²≥0.95) on every one of its value passages. */
  transition: color 600ms linear;
}
.dmp-sm .dmp-v { font-size: 19px; font-weight: 650; color: var(--bb-ink-2); }

.dmp-bandside { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* The encoding badge is a discrete state flip, not a count — so it gets the
   app's strong ease, matching the reference's `cubic-bezier(0,0,0.58,1)`
   toggles rather than its linear value ramps. */
.dmp-enc {
  font-family: var(--bb-mono); font-size: 11.5px; font-weight: 700;
  letter-spacing: .04em;
  padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--bb-line); background: var(--bb-inset); color: var(--bb-ink-3);
  transition: background var(--bb-t-fast) var(--bb-ease-strong),
              border-color var(--bb-t-fast) var(--bb-ease-strong),
              color var(--bb-t-fast) var(--bb-ease-strong); font-variant-numeric: tabular-nums;
}
.dmp-enc.good {
  border-color: color-mix(in srgb, var(--bb-green) 42%, var(--bb-line));
  background: var(--bb-green-tint); color: var(--bb-ink);
}
.dmp-enc.bad {
  border-color: color-mix(in srgb, var(--bb-red) 50%, var(--bb-line));
  background: var(--bb-red-tint); color: var(--bb-ink);
}

.dmp-rate { display: flex; align-items: center; gap: 7px; }
.dmp-rate span { font-size: 11px; color: var(--bb-ink-3); white-space: nowrap; }
.dmp-rate input {
  width: 84px; padding: 6px 8px;
  font-family: var(--bb-mono); font-variant-numeric: tabular-nums; font-size: 12.5px;
  color: var(--bb-ink); background: var(--bb-inset);
  border: 1px solid var(--bb-line); border-radius: var(--bb-r-control);
}
.dmp-rate input:focus { outline: none; border-color: var(--bb-accent); background: var(--bb-surface); }
.dmp-bandnote { flex-basis: 100%; }

/* --- two columns -------------------------------------------------------- */
/* `align-items: start` on purpose: the two panels hold different amounts of
   content (the composer is short, the mapper is long) and a stretched grid
   cell left ~400px of dead card under the message box. */
.dmp-cols {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px; align-items: start;
}
.dmp-panel {
  display: flex; flex-direction: column; gap: 11px;
  padding: 14px 16px;
  border: 1px solid var(--bb-line);
  border-radius: var(--bb-r-card);
  background: var(--bb-surface);
  box-shadow: var(--bb-sh-hairline);
}

.dmp-h { display: flex; align-items: center; gap: 10px; }
.dmp-h .t { font-size: 13px; font-weight: 650; color: var(--bb-ink-2); }
.dmp-h .rule { flex: 1; height: 1px; background: var(--bb-line); }
.dmp-count {
  font-family: var(--bb-mono); font-variant-numeric: tabular-nums;
  font-size: 11.5px; color: var(--bb-ink-3);
  transition: color 600ms linear;
}
.dmp-count.warn { color: var(--bb-orange); font-weight: 700; }
.dmp-file {
  font-family: var(--bb-mono); font-size: 11px; color: var(--bb-ink-3);
  max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.dmp-h2 {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 650; letter-spacing: .05em;
  text-transform: uppercase; color: var(--bb-ink-3);
}
.dmp-h2 i { font-family: var(--bb-mono); font-style: normal; font-variant-numeric: tabular-nums; }

/* --- composer: el hilo, el input y los campos ----------------------------
   Se compone DENTRO de la conversación. Arriba lo que va a llegar al teléfono
   (la misma burbuja que las tarjetas de campaña), abajo el campo donde se
   escribe, y en medio los campos que se pueden insertar.

   Referencias medidas: CollectUI 4f33acd6 (@flornkm, iMessage) para el hilo, y
   c20aa8d1 (@sitenley, composer) para la tira de controles pegada al input —
   99% de su timeline está quieto y su paleta es monocroma, así que aquí no se
   anima nada y el color lo pone sólo la burbuja.

   NO hay botón de enviar a propósito: de aquí no sale ningún texto. */
.dmp-thread {
  border: 1px solid var(--bb-line);
  border-radius: 14px 14px 6px 6px;
  background: var(--bb-surface);
  padding: 10px;
  min-height: 108px;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.dmp-thread .besc-sms {
  border: 0; background: transparent; padding: 0;
}
.dmp-thread .besc-sms-scroll { max-height: 190px; }
.dmp-thread-idle {
  text-align: center; font-size: 11.5px; color: var(--bb-ink-3);
  padding: 26px 0;
}

/* El input, pegado al hilo: una sola pieza, como un compositor de mensajes. */
.dmp-inputwrap { margin-top: -7px; }
.dmp-ta {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 92px;
  padding: 12px 13px;
  font-family: inherit; font-size: 14px; line-height: 1.5; color: var(--bb-ink);
  background: var(--bb-inset);
  border: 1px solid var(--bb-line); border-radius: 6px 6px 14px 14px;
}
.dmp-ta:focus { outline: none; border-color: var(--bb-accent); background: var(--bb-surface); }

/* Los campos insertables. Son los del MAPEO, no una lista fija. */
.dmp-fields { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dmp-fields-k {
  font-size: 10px; font-weight: 650; letter-spacing: .06em;
  text-transform: uppercase; color: var(--bb-ink-3); margin-right: 2px;
}
.dmp-field {
  cursor: pointer;
  font-family: var(--bb-mono); font-size: 11px; font-weight: 500;
  color: var(--bb-ink-2);
  padding: 4px 9px 4px 7px;
  border: 1px solid var(--bb-line); border-radius: 6px;
  background: var(--bb-inset);
  transition: border-color var(--bb-t-fast) var(--bb-ease-strong),
              background var(--bb-t-fast) var(--bb-ease-strong),
              color var(--bb-t-fast) var(--bb-ease-strong); font-variant-numeric: tabular-nums;
}
/* El "+" es del botón, no del texto: así el nombre del campo se puede leer y
   copiar sin arrastrar un signo que no es parte del campo. */
.dmp-field::before { content: '+'; margin-right: 5px; opacity: .5; font-weight: 700; }
.dmp-field:hover {
  border-color: var(--bb-accent); background: var(--bb-accent-tint); color: var(--bb-ink);
}
.dmp-field:hover::before { opacity: 1; }
.dmp-chips { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.dmp-fix {
  cursor: pointer;
  border-color: color-mix(in srgb, var(--bb-green) 42%, var(--bb-line)) !important;
  background: var(--bb-green-tint) !important;
  color: var(--bb-ink) !important;
  font-weight: 650;
}
.dmp-fix:hover { background: color-mix(in srgb, var(--bb-green) 20%, var(--bb-surface)) !important; }

/* --- drop zone ---------------------------------------------------------- */
.dmp-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-height: 168px; padding: 20px; cursor: pointer;
  border: 1.5px dashed var(--bb-line-strong);
  border-radius: var(--bb-r-card);
  background: var(--bb-inset);
  transition: border-color var(--bb-t-fast) var(--bb-ease-strong),
              background var(--bb-t-fast) var(--bb-ease-strong);
}
.dmp-drop:hover, .dmp-drop.on { border-color: var(--bb-accent); background: var(--bb-accent-tint); }
.dmp-drop b { font-size: 13.5px; color: var(--bb-ink-2); }
.dmp-drop .num { font-family: var(--bb-mono); font-size: 11px; color: var(--bb-ink-3); font-variant-numeric: tabular-nums; }

/* --- controls ----------------------------------------------------------- */
.dmp-sub { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dmp-splitrow { display: flex; align-items: center; gap: 7px; min-width: 0; }
.dmp-splitrow > span { font-size: 11px; color: var(--bb-ink-3); white-space: nowrap; }
.dmp-chk { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.dmp-chk span { font-size: 11px; color: var(--bb-ink-3); }

.dmp select {
  max-width: 100%; padding: 6px 8px;
  font-family: inherit; font-size: 12px; color: var(--bb-ink);
  background: var(--bb-inset);
  border: 1px solid var(--bb-line); border-radius: var(--bb-r-control);
}
.dmp select:focus { outline: none; border-color: var(--bb-accent); }

/* --- groups ------------------------------------------------------------- */
.dmp-gs { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.dmp-g {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--bb-line); border-radius: 6px;
  background: var(--bb-inset);
  transition: background var(--bb-t-fast) var(--bb-ease-strong);
}
.dmp-g:hover { background: var(--bb-hover); }
.dmp-gname {
  font-size: 12.5px; font-weight: 600; color: var(--bb-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dmp-gn {
  font-family: var(--bb-mono); font-variant-numeric: tabular-nums;
  font-size: 13px; font-weight: 700; color: var(--bb-ink);
}
.dmp-gcost {
  font-family: var(--bb-mono); font-variant-numeric: tabular-nums;
  font-size: 11px; color: var(--bb-ink-3); min-width: 62px; text-align: right;
  transition: color 600ms linear;
}

/* --- column mapper ------------------------------------------------------ */
.dmp-map { border-top: 1px solid var(--bb-line); padding-top: 10px; }
.dmp-map > summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 650; letter-spacing: .05em;
  text-transform: uppercase; color: var(--bb-ink-3);
}
.dmp-map > summary::-webkit-details-marker { display: none; }
.dmp-map > summary::before { content: '›'; font-size: 15px; line-height: 1; transition: transform var(--bb-t-fast) var(--bb-ease-strong); }
.dmp-map[open] > summary::before { transform: rotate(90deg); }
.dmp-map > summary i { font-family: var(--bb-mono); font-style: normal; font-variant-numeric: tabular-nums; }
.dmp-maprows {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 6px 12px; margin: 10px 0;
}
.dmp-maprow { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 8px; }
.dmp-mapk {
  font-family: var(--bb-mono); font-size: 10.5px; color: var(--bb-ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.dmp-mapk.req { color: var(--bb-ink); font-weight: 700; }

/* --- narrow ------------------------------------------------------------- */
@media (max-width: 1040px) {
  .dmp-cols { grid-template-columns: minmax(0, 1fr); }
  .dmp-bigs { gap: 18px; }
  .dmp-v { font-size: 25px; }
}
/* Under ~620px the five figures wrapped one-per-row and the band became a
   ~260px tall column before the message box. A 3-up grid keeps the whole
   readout on two lines, which is the point of putting it at the top. */
@media (max-width: 620px) {
  .dmp-band { gap: 12px; padding: 13px 14px; }
  .dmp-bigs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; }
  .dmp-big { align-items: flex-start; }
  .dmp-v { font-size: 22px; }
  .dmp-sm .dmp-v { font-size: 16px; }
  .dmp-bandside { width: 100%; justify-content: space-between; }
  .dmp-maprows { grid-template-columns: minmax(0, 1fr); }
  .dmp-g { grid-template-columns: minmax(0, 1fr) auto auto; row-gap: 6px; }
  /* The download button drops to its own full-width row rather than squeezing
     the campus name to an ellipsis. */
  .dmp-g > .besc-btn { grid-column: 1 / -1; }
  .dmp-gcost { min-width: 0; }
}

/* La vista del teléfono vive dentro de `.dmp-thread` (arriba). El markup es
   `besc-sms*` (besc.css), expuesto por `window.BESC.smsHilo`, para que "así se
   va a ver" y "así se vio" no sean dos diseños distintos. */
