/* El disparador y la ventana comparten la paleta del módulo Empresas. */
.ot-operar[data-ot-operar="/empresas"],
dialog.ot-operacion.ot-sociedades {
  --soc-fondo: #fff;
  --soc-suave: #f5f8fc;
  --soc-tinta: #0b1b33;
  --soc-secundario: #53657f;
  --soc-borde: #e3eaf5;
  --soc-azul: #0b64f0;
  --soc-boton: #0b64f0;
  --soc-boton-hover: #0a52cb;
  --soc-seleccion: #edf4ff;
  --soc-error: #a3312a;
  --soc-error-fondo: #fff3f1;
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
}
html[data-ot-theme="dark"] :is(.ot-operar[data-ot-operar="/empresas"], dialog.ot-operacion.ot-sociedades) {
  color-scheme: dark;
  --soc-fondo: #101f35;
  --soc-suave: #162941;
  --soc-tinta: #f4f8ff;
  --soc-secundario: #b0bfd3;
  --soc-borde: #364b65;
  --soc-azul: #8ab8ff;
  --soc-boton: #175dc7;
  --soc-boton-hover: #1455b9;
  --soc-seleccion: #18365b;
  --soc-error: #ffb9b2;
  --soc-error-fondo: #39242e;
}
html #app button.ot-operar[data-ot-operar="/empresas"],
dialog.ot-operacion.ot-sociedades button {
  box-sizing: border-box;
  margin: 0;
  border: 1px solid var(--soc-borde);
  border-radius: 10px;
  padding: 8px 14px;
  min-height: 38px;
  color: var(--soc-tinta);
  background: var(--soc-fondo);
  font: 600 14px/1.4 "Plus Jakarta Sans", Arial, sans-serif;
  cursor: pointer;
}
html #app button.ot-operar[data-ot-operar="/empresas"] {
  color: var(--soc-azul);
  margin-block: 5px 3px;
}
html #app button.ot-operar[data-ot-operar="/empresas"]:hover,
dialog.ot-operacion.ot-sociedades button:hover {
  background: var(--soc-seleccion);
  color: var(--soc-azul);
}
html #app button.ot-operar[data-ot-operar="/empresas"]:focus-visible,
dialog.ot-operacion.ot-sociedades :focus-visible {
  outline: 2px solid var(--soc-azul);
  outline-offset: 2px;
}
dialog.ot-operacion.ot-sociedades {
  width: min(46rem, calc(100% - 32px));
  max-width: none;
  max-height: min(88vh, 54rem);
  max-height: min(88dvh, 54rem);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--soc-borde);
  border-radius: 16px;
  color: var(--soc-tinta);
  background: var(--soc-fondo);
  box-shadow: 0 18px 60px rgb(11 27 51 / 20%);
  font-size: 14px;
  line-height: 1.55;
}
dialog.ot-operacion.ot-sociedades[open] { display: flex; flex-direction: column; }
dialog.ot-operacion.ot-sociedades::backdrop { background: rgb(11 27 51 / 46%); }
dialog.ot-sociedades.ot-operacion > header {
  flex: none;
  padding: 16px 24px;
  border-bottom: 1px solid var(--soc-borde);
  background: var(--soc-fondo);
}
dialog.ot-sociedades.ot-operacion h2 {
  margin: 0;
  color: var(--soc-tinta);
  font: 800 clamp(18px, 2.5vw, 22px)/1.3 "Plus Jakarta Sans", Arial, sans-serif;
  letter-spacing: -.025em;
}
dialog.ot-sociedades.ot-operacion > main {
  display: grid;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 24px;
}
dialog.ot-sociedades.ot-operacion form { display: grid; gap: 14px; min-width: 0; }
dialog.ot-sociedades.ot-operacion label {
  margin: 0;
  color: var(--soc-tinta);
  font-size: 14px;
  font-weight: 600;
}
dialog.ot-sociedades.ot-operacion input[type="text"] {
  margin-top: 6px;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--soc-borde);
  border-radius: 10px;
  color: var(--soc-tinta);
  background: var(--soc-fondo);
  font: 500 14px/1.45 "Plus Jakarta Sans", Arial, sans-serif;
}
dialog.ot-sociedades.ot-operacion input::placeholder { color: var(--soc-secundario); opacity: 1; }
dialog.ot-sociedades.ot-operacion input[type="text"]:focus { border-color: var(--soc-azul); }
dialog.ot-sociedades.ot-operacion .ot-soc-opcion {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  font-weight: 500;
  cursor: pointer;
}
dialog.ot-sociedades.ot-operacion input[type="checkbox"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--soc-boton);
}
dialog.ot-sociedades.ot-operacion button[type="submit"] {
  justify-self: start;
  min-height: 42px;
  padding-inline: 18px;
  border-color: transparent;
  color: #fff;
  background: var(--soc-boton);
  font-weight: 700;
}
dialog.ot-sociedades.ot-operacion button[type="submit"]:hover { color: #fff; background: var(--soc-boton-hover); }
dialog.ot-sociedades.ot-operacion p { margin: 0; }
dialog.ot-sociedades.ot-operacion .ot-soc-nota,
dialog.ot-sociedades.ot-operacion [role="alert"]:not(:empty) {
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--soc-secundario);
  background: var(--soc-suave);
  font-size: 13px;
}
dialog.ot-sociedades.ot-operacion [role="alert"]:not(:empty) {
  color: var(--soc-error);
  background: var(--soc-error-fondo);
}
dialog.ot-sociedades.ot-operacion [role="alert"]:empty,
dialog.ot-sociedades.ot-operacion .ot-soc-resultados:empty { display: none; }
dialog.ot-sociedades.ot-operacion .ot-soc-estado:not([data-cargando]) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
dialog.ot-sociedades.ot-operacion .ot-soc-estado[data-cargando] {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--soc-azul);
  font-weight: 600;
}
.ot-sociedades .ot-soc-estado[data-cargando]::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--soc-borde);
  border-top-color: currentColor;
  border-radius: 50%;
}
@media (prefers-reduced-motion: no-preference) {
  .ot-sociedades .ot-soc-estado[data-cargando]::before { animation: ot-soc-giro .8s linear infinite; }
  @keyframes ot-soc-giro { to { transform: rotate(1turn); } }
}
dialog.ot-sociedades.ot-operacion .ot-soc-resultados { display: grid; gap: 8px; min-width: 0; }
dialog.ot-sociedades.ot-operacion .ot-soc-resultados h3 {
  margin: 0;
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--soc-tinta);
  background: var(--soc-seleccion);
  font-size: 17px;
  font-weight: 800;
}
dialog.ot-sociedades.ot-operacion .ot-soc-resultados > p,
dialog.ot-sociedades.ot-operacion .ot-soc-datos small { color: var(--soc-secundario); font-size: 13px; }
.ot-sociedades .ot-soc-empresa { min-width: 0; border: 1px solid var(--soc-borde); border-radius: 12px; }
dialog.ot-sociedades.ot-operacion .ot-soc-titular {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto 8px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 11px;
  text-align: start;
}
.ot-sociedades .ot-soc-titular::after {
  content: "";
  width: 6px;
  height: 6px;
  border: solid var(--soc-azul);
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-2px) rotate(45deg);
}
.ot-sociedades .ot-soc-titular[aria-expanded="true"]::after { transform: translateY(2px) rotate(225deg); }
.ot-sociedades .ot-soc-datos { display: grid; gap: 3px; overflow-wrap: anywhere; }
.ot-sociedades .ot-soc-datos small { font-weight: 500; }
.ot-sociedades .ot-soc-importe { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.ot-sociedades .ot-soc-detalle { padding: 0 14px 12px; overflow-wrap: anywhere; }
.ot-sociedades .ot-soc-detalle ul { list-style: none; padding: 0; margin: 0; }
.ot-sociedades .ot-soc-detalle li { padding-block: 9px; border-top: 1px solid var(--soc-borde); }
dialog.ot-sociedades.ot-operacion a { color: var(--soc-azul); text-decoration: underline; text-underline-offset: 2px; }
dialog.ot-sociedades.ot-operacion .ot-soc-pagina { margin: 5px 8px 0 0; }
/* El tema global también genera reglas con prioridad para los antiguos diálogos operativos. */
html[data-ot-theme="dark"] #app button.ot-operar[data-ot-operar="/empresas"] {
  background-color: var(--soc-fondo) !important;
  border-color: var(--soc-borde) !important;
  color: var(--soc-azul) !important;
}
html[data-ot-theme="dark"] dialog.ot-operacion.ot-sociedades,
html[data-ot-theme="dark"] dialog.ot-sociedades.ot-operacion :is(header, button, input[type="text"]) {
  background-color: var(--soc-fondo) !important;
  border-color: var(--soc-borde) !important;
  color: var(--soc-tinta) !important;
}
html[data-ot-theme="dark"] #app button.ot-operar[data-ot-operar="/empresas"]:hover,
html[data-ot-theme="dark"] dialog.ot-operacion.ot-sociedades button:hover {
  background-color: var(--soc-seleccion) !important;
  color: var(--soc-azul) !important;
}
html[data-ot-theme="dark"] dialog.ot-operacion.ot-sociedades button[type="submit"] {
  background-color: var(--soc-boton) !important;
  border-color: transparent !important;
  color: #fff !important;
}
html[data-ot-theme="dark"] dialog.ot-operacion.ot-sociedades button[type="submit"]:hover { background-color: var(--soc-boton-hover) !important; }
html[data-ot-theme="dark"] dialog.ot-operacion.ot-sociedades input[type="text"]:focus { border-color: var(--soc-azul) !important; }
html[data-ot-theme="dark"] #app button.ot-operar[data-ot-operar="/empresas"]:focus-visible,
html[data-ot-theme="dark"] dialog.ot-operacion.ot-sociedades :focus-visible { outline-color: var(--soc-azul) !important; }
html[data-ot-theme="dark"] dialog.ot-operacion.ot-sociedades a { color: var(--soc-azul) !important; }
html[data-ot-theme="dark"] dialog.ot-operacion.ot-sociedades [role="alert"]:not(:empty) { color: var(--soc-error) !important; }
@media (max-width: 540px) {
  dialog.ot-operacion.ot-sociedades { width: calc(100% - 20px); max-height: calc(100dvh - 32px); }
  dialog.ot-sociedades.ot-operacion > header { padding: 13px 16px; }
  dialog.ot-sociedades.ot-operacion > main { padding: 16px; }
  dialog.ot-sociedades.ot-operacion button[type="submit"] { justify-self: stretch; }
  dialog.ot-sociedades.ot-operacion input[type="text"] { font-size: 16px; }
  dialog.ot-sociedades.ot-operacion .ot-soc-titular { grid-template-columns: minmax(0,1fr) 8px; gap: 5px 10px; }
  .ot-sociedades .ot-soc-importe { grid-area: 2 / 1; }
  .ot-sociedades .ot-soc-titular::after { grid-area: 1 / 2 / 3; }
}
