:root { color-scheme: light; --fondo: #f2f5f3; --texto: #152b25; --muted: #4e645c; --borde: #d8e2dd; --acento: #21664e; --error: #961e2d; --sidebar: #17352c; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--fondo); color: var(--texto); font: 16px/1.48 system-ui, sans-serif; }
a { color: var(--acento); }
.saltar { position: fixed; top: .65rem; left: .65rem; z-index: 5; padding: .65rem 1rem; background: white; border-radius: .45rem; transform: translateY(-200%); }
.saltar:focus { transform: none; }
.panel-app { min-height: 100vh; display: grid; grid-template-columns: 14.5rem minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; align-self: start; min-height: 100vh; max-height: 100vh; overflow-y: auto; padding: 1.35rem .85rem 1.5rem; background: var(--sidebar); color: #edf6f1; }
.sidebar-cabeza { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .25rem .6rem 1.2rem; }
.marca { display: grid; gap: .12rem; color: #fff; text-decoration: none; font-weight: 750; font-size: 1.3rem; letter-spacing: .055em; }
.marca span { color: #b9d1c7; font-weight: 500; font-size: .79rem; letter-spacing: normal; }
.nav-grupo { margin-top: 1.15rem; display: grid; gap: .2rem; }
.nav-grupo > p { margin: 0; padding: 0 .65rem .25rem; color: #b9d1c7; font-size: .75rem; font-weight: 650; }
.nav-grupo a { color: #e1efe9; min-height: 2.55rem; display: flex; align-items: center; text-decoration: none; padding: .48rem .65rem; border-radius: .5rem; font-size: .92rem; }
.nav-icono { width: 1.125rem; height: 1.125rem; flex: 0 0 auto; margin-right: .55rem; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.nav-grupo a:hover { background: #26483d; }
.nav-grupo a[aria-current="page"] { background: #d8eee2; color: #17372b; font-weight: 700; }
#nav-toggle { display: none; background: #294e40; border-color: #5c7d6f; }
.sidebar :focus-visible { outline: 2px solid #cdeedf; outline-offset: 2px; }
main { width: 100%; min-width: 0; max-width: 85rem; margin: 0 auto; padding: clamp(1.2rem, 3vw, 2.7rem); }
.vista { min-width: 0; display: grid; gap: 1rem; align-content: start; }
.vista-cabeza { padding-bottom: .45rem; }
h1, h2, h3, p, dl { margin: 0; }
h1 { font-size: clamp(1.7rem, 2.8vw, 2.25rem); line-height: 1.18; letter-spacing: -.028em; }
h1:focus { outline: none; }
h2 { font-size: 1.17rem; }
h3 { font-size: 1rem; margin-top: 1.15rem; }
section, dialog { background: #fff; border: 1px solid var(--borde); border-radius: .8rem; padding: 1.3rem; min-width: 0; }
.accesos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .65rem; margin-top: .75rem; }
.accesos a { display: grid; gap: .2rem; padding: .8rem; border: 1px solid var(--borde); border-radius: .55rem; color: var(--texto); text-decoration: none; }
.accesos a:hover { border-color: var(--acento); background: var(--fondo); }
.accesos span { color: var(--muted); font-size: .85rem; }
a:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
p:not(:empty),.recursos,.tabla,.registros,form{margin-top:.6rem}
.cabecera,.acciones{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap}
.secundario{color:var(--muted)} .error{color:var(--error)}
button,input,textarea,select{font:inherit}
button{border:1px solid transparent;border-radius:7px;padding:.55rem .9rem;color:#fff;background:var(--acento);cursor:pointer;font-weight:600}
button:disabled{cursor:default;background:#63756f;color:#fff}
button.alterno{background:#fff;color:var(--texto);border-color:var(--borde)}
button:focus-visible,input:focus-visible,textarea:focus-visible{outline:3px solid #34876b;outline-offset:2px}
.recursos{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,12rem),1fr));gap:.55rem}
.recursos div{background:var(--fondo);border-radius:7px;padding:.6rem .75rem;min-width:0}
dt{color:var(--muted);font-size:.87rem} dd{margin:0;font-weight:650}
.tabla{overflow:auto} table{width:100%;border-collapse:collapse;text-align:left;font-size:.92rem}
td,th{padding:.65rem;border-bottom:1px solid var(--borde);overflow-wrap:anywhere}
.registros{padding:0;list-style:none}
.registros li{border-bottom:1px solid var(--borde);padding:.55rem 0;overflow-wrap:anywhere}
.registros li:last-child{border-bottom:none}
label{display:grid;gap:.25rem;font-weight:550} label:has(textarea){grid-column:1/-1}
select{padding:.5rem;border:1px solid var(--borde);border-radius:6px;background:white;color:inherit} input,textarea{width:100%;padding:.5rem;border:1px solid var(--borde);border-radius:6px;color:inherit;background:white}
dialog{max-width:min(40rem,calc(100% - 2rem));width:100%;color:var(--texto)}
dialog::backdrop{background:#13261eaa} pre{white-space:pre-wrap;overflow-wrap:anywhere;background:var(--fondo);padding:.8rem}
@media(max-width:36rem){section{padding:1rem}}

#po-detalle{max-width:min(64rem,calc(100% - 2rem))}
[id$="-documentos"] button{margin-top:.45rem}

#prefactura-form{display:flex;gap:.65rem;align-items:end;flex-wrap:wrap}
#prefactura-guardar{margin-top:.65rem}

#facturas-grupos button{margin-top:.45rem;margin-right:.45rem}

#reporte-form{display:flex;gap:.65rem;align-items:end;flex-wrap:wrap}

@media (max-width: 48rem) {
  .panel-app { display: block; }
  .sidebar { z-index: 2; border-bottom: 1px solid #315549; min-height: auto; max-height: 78vh; padding: .55rem 1rem; }
  .sidebar-cabeza { padding: .15rem 0; }
  #nav-toggle { display: inline-flex; }
  #sidebar-nav { display: none; }
  #nav-toggle[aria-expanded="true"] { background: #d8eee2; color: #17372b; }
  .sidebar.menu-abierto #sidebar-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem .7rem; padding-bottom: .55rem; }
  .nav-grupo { align-content: start; margin-top: .65rem; }
  main { padding: 1.1rem 1rem 2.5rem; }
}

.acceso { max-width: 31rem; min-height: 100vh; display: grid; place-items: center; }
.acceso section { width: 100%; }
.entrada { display: inline-block; padding: .65rem 1rem; border-radius: .5rem; background: var(--acento); color: white; text-decoration: none; font-weight: 650; }
.sesion-salir { margin: 1rem .6rem 0; background: transparent; border-color: #759589; }
@media (max-width: 48rem) {
  .sesion-salir { display: none; }
  .sidebar.menu-abierto .sesion-salir { display: inline-flex; margin: .4rem 0; }
}

.opciones-secundarias { margin-top: .75rem; color: var(--muted); }
.opciones-secundarias > summary { cursor: pointer; width: fit-content; font-weight: 600; }
.archivo-estado { display: flex; gap: .35rem .65rem; align-items: center; flex-wrap: wrap; }
.distintivo-estado { display: inline-block; padding: .13rem .47rem; border-radius: .35rem; background: #e9efec; color: #314a40;
  font-size: .8rem; font-weight: 650; }
.distintivo-estado[data-tono=correcto] { background: #dcefe4; color: #194d36; }
.distintivo-estado[data-tono=atencion] { background: #fff0cf; color: #624500; }
.distintivo-estado[data-tono=error] { background: #f9e3e6; color: #88182b; }
.aviso-revision { margin-top: .9rem; padding: .65rem .8rem; border-left: .25rem solid #a37012; background: #fffaed; }
.aviso-revision h3 { margin: 0; }
.aviso-revision .registros { margin-bottom: 0; }
.aviso-revision .registros li { border-color: #ece1ca; }
.icono-carpeta { display: flex; align-items: center; gap: .55em; }
.icono-carpeta::before {
  content: ""; width: 1.25em; height: 1em; flex: none; border-radius: .12em;
  background-color: currentColor; forced-color-adjust: none;
  clip-path: polygon(0 12%, 39% 12%, 49% 28%, 100% 28%, 100% 94%, 0 94%);
}
.regla-recepcion { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: .6rem .8rem; min-width: 0; border: 1px solid var(--borde); border-radius: .5rem; padding: .7rem .8rem .85rem; margin: .65rem 0 0; }
.regla-recepcion legend { font-weight: 650; padding: 0 .25rem; color: var(--texto); }
.regla-recepcion label:has(textarea) { grid-column: auto; }
.reglas-acciones { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .7rem; }
#buscar-correos-form { justify-content: start; align-items: end; }
#buscar-correos-tabla input[type=checkbox] { width: auto; }
#procesar-correos { margin-top: .7rem; }
#facturas-grupos .archivo-acciones { margin-top: .5rem; }
#documentos-indice .cabecera { align-items: end; }
.carpeta-lista { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .75rem; padding: 0; margin: .9rem 0 0; list-style: none; }
.carpeta-boton { width: 100%; min-height: 5rem; display: grid; grid-template-columns: 1.8rem minmax(0, 1fr);
  justify-items: start; align-content: center; align-items: start; gap: .1rem .65rem; text-align: left; overflow-wrap: anywhere; }
.carpeta-boton::before { grid-row: span 2; align-self: center; font-size: 1.35rem; color: var(--acento); }
.carpeta-boton:hover { background: var(--fondo); border-color: var(--acento); }
.carpeta-boton span, .archivo-fila span:not(.distintivo-estado) { color: var(--muted); font-size: .88rem; display: block; font-weight: 400; }
#carpeta-titulo { margin-top: 1rem; }
#carpeta-grupos details { border: 1px solid var(--borde); border-radius: .55rem; margin-top: .75rem; padding: .7rem .9rem; }
#carpeta-grupos summary { cursor: pointer; font-weight: 650; }
.archivo-fila { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; }
.archivo-acciones { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.tabla-ordenes table { min-width: 86rem; }
.tabla-ordenes td:nth-child(11) { min-width: 12rem; }
#tablas-filtros { justify-content: start; align-items: end; }
#po-detalle { max-width: min(70rem, calc(100% - 2rem)); }
.archivo-fila a { font-weight: 650; text-underline-offset: .15em; }

.formato-prefactura table { min-width: 46rem; }
.formato-prefactura thead { background: #e9f2ec; }
.formato-prefactura tr[data-tipo=grupo] { background: #f2f6f3; }
.formato-prefactura tr[data-tipo=titulo], .formato-prefactura tr[data-tipo=grupo],
.formato-prefactura tr[data-tipo=total] { font-weight: 700; }
.formato-prefactura tr[data-tipo=total] td { border-top: 2px solid #52685d; }
.formato-prefactura :is(th, td):is(:first-child, :nth-child(5), :nth-child(6), :nth-child(7), :last-child) { text-align: right; }
#prefactura-descarga { margin-top: .6rem; }
.form-serial { display: flex; align-items: center; gap: .35rem; margin: 0 0 .2rem; min-width: 12rem; }
.form-serial input { min-width: 6rem; }
#prefactura-avance caption { text-align: left; font-weight: 650; padding: .3rem 0; }
.pestanas-tablas { display: flex; flex-wrap: wrap; gap: .35rem; margin: -0.2rem 0 .85rem; }
.pestanas-tablas a { padding: .6rem .72rem; color: var(--texto); border: 1px solid var(--borde);
  border-radius: .45rem; background: white; text-decoration: none; font-size: .82rem; font-weight: 650; }
.pestanas-tablas a[aria-current="page"] { color: white; background: #245a48; border-color: #245a48; }
.tabla-extensa td, .tabla-extensa th { min-width: 7rem; }

#documento-correccion { max-width: min(76rem, calc(100% - 2rem)); max-height: calc(100% - 2rem); overflow: auto; }
.correccion-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr)); gap: 0.75rem; }
.correccion-campos label { display: grid; gap: 0.3rem; }
#corregir-partidas input { min-width: 7rem; width: 100%; }
#corregir-partidas input[data-campo="descripcion"] { min-width: 14rem; }
