/* Contabilidad › Tesorería › Efectos (public/efectos.js): lista, asistente de alta, ficha y
   ventanas de acción. 13-oct-2026: «arregla toda la estética». Mismos criterios que la
   lista de Conciliar (reconciliation-list.css), el chat y la cabecera de Contabilidad: bordes
   #E2E5EA, fondo #F3F4F6, tarjetas blancas de radio 14, chips de 12 px, controles de 44 px y
   radio 10, secundarios #5B6472, cifras tabulares y monoespaciada para números de documento.
   Todo cuelga de ids (#tes-efectos y .ef-modal con su id) para quedar por encima de los temas
   glass y festival sin !important salvo donde el tema ya lo usa. */
:is(#tes-efectos, .ef-modal) {
  --ef-page: #F3F4F6; --ef-card: #FFFFFF; --ef-border: #E2E5EA; --ef-border-hover: #C3C9D2;
  --ef-strip: #F7F8FA; --ef-strip-border: #ECEEF2; --ef-outline: #CDD3DC;
  --ef-text: #161B26; --ef-sec: #5B6472; --ef-sec2: #4A5260;
  --ef-acc: #2F3F7A; --ef-acc-bg: #E3E8F7;
  --ef-in: #1F7A4D; --ef-in-bg: #E5F3EB; --ef-out: #B42318; --ef-out-bg: #FCEBE9;
  --ef-amb: #7A5200; --ef-amb-bg: #FDF0D2; --ef-gris: #4A5260; --ef-gris-bg: #ECEEF2; --ef-focus: #2F3F7A;
  --ef-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --ef-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --ef-dur: var(--dur-control, 150ms);
}
[data-theme="dark"] :is(#tes-efectos, .ef-modal) {
  --ef-page: var(--bg-body); --ef-card: var(--bg-card); --ef-border: var(--border); --ef-border-hover: #3a414d;
  --ef-strip: color-mix(in srgb, var(--bg-card) 86%, #ffffff 4%); --ef-strip-border: var(--border); --ef-outline: #3d4450;
  --ef-text: var(--text-primary); --ef-sec: #A3AAB6; --ef-sec2: #B7BDC7;
  --ef-acc: #B9C6F7; --ef-acc-bg: rgba(63, 86, 170, .30);
  --ef-in: #5DD39E; --ef-in-bg: rgba(31, 122, 77, .22); --ef-out: #FF8F85; --ef-out-bg: rgba(180, 35, 24, .24);
  --ef-amb: #F3CA74; --ef-amb-bg: rgba(200, 140, 0, .20); --ef-gris: #C3C9D2; --ef-gris-bg: rgba(255, 255, 255, .08); --ef-focus: #B9C6F7;
  --ef-shadow: none;
}

/* ================= Piezas comunes ================= */
:is(#tes-efectos, .ef-modal) .ef-ico { flex: none; width: 16px; height: 16px; }
:is(#tes-efectos, .ef-modal) .ef-mono { font-family: var(--ef-mono); font-size: .93em; letter-spacing: 0; }
:is(#tes-efectos, .ef-modal) .ef-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
:is(#tes-efectos, .ef-modal) .ef-sec { color: var(--ef-sec); }
:is(#tes-efectos, .ef-modal) ::selection { background: var(--ef-acc-bg); color: var(--ef-text); }

/* Chips: 24 px, 12 px semibold */
:is(#tes-efectos, .ef-modal) .ef-chip {
  flex: none; display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; border: 0;
  font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums;
  color: var(--ef-gris); background: var(--ef-gris-bg);
}
:is(#tes-efectos, .ef-modal) .ef-chip .ef-ico { width: 13px; height: 13px; }
:is(#tes-efectos, .ef-modal) .ef-chip-azul { color: var(--ef-acc); background: var(--ef-acc-bg); }
:is(#tes-efectos, .ef-modal) .ef-chip-linea { color: var(--ef-acc); background: transparent; box-shadow: inset 0 0 0 1px currentColor; }
:is(#tes-efectos, .ef-modal) .ef-chip-ambar { color: var(--ef-amb); background: var(--ef-amb-bg); }
:is(#tes-efectos, .ef-modal) .ef-chip-verde { color: var(--ef-in); background: var(--ef-in-bg); }
:is(#tes-efectos, .ef-modal) .ef-chip-rojo { color: var(--ef-out); background: var(--ef-out-bg); }
:is(#tes-efectos, .ef-modal) .ef-chip-doc { font-family: var(--ef-mono); font-weight: 500; color: var(--ef-text); background: var(--ef-card); box-shadow: inset 0 0 0 1px var(--ef-outline); }

/* Botones: 44 px, radio 10 */
:is(#tes-efectos, .ef-modal) .ef-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; min-height: 44px; padding: 0 16px; margin: 0;
  border-radius: 10px !important; font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; white-space: nowrap; cursor: pointer;
  transition: background-color var(--ef-dur) ease, border-color var(--ef-dur) ease, color var(--ef-dur) ease;
}
:is(#tes-efectos, .ef-modal) .ef-btn.btn-primary { box-shadow: none !important; }
:is(#tes-efectos, .ef-modal) .ef-btn-outline { background: var(--ef-card) !important; border: 1px solid var(--ef-outline) !important; color: var(--ef-text) !important; box-shadow: none !important; }
:is(#tes-efectos, .ef-modal) .ef-btn-ghost { background: transparent !important; border: 1px solid transparent !important; color: var(--ef-text) !important; box-shadow: none !important; }
:is(#tes-efectos, .ef-modal) .ef-btn-peligro { color: var(--ef-out) !important; }
:is(#tes-efectos, .ef-modal) :is(.ef-btn-outline, .ef-btn-ghost) .ef-ico { color: var(--ef-acc); }
:is(#tes-efectos, .ef-modal) .ef-btn-peligro .ef-ico { color: currentColor; }
:is(#tes-efectos, .ef-modal) .ef-btn-texto {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 8px; margin: 0; border: 0; border-radius: 8px; background: none;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ef-acc); cursor: pointer; white-space: nowrap;
}
:is(#tes-efectos, .ef-modal) .ef-icono {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; margin: 0; border: 0; border-radius: 10px;
  background: transparent; color: var(--ef-sec); cursor: pointer; transition: background-color var(--ef-dur) ease, color var(--ef-dur) ease;
}
:is(#tes-efectos, .ef-modal) .ef-icono .ef-ico { width: 18px; height: 18px; }
:is(#tes-efectos, .ef-modal) :is(.ef-btn, .ef-btn-texto, .ef-icono):disabled { opacity: .45; cursor: default; }
@media (hover: hover) and (pointer: fine) {
  :is(#tes-efectos, .ef-modal) .ef-btn-outline:hover:not(:disabled) { background: var(--ef-strip) !important; border-color: var(--ef-border-hover) !important; }
  :is(#tes-efectos, .ef-modal) .ef-btn-ghost:hover:not(:disabled) { background: var(--ef-gris-bg) !important; }
  :is(#tes-efectos, .ef-modal) .ef-btn-peligro:hover:not(:disabled) { background: var(--ef-out-bg) !important; }
  :is(#tes-efectos, .ef-modal) .ef-btn-texto:hover:not(:disabled) { background: var(--ef-acc-bg); }
  :is(#tes-efectos, .ef-modal) .ef-icono:hover:not(:disabled) { background: var(--ef-gris-bg); color: var(--ef-text); }
}
:is(#tes-efectos, .ef-modal) :is(button, summary, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--ef-focus) !important; outline-offset: 2px; }

/* Campos: etiqueta arriba (12 px) y control de 44 px */
:is(#tes-efectos, .ef-modal) .ef-campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
:is(#tes-efectos, .ef-modal) section { background: transparent; }
:is(#tes-efectos, .ef-modal) .ef-campo > :is(label, legend, .ef-lbl) {
  display: block; margin: 0; padding: 0; font-size: 12px; font-weight: 600; line-height: 16px; letter-spacing: 0; text-transform: none; color: var(--ef-sec);
}
:is(#tes-efectos, .ef-modal) .ef-campo > label small { font-weight: 500; color: var(--ef-sec); }
:is(#tes-efectos, .ef-modal) :where(.ef-control, .ef-campo > input, .ef-campo > select, .ef-tabla input:not([type=checkbox]), .ef-barra select, .ef-buscar input) {
  box-sizing: border-box; width: 100%; height: 44px; min-height: 44px; margin: 0; padding: 0 12px;
  border: 1px solid var(--ef-outline) !important; border-radius: 10px !important; background-color: var(--ef-card) !important; box-shadow: none !important;
  font-family: inherit; font-size: 14px; line-height: 1.2; color: var(--ef-text) !important; outline: none;
  transition: border-color var(--ef-dur) ease, box-shadow var(--ef-dur) ease;
}
:is(#tes-efectos, .ef-modal) :where(.ef-campo > select, .ef-barra select) {
  appearance: none; -webkit-appearance: none; padding-right: 34px; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%235B6472' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: right 10px center !important;
}
:is(#tes-efectos, .ef-modal) :where(.ef-control, .ef-campo > input, .ef-campo > select, .ef-tabla input:not([type=checkbox]), .ef-barra select, .ef-buscar input):hover:not(:disabled):not(:focus) { border-color: var(--ef-border-hover) !important; }
:is(#tes-efectos, .ef-modal) :where(.ef-control, .ef-campo > input, .ef-campo > select, .ef-tabla input:not([type=checkbox]), .ef-barra select, .ef-buscar input):focus {
  border-color: var(--ef-focus) !important; box-shadow: 0 0 0 3px var(--ef-acc-bg) !important; outline: none !important;
}
:is(#tes-efectos, .ef-modal) :is(.ef-campo > input, .ef-tabla input)::placeholder { color: #8A929E; opacity: 1; }
:is(#tes-efectos, .ef-modal) .ef-tabla input[aria-invalid="true"], :is(#tes-efectos, .ef-modal) .ef-campo > input[aria-invalid="true"] { border-color: var(--ef-out) !important; }
:is(#tes-efectos, .ef-modal) input.ef-imp { text-align: right; font-variant-numeric: tabular-nums; }
:is(#tes-efectos, .ef-modal) input.ef-mono { font-family: var(--ef-mono); font-size: 13.5px; }
:is(#tes-efectos, .ef-modal) input[type=date] { font-variant-numeric: tabular-nums; }
:is(#tes-efectos, .ef-modal) input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--ef-acc); cursor: pointer; }

/* Control segmentado */
:is(#tes-efectos, .ef-modal) .ef-seg {
  display: inline-flex; flex-wrap: wrap; align-items: stretch; gap: 2px; padding: 3px; min-height: 44px; box-sizing: border-box;
  background: var(--ef-gris-bg); border-radius: 10px; max-width: 100%;
}
:is(#tes-efectos, .ef-modal) .ef-seg > button {
  flex: 0 0 auto; min-width: 38px; min-height: 38px; margin: 0; padding: 0 12px; border: 0 !important; border-radius: 8px !important;
  background: transparent !important; box-shadow: none !important; color: var(--ef-sec2) !important;
  font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; font-variant-numeric: tabular-nums;
  transition: background-color var(--ef-dur) ease, color var(--ef-dur) ease;
}
:is(#tes-efectos, .ef-modal) .ef-seg > button[aria-checked="true"], :is(#tes-efectos, .ef-modal) .ef-seg > button[aria-pressed="true"] {
  background: var(--ef-card) !important; color: var(--ef-text) !important; box-shadow: 0 1px 2px rgba(16, 24, 40, .12) !important;
}
@media (hover: hover) and (pointer: fine) {
  :is(#tes-efectos, .ef-modal) .ef-seg > button:not([aria-checked="true"]):not([aria-pressed="true"]):hover { color: var(--ef-text) !important; background: color-mix(in srgb, var(--ef-card) 55%, transparent) !important; }
}

/* Nota corta con icono */
:is(#tes-efectos, .ef-modal) .ef-nota { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 13px; line-height: 1.45; color: var(--ef-sec); text-wrap: pretty; }
:is(#tes-efectos, .ef-modal) .ef-nota .ef-ico { margin-top: 1px; color: var(--ef-sec); }

/* Tarjeta y caja de tabla */
:is(#tes-efectos, .ef-modal) .ef-tarjeta { background: var(--ef-card); border: 1px solid var(--ef-border); border-radius: 14px; box-shadow: var(--ef-shadow); }
:is(#tes-efectos, .ef-modal) .ef-tabla-caja { background: var(--ef-card); border: 1px solid var(--ef-border); border-radius: 14px; overflow: hidden; }
:is(#tes-efectos, .ef-modal) .ef-tabla { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 14px; color: var(--ef-text); background: none; margin: 0; }
:is(#tes-efectos, .ef-modal) .ef-tabla :is(th, td) { padding: 0 12px; height: 52px; text-align: left; vertical-align: middle; border: 0; border-bottom: 1px solid var(--ef-strip-border); background: none; }
:is(#tes-efectos, .ef-modal) .ef-tabla thead th {
  height: 40px; font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ef-sec); background: var(--ef-strip);
  border-bottom: 1px solid var(--ef-border); white-space: nowrap; position: static;
}
:is(#tes-efectos, .ef-modal) .ef-tabla tbody tr:last-child > td { border-bottom: 0; }
:is(#tes-efectos, .ef-modal) .ef-tabla tfoot td { height: 56px; background: var(--ef-strip); border-top: 1px solid var(--ef-border); border-bottom: 0; }
:is(#tes-efectos, .ef-modal) .ef-tabla .ef-der { text-align: right; }
:is(#tes-efectos, .ef-modal) .ef-tabla .ef-cen { text-align: center; }
:is(#tes-efectos, .ef-modal) .ef-tabla tbody tr { transition: background-color var(--ef-dur) ease; }
@media (hover: hover) and (pointer: fine) { :is(#tes-efectos, .ef-modal) .ef-tabla tbody tr:hover { background: #F7F8FB; } [data-theme="dark"] :is(#tes-efectos, .ef-modal) .ef-tabla tbody tr:hover { background: rgba(255, 255, 255, .03); } }
:is(#tes-efectos, .ef-modal) .ef-tabla small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.35; color: var(--ef-sec); }
:is(#tes-efectos, .ef-modal) .ef-vacio { margin: 0; padding: 20px 16px; font-size: 14px; color: var(--ef-sec); text-align: center; }

/* ================= Ventanas ================= */
.ef-modal > .modal-content.ef-dlg {
  display: flex; flex-direction: column; width: min(880px, calc(100vw - 48px)); max-width: none; max-height: min(880px, calc(100dvh - 48px));
  padding: 0; overflow: hidden; background: var(--ef-card); color: var(--ef-text);
}
.ef-modal > .modal-content.ef-dlg-medio { width: min(600px, calc(100vw - 48px)); }
.ef-modal > .modal-content.ef-dlg-ficha { width: min(800px, calc(100vw - 48px)); }
.ef-modal .ef-dlg-cab { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 4px 12px; padding: 20px 16px 16px 24px; border-bottom: 1px solid var(--ef-border); }
.ef-modal .ef-dlg-tit { min-width: 0; padding-top: 6px; }
.ef-modal .ef-dlg-tit h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin: 0; font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: -.02em; color: var(--ef-text); text-wrap: balance; }
.ef-modal .ef-dlg-sub { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: var(--ef-sec); }
.ef-modal .ef-dlg-sub:empty { display: none; }
.ef-modal .ef-x { margin: -2px -4px 0 0; }
.ef-modal .ef-x .ef-ico { width: 20px; height: 20px; }
.ef-modal :is(.ef-dlg-form, .ef-dlg-cuerpo-caja) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin: 0; }
.ef-modal .ef-dlg-cuerpo { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.ef-modal .ef-dlg-pie { flex: none; display: flex; flex-direction: column; gap: 10px; padding: 14px 24px 16px; border-top: 1px solid var(--ef-border); background: var(--ef-card); }
.ef-modal .ef-pie-fila { display: flex; align-items: center; gap: 8px; }
.ef-modal .ef-pie-fila > .ef-hueco { flex: 1 1 auto; }
.ef-modal .ef-pie-fila .ef-oculto { visibility: hidden; }
.ef-modal .ef-error { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--ef-out-bg); color: var(--ef-out); font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.ef-modal .ef-error:empty { display: none; }

/* Pasos: número en círculo, completado con ✓, activo en color y línea de progreso */
.ef-modal .ef-pasos { grid-column: 1 / -1; display: flex; margin: 14px 0 0; padding: 0; list-style: none; counter-reset: none; }
.ef-modal .ef-pasos li { flex: 1 1 0; min-width: 0; position: relative; display: flex; }
.ef-modal .ef-pasos li + li::before {
  content: ''; position: absolute; top: 21px; left: -50%; right: 50%; height: 2px; margin: 0 22px; border-radius: 2px; background: var(--ef-border);
  transition: background-color var(--ef-dur) ease;
}
.ef-modal .ef-pasos li:has(> .ef-paso.hecho, > .ef-paso[aria-current="step"])::before { background: var(--ef-acc); }
.ef-modal .ef-paso {
  position: relative; z-index: 1; flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; margin: 0; padding: 6px 4px;
  border: 0; border-radius: 10px; background: none; font: inherit; font-size: 13px; font-weight: 500; line-height: 1.25; color: var(--ef-sec); cursor: default; text-align: center;
}
.ef-modal .ef-paso-n {
  display: grid; place-items: center; width: 30px; height: 30px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--ef-outline); background: var(--ef-card);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ef-sec); transition: background-color var(--ef-dur) ease, border-color var(--ef-dur) ease, color var(--ef-dur) ease;
}
.ef-modal .ef-paso-n .ef-ico { width: 15px; height: 15px; stroke-width: 2.4; }
.ef-modal .ef-paso-t { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ef-modal .ef-paso[aria-current="step"] { color: var(--ef-text); font-weight: 600; }
.ef-modal .ef-paso[aria-current="step"] .ef-paso-n { border-color: var(--ef-acc); background: var(--ef-acc); color: var(--ef-card); }
.ef-modal .ef-paso.hecho { color: var(--ef-text); cursor: pointer; }
.ef-modal .ef-paso.hecho .ef-paso-n { border-color: var(--ef-acc); background: var(--ef-acc-bg); color: var(--ef-acc); }
@media (hover: hover) and (pointer: fine) { .ef-modal .ef-paso.hecho:hover .ef-paso-t { text-decoration: underline; text-underline-offset: 3px; } }

/* En móvil, hojas a pantalla completa con cabecera y pie fijos */
@media (max-width: 800px) {
  .ef-modal > .modal-content.ef-dlg { width: 100% !important; height: calc(100dvh - env(safe-area-inset-top) - 24px); max-height: calc(100dvh - env(safe-area-inset-top) - 24px) !important; padding: 0 !important; }
  .ef-modal > .modal-content.ef-dlg:is(.ef-dlg-medio) { height: auto; }
  .ef-modal > .modal-content.ef-dlg::before { flex: none; margin: 8px auto 0 !important; }
  .ef-modal .ef-dlg-cab { padding: 10px 8px 12px 16px; }
  .ef-modal .ef-dlg-tit h2 { font-size: 18px; }
  .ef-modal .ef-dlg-cuerpo { padding: 16px; gap: 16px; }
  .ef-modal .ef-dlg-pie { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); box-shadow: none !important; }
  .ef-modal .ef-pie-fila .ef-btn { flex: 1 1 auto; min-width: 0; padding: 0 12px; }
  .ef-modal .ef-pie-fila > .ef-hueco { display: none; }
  .ef-modal .ef-pie-fila .ef-oculto { display: none; }
  .ef-modal .ef-pasos { margin-top: 10px; }
  .ef-modal .ef-paso { font-size: 12px; }
  .ef-modal :is(.ef-campo > input, .ef-campo > select, .ef-tabla input:not([type=checkbox]), .ef-buscar input, .ef-barra select) { font-size: 16px; }
}

/* ================= Asistente de alta ================= */
#modal-efecto-nuevo .ef-panel { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
#modal-efecto-nuevo .ef-panel.hidden { display: none; }

/* Paso 1: buscador y tarjeta del tercero */
.ef-modal .ef-buscar { position: relative; }
.ef-modal .ef-buscar > .ef-ico { position: absolute; left: 14px; top: 14px; color: var(--ef-sec); pointer-events: none; }
:is(#tes-efectos, .ef-modal) .ef-buscar input { padding-left: 40px; }
#modal-efecto-nuevo .ef-buscar input { height: 48px; font-size: 15px; }
.ef-modal .ef-resultados { margin: 6px 0 0; padding: 6px; max-height: 300px; overflow-y: auto; background: var(--ef-card); border: 1px solid var(--ef-border); border-radius: 12px; box-shadow: 0 14px 34px rgba(16, 24, 40, .12); }
.ef-modal .ef-resultados[hidden] { display: none; }
.ef-modal .ef-res { display: block; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 8px; background: none; text-align: left; font: inherit; color: var(--ef-text); cursor: pointer; }
.ef-modal .ef-res[aria-selected="true"], .ef-modal .ef-res:hover { background: var(--ef-strip); }
.ef-modal .ef-res b { display: block; font-size: 14px; font-weight: 600; }
.ef-modal .ef-res span { display: block; margin-top: 2px; font-size: 12px; color: var(--ef-sec); }
.ef-modal .ef-res em { font-style: normal; color: var(--ef-amb); }
.ef-modal .ef-res-nada { padding: 12px; font-size: 13px; color: var(--ef-sec); }
.ef-modal .ef-tercero { display: flex; align-items: center; gap: 14px; padding: 14px 8px 14px 16px; }
.ef-modal .ef-tercero.hidden { display: none; }
.ef-modal .ef-tercero-ini { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--ef-acc-bg); color: var(--ef-acc); font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.ef-modal .ef-tercero-txt { flex: 1 1 auto; min-width: 0; }
.ef-modal .ef-tercero-nombre { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--ef-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ef-modal .ef-tercero-info { margin: 3px 0 0; font-size: 13px; line-height: 1.35; color: var(--ef-sec); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ef-modal .ef-tercero-info:empty { display: none; }

/* Paso 2: facturas */
#modal-efecto-nuevo .ef-docs col.c-chk { width: 48px; }
#modal-efecto-nuevo .ef-docs col.c-fecha { width: 104px; }
#modal-efecto-nuevo .ef-docs col.c-vence { width: 176px; }
#modal-efecto-nuevo .ef-docs col.c-disp { width: 128px; }
#modal-efecto-nuevo .ef-docs col.c-pagar { width: 168px; }
#modal-efecto-nuevo .ef-docs :is(th, td):first-child { padding-left: 16px; padding-right: 0; }
#modal-efecto-nuevo .ef-docs .ef-doc-num { font-family: var(--ef-mono); font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#modal-efecto-nuevo .ef-docs td.ef-vence { white-space: nowrap; }
#modal-efecto-nuevo .ef-docs td.ef-vence .ef-chip { margin-left: 6px; height: 22px; padding: 0 8px; }
#modal-efecto-nuevo .ef-docs input.ef-imp { width: 140px; height: 40px; min-height: 40px; margin-left: auto; display: block; }
#modal-efecto-nuevo .ef-docs th.ef-der:last-child { padding-right: 25px; }
#modal-efecto-nuevo .ef-docs tbody tr.marcada { background: color-mix(in srgb, var(--ef-acc-bg) 35%, transparent); }
#modal-efecto-nuevo .ef-docs tfoot td { height: auto; padding-top: 12px; padding-bottom: 12px; }
#modal-efecto-nuevo .ef-docs .ef-pie-lbl { font-size: 13px; font-weight: 600; color: var(--ef-text); white-space: nowrap; }
#modal-efecto-nuevo .ef-docs .ef-pie-de { display: block; margin-top: 4px; text-align: right; font-size: 12px; color: var(--ef-sec); font-variant-numeric: tabular-nums; white-space: nowrap; }
#modal-efecto-nuevo .ef-docs input#ef-n-total { font-weight: 600; }
#modal-efecto-nuevo .ef-contador { font-size: 13px; color: var(--ef-sec); white-space: nowrap; font-variant-numeric: tabular-nums; }
#modal-efecto-nuevo .ef-contador b { color: var(--ef-text); font-weight: 600; }
#modal-efecto-nuevo .ef-aviso { margin: 0; font-size: 12px; font-weight: 600; color: var(--ef-amb); text-align: right; }
#modal-efecto-nuevo .ef-aviso:empty { display: none; }

/* Paso 3: resumen, rejilla de campos y vencimientos */
#modal-efecto-nuevo .ef-resumen { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
#modal-efecto-nuevo .ef-resumen-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
#modal-efecto-nuevo .ef-resumen-nombre { margin: 0; color: var(--ef-text); font-size: 16px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#modal-efecto-nuevo .ef-resumen-chips { display: flex; flex-wrap: wrap; gap: 6px; }
#modal-efecto-nuevo .ef-resumen-total { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
#modal-efecto-nuevo .ef-resumen-total span { font-size: 12px; font-weight: 600; color: var(--ef-sec); }
#modal-efecto-nuevo .ef-resumen-total strong { color: var(--ef-text); font-size: 24px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
#modal-efecto-nuevo .ef-rejilla { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: start; }
#modal-efecto-nuevo .ef-rejilla .ef-doble { grid-column: span 2; }
#modal-efecto-nuevo .ef-num-fila { display: flex; align-items: center; gap: 8px; min-width: 0; }
#modal-efecto-nuevo .ef-num-fila .ef-seg { flex: none; }
#modal-efecto-nuevo .ef-num-fila .ef-seg > button { min-width: 40px; padding: 0 10px; }
#modal-efecto-nuevo input#ef-n-num-otro { width: 72px; flex: none; text-align: center; font-variant-numeric: tabular-nums; }
#modal-efecto-nuevo input#ef-n-num-otro[hidden] { display: none; }
#modal-efecto-nuevo .ef-vencs col.c-n { width: 48px; }
#modal-efecto-nuevo .ef-vencs col.c-ref { width: 32%; }
#modal-efecto-nuevo .ef-vencs col.c-venc { width: 30%; }
#modal-efecto-nuevo .ef-vencs col.c-x { width: 56px; }
#modal-efecto-nuevo .ef-vencs :is(th, td):first-child { padding-left: 16px; padding-right: 0; color: var(--ef-sec); font-variant-numeric: tabular-nums; }
#modal-efecto-nuevo .ef-vencs :is(th, td):last-child { padding: 0 6px 0 0; }
#modal-efecto-nuevo .ef-vencs input { height: 40px; min-height: 40px; }
#modal-efecto-nuevo .ef-vencs input.ef-imp { max-width: 168px; margin-left: auto; display: block; }
/* La cifra de la cabecera y la del pie caen sobre las del campo (12 px de relleno + 1 de borde) */
#modal-efecto-nuevo .ef-vencs th.ef-der, #modal-efecto-nuevo .ef-vencs .ef-cuadre { padding-right: 25px; }
#modal-efecto-nuevo .ef-vencs .ef-quitar { width: 40px; height: 40px; min-height: 40px; margin-left: auto; }
#modal-efecto-nuevo .ef-vencs .ef-quitar .ef-ico { width: 16px; height: 16px; }
#modal-efecto-nuevo .ef-vencs tfoot td { height: 60px; }
#modal-efecto-nuevo .ef-vencs tfoot td:first-child { padding-left: 8px; }
#modal-efecto-nuevo .ef-cuadre { text-align: right; line-height: 1.3; }
#modal-efecto-nuevo .ef-cuadre strong { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
#modal-efecto-nuevo .ef-cuadre small { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; white-space: nowrap; }
#modal-efecto-nuevo .ef-cuadre.ok strong, #modal-efecto-nuevo .ef-cuadre.ok small { color: var(--ef-in); }
#modal-efecto-nuevo .ef-cuadre.mal strong, #modal-efecto-nuevo .ef-cuadre.mal small { color: var(--ef-amb); }
#modal-efecto-nuevo .ef-cuadre .ef-btn-texto { height: 28px; padding: 0 6px; margin: 0 -6px 0 0; font-size: 12px; color: var(--ef-amb); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 719px) {
  #modal-efecto-nuevo .ef-rejilla { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  #modal-efecto-nuevo .ef-rejilla .ef-doble { grid-column: auto; }
  #modal-efecto-nuevo .ef-num-fila { flex-wrap: wrap; }
  #modal-efecto-nuevo .ef-resumen { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px; }
  #modal-efecto-nuevo .ef-resumen-total { flex-direction: row; justify-content: space-between; align-items: baseline; padding-top: 10px; border-top: 1px solid var(--ef-strip-border); }
  #modal-efecto-nuevo .ef-resumen-total strong { color: var(--ef-text); font-size: 22px; }
  /* Tablas como filas apiladas: sin desplazamiento lateral */
  #modal-efecto-nuevo .ef-tabla, #modal-efecto-nuevo .ef-tabla :is(tbody, tfoot) { display: block; }
  #modal-efecto-nuevo .ef-tabla :is(colgroup, thead) { display: none; }
  #modal-efecto-nuevo .ef-tabla tr { display: grid; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--ef-strip-border); }
  #modal-efecto-nuevo .ef-tabla :is(td, th) { display: block; height: auto; padding: 0 !important; border: 0; }
  #modal-efecto-nuevo .ef-tabla tbody tr:last-child { border-bottom: 0; }
  #modal-efecto-nuevo .ef-tabla tfoot tr { background: var(--ef-strip); border-top: 1px solid var(--ef-border); border-bottom: 0; }
  #modal-efecto-nuevo .ef-tabla tfoot td { background: none; border: 0; }
  /* Facturas: casilla · número y vencimiento · disponible · a pagar */
  #modal-efecto-nuevo .ef-docs tbody tr { grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-areas: "chk doc doc" "chk fecha fecha" "chk disp pagar"; gap: 4px 10px; }
  #modal-efecto-nuevo .ef-docs tbody td:nth-child(1) { grid-area: chk; align-self: start; padding-top: 2px !important; }
  #modal-efecto-nuevo .ef-docs tbody td:nth-child(2) { grid-area: doc; }
  #modal-efecto-nuevo .ef-docs tbody td:nth-child(3) { display: none; }
  #modal-efecto-nuevo .ef-docs tbody td:nth-child(4) { grid-area: fecha; font-size: 13px; color: var(--ef-sec); }
  #modal-efecto-nuevo .ef-docs tbody td:nth-child(4)::before { content: 'Vence '; }
  #modal-efecto-nuevo .ef-docs tbody td:nth-child(5) { grid-area: disp; text-align: left; font-size: 13px; color: var(--ef-sec); }
  #modal-efecto-nuevo .ef-docs tbody td:nth-child(5)::after { content: ' disponibles'; }
  #modal-efecto-nuevo .ef-docs tbody td:nth-child(6) { grid-area: pagar; }
  #modal-efecto-nuevo .ef-docs input.ef-imp { width: 132px; }
  #modal-efecto-nuevo .ef-docs tfoot tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "cont cont" "lbl total"; gap: 8px 12px; }
  #modal-efecto-nuevo .ef-docs tfoot td:nth-child(1) { grid-area: cont; }
  #modal-efecto-nuevo .ef-docs tfoot td:nth-child(2) { grid-area: lbl; align-self: start; padding-top: 12px !important; }
  #modal-efecto-nuevo .ef-docs tfoot td:nth-child(3) { grid-area: total; }
  /* Vencimientos: número y quitar · nº de pagaré · vencimiento e importe */
  #modal-efecto-nuevo .ef-vencs tbody tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; grid-template-areas: "n n x" "ref ref ref" "venc imp imp"; gap: 8px 10px; }
  #modal-efecto-nuevo .ef-vencs tbody td:nth-child(1) { grid-area: n; font-size: 12px; font-weight: 600; }
  #modal-efecto-nuevo .ef-vencs tbody td:nth-child(1)::before { content: 'Vencimiento '; }
  #modal-efecto-nuevo .ef-vencs tbody td:nth-child(2) { grid-area: ref; }
  #modal-efecto-nuevo .ef-vencs tbody td:nth-child(3) { grid-area: venc; }
  #modal-efecto-nuevo .ef-vencs tbody td:nth-child(4) { grid-area: imp; }
  #modal-efecto-nuevo .ef-vencs tbody td:nth-child(5) { grid-area: x; margin: -8px 0; }
  #modal-efecto-nuevo .ef-vencs input.ef-imp { max-width: none; }
  #modal-efecto-nuevo .ef-vencs tfoot tr { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 8px 14px 12px; }
  #modal-efecto-nuevo .ef-vencs tfoot td { height: auto; }
  #modal-efecto-nuevo .ef-vencs tfoot td:first-child { margin-left: -8px; }
  #modal-efecto-nuevo #ef-n-tipos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  #modal-efecto-nuevo #ef-n-tipos > button { white-space: normal; padding: 6px 8px; }
  #modal-efecto-nuevo .ef-vencs tfoot td[aria-hidden] { display: none; }
  #modal-efecto-nuevo .ef-vencs .ef-cuadre { padding-right: 0 !important; }
}

/* ================= Ficha del efecto ================= */
#modal-efecto-detalle .ef-ficha-cab { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 24px; align-items: start; padding: 18px 20px; }
#modal-efecto-detalle .ef-ficha-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 20px; margin: 0; }
#modal-efecto-detalle .ef-ficha-meta div { min-width: 0; }
#modal-efecto-detalle .ef-ficha-meta dt { margin: 0 0 3px; font-size: 12px; font-weight: 600; color: var(--ef-sec); }
#modal-efecto-detalle .ef-ficha-meta dd { margin: 0; font-size: 14px; line-height: 1.4; color: var(--ef-text); overflow-wrap: anywhere; }
#modal-efecto-detalle .ef-ficha-meta dd .ef-chip { margin-left: 6px; height: 22px; padding: 0 8px; vertical-align: 1px; }
#modal-efecto-detalle .ef-ficha-meta .ef-ancho { grid-column: 1 / -1; }
#modal-efecto-detalle .ef-ficha-nominal { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
#modal-efecto-detalle .ef-ficha-nominal span { font-size: 12px; font-weight: 600; color: var(--ef-sec); }
#modal-efecto-detalle .ef-ficha-nominal strong { font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
#modal-efecto-detalle .ef-seccion { display: flex; flex-direction: column; gap: 10px; }
#modal-efecto-detalle .ef-seccion h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--ef-text); }
#modal-efecto-detalle .ef-ficha-docs col.c-fecha, #modal-efecto-detalle .ef-ficha-movs col.c-fecha { width: 112px; }
#modal-efecto-detalle .ef-ficha-docs col.c-imp, #modal-efecto-detalle .ef-ficha-movs col.c-imp { width: 132px; }
#modal-efecto-detalle .ef-ficha-docs col.c-estado { width: 128px; }
#modal-efecto-detalle .ef-ficha-movs col.c-que { width: 180px; }
#modal-efecto-detalle .ef-ficha-movs col.c-as { width: 150px; }
#modal-efecto-detalle .ef-tabla td { height: auto; min-height: 52px; padding-top: 12px; padding-bottom: 12px; }
#modal-efecto-detalle .ef-tabla :is(th, td):first-child { padding-left: 16px; }
#modal-efecto-detalle .ef-tabla :is(th, td):last-child { padding-right: 16px; }
#modal-efecto-detalle .ef-asiento { height: 32px; padding: 0 6px; margin-left: -6px; font-family: var(--ef-mono); font-size: 12.5px; }
#modal-efecto-detalle .ef-pie-acc { flex-wrap: wrap; }
@media (max-width: 719px) {
  #modal-efecto-detalle .ef-ficha-cab { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  #modal-efecto-detalle .ef-ficha-nominal { order: -1; flex-direction: row; justify-content: space-between; align-items: baseline; padding-bottom: 12px; border-bottom: 1px solid var(--ef-strip-border); }
  #modal-efecto-detalle .ef-ficha-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #modal-efecto-detalle .ef-tabla, #modal-efecto-detalle .ef-tabla tbody { display: block; }
  #modal-efecto-detalle .ef-tabla :is(colgroup, thead) { display: none; }
  #modal-efecto-detalle .ef-tabla tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--ef-strip-border); }
  #modal-efecto-detalle .ef-tabla tbody tr:last-child { border-bottom: 0; }
  #modal-efecto-detalle .ef-tabla td { display: block; min-height: 0; padding: 0 !important; border: 0; }
  #modal-efecto-detalle .ef-tabla td.ef-der { grid-column: 2; grid-row: 1; }
  #modal-efecto-detalle .ef-tabla td:empty { display: none; }
  #modal-efecto-detalle .ef-ficha-movs td:not(:first-child):not(.ef-der) { grid-column: 1 / -1; }
  #modal-efecto-detalle .ef-ficha-movs td:nth-child(2) { font-weight: 600; }
  #modal-efecto-detalle .ef-pie-acc { display: grid; grid-template-columns: 1fr 1fr; }
  #modal-efecto-detalle .ef-pie-acc .btn-primary { grid-column: 1 / -1; order: -1; }
}

/* ================= Acción e impresión ================= */
:is(#modal-efecto-accion, #modal-pagare-impresion, #modal-efecto-editar) .ef-rejilla2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
:is(#modal-efecto-accion, #modal-pagare-impresion, #modal-efecto-editar) .ef-rejilla2 .ef-entera { grid-column: 1 / -1; }
:is(#modal-efecto-accion, #modal-pagare-impresion, #modal-efecto-editar) .ef-campo.hidden { display: none; }
:is(#modal-efecto-accion, #modal-pagare-impresion, #modal-efecto-nuevo, #modal-efecto-editar) .ef-ayuda-campo { margin: 0; font-size: 12px; color: var(--ef-sec); }
@media (max-width: 719px) { :is(#modal-efecto-accion, #modal-pagare-impresion, #modal-efecto-editar) .ef-rejilla2 { grid-template-columns: minmax(0, 1fr); } }

/* ================= Lista ================= */
#tes-efectos { display: flex; flex-direction: column; gap: 16px; color: var(--ef-text); }
#tes-efectos.hidden { display: none; }
#tes-efectos .ef-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
#tes-efectos .ef-cab-txt { flex: 1 1 380px; min-width: 0; }
#tes-efectos .ef-cab-txt h3 { margin: 0 0 4px; font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: -.02em; color: var(--ef-text); }
#tes-efectos .ef-cab-txt p { margin: 0; max-width: 72ch; font-size: 13px; line-height: 1.5; color: var(--ef-sec); text-wrap: pretty; }
#tes-efectos .ef-cab-acc { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Cuatro totales en una sola banda */
#tes-efectos .ef-totales { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
#tes-efectos .ef-total { min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; }
#tes-efectos .ef-total + .ef-total { border-left: 1px solid var(--ef-strip-border); }
#tes-efectos .ef-total-lbl { font-size: 12px; font-weight: 600; color: var(--ef-sec); }
#tes-efectos .ef-total-val { font-size: 22px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ef-text); }
#tes-efectos .ef-total-val.rojo { color: var(--ef-out); }
#tes-efectos .ef-total small { font-size: 12px; line-height: 1.4; color: var(--ef-sec); font-variant-numeric: tabular-nums; }

/* Riesgo por banco */
#tes-efectos .ef-riesgo > summary { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 16px; list-style: none; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ef-text); border-radius: 14px; }
#tes-efectos .ef-riesgo > summary::-webkit-details-marker { display: none; }
#tes-efectos .ef-riesgo > summary .ef-ico { color: var(--ef-sec); transition: transform var(--ef-dur) ease; }
#tes-efectos .ef-riesgo[open] > summary .ef-ico { transform: rotate(90deg); }
#tes-efectos .ef-riesgo > summary .ef-sec { margin-left: auto; font-size: 13px; font-weight: 500; }
#tes-efectos .ef-riesgo[open] > summary { border-bottom: 1px solid var(--ef-strip-border); border-radius: 14px 14px 0 0; }
#tes-efectos .ef-riesgo .ef-tabla-scroll { overflow-x: auto; }
#tes-efectos .ef-riesgo .ef-tabla { min-width: 820px; }
#tes-efectos .ef-riesgo .ef-tabla thead th { white-space: normal; line-height: 1.3; }
#tes-efectos .ef-riesgo .ef-tabla :is(th, td):first-child { width: 22%; }
#tes-efectos .ef-riesgo .ef-tabla :is(th, td):first-child { padding-left: 16px; }
#tes-efectos .ef-riesgo .ef-tabla :is(th, td):last-child { padding-right: 16px; }
#tes-efectos .ef-riesgo .ef-tabla td { height: auto; padding-top: 12px; padding-bottom: 12px; }
#tes-efectos .ef-riesgo .ef-vacio { text-align: left; padding: 14px 16px; font-size: 13px; }

/* Barra de filtros */
#tes-efectos .ef-barra { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#tes-efectos .ef-buscar { position: relative; }
#tes-efectos .ef-buscar > .ef-ico { position: absolute; left: 14px; top: 14px; color: var(--ef-sec); pointer-events: none; }
#tes-efectos .ef-barra select { width: 180px; flex: 0 1 180px; }
#tes-efectos .ef-barra #ef-estado { width: 220px; flex-basis: 220px; }
#tes-efectos .ef-barra .ef-buscar { flex: 1 1 240px; min-width: 200px; }
#tes-efectos .ef-barra .ef-buscar input { height: 44px; font-size: 14px; }
#tes-efectos .ef-barra .ef-buscar > .ef-ico { top: 14px; }

/* Selección en lote */
#tes-efectos .ef-lote { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 8px 8px 16px; }
#tes-efectos .ef-lote.hidden { display: none; }
#tes-efectos .ef-lote-n { margin-right: 4px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
#tes-efectos .ef-lote .ef-hueco { flex: 1 1 auto; }

/* Tabla de efectos */
#tes-efectos .ef-lista-caja { overflow-x: auto; }
#tes-efectos #tabla-efectos { min-width: 980px; }
#tes-efectos #tabla-efectos col.c-sel { width: 44px; }
#tes-efectos #tabla-efectos col.c-ef { width: 168px; }
#tes-efectos #tabla-efectos col.c-venc { width: 124px; }
#tes-efectos #tabla-efectos col.c-banco { width: 112px; }
#tes-efectos #tabla-efectos col.c-estado { width: 124px; }
#tes-efectos #tabla-efectos col.c-imp { width: 124px; }
#tes-efectos #tabla-efectos col.c-acc { width: 212px; }
#tes-efectos #tabla-efectos :is(thead th, td) { overflow: hidden; text-overflow: ellipsis; }
#tes-efectos #tabla-efectos td:last-child { overflow: visible; }
#tes-efectos #tabla-efectos :is(th, td):first-child { padding-left: 16px; padding-right: 0; }
#tes-efectos #tabla-efectos :is(th, td):last-child { padding-right: 12px; }
#tes-efectos #tabla-efectos td { height: 64px; padding-top: 10px; padding-bottom: 10px; }
#tes-efectos #tabla-efectos .ef-ref { display: block; font-family: var(--ef-mono); font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tes-efectos #tabla-efectos .ef-tercero { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tes-efectos #tabla-efectos .ef-facturas { font-family: var(--ef-mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tes-efectos #tabla-efectos td.ef-imp-c { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
#tes-efectos #tabla-efectos th.ef-der { padding-right: 12px; }
#tes-efectos #tabla-efectos .ef-dias { display: block; margin-top: 3px; font-size: 12px; color: var(--ef-sec); font-variant-numeric: tabular-nums; }
#tes-efectos #tabla-efectos .ef-dias.vencido { color: var(--ef-out); font-weight: 600; }
#tes-efectos #tabla-efectos .ef-dias.hoy { color: var(--ef-amb); font-weight: 600; }
#tes-efectos #tabla-efectos .action-btns { justify-content: flex-end; flex-wrap: nowrap; }
#tes-efectos .ef-lista-caja .ef-vacio { padding: 28px 16px; }

@media (max-width: 1100px) {
  #tes-efectos .ef-totales { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #tes-efectos .ef-total:nth-child(3) { border-left: 0; }
  #tes-efectos .ef-total:nth-child(n+3) { border-top: 1px solid var(--ef-strip-border); }
}
@media (max-width: 719px) {
  #tes-efectos { gap: 12px; }
  #tes-efectos .ef-cab-acc { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); justify-content: stretch; }
  #tes-efectos .ef-cab-acc .ef-btn:not(.btn-primary) .ef-ico { display: none; }
  #tes-efectos .ef-cab-acc .btn-primary { grid-column: 1 / -1; order: -1; }
  #tes-efectos .ef-cab-acc .ef-btn { width: 100%; min-width: 0; padding: 0 8px; font-size: 13.5px; }
  #tes-efectos .ef-total { padding: 12px 14px; }
  #tes-efectos .ef-total-val { font-size: 18px; }
  #tes-efectos .ef-barra { display: grid; grid-template-columns: 1fr 1fr; }
  #tes-efectos .ef-barra .ef-seg { grid-column: 1 / -1; display: flex; }
  #tes-efectos .ef-barra .ef-seg > button { flex: 1 1 0; }
  #tes-efectos .ef-barra select { width: 100%; max-width: none; font-size: 16px; }
  #tes-efectos .ef-barra #ef-estado { grid-column: 1 / -1; width: 100%; }
  #tes-efectos .ef-barra .ef-buscar { grid-column: 1 / -1; min-width: 0; }
  /* La lista de efectos como tarjetas: nada se desplaza de lado */
  #tes-efectos .ef-lista-caja { overflow: visible; }
  #tes-efectos #tabla-efectos { min-width: 0; display: block; }
  #tes-efectos #tabla-efectos :is(colgroup, thead) { display: none; }
  #tes-efectos #tabla-efectos tbody { display: block; }
  #tes-efectos #tabla-efectos tr { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "sel ef imp" "sel ter estado" "sel venc venc" "sel acc acc"; gap: 6px 10px; padding: 14px 14px 10px; border-bottom: 1px solid var(--ef-strip-border); }
  #tes-efectos #tabla-efectos tbody tr:last-child { border-bottom: 0; }
  #tes-efectos #tabla-efectos td { display: block; height: auto; padding: 0 !important; border: 0; min-width: 0; }
  #tes-efectos #tabla-efectos td:nth-child(1) { grid-area: sel; padding-top: 2px !important; }
  #tes-efectos #tabla-efectos td:nth-child(2) { grid-area: ef; }
  #tes-efectos #tabla-efectos td:nth-child(3) { grid-area: ter; }
  #tes-efectos #tabla-efectos td:nth-child(4) { grid-area: venc; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
  #tes-efectos #tabla-efectos td:nth-child(4) .ef-dias { display: inline; margin: 0; }
  #tes-efectos #tabla-efectos td:nth-child(5) { display: none; }
  #tes-efectos #tabla-efectos td:nth-child(6) { grid-area: estado; justify-self: end; }
  #tes-efectos #tabla-efectos td:nth-child(7) { grid-area: imp; justify-self: end; }
  #tes-efectos #tabla-efectos td:nth-child(8) { grid-area: acc; margin: 2px -6px 0 0 !important; }
  #tes-efectos #tabla-efectos .action-btns { justify-content: flex-end; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  :is(#tes-efectos, .ef-modal) * { transition: none !important; }
}

/* Anular como acción principal de su ventana: rojo, no azul */
.ef-modal .btn.ef-btn.ef-btn-peligro-primario { background: var(--ef-out) !important; border-color: var(--ef-out) !important; color: #fff !important; }
[data-theme="dark"] .ef-modal .btn.ef-btn.ef-btn-peligro-primario { color: #1b1f27 !important; }
/* Acciones de fila: las de toda la app, con la medida táctil en móvil */
@media (max-width: 719px) { #tes-efectos #tabla-efectos :is(.ra-btn, .ra-primary) { min-width: 40px; height: 40px; } }
#modal-efecto-nuevo .ef-solo-movil { display: none; }
@media (max-width: 719px) {
  #modal-efecto-nuevo .ef-docs tfoot td:nth-child(1) { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  #modal-efecto-nuevo .ef-solo-movil { display: inline-flex; margin-right: -8px; }
}
#tes-efectos #tabla-efectos .ef-linea { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tes-efectos #tabla-efectos tbody tr { cursor: pointer; }
#tes-efectos #tabla-efectos col.c-acc { width: 188px; }

/* Calendario de la app (datepicker.js): el campo visible con la misma medida que el resto */
:is(#tes-efectos, .ef-modal) .rdp-field {
  height: 44px; min-height: 44px; padding: 0 12px; border: 1px solid var(--ef-outline); border-radius: 10px; background: var(--ef-card);
  color: var(--ef-text); font-size: 14px; font-variant-numeric: tabular-nums; box-shadow: none;
  transition: border-color var(--ef-dur) ease, box-shadow var(--ef-dur) ease;
}
:is(#tes-efectos, .ef-modal) .rdp-field:hover { border-color: var(--ef-border-hover); }
:is(#tes-efectos, .ef-modal) :is(.rdp-active .rdp-field, .rdp-field:focus-visible) { border-color: var(--ef-focus); box-shadow: 0 0 0 3px var(--ef-acc-bg); outline: none !important; }
:is(#tes-efectos, .ef-modal) .rdp-icon { color: var(--ef-sec); }
:is(#tes-efectos, .ef-modal) .rdp-wrap:has(input[aria-invalid="true"]) .rdp-field { border-color: var(--ef-out); }
#modal-efecto-nuevo .ef-vencs .rdp-field { height: 40px; min-height: 40px; }
@media (max-width: 800px) { :is(#tes-efectos, .ef-modal) .rdp-field { font-size: 16px; } }
/* Editar un efecto: los campos arriba y las facturas con su importe debajo, con aire entre medias */
#modal-efecto-editar .ef-dlg-cuerpo { display: grid; gap: 18px; }
#modal-efecto-editar #ef-e-docs tfoot td { font-weight: 600; }
#modal-efecto-editar #ef-e-docs input.ef-imp { max-width: 160px; margin-left: auto; }
