/* ===== Tools Overlay: contenido interno ===== */
.tools-body{display:block;color:var(--label,#0f1422);--tools-gap:12px}

/* Top: UF + conversor */
.tools-top{display:grid;gap:6px;margin-bottom:12px;border-bottom:1px solid var(--separator,#e6eaf0);padding-bottom:12px}
.tools-top .uf-row{display:flex;align-items:center;gap:8px;font:600 13px/1.2 system-ui,-apple-system,Segoe UI,Roboto,Arial;color:var(--label,#0f1422)}
.tools-top .uf-row strong{color:var(--muted,#6b7280);font-weight:600}
.tools-top .uf-row #tUfVal{font-weight:700}

/* Conversor: dos columnas fijas + acciones */
.tools-top .conv2{margin-top:12px}
.conv2{display:grid;align-items:end;gap:10px;grid-template-columns:1fr max-content 1fr}
.conv2 .conv-col{display:grid;gap:6px;min-width:0}
.conv2 .conv-lab{font:600 12px/1.2 system-ui,-apple-system,Segoe UI,Roboto,Arial;color:var(--muted,#6b7280)}
.conv2 .in{height:36px;padding:8px 10px;border:1px solid var(--separator,#e6eaf0);border-radius:8px;background:var(--surface,#fff);color:var(--label,#0f1422);font:600 14px/1.1 ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial;font-variant-numeric:tabular-nums;width:100%;min-width:0}
.conv2 .in:focus{outline:2px solid var(--tint,#0d99ff);outline-offset:2px;border-color:transparent}

/* Acciones (vertical) */
.conv-actions{display:flex;flex-direction:column;align-items:center;gap:2px;width:36px}
.conv2 .swap{appearance:none;border:0;background:transparent;display:inline-grid;place-items:center;width:32px;height:32px;border-radius:8px;cursor:pointer;transition:background .15s ease,opacity .15s ease}
.conv2 .swap:hover{background:color-mix(in oklch,var(--surface) 92%,var(--bg,#0f1422) 8%)}
.conv2 .swap i,[data-lucide="arrow-left-right"]{width:18px;height:18px}
.conv2 .swap[aria-disabled="true"]{opacity:.55;cursor:default;pointer-events:none}
.conv2 .swap.clear{background:color-mix(in oklch,var(--surface) 98%,white 2%)}
.conv2 .swap.clear:hover{background:color-mix(in oklch,var(--surface) 94%,white 6%)}
.conv2 .swap.clear i,[data-lucide="trash-2"]{width:18px;height:18px}

/* Acordeón */
.acc{display:grid;gap:10px;margin-top:14px}
.acc-item{border:1px solid var(--separator,#e6eaf0);border-radius:10px;overflow:hidden;background:var(--surface,#fff)}
.acc-item>summary{list-style:none;display:flex;align-items:center;gap:8px;padding:12px 14px;cursor:pointer;user-select:none;font:600 13px/1.25 system-ui,-apple-system,Segoe UI,Roboto,Arial;color:var(--label,#0f1422)}
.acc-item>summary::-webkit-details-marker{display:none}
.acc-item>summary:hover{background:color-mix(in oklch,var(--surface) 94%,var(--bg,#0f1422) 6%)}
.acc-item>summary [data-lucide],.acc-item>summary i{width:16px;height:16px;color:currentColor;opacity:.9}
.acc-item[open]>summary{border-bottom:1px solid var(--separator,#e6eaf0)}
.acc-panel{padding:12px 14px;display:grid;gap:10px}
.acc-item[data-key="formula"] .acc-panel p{margin:0;font:500 12px/1.35 system-ui,-apple-system,Segoe UI,Roboto,Arial;color:var(--muted,#6b7280)}

/* Campos internos */
.fld{display:grid;gap:6px}
.fld>span{font:600 12px/1.2 system-ui,-apple-system,Segoe UI,Roboto,Arial;color:var(--muted,#6b7280)}
.fld .in{height:34px;padding:6px 10px;border:1px solid var(--separator,#e6eaf0);border-radius:8px;background:var(--surface,#fff);color:var(--label,#0f1422);font:500 14px/1 system-ui,-apple-system,Segoe UI,Roboto,Arial}
.fld .in:focus{outline:2px solid var(--tint,#0d99ff);outline-offset:2px;border-color:transparent}

/* Resultados */
.acc .res{margin:0;font:600 13px/1.2 system-ui,-apple-system,Segoe UI,Roboto,Arial;color:var(--label,#0f1422)}
.acc .res small{margin-left:6px;font:600 12px/1.2 system-ui,-apple-system,Segoe UI,Roboto,Arial;color:var(--muted,#6b7280)}

/* Bloques auxiliares */
.code-like{border:1px dashed var(--separator,#e6eaf0);border-radius:8px;background:color-mix(in oklch,var(--surface) 98%,white 2%);padding:10px 12px;font:600 12px/1.35 ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--label,#0f1422)}
.acc .note{margin:0;font:500 12px/1.35 system-ui,-apple-system,Segoe UI,Roboto,Arial;color:var(--muted,#6b7280)}
.acc .links{margin:0;padding-left:16px;display:grid;gap:6px}
.acc .links a{color:var(--tint,#0d99ff);text-decoration:none;font:500 12px/1.3 system-ui,-apple-system,Segoe UI,Roboto,Arial}
.acc .links a:hover{text-decoration:underline}

/* Tabla base (todas las tablas del overlay) */
.tbl-wrap{overflow:auto;border:1px solid var(--separator,#e6eaf0);border-radius:8px}
.tbl{border-collapse:separate;border-spacing:0;width:100%;min-width:460px;background:var(--surface,#fff)}
.tbl thead th{position:sticky;top:0;background:color-mix(in oklch,var(--surface) 96%,white 4%);text-align:left;padding:10px 12px;font:700 12px/1.2 system-ui,-apple-system,Segoe UI,Roboto,Arial;color:var(--muted,#6b7280);border-bottom:1px solid var(--separator,#e6eaf0)}
.tbl tbody td{padding:10px 12px;border-bottom:1px solid var(--separator,#e6eaf0);font:500 13px/1.4 system-ui,-apple-system,Segoe UI,Roboto,Arial;color:var(--label,#0f1422)}
.tbl tbody tr:nth-child(odd){background:color-mix(in oklch,var(--surface) 98%,var(--bg,#0f1422) 2%)}

/* Tabla factores y GES: layout fijo y tipografía ajustada */
.tbl-wrap:has(.tbl-factores),.tbl-wrap:has(.tbl-ges){overflow:visible}
.tbl.tbl-factores,.tbl.tbl-ges{min-width:0!important;table-layout:fixed}
.tbl.tbl-factores thead th,.tbl.tbl-ges thead th{white-space:normal;word-break:break-word;hyphens:auto;padding:10px 12px;font:700 12px/1.35 system-ui,-apple-system,Segoe UI,Roboto,Arial;color:var(--muted,#6b7280);vertical-align:middle}
.tbl.tbl-factores tbody td,.tbl.tbl-ges tbody td{white-space:normal;word-break:break-word;hyphens:auto;padding:10px 12px;font:500 13px/1.35 system-ui,-apple-system,Segoe UI,Roboto,Arial;color:var(--label,#0f1422);vertical-align:middle}

/* Alineación columnas GES */
.tbl.tbl-ges th:nth-child(1),.tbl.tbl-ges td:nth-child(1){text-align:left}
.tbl.tbl-ges th:nth-child(2),.tbl.tbl-ges td:nth-child(2),.tbl.tbl-ges th:nth-child(3),.tbl.tbl-ges td:nth-child(3){text-align:right;font-variant-numeric:tabular-nums}

/* Extras factores */
.tbl.tbl-factores .chips,.tbl.tbl-factores .tags,.tbl.tbl-factores .clinicas,.tbl.tbl-factores .factores,.tbl.tbl-factores .personas{display:flex;flex-wrap:wrap;gap:4px 6px;min-width:0}
.tbl.tbl-factores .num{text-align:right;font-variant-numeric:tabular-nums}
.tbl.tbl-factores .cell-duo{display:grid;grid-template-columns:1fr;row-gap:2px}
@media (min-width:680px){.tbl.tbl-factores .cell-duo{grid-template-columns:1fr 1fr;column-gap:8px}}

/* Accesibilidad (focus) */
.acc-item:focus-within,.conv2 .swap:focus-visible,.fld .in:focus-visible,.conv2 .in:focus-visible{outline:2px solid var(--focus,#3b82f6);outline-offset:2px}

/* Responsivo */
@media (max-width:420px){
  .conv2{grid-template-columns:1fr max-content;grid-template-areas:"uf act" "clp clp";row-gap:8px}
  .conv2 .conv-col:first-child{grid-area:uf}
  .conv2 .conv-col:last-child{grid-area:clp}
  .conv-actions{grid-area:act}
}