/* Presupuestador de Sueldos — estética estándar Upgrade (fondo de hexágonos, vidrio, Barlow) */
:root {
  --tinta: #1d2733; --suave: #5b6b7a; --linea: #d9dee5; --azul-enc: #1f3f66; --grafito: #3b4250;
  --verde: #2e8b57; --alerta: #c0392b; --vidrio: rgba(255,255,255,.91);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: 'Barlow', system-ui, sans-serif; color: var(--tinta); }
body {
  background: #0d2733 url('../img/fondo.jpg') center / cover fixed no-repeat;
  background-image: url('../img/fondo.jpg'), radial-gradient(ellipse at 20% 20%, #1d4f63 0%, #0d2733 55%, #071820 100%);
}
.oculto { display: none !important; }
input, select, button { font-family: inherit; font-size: 15px; }
.vidrio { background: var(--vidrio); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 10px; box-shadow: 4px 6px 18px rgba(0,0,0,.35); }
.btn { border: 0; border-radius: 7px; padding: 8px 16px; cursor: pointer; font-weight: 600; }
.btn-principal { background: var(--grafito); color: #fff; }
.btn-gris { background: #e6e9ee; color: var(--tinta); }
.btn-gris:hover { background: #d7dce3; }
.btn-vidrio { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.28); }
.btn-vidrio:hover { background: rgba(255,255,255,.24); }
.btn-chico { padding: 4px 10px; font-size: 13px; }
.req { color: var(--tinta); }

/* ingreso */
.ingreso { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 16px; }
.ingreso-marca { text-align: center; color: #fff; }
.logo-cliente-grande { max-height: 40px; max-width: 90vw; margin-bottom: 18px; }
.titulo-metal { margin: 0; font-size: 38px; font-weight: 700; letter-spacing: .5px;
  background: linear-gradient(180deg, #f4f6f8 0%, #c9d1da 55%, #e9edf1 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 1px 1px 0 rgba(0,0,0,.25); }
.leyenda { margin: 6px 0 0; color: #dfe6ee; }
.cuadro-ingreso { width: min(380px, 100%); padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.cuadro-ingreso input { padding: 9px 10px; border: 1px solid var(--linea); border-radius: 7px; }
.cuadro-ingreso .btn { margin-top: 10px; }
.mensaje { min-height: 18px; margin: 4px 0 0; color: var(--alerta); font-size: 14px; }

/* barra superior */
.barra-superior { max-width: 1500px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #fff; }
.barra-izq, .barra-der { display: flex; align-items: center; gap: 14px; }
.logo-cliente img { max-height: 24px; display: block; }
.logo-cliente, .logo-upgrade { color: #fff; font-weight: 700; text-decoration: none; }
.logo-upgrade img { height: 42px; border-radius: 7px; display: block; background: #fff; padding: 2px; }
.app-nombre { font-size: 20px; font-weight: 700; }
.app-pantalla { font-size: 14px; color: #dfe6ee; }
.usuario { display: flex; flex-direction: column; align-items: flex-end; font-size: 14px; }
.rol { color: #cfd8e3; font-size: 12px; }

/* contenido */
.contenido { max-width: 1500px; margin: 0 auto; padding: 0 16px 90px; display: flex; flex-direction: column; gap: 14px; }
.filtros { padding: 14px; display: grid; grid-template-columns: 1fr 2fr 1fr 1.3fr; gap: 12px; }
.campo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.campo label { font-size: 13px; font-weight: 600; color: var(--suave); }
.campo select, .campo input { padding: 8px 10px; border: 1px solid var(--linea); border-radius: 7px; background: #fff; width: 100%; }
.buscable { position: relative; }
.lista { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; max-height: 320px; overflow: auto; background: #fff;
  border: 1px solid var(--linea); border-radius: 7px; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.lista div { padding: 7px 10px; cursor: pointer; font-size: 14px; border-bottom: 1px solid #f0f2f5; }
.lista div:hover, .lista div.activo { background: #eef2f7; }
.lista small { color: var(--suave); }
.texto-sobre-fondo { color: #e9eef5; text-align: center; padding: 30px; font-size: 17px; }

.ficha { padding: 14px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px 16px; }
.ficha .dato { display: flex; flex-direction: column; }
.ficha .dato span:first-child { font-size: 12px; color: var(--suave); font-weight: 600; }
.ficha .dato span:last-child { font-size: 15px; font-weight: 600; }

#panelLiquidacion { padding: 12px; }
.tabla-herramientas { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.tabla-herramientas input[type=text], #txtFiltro { padding: 7px 10px; border: 1px solid var(--linea); border-radius: 7px; width: 340px; }
.chk { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.espaciador { flex: 1; }
.tabla-contenedor { max-height: calc(100vh - 330px); overflow: auto; border-radius: 8px; border: 1px solid var(--linea); background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
thead th { position: sticky; top: 0; z-index: 2; background: var(--azul-enc); color: #fff; font-weight: 600; text-align: left;
  padding: 8px 8px; white-space: nowrap; cursor: pointer; user-select: none; }
thead th.num { text-align: right; }
thead th .flecha { margin-left: 4px; opacity: .8; }
tbody td { padding: 6px 8px; border-bottom: 1px solid #eef0f3; white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.clic { cursor: pointer; }
td.clic:hover { background: #e9f0f8; text-decoration: underline; }
td.cero { color: #a7b0bb; }
tr.seccion td { background: #eef2f7; font-weight: 700; color: var(--azul-enc); }
tr.subtotal td { font-weight: 700; border-top: 1px solid #cfd6df; }
tr.total td { font-weight: 700; background: #e3e9f1; }
tr.aux td:first-child { color: var(--suave); }
td.concepto { white-space: normal; min-width: 260px; }
.etq { white-space: nowrap; font-size: 11px; color: var(--suave); margin-left: 6px; }
.nota { font-size: 13px; color: var(--suave); margin: 8px 2px 0; }

/* barra de estado */
.barra-estado { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 7px 18px;
  background: rgba(10, 22, 30, .78); backdrop-filter: blur(6px); color: #dfe6ee; font-size: 13px; }
.powered { color: #dfe6ee; text-decoration: none; display: flex; align-items: center; gap: 6px; }
.chip-logo { background: #fff; border-radius: 6px; padding: 2px 4px; display: inline-flex; color: #333; font-weight: 700; }
.chip-logo img { height: 22px; display: block; }

/* ventana */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-caja { width: min(980px, 100%); max-height: 90vh; overflow: auto; padding: 20px; }
.modal-pie { display: flex; justify-content: flex-end; margin-top: 14px; }
.modal h2 { margin: 0 0 4px; font-size: 20px; }
.modal h3 { margin: 16px 0 6px; font-size: 15px; color: var(--azul-enc); }
.modal .formula { background: #f4f6f9; border-radius: 7px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.5; }
.modal table { font-size: 13px; }
.modal .resultado { font-size: 22px; font-weight: 700; margin-top: 6px; }
.modal .alerta { color: var(--alerta); font-weight: 600; }
.cargando { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.25); }
.cargando .vidrio { padding: 18px 28px; font-weight: 600; }

/* celular */
@media (max-width: 900px) {
  .filtros { grid-template-columns: 1fr; }
  .ficha { grid-template-columns: repeat(2, 1fr); }
  .barra-superior { flex-wrap: wrap; }
  .app-pantalla, #estDatos, #btnClave, .powered { display: none; }
  .tabla-contenedor { max-height: none; }
}

/* impresión (PDF) */
#zonaImpresion { display: none; }
@media print {
  @page { size: A4 portrait; margin: 14mm 10mm 16mm; }
  body { background: #fff !important; }
  #pantallaApp, #pantallaIngreso, .modal, .cargando { display: none !important; }
  #zonaImpresion { display: block; font-size: 10.5px; }
  #zonaImpresion table { font-size: 10px; }
  #zonaImpresion thead th { position: static; background: #fff; color: #000; border-bottom: 1.5px solid #000; }
  #zonaImpresion thead { display: table-header-group; }
  #zonaImpresion tr.seccion td { background: #f0f0f0; color: #000; }
  #zonaImpresion .enc { display: flex; justify-content: space-between; border-bottom: 1px solid #000; margin-bottom: 6px; padding-bottom: 4px; }
  #zonaImpresion .sub { margin-bottom: 6px; font-weight: 600; }
  #zonaImpresion td, #zonaImpresion th { padding: 2px 4px; white-space: nowrap; }
  #zonaImpresion td.num { text-align: right; }
}

/* ---------------- menú principal ---------------- */
.menu { max-width: 1500px; margin: 0 auto 12px; padding: 0 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.menu a { color: #e6edf5; text-decoration: none; padding: 7px 14px; border-radius: 7px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); font-weight: 600; font-size: 14.5px; }
.menu a:hover { background: rgba(255,255,255,.18); }
.menu a.activo { background: #fff; color: var(--azul-enc); }
.campo-version { display: flex; flex-direction: column; gap: 2px; }
.campo-version label { font-size: 11px; color: #cfd8e3; font-weight: 600; }
.campo-version select { padding: 6px 8px; border-radius: 7px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.95); max-width: 330px; }
.panel { padding: 14px; }
.filtros-sim { grid-template-columns: 2fr 1fr 1.3fr; }

/* ---------------- botones extra ---------------- */
.btn-peligro { background: #b03a2e; color: #fff; }
.btn-peligro:hover { background: #962f25; }
.btn-principal:hover { background: #2b313c; }
.fila-botones { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

/* ---------------- grilla ---------------- */
thead tr.filtros-col th { top: 35px; background: #2c4f78; padding: 4px 5px; cursor: default; }
thead tr.filtros-col input { width: 100%; min-width: 60px; padding: 3px 6px; border: 0; border-radius: 4px; font-size: 12.5px; }
.g-filtro { padding: 7px 10px; border: 1px solid var(--linea); border-radius: 7px; width: 320px; }
.g-cuenta { font-size: 13px; color: var(--suave); }
td.editable { cursor: cell; background: #fbfcfe; }
td.editable:hover { outline: 1px solid #9db4d0; outline-offset: -1px; }
td.guardando { background: #fff6d6; }
td.guardado { background: #dff3e5; transition: background .6s; }
td.vacio { text-align: center; color: var(--suave); padding: 18px; }
.celda-edit { width: 100%; min-width: 80px; padding: 3px 5px; border: 1.5px solid var(--azul-enc); border-radius: 4px; font-size: 13.5px; text-align: right; }
tfoot td { position: sticky; bottom: 0; background: #e3e9f1; font-weight: 700; padding: 6px 8px; }

/* ---------------- datos maestros ---------------- */
.maestros { display: grid; grid-template-columns: 270px 1fr; gap: 14px; align-items: start; }
.menu-maestros { padding: 10px; position: sticky; top: 8px; max-height: calc(100vh - 170px); overflow: auto; }
.menu-maestros .grupo { font-size: 12px; font-weight: 700; color: var(--suave); text-transform: uppercase; letter-spacing: .4px; margin: 12px 6px 4px; }
.menu-maestros .grupo:first-child { margin-top: 2px; }
.menu-maestros a { display: block; padding: 6px 9px; border-radius: 6px; cursor: pointer; font-size: 14px; color: var(--tinta); }
.menu-maestros a:hover { background: #eef2f7; }
.menu-maestros a.activo { background: var(--azul-enc); color: #fff; }
.editor-maestro { min-width: 0; }
.editor-maestro .nota { margin: 6px 2px 10px; }
.titulo-editor { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.titulo-editor h2 { margin: 0; font-size: 20px; }
.titulo-editor .sub { color: var(--suave); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.form-grid .campo input, .form-grid .campo select, .form-grid .campo textarea { padding: 8px 10px; border: 1px solid var(--linea); border-radius: 7px; background: #fff; width: 100%; }
.lista-errores { max-height: 160px; overflow: auto; background: #fdf1ef; border-radius: 7px; padding: 8px 10px; font-size: 13px; color: var(--alerta); margin-bottom: 8px; }
.lista .sin { color: var(--suave); cursor: default; }
.alerta { color: var(--alerta); font-weight: 600; }

/* ---------------- avisos ---------------- */
.avisos { position: fixed; right: 18px; bottom: 54px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.aviso { background: #20303f; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.3); font-size: 14px; max-width: 420px; transition: opacity .5s; }
.aviso.error { background: #8e2b22; }
.aviso.fuera { opacity: 0; }

@media (max-width: 900px) {
  .maestros { grid-template-columns: 1fr; }
  .menu-maestros { position: static; max-height: 220px; }
  .form-grid { grid-template-columns: 1fr; }
  .campo-version select { max-width: 200px; }
  .filtros-sim { grid-template-columns: 1fr; }
}
.filtros-aud { grid-template-columns: 150px 150px 1fr 1.3fr 1.3fr auto; align-items: end; }
.campo-boton { justify-content: flex-end; }
.valor-grande { font-size: 20px; font-weight: 700; padding: 6px 0; }
.valor-grande small { display: block; font-size: 12.5px; font-weight: 500; color: var(--suave); }
@media (max-width: 900px) { .filtros-aud { grid-template-columns: 1fr 1fr; } }

/* ---------------- conceptos ---------------- */
.editor-concepto { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; }
.editor-concepto .campo { margin-top: 10px; }
.editor-concepto textarea, .editor-concepto input, .editor-concepto select { padding: 8px 10px; border: 1px solid var(--linea); border-radius: 7px; background: #fff; width: 100%; font-family: inherit; font-size: 14.5px; }
.editor-concepto textarea.mono { font-family: Consolas, 'Cascadia Mono', 'Courier New', monospace; font-size: 14px; line-height: 1.45; }
.col-der { border-left: 1px solid var(--linea); padding-left: 18px; min-width: 0; }
.chequeo { font-size: 12.5px; margin-top: 3px; min-height: 15px; }
.chequeo.ok { color: var(--verde); }
.chequeo.mal { color: var(--alerta); font-weight: 600; }
.meses-chk { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px 10px; font-size: 14px; }
.meses-chk input, .etiquetas-chk input { width: auto !important; }
.etiquetas-chk { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 12px; font-size: 13.5px; max-height: 150px; overflow: auto; border: 1px solid var(--linea); border-radius: 7px; padding: 6px 8px; background: #fff; }
.ayuda-formulas { font-size: 13px; color: var(--tinta); }
.ayuda-formulas code { background: #eef2f7; border-radius: 4px; padding: 1px 5px; display: inline-block; margin: 2px 2px; font-size: 12.5px; }
.tabla-prueba { font-size: 13px; }
.tabla-prueba tr.clic:hover td { background: #e9f0f8; cursor: pointer; }
tr.inactivo td { color: #a0a8b2; text-decoration: line-through; }
td.formula-celda { max-width: 380px; overflow: hidden; text-overflow: ellipsis; font-family: Consolas, 'Courier New', monospace; font-size: 12.5px; }
.ordenar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-height: 65vh; overflow: auto; }
.sec-orden h3 { margin: 4px 0 6px; }
.items { min-height: 40px; background: #f4f6f9; border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.item { background: #fff; border: 1px solid var(--linea); border-radius: 6px; padding: 6px 9px; cursor: grab; font-size: 13.5px; display: flex; justify-content: space-between; gap: 8px; }
.item small { color: var(--suave); }
.item.arrastrando { opacity: .5; }
@media (max-width: 900px) { .editor-concepto { grid-template-columns: 1fr; } .col-der { border: 0; padding: 0; } .ordenar { grid-template-columns: 1fr; } }

/* ---------------- tableros ---------------- */
.filtros-tab { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tarjetas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.tarjeta { background: #fff; border: 1px solid var(--linea); border-radius: 9px; padding: 10px 14px; display: flex; flex-direction: column; min-width: 0; }
.tarjeta span { font-size: 12.5px; color: var(--suave); font-weight: 600; }
.tarjeta b { font-size: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tarjeta small { color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grafico { height: 300px; position: relative; }
td.accion { color: var(--azul-enc); font-weight: 600; text-decoration: underline; cursor: pointer; }
.sube { color: #b03a2e; } .baja { color: var(--verde); }
@media (max-width: 900px) { .filtros-tab { grid-template-columns: 1fr 1fr; } .tarjetas { grid-template-columns: 1fr; } }
.filtros-ej { grid-template-columns: 1.2fr 1.4fr 1fr 0.8fr 1.2fr; }
@media (max-width: 900px) { .filtros-ej { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .logo-cliente img { max-height: 16px; }
  .app-nombre { font-size: 15px; }
  .barra-izq { min-width: 0; flex: 1 1 100%; }
  .barra-der { flex: 1 1 100%; justify-content: space-between; flex-wrap: wrap; }
  .g-filtro { width: 100%; }
  .menu a { padding: 6px 10px; font-size: 13.5px; }
}
