/* ═══════════════════════════════════════════════════════════════════════════
   LESÕES · BANCADA + LISTA — redesign 06/09 (Claude Design)
   Uma lesão expandida por vez (a bancada, fixa no topo) + livro-razão de linhas
   de 46 px em colunas alinhadas. Paleta do DS: marrom #785533 para seleção/ação,
   âmbar #B3864F para "em edição", alvos ≥ 44 px no iPad / 36 px no desktop.
   Desligar tudo: window.CEDAR_LESOES_BANCADA = false (volta ao acordeão).
   ═══════════════════════════════════════════════════════════════════════════ */

.lesb { display: flex; flex-direction: column; gap: 12px; }

/* ── Bancada ─────────────────────────────────────────────────────────────── */
.lesb-bench {
  background: #fff;
  border: 1.5px solid #B3864F;
  border-radius: 12px;
  box-shadow: 0 3px 14px rgba(120, 85, 51, .12);
  overflow: hidden;
}
.lesb-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px;
  background: #FCF6EE;
  border-bottom: 1px solid #EFE6DB;
}
.lesb-head-num {
  display: inline-flex; align-items: center; justify-content: center;
  height: 24px; padding: 0 8px; border-radius: 6px;
  background: #2B211B; color: #fff; font: 800 11.5px/1 Inter, system-ui, sans-serif;
}
.lesb-head-tipo { font: 800 13px/1 Inter, system-ui, sans-serif; color: #2B211B; }
.lesb-head-modo {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border-radius: 6px; background: #F4EADF; border: 1px solid #E6D8C8;
  color: #785533; font: 700 10px/1 Inter, system-ui, sans-serif;
}
.lesb-head-pend { font: 600 11.5px/1.3 Inter, system-ui, sans-serif; color: #92610C; }
.lesb-head-pend--ok { color: #177245; }
.lesb-head-sp { flex: 1 1 auto; }
.lesb-done {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: 8px; border: 1.5px solid #785533; background: #fff; color: #785533;
  font: 800 12px/1 Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap;
}
.lesb-done:hover { background: #785533; color: #fff; }

/* O resumo da lesão ativa vive na LINHA do livro-razão; dentro da bancada a
   linha antiga fica só como âncora dos handlers já existentes (summary/AP badge). */
.lesb-hidden-row { display: none !important; }
.lesb-bench .les-edit { display: block; border: 0; border-radius: 0; }

/* ── Livro-razão ─────────────────────────────────────────────────────────── */
.lesb-list {
  background: #fff; border: 1px solid #E6D8C8; border-radius: 10px; overflow: hidden;
}
.lesb-lhead, .lesb-row {
  display: grid;
  grid-template-columns: var(--lesb-cols);
  gap: 8px; align-items: center;
  padding: 0 8px 0 6px;
}
.lesb-lhead {
  min-height: 26px; background: #FCF9F5; border-bottom: 1px solid #EFE6DB;
  font: 700 9px/1 ui-monospace, Menlo, monospace; color: #9C8D7D; letter-spacing: .07em;
}
.lesb-row {
  min-height: 46px; border-top: 1px solid #F3EEE7; cursor: pointer; background: #fff;
}
.lesb-row:first-of-type { border-top: 0; }
.lesb-row:hover { background: #FBF8F4; }
.lesb-row--sel { background: #FBF7F2; }
.lesb-row--ativa { background: #FCF6EE; box-shadow: inset 3px 0 0 #B3864F; cursor: default; }

.lesb-cb { width: 22px; height: 22px; margin: 0 6px; accent-color: #785533; cursor: pointer; }
.lesb-num {
  display: inline-flex; align-items: center; justify-content: center;
  height: 22px; padding: 0 6px; border-radius: 6px;
  background: #F3F0EC; color: #2B211B; font: 800 11px/1 Inter, system-ui, sans-serif;
}
.lesb-num--ativa { background: #2B211B; color: #fff; }
.lesb-cell {
  font: 600 12px/1.3 Inter, system-ui, sans-serif; color: #2B211B;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lesb-cell--tipo { font-weight: 700; }
.lesb-dim { font-style: normal; color: #B0A79D; }
.lesb-ap { font: 500 12px/1.3 Inter, system-ui, sans-serif; color: #B0A79D; white-space: nowrap; }
.lesb-ap--sim { font-weight: 800; color: #1D4ED8; }

.lesb-tags { display: flex; gap: 4px; flex-wrap: wrap; overflow: hidden; }
.lesb-tag {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px;
  border-radius: 5px; font: 700 9.5px/1 Inter, system-ui, sans-serif; white-space: nowrap;
}
.lesb-tag--brown  { background: #F4EADF; color: #785533; border: 1px solid #E6D8C8; }
.lesb-tag--red    { background: #FBEDEC; color: #B3261E; border: 1px solid #F2CFCC; }
.lesb-tag--amber  { background: #FEF6E7; color: #92610C; border: 1px solid #F3E0BD; }
.lesb-tag--slate  { background: #F3F0EC; color: #6F6258; border: 1px solid #E2DCD4; }
.lesb-tag--indigo { background: #EEF2FF; color: #4338CA; border: 1px solid #E0E7FF; }

.lesb-orig {
  display: inline-flex; align-items: center; justify-content: center; height: 18px;
  padding: 0 6px; border-radius: 5px; font: 700 9.5px/1 Inter, system-ui, sans-serif;
}
.lesb-orig--eda    { background: #EFF4FE; color: #1D4ED8; border: 1px solid #C7DAFB; }
.lesb-orig--colono { background: #EDF7F1; color: #177245; border: 1px solid #C4E3D2; }

.lesb-acoes { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.lesb-act {
  width: 40px; height: 40px; border-radius: 8px; border: 1px solid #E6D8C8;
  background: #fff; color: #6F6258; font: 600 15px/1 Inter, system-ui, sans-serif;
  cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center;
}
.lesb-act:hover { border-color: #785533; color: #785533; }
.lesb-act--del:hover { border-color: #B3261E; color: #B3261E; }
.lesb-editando { font: 700 11px/1 Inter, system-ui, sans-serif; color: #92610C; white-space: nowrap; }

/* Confirmação de exclusão NA PRÓPRIA LINHA (sem confirm() nativo). */
.lesb-row--confirm {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  min-height: 46px; padding: 6px 12px; border-top: 1px solid #F3EEE7;
  background: #FBEDEC; cursor: default;
}
.lesb-confirm-txt { font: 600 11.5px/1.4 Inter, system-ui, sans-serif; color: #7A1F1A; }
.lesb-confirm-yes, .lesb-confirm-no {
  height: 34px; padding: 0 14px; border-radius: 8px; cursor: pointer;
  font: 800 11.5px/1 Inter, system-ui, sans-serif;
}
.lesb-confirm-yes { border: 1.5px solid #B3261E; background: #B3261E; color: #fff; }
.lesb-confirm-no  { border: 1.5px solid #E6D8C8; background: #fff; color: #6F6258; }

.lesb-empty {
  background: #fff; border: 1px dashed #D8C4AC; border-radius: 10px;
  padding: 14px 16px; font: 500 12px/1.6 Inter, system-ui, sans-serif; color: #8A7F73;
}

/* Desktop: linhas de 38 px e alvos de 36 px (mesma arquitetura, mais densidade). */
@media (min-width: 1100px) {
  .lesb-row, .lesb-row--confirm { min-height: 38px; }
  .lesb-act { width: 34px; height: 32px; }
  .lesb-done { height: 32px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHIPS SOBRE O SELECT · STEPPER · BLOCO DE CLIPES  (06/09, decisões 2a e 2b)
   O controle original (select/input) continua no DOM, só escondido — ele é
   quem guarda o valor. Os chips são a superfície de toque.
   ═══════════════════════════════════════════════════════════════════════════ */
.les-select-oculto { display: none !important; }

.les-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.les-chips-raros { display: contents; }
.les-chip {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 14px; border-radius: 9px;
  border: 1.5px solid #DCCDBB; background: #fff; color: #2B211B;
  font: 600 12.5px/1 Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap;
}
.les-chip:hover { border-color: #B3864F; }
.les-chip.on { background: #785533; border-color: #785533; color: #fff; font-weight: 700; }
.les-chip--more { border-style: dashed; color: #785533; font-weight: 700; }
.les-chip--mm { min-width: 44px; padding: 0 10px; font-variant-numeric: tabular-nums; }
.les-input-outro { max-width: 96px; }

.les-stepper { display: inline-flex; align-items: center; gap: 0; }
.les-stepper input {
  width: 60px; height: 40px; text-align: center; border-radius: 0;
  border-left: 0; border-right: 0; font-variant-numeric: tabular-nums;
}
.les-step {
  width: 40px; height: 40px; border: 1.5px solid #DCCDBB; background: #fff;
  color: #785533; font: 700 17px/1 Inter, system-ui, sans-serif; cursor: pointer; padding: 0;
}
.les-step[data-d="-1"] { border-radius: 9px 0 0 9px; }
.les-step[data-d="1"]  { border-radius: 0 9px 9px 0; }
.les-step:hover { border-color: #785533; background: #F4EADF; }

.les-field--wide { flex-basis: 100%; }
.les-grid--clipes { align-items: flex-start; }
.les-hemo-clip-hint {
  margin-top: 6px; padding: 6px 10px; border-radius: 8px;
  background: #F4EADF; border: 1px solid #E6D8C8;
  font: 500 11px/1.5 Inter, system-ui, sans-serif; color: #6F5844;
}

@media (min-width: 1100px) {
  .les-chip, .les-step, .les-stepper input { height: 34px; }
  .les-chip { padding: 0 12px; font-size: 12px; }
  .les-step { width: 34px; }
}

/* Polyp workbench follows the reference, with one canonical control per field. */
#list_lesoes .les-polipo-layout {display:grid;grid-template-columns:minmax(0,1.9fr) minmax(240px,1fr);gap:14px 24px;background:#fff;}
#list_lesoes .lp-topo,#list_lesoes .lp-options,#list_lesoes .lp-additional {grid-column:1/-1;}
#list_lesoes .les-polipo-layout .les-field {min-width:0;}
#list_lesoes .les-polipo-layout .les-field-label {margin:0 0 6px;line-height:1.3;}
#list_lesoes .les-polipo-layout .les-field-label small {font-size:11px;font-weight:400;text-transform:none;letter-spacing:0;color:#998e80;}
#list_lesoes .les-polipo-layout .les-chips,#list_lesoes .les-polipo-layout .les-tecnica-chips {display:flex;flex-wrap:wrap;gap:5px;}
#list_lesoes .les-polipo-layout .les-chip,#list_lesoes .les-polipo-layout .les-tecnica-chip {display:inline-flex;align-items:center;justify-content:center;gap:6px;flex:0 0 auto;min-height:44px;padding:8px 12px;border-radius:9px;font-size:13px;line-height:1.2;white-space:nowrap;}
#list_lesoes .les-polipo-layout [data-les-raros] {display:contents;}
#list_lesoes .les-paris-icon {flex:none;}
#list_lesoes .lp-size-row {display:flex;gap:14px;align-items:flex-start;min-width:0;}
#list_lesoes .lp-size {flex:1;min-width:0;}
#list_lesoes .lp-size-controls {display:flex;flex-wrap:wrap;gap:5px;}
#list_lesoes .lp-size-controls .les-chips {display:contents;}
#list_lesoes .lp-size-controls .les-chip {min-width:36px;padding:8px;}
#list_lesoes .lp-size-controls .les-input-outro {width:76px;margin:0;min-height:44px;}
#list_lesoes .lp-max {flex:0 0 140px;}
#list_lesoes .lp-max input {width:100%;min-height:44px;}
#list_lesoes .lp-max input:disabled {background:#f5f2ee;opacity:.6;}
#list_lesoes .lp-quantity .les-stepper {width:148px;min-height:44px;}
#list_lesoes .lp-options {display:flex;flex-wrap:wrap;align-items:flex-start;gap:14px 20px;}
#list_lesoes .lp-options .les-edit-section {margin:0;}
#list_lesoes .lp-options .les-edit-section-label {display:none;}
#list_lesoes .lp-options .les-grid {display:flex;flex-wrap:wrap;gap:16px;align-items:flex-start;}
#list_lesoes .lp-options .les-field {flex:0 1 auto;}
#list_lesoes .lp-options .les-frasco-field {width:150px;}
#list_lesoes .lp-options .les-field select:not(.les-select-oculto) {min-height:44px;}
#list_lesoes .lp-additional {border-top:1px dashed #e9dfd4;padding-top:8px;}
#list_lesoes .lesb-head [data-bench-dup],#list_lesoes .lesb-head [data-bench-del] {width:auto;min-width:44px;padding:8px 12px;}
@media(max-width:1050px){#list_lesoes .les-polipo-layout {grid-template-columns:minmax(0,1fr);gap:14px;}#list_lesoes .lp-options {gap:12px;}#list_lesoes .lp-quantity {grid-row:3;} }
@media(max-width:550px){#list_lesoes .lp-size-row {flex-wrap:wrap;}#list_lesoes .lp-size {flex-basis:100%;}#list_lesoes .lesb-head {flex-wrap:wrap;}}

#list_lesoes .lp-detail-note{font-size:11px;color:#a3988b;margin-left:14px;}
#list_lesoes .lesb-bench .les-edit{background:#fff;}
#list_lesoes .lp-options [data-les-chips="enviado_ap"],#list_lesoes .lp-options [data-les-chips="fechamento_clipe"] {gap:3px;padding:3px;border:1px solid #e5d6c4;background:#f5efe8;border-radius:10px;}
#list_lesoes .lp-options [data-les-chips="enviado_ap"] .les-chip,#list_lesoes .lp-options [data-les-chips="fechamento_clipe"] .les-chip {border-color:transparent;background:transparent;}
#list_lesoes .lp-options [data-les-chips="enviado_ap"] .les-chip.on,#list_lesoes .lp-options [data-les-chips="fechamento_clipe"] .les-chip.on {background:#785533;color:#fff;}
