:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #17243a;
  background: #f3f6fa;
  --marino: #14223c;
  --marino-oscuro: #101a30;
  --brand: #0b665d;
  --ink: #17243a;
  --muted: #53657c;
  --line: #dce4ed;
  --panel: #fff;
  --radius: 16px;
  --sombra: 0 8px 24px #182c4710;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.8rem, 3.1vw, 2.75rem); font-weight: 750; letter-spacing: -.045em; line-height: 1.1; }
h2 { font-size: 1.12rem; font-weight: 730; line-height: 1.32; letter-spacing: -.012em; }
button, input, textarea, select { font: inherit; }
:focus-visible { outline: 3px solid #319d89; outline-offset: 3px; }

.shell { display: grid; grid-template-columns: 234px minmax(0, 1fr); min-height: 100vh; }
.barra-lateral { position: sticky; top: 0; align-self: start; height: 100dvh; padding: 28px 17px;
  background: linear-gradient(165deg, #182a47, var(--marino-oscuro) 65%); color: #fff; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; margin-bottom: 38px; }
.mark { display: inline-grid; place-items: center; width: 41px; height: 41px; flex: 0 0 auto;
  border-radius: 11px; background: #adf1d9; color: #173d38; font-size: .87rem; font-weight: 850; }
.brand strong { display: block; font-size: 1.39rem; line-height: 1; letter-spacing: -.04em; }
.brand strong span, .acceso-identidad strong span { color: #a5e9d1; }
.brand small { color: #bdcbe0; font-size: .75rem; }
.menu-balancx { display: grid; gap: 8px; }
.menu-balancx button { justify-content: flex-start; gap: 11px; width: 100%; min-height: 46px;
  background: transparent; border-color: transparent; color: #e1eaf8; padding-inline: 12px;
  white-space: normal; text-align: left; }
.menu-balancx button:hover { background: #ffffff15; }
.menu-balancx button[aria-pressed="true"] { background: #284360; border-color: #46617b; color: #c3f5e0; }
.nav-icon { display: inline-block; position: relative; flex: 0 0 auto; width: 17px; height: 16px; color: inherit; }
.icon-trabajo { border: 1.5px solid currentColor; border-radius: 3px; }
.icon-trabajo::before { position: absolute; content: ""; inset: 4px 3px auto; border-top: 1.5px solid currentColor; }
.icon-trabajo::after { position: absolute; content: ""; bottom: 3px; left: 3px; width: 6px; border-top: 1.5px solid currentColor; }
.icon-reporte { border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; border-radius: 0 0 0 2px; }
.icon-reporte::before { position: absolute; content: ""; bottom: 3px; left: 3px; width: 2px; height: 5px;
  background: currentColor; box-shadow: 4px -3px currentColor, 8px -6px currentColor; }
.espacio-trabajo { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 67px;
  padding: 11px clamp(17px, 3vw, 42px); background: #fff; border-bottom: 1px solid var(--line);
  font-size: .88rem; font-weight: 700; }
.session, .actions { display: flex; align-items: center; gap: 10px; }
.actions { flex-wrap: wrap; }
.status { background: #e6f5ee; color: #155f51; border: 1px solid #c8e8db; border-radius: 24px;
  white-space: nowrap; padding: 5px 9px; font-size: .75rem; }
.usuario-activo { max-width: 19ch; overflow: hidden; text-overflow: ellipsis; color: var(--muted); white-space: nowrap; }
.topbar button { min-height: 34px; padding: 5px 11px; }
main { width: min(100%, 1580px); margin-inline: auto; padding: 26px clamp(17px, 3vw, 42px) 12px; flex: 1; }
footer { width: min(100%, 1580px); margin-inline: auto; padding: 8px clamp(17px, 3vw, 42px) 21px; }

.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 19px; }
.page-heading p, .section-head p { margin-top: 7px; color: var(--muted); line-height: 1.48; }
.portada, .acceso-identidad { background-color: var(--marino); background-image:
  radial-gradient(ellipse at 105% 0, #27796c9c, transparent 56%),
  radial-gradient(ellipse at 84% 190%, #2a517c, transparent 58%),
  linear-gradient(125deg, #152740, #192d49 58%, #164647); color: #fff; }
.portada { position: relative; border-radius: 19px; padding: clamp(23px, 3.8vw, 42px);
  box-shadow: 0 8px 24px #162e4a22; min-height: 138px; overflow: hidden; }
.portada::before { position: absolute; content: ""; pointer-events: none; inset: 0 0 0 49%;
  background-image: radial-gradient(#a3dcca59 1px, transparent 1px); background-size: 16px 16px;
  mask-image: linear-gradient(100deg, transparent, #000); opacity: .6; }
.portada > div { min-width: 0; position: relative; }
.portada p { color: #d6e9ee; }
.portada :focus-visible { outline-color: #a5e9d1; }
.acciones-reporte { display: grid; justify-items: end; flex-shrink: 0; }
.acciones-reporte p { font-size: .79rem; max-width: 28ch; text-align: right; }
.acciones-reporte p.error { padding: 6px 8px; border-radius: 7px; color: #ffcfcf; background: #442334; }
.boton-descarga { gap: 10px; background: #b6f2dc; color: #123934; border-color: #b6f2dc; }
.boton-descarga:hover { background: #d1faec; }
.icon-descarga { position: relative; width: 16px; height: 14px; border-bottom: 1.5px solid currentColor; }
.icon-descarga::before { position: absolute; content: ""; top: 0; left: 7px; height: 9px; border-left: 1.5px solid currentColor; }
.icon-descarga::after { position: absolute; content: ""; left: 5px; top: 4px; height: 6px; width: 6px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 17px; box-shadow: var(--sombra); min-width: 0; }
.section-head { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; padding: 17px 20px; }
#conteo { background: #eff4f9; padding: 5px 8px; border-radius: 9px; }
#conteo:empty { visibility: hidden; }
.filters { display: grid; grid-template-columns: minmax(105px, 1fr) minmax(125px, .9fr) minmax(125px, .9fr) minmax(140px, 1.4fr) auto;
  gap: 13px; align-items: end; padding: 17px; }
.filters.real { grid-template-columns: minmax(105px, .9fr) minmax(125px, .95fr) minmax(124px, .95fr)
  minmax(124px, .95fr) minmax(135px, 1.3fr) auto; }
label { color: var(--ink); font-size: .82rem; font-weight: 680; display: grid; gap: 7px; min-width: 0; }
input, select, textarea { width: 100%; min-width: 0; color: #223750;
  background: #fff; border: 1px solid #bfcddc; border-radius: 8px; padding: 9px 10px; }
input, select { min-height: 41px; }
input:disabled { background: #f0f3f7; }
textarea { resize: vertical; }
button, .button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; border-radius: 9px; min-height: 41px; padding: 8px 14px;
  cursor: pointer; font-size: .86rem; font-weight: 710; text-decoration: none; white-space: nowrap; }
button:hover { background: #09534b; }
button:disabled { opacity: .55; cursor: default; }
#descargar-reporte:disabled { cursor: wait; }
.button.secondary, button.secondary { background: #fff; color: var(--brand); border-color: #c4d5d8; }
.button.secondary:hover, button.secondary:hover { background: #eef8f6; border-color: #a9ccc6; }
.button[aria-disabled="true"] { opacity: .55; cursor: default; }
.plain { background: transparent; border-color: transparent; color: var(--brand); padding: 4px 0; }
.plain:hover { background: transparent; text-decoration: underline; }

.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
.tabla-trabajo { min-width: 690px; }
th { text-align: left; font-weight: 710; font-size: .77rem; white-space: nowrap; background: #eef3f9; color: #41566f; }
td, th { padding: 11px 13px; border-top: 1px solid #e6edf5; }
td:first-child, th:first-child { padding-left: 19px; }
td:last-child, th:last-child { padding-right: 19px; }
td { font-size: .86rem; vertical-align: middle; }
tbody tr:nth-child(even) { background: #fafcfe; }
tbody tr:hover { background: #f0f7fb; }
.num, .number { text-align: right; font-variant-numeric: tabular-nums; }
.line-input { min-width: 5.7rem; text-align: right; font-variant-numeric: tabular-nums; }
.line-input.quantity { min-width: 4.2rem; }
.lines { min-width: 900px; }
.lines td { padding-inline: 9px; }
.lines td:first-child { padding-left: 19px; min-width: 200px; }
.lines td:last-child { padding-right: 17px; }
small, .muted, .section-head p, footer { color: var(--muted); font-size: .8rem; }
small { display: block; margin-top: 4px; }

.detail-heading { padding: 19px 21px; margin-bottom: 13px; }
.back { margin-bottom: 7px; }
.metadata { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 20px; background: #e9f0f9; border: 1px solid #dae7f4;
  padding: 15px 18px; border-radius: var(--radius); margin-bottom: 15px; }
.metadata dt { color: var(--muted); font-size: .76rem; margin-bottom: 4px; }
.metadata dd { font-size: .87rem; font-weight: 700; overflow-wrap: anywhere; }
.summary, .indicadores-reporte { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; margin-bottom: 16px; }
.metric, .indicador { padding: 13px 14px; min-width: 0; border: 1px solid var(--line); border-top: 3px solid #52849d;
  background: #fff; border-radius: 12px; box-shadow: var(--sombra); }
.metric:nth-child(2), .indicador:nth-child(2) { border-top-color: #7790be; }
.metric:last-child, .indicador-ganancia { background: #e5f4ee; border-color: #c7e3d8; border-top-color: #14806a; }
.metric span, .indicador span { display: block; color: var(--muted); font-size: .79rem; font-weight: 650; }
.metric strong, .indicador strong { display: block; margin-top: 5px; font-size: clamp(1rem, 1.7vw, 1.45rem);
  font-weight: 770; line-height: 1.18; letter-spacing: -.02em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.capture { padding: 17px 19px; }
.capture-grid { margin-top: 14px; display: grid; grid-template-columns: 1.2fr 1fr 2fr; align-items: start; gap: 14px; }
.notice { padding: 11px 18px; color: #235960; }
#mensaje-detalle { position: sticky; bottom: 0; z-index: 2; border: 1px solid #bad8da; border-radius: 10px; background: #edf7f8; }
.error, #mensaje-detalle.error { color: #902c34; background: #fff1f2; border-color: #e5c0c4; font-size: .83rem; }
.pagination { display: flex; justify-content: end; align-items: center; gap: 10px;
  padding: 11px 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }

.indicadores-reporte { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.indicador { min-height: 91px; }
.reporte-contexto { display: flex; justify-content: space-between; gap: 12px; margin: 0 3px 11px; }
#conteo-reporte { text-align: right; font-weight: 650; }
.orden-reporte { margin-bottom: 11px; }
.cabecera-reporte { position: relative; display: grid; align-items: start; gap: 10px 13px;
  grid-template-columns: .95fr 1.65fr 1.05fr 1fr 1fr 1fr; padding: 15px 40px 15px 17px;
  list-style: none; border-radius: 15px; cursor: pointer; }
.cabecera-reporte::-webkit-details-marker { display: none; }
.cabecera-reporte:hover { background: #f6f9fc; }
.orden-reporte[open] > .cabecera-reporte { background: #f2f7fc; border-radius: 15px 15px 0 0; }
.cabecera-reporte::after { content: ""; position: absolute; right: 17px; top: 20px; width: 9px; height: 9px;
  border-right: 2px solid var(--brand); border-bottom: 2px solid var(--brand); transform: rotate(45deg); }
.orden-reporte[open] > .cabecera-reporte::after { transform: rotate(225deg); top: 24px; }
.cabecera-reporte strong, .entrega-reporte-cabecera strong { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.cabecera-reporte > div { min-width: 0; }
.cabecera-reporte .muted { font-size: .75rem; }
.importe-reporte { font-variant-numeric: tabular-nums; }
.ganancia-reporte strong { color: var(--brand); }
.estado-factura strong { font-size: .86rem; }
.estado-factura.facturada strong { color: var(--brand); }
.cuerpo-reporte { padding: 0 15px 13px; border-top: 1px solid var(--line); }
.datos-reporte { padding: 11px 0; }
.entrega-reporte { border: 1px solid var(--line); border-radius: 11px; margin-bottom: 10px; overflow: hidden; }
.entrega-reporte:last-child { margin-bottom: 0; }
.entrega-reporte-cabecera { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 9px 20px;
  align-items: center; padding: 11px 13px; background: #fcfdff; }
.tabla-reporte { min-width: 950px; }
.tabla-reporte td:first-child { min-width: 176px; }
.tabla-reporte td, .tabla-reporte th { padding: 8px 10px; }
.tabla-reporte .number { white-space: nowrap; }
.tabla-reporte tfoot { background: #edf4f9; font-weight: 720; }
.notas-reporte { padding: 8px 11px; border-top: 1px solid var(--line); }

.filtros-comisiones { display: flex; align-items: end; flex-wrap: wrap; gap: 13px; padding: 17px; }
.filtros-comisiones label { width: min(100%, 220px); }
#actualizacion-comisiones { margin: 0 0 5px auto; }
.tabla-comisiones { min-width: 790px; }
.estado-comision { display: inline-block; font-size: .77rem; font-weight: 710; padding: 5px 8px;
  border-radius: 20px; background: #fff0d6; color: #744010; }
.estado-comision.preparado { background: #e8efff; color: #234779; }
.estado-comision.entregado { background: #e1f4eb; color: #145b49; }
.seguimiento-comision { min-width: 155px; }
.seguimiento-comision small { font-size: .75rem; }
.importe-comision { font-weight: 740; white-space: nowrap; }
.acciones-comision { display: flex; flex-wrap: wrap; gap: 5px; }
.acciones-comision button { min-height: 34px; padding: 5px 9px; font-size: .77rem; }
.icon-usuarios::before, .icon-usuarios::after { content: ""; position: absolute; border: 1.5px solid currentColor; }
.icon-usuarios::before { width: 7px; height: 7px; left: 5px; top: 0; border-radius: 50%; }
.icon-usuarios::after { width: 15px; height: 7px; left: 1px; bottom: 0; border-radius: 7px 7px 2px 2px; }
.tabla-usuarios { min-width: 600px; }
.tabla-usuarios td:last-child { width: 130px; }
.tabla-usuarios button { min-height: 34px; }
.dialogo-usuario { width: min(440px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0;
  border: 1px solid var(--line); border-radius: 17px; color: var(--ink); box-shadow: 0 22px 55px #152e4760; }
.dialogo-usuario::backdrop { background: #12213885; }
.encabezado-dialogo-usuario { padding: 17px 20px; background: var(--marino); color: #fff; }
#form-usuario { display: grid; gap: 13px; padding: 19px 20px; }
#form-usuario input[readonly] { background: #f0f4f8; }
#alcance-perfil { line-height: 1.45; }
.acciones-dialogo-usuario { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.acceso { width: min(calc(100% - 34px), 830px); min-height: 378px; display: grid;
  grid-template-columns: 1.05fr 1fr; margin: max(32px, 14vh) auto 32px;
  background: #fff; border: 1px solid var(--line); border-radius: 21px; overflow: hidden; box-shadow: 0 21px 55px #182c4720; }
.acceso-identidad { padding: 39px 34px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.acceso-identidad strong { display: block; margin: 17px 0 10px; font-size: clamp(2.6rem, 8vw, 3.7rem); line-height: 1; letter-spacing: -.06em; }
.acceso-identidad p { color: #dcebea; max-width: 27ch; }
.login { padding: 38px 33px; align-content: center; }
.login h1 { font-size: 1.85rem; margin-bottom: 21px; }
.login form { display: grid; gap: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1190px) {
  .filters, .filters.real { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search { grid-column: span 2; }
  .cabecera-reporte { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .barra-lateral { position: static; height: auto; display: flex; align-items: center; gap: 17px;
    flex-wrap: wrap; padding: 13px 17px; }
  .brand { margin: 0; padding: 0; }
  .menu-balancx { display: flex; flex-wrap: wrap; gap: 6px; }
  .menu-balancx button { width: auto; min-height: 37px; }
  .summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 610px) {
  main { padding: 17px 12px 10px; }
  .topbar { padding-inline: 12px; min-height: 53px; }
  .usuario-activo { display: none; }
  .barra-lateral { padding: 11px 12px; row-gap: 10px; }
  .mark { width: 37px; height: 37px; }
  .menu-balancx button { padding-inline: 9px; }
  .page-heading { flex-direction: column; align-items: flex-start; gap: 13px; }
  .portada { padding: 20px 17px; min-height: 0; }
  .acciones-reporte { justify-items: start; }
  .acciones-reporte p { text-align: left; }
  .filters, .filters.real, .metadata, .summary, .capture-grid, .indicadores-reporte {
    grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters label:first-child, .search, .filters button, .observations { grid-column: span 2; }
  .metadata { gap: 10px; }
  .cabecera-reporte { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cuerpo-reporte { padding-inline: 9px; }
  .reporte-contexto { display: block; }
  #conteo-reporte { display: block; text-align: left; margin-top: 5px; }
  .acceso { grid-template-columns: minmax(0, 1fr); }
  .acceso-identidad, .login { padding: 22px; }
  .filtros-comisiones label { width: auto; flex: 1 1 130px; }
  #actualizacion-comisiones { width: 100%; margin: 0; }
  .tabla-comisiones { min-width: 0; }
  .tabla-comisiones thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tabla-comisiones tbody, .tabla-comisiones tbody td { display: block; }
  .tabla-comisiones tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px; padding: 14px; border-top: 1px solid var(--line); }
  .tabla-comisiones tbody td { padding: 0; border: 0; min-width: 0; text-align: left; overflow-wrap: anywhere; }
  .tabla-comisiones tbody td::before { content: attr(data-etiqueta); display: block; margin-bottom: 2px;
    font-weight: 650; font-size: .76rem; color: var(--muted); }
  .tabla-comisiones tbody td:first-child, .tabla-comisiones tbody td:nth-child(n+6) { grid-column: span 2; }
  .tabla-comisiones tbody td:empty { display: none; }
}


/* BalancX: logo de inicio de sesion */
#acceso .acceso-identidad {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 36px clamp(24px, 4vw, 48px);
}

#acceso .acceso-identidad::before {
  content: "";
  width: min(100%, 310px);
  aspect-ratio: 900 / 150;
  background: url("./balancx-logo-login.png") center / contain no-repeat;
}

#acceso .acceso-identidad > .mark,
#acceso .acceso-identidad > p {
  display: none;
}

#acceso .acceso-identidad > strong {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 610px) {
  #acceso .acceso-identidad {
    min-height: 120px;
    padding: 24px;
  }

  #acceso .acceso-identidad::before {
    width: min(100%, 250px);
  }
}


/* BalancX: logo de la barra lateral */
.barra-lateral .brand > .mark {
  display: none;
}

.barra-lateral .brand > div {
  position: relative;
  display: grid;
  width: min(100%, 164px);
  row-gap: 3px;
}

.barra-lateral .brand > div::before {
  content: "";
  width: 100%;
  aspect-ratio: 900 / 150;
  background: url("./balancx-logo-login.png") left center / contain no-repeat;
}

.barra-lateral .brand strong {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.barra-lateral .brand small {
  padding-inline-start: 26%;
  line-height: 1.2;
}

@media (max-width: 900px) {
  .barra-lateral .brand > div {
    width: 144px;
  }
}
