/* =========================================================
   Piscigranja Valle Chimbilla
   Paleta: agua de manantial, bosque nublado, franja de trucha arcoíris
   ========================================================= */
/* Fuentes incluidas (licencia SIL Open Font) */
@font-face { font-family: "Bricolage Grotesque"; src: url(fuentes/bricolage-grotesque-latin-wght-normal.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Nunito Sans"; src: url(fuentes/nunito-sans-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito Sans"; src: url(fuentes/nunito-sans-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Nunito Sans"; src: url(fuentes/nunito-sans-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito Sans"; src: url(fuentes/nunito-sans-latin-800-normal.woff2) format("woff2"); font-weight: 800; font-display: swap; }
:root {
  --agua: #0b3a4a;        /* agua profunda: barra y menú */
  --agua-2: #11566b;
  --bosque: #2e6b4f;      /* acción principal */
  --rosa: #d4587a;        /* franja de la trucha arcoíris: acento */
  --neblina: #edf2f0;     /* fondo */
  --tinta: #14302b;       /* texto */
  --piedra: #5e716c;      /* texto suave */
  --linea: #d7e1dd;

  --c-pri: var(--agua);
  --c-pri-2: var(--agua-2);
  --c-acento: var(--bosque);
  --c-ven: #2e8c7a;
  --c-ali: #3a7ca5;
  --c-mor: #c2415b;
  --c-alerta: #a86b12;
  --fondo: var(--neblina);
  --tarjeta: #ffffff;
  --texto: var(--tinta);
  --suave: var(--piedra);
  --borde: var(--linea);
  --radio: 14px;
  --franja: linear-gradient(90deg, #7b8f3c 0%, #c99a4b 18%, #d4587a 45%, #a46aa8 68%, #7fb4c4 88%, #b9cfd3 100%);
  --t-titulo: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  font-family: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--fondo); color: var(--texto); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--agua-2); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--t-titulo); letter-spacing: -.01em; color: var(--agua); }
h1 { font-size: 1.85rem; font-weight: 700; margin: .1rem 0 1rem; line-height: 1.15; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 1.8rem 0 .7rem; }
.tarjeta h2 { margin-top: 0; }
small { color: var(--suave); }
.num, .kpi b, .total-venta b, .fv-sub { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid rgba(212, 88, 122, .45); outline-offset: 2px; }
.ico { width: 20px; height: 20px; flex-shrink: 0; }

/* ---------- Barra superior ---------- */
.barra { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  background: var(--agua); color: #fff; padding: .55rem 1rem; min-height: 62px; }
.barra::after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 5px; background: var(--franja); }
.marca { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; min-width: 0; }
.marca img { width: 46px; height: 46px; border-radius: 12px; background: #fff; padding: 2px; object-fit: contain; flex-shrink: 0; }
.marca span { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.marca b { font-family: var(--t-titulo); font-size: 1.12rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca small { color: #a9c8cf; font-size: .78rem; }
.btn-menu { background: rgba(255,255,255,.08); border: 0; color: #fff; padding: .45rem; cursor: pointer; border-radius: 10px; display: flex; }
.btn-menu .ico { width: 26px; height: 26px; }

/* ---------- Menú lateral ---------- */
.menu { position: fixed; top: 67px; left: 0; bottom: 0; width: 264px; z-index: 15; overflow-y: auto; padding: .4rem 0 2rem;
  background-color: var(--agua);
  /* pintas de la trucha */
  background-image: radial-gradient(rgba(255,255,255,.05) 1.5px, transparent 2px), radial-gradient(rgba(255,255,255,.035) 1px, transparent 1.5px);
  background-size: 34px 34px, 21px 21px; background-position: 0 0, 11px 7px;
  transform: translateX(-100%); transition: transform .22s ease; box-shadow: 4px 0 18px rgba(0,0,0,.2); }
.menu-abierto .menu { transform: none; }
.menu { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.menu::-webkit-scrollbar { width: 6px; } .menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 6px; }
.menu a { display: flex; align-items: center; gap: .75rem; margin: 1px .6rem; padding: .5rem .8rem; color: #cfe1e4; text-decoration: none; border-radius: 10px; font-weight: 600; font-size: .96rem; position: relative; }
.menu a .ico { opacity: .75; }
.menu a:hover { background: rgba(255,255,255,.07); color: #fff; }
.menu a.activo { background: rgba(255,255,255,.12); color: #fff; }
.menu a.activo::before { content: ""; position: absolute; left: -.6rem; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--rosa); }
.menu a.activo .ico { opacity: 1; color: #f3a6bb; }
.menu a.salir { color: #f0a3b2; margin-top: .4rem; }
.menu-usuario { margin: .3rem .6rem .6rem; padding: .7rem 1rem; border-radius: 12px; background: rgba(255,255,255,.07); display: flex; flex-direction: column; color: #fff; }
.menu-usuario b { font-family: var(--t-titulo); font-size: 1.05rem; text-transform: capitalize; }
.menu-usuario small { color: #a9c8cf; }
.menu-sep { margin: .7rem 1.4rem .2rem; font-size: .78rem; color: #7fa3ab; font-weight: 700; }
.contenido { max-width: 1180px; margin: 0 auto; padding: 1.4rem 1rem 3rem; min-width: 0; }

@media (min-width: 1000px) {
  .btn-menu { display: none; }
  .menu { transform: none; box-shadow: none; }
  .contenido { margin-left: 264px; max-width: none; padding: 2rem clamp(1.6rem, 3vw, 3.2rem) 3rem; }
}

/* ---------- Avisos ---------- */
.aviso { padding: .8rem 1rem .8rem 1.1rem; border-radius: 12px; margin-bottom: .7rem; border-left: 5px solid; font-size: .96rem; }
.aviso-ok { background: #e3f2ea; border-color: var(--bosque); }
.aviso-error { background: #fbe9ed; border-color: var(--c-mor); }
.aviso-alerta { background: #fbf2e1; border-color: var(--c-alerta); }

/* ---------- Tarjetas y formularios ---------- */
.tarjeta { background: var(--tarjeta); border-radius: var(--radio); padding: 1.3rem; margin-bottom: 1.2rem; border: 1px solid var(--borde); }
.formulario > h2:first-of-type { padding-bottom: .7rem; margin-bottom: 1rem; border-bottom: 1px dashed var(--borde); }
.formulario label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; font-weight: 700; color: var(--suave); margin-bottom: .9rem; }
.formulario .grilla label { margin-bottom: 0; }
input, select { font: inherit; font-size: 16px; padding: .65rem .75rem; border: 1.5px solid #c5d3cf; border-radius: 10px; background: #fbfdfc; color: var(--texto); width: 100%; min-height: 48px; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover { border-color: #9fb5af; }
input:focus, select:focus { outline: none; border-color: var(--agua-2); box-shadow: 0 0 0 4px rgba(17, 86, 107, .14); background: #fff; }
input::placeholder { color: #9aaaa6; }
.grilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.grilla .ancho { grid-column: 1 / -1; }
label.check { flex-direction: row !important; align-items: center; gap: .55rem; font-weight: 600; color: var(--texto); }
label.check input { width: 22px; min-height: 22px; accent-color: var(--bosque); }
.angosto { max-width: 440px; }
.con-unidad { display: flex; gap: .4rem; } .con-unidad select { width: 110px; flex-shrink: 0; }
.segmentado { display: flex; border: 1.5px solid #c5d3cf; border-radius: 10px; overflow: hidden; min-height: 48px; background: #fbfdfc; }
.segmentado label { flex: 1; flex-direction: row !important; justify-content: center; align-items: center; margin: 0 !important; cursor: pointer; color: var(--texto) !important; font-weight: 600 !important; font-size: .95rem !important; }
.segmentado input { display: none; }
.segmentado label:has(input:checked) { background: var(--agua); color: #fff !important; }
.opc { font-weight: 400; }
.ayuda { color: var(--suave); font-size: .9rem; margin: .4rem 0 1rem; max-width: 78ch; }

/* Fila por poza (alimentación rápida) */
.filas-pozas { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.fila-poza { display: grid; grid-template-columns: 1fr 1.4fr 110px; gap: .6rem; align-items: center; padding: .6rem .7rem; background: var(--fondo); border-radius: 12px; border-left: 4px solid var(--c-ali); }
.fp-nombre { display: flex; flex-direction: column; line-height: 1.25; }
.fp-nombre b { font-family: var(--t-titulo); font-size: 1.05rem; color: var(--agua); }
.input-kg { text-align: right; font-weight: 800; font-size: 1.1rem; }
@media (max-width: 520px) {
  .fila-poza { grid-template-columns: 1fr 100px; }
  .fila-poza select { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; background: var(--bosque); color: #fff; border: 0; border-radius: 11px;
  padding: .7rem 1.35rem; font: inherit; font-weight: 800; cursor: pointer; text-decoration: none; min-height: 48px; transition: background .15s, transform .05s; }
.btn:hover { background: #255a42; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; }
.btn-sec { background: #fff; color: var(--agua); box-shadow: inset 0 0 0 1.5px #c5d3cf; }
.btn-sec:hover { background: #f1f6f4; }
.btn-chico { padding: .35rem .75rem; min-height: 34px; font-size: .86rem; font-weight: 700; border-radius: 9px; }
.btn-grande { width: 100%; font-size: 1.1rem; min-height: 56px; }
.btn-borrar { background: #fff; border: 1.5px solid #ecc3cc; color: var(--c-mor); border-radius: 9px; width: 34px; height: 34px; cursor: pointer; font-size: .95rem; }
.btn-borrar:hover { background: #fbe9ed; }
form.inline { display: inline; margin: 0; }

/* ---------- Indicadores: un solo panel dividido ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--borde);
  border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; margin-bottom: 1.2rem; }
.kpi { background: #fff; padding: 1rem 1.1rem 1.05rem; display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.kpi span { font-size: .86rem; font-weight: 700; color: var(--suave); display: flex; align-items: center; gap: .45rem; }
.kpi span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--agua-2); flex-shrink: 0; }
.kpi b { font-family: var(--t-titulo); font-size: clamp(1.2rem, 1rem + 1vw, 1.75rem); font-weight: 700; color: var(--tinta); line-height: 1.15; letter-spacing: -.02em; white-space: nowrap; }
.kpi small { font-size: .84rem; }
.kpi-ven span::before { background: var(--c-ven); }
.kpi-ali span::before { background: var(--c-ali); }
.kpi-mor span::before { background: var(--c-mor); }
.kpi-ok span::before { background: var(--bosque); }
.kpi-alerta { background: #fdf7ea; } .kpi-alerta span::before { background: var(--c-alerta); }
.total-venta { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; font-size: 1.05rem; font-weight: 700; color: var(--suave);
  margin: .3rem 0 .8rem; padding: .9rem 1.1rem; background: var(--agua); color: #cfe1e4; border-radius: 12px; position: relative; overflow: hidden; }
.total-venta::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--franja); }
.total-venta b { color: #fff; font-family: var(--t-titulo); font-size: 1.7rem; }

/* ---------- Tablas ---------- */
.tabla-cont { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; background: #fff; border-radius: var(--radio); border: 1px solid var(--borde); margin-bottom: 1.2rem; }
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
th, td { padding: .7rem .85rem; border-bottom: 1px solid #e8eeec; text-align: left; vertical-align: top; }
th { background: #f5f8f7; color: var(--suave); font-weight: 700; font-size: .84rem; white-space: nowrap; border-bottom-color: var(--borde); }
tbody tr:hover td { background: #f8fbfa; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 800; background: #f5f8f7; border-top: 1px solid var(--borde); border-bottom: 0; }
td b { color: var(--tinta); }
.num { text-align: right; white-space: nowrap; }
.vacio { text-align: center; color: var(--suave); padding: 1.8rem 1rem; }
tr.inactivo { opacity: .55; }
.rojo { color: var(--c-mor) !important; } .verde { color: var(--bosque) !important; } .gris { color: #9aaaa6; }
.etq { display: inline-block; font-size: .76rem; font-weight: 700; padding: .12rem .5rem; border-radius: 20px; background: #e6eeeb; color: var(--suave); }
.etq-ok { background: #dff0e6; color: var(--bosque); } .etq-alerta { background: #fbe1e7; color: var(--c-mor); }
.lista-simple { margin: 0; padding-left: 1.2rem; } .lista-simple li { margin-bottom: .35rem; }
.corta { word-break: break-all; }

/* ---------- Filtros ---------- */
.filtro { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: .9rem; }
.filtro label { display: flex; flex-direction: column; font-size: .84rem; font-weight: 700; color: var(--suave); gap: .2rem; flex: 1 1 140px; }
.atajos { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.atajos > a:not(.btn) { padding: .4rem .9rem; background: #fff; border: 1.5px solid var(--borde); border-radius: 20px; text-decoration: none; font-size: .9rem; font-weight: 700; color: var(--agua); }
.atajos > a:not(.btn):hover { border-color: var(--rosa); }

.dos-col { display: grid; grid-template-columns: 1fr; gap: 0 1.4rem; }
@media (min-width: 820px) { .dos-col { grid-template-columns: 1fr 1fr; } }
.grafico { position: relative; height: 270px; margin-bottom: 1.2rem; }
details summary { cursor: pointer; }

/* ---------- Inicio de trabajadores ---------- */
.botones-grandes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1.8rem; }
.bg { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 1rem; min-height: 128px; border-radius: 16px;
  color: #fff; text-decoration: none; font-family: var(--t-titulo); font-weight: 700; font-size: 1.15rem; line-height: 1.2; padding: 1rem 1.1rem; position: relative; overflow: hidden; }
.bg .ico { width: 34px; height: 34px; padding: 6px; border-radius: 10px; background: rgba(255,255,255,.18); box-sizing: content-box; }
.bg:active { transform: scale(.98); }
.bg-ali { background: var(--c-ali); } .bg-mor { background: var(--c-mor); } .bg-ven { background: var(--c-ven); }
.bg-mov { background: var(--agua-2); } .bg-mue { background: var(--bosque); }

/* ---------- Login ---------- */
.pantalla-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.2rem;
  background-color: var(--agua);
  background-image: radial-gradient(rgba(255,255,255,.06) 2px, transparent 2.5px), radial-gradient(rgba(255,255,255,.04) 1px, transparent 1.5px),
                    radial-gradient(ellipse at 20% 0%, #17677d 0%, transparent 60%), radial-gradient(ellipse at 90% 100%, #1f5a44 0%, transparent 55%);
  background-size: 42px 42px, 23px 23px, 100% 100%, 100% 100%; background-position: 0 0, 13px 9px, 0 0, 0 0; }
.caja-login { background: #fff; border-radius: 20px; padding: 2.2rem 1.7rem 1.8rem; width: 100%; max-width: 390px; box-shadow: 0 24px 60px rgba(0,0,0,.35); text-align: center; position: relative; overflow: hidden; }
.caja-login::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 7px; background: var(--franja); }
.caja-login form { text-align: left; }
.caja-login label { display: flex; flex-direction: column; gap: .3rem; font-weight: 700; color: var(--suave); margin-bottom: 1rem; font-size: .88rem; }
.caja-login .btn { width: 100%; margin-top: .3rem; }
.caja-login h1 { margin: .8rem 0 0; font-size: 1.55rem; }
.caja-login .sub { color: var(--suave); margin: .2rem 0 1.4rem; }
.logo-login { width: 150px; height: 150px; object-fit: contain; background: #fff; }

@media (max-width: 520px) {
  h1 { font-size: 1.5rem; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: .85rem .9rem; }
  .kpi b { font-size: 1.22rem; }
  .kpi:last-child:nth-child(odd) { grid-column: span 2; }
  .tarjeta { padding: 1.05rem; }
}

/* ---------- Ventas con varias pozas ---------- */
.filas-venta { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.fv-cab, .fila-venta { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr .9fr; gap: .55rem; align-items: center; }
.fv-cab { font-size: .82rem; color: var(--suave); font-weight: 700; padding: 0 .75rem; }
.fila-venta { padding: .6rem .7rem; background: var(--fondo); border-radius: 12px; border: 2px solid transparent; transition: border-color .15s, background .15s; }
.fila-venta.con-datos { border-color: var(--c-ven); background: #e8f5f1; }
.fila-venta label { margin: 0 !important; }
.fv-sub { text-align: right; font-weight: 800; font-family: var(--t-titulo); font-size: 1.05rem; }
.solo-movil { display: none; }
@media (max-width: 640px) {
  .fv-cab { display: none; }
  .fila-venta { grid-template-columns: 1fr 1fr 1fr; }
  .fila-venta .fp-nombre { grid-column: 1 / 3; }
  .fila-venta .fv-sub { grid-column: 3; grid-row: 1; }
  .solo-movil { display: block; font-size: .78rem; }
}
td.acciones { white-space: nowrap; }
td.acciones .btn, td.acciones form { margin: .1rem; }
details.tarjeta summary, form details summary { cursor: pointer; margin-bottom: .6rem; color: var(--agua); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .barra, .menu, .filtro, .atajos, .btn, .btn-borrar, form.inline { display: none !important; }
  .contenido { margin: 0 !important; padding: 0 !important; max-width: none; }
  body { background: #fff; font-size: 12px; }
  .tabla-cont, .kpis, .tarjeta { break-inside: avoid; }
}

/* Pantallas muy anchas: contenido a todo el ancho pero con lectura cómoda */
@media (min-width: 1700px) { .contenido > * { max-width: 1500px; } }
@media (min-width: 1000px) and (max-height: 760px) { .menu a { padding: .42rem .8rem; font-size: .93rem; } .menu-sep { margin-top: .5rem; } }
html, body { overflow-x: hidden; }

/* Tablas en celular: cada fila se vuelve una ficha */
@media (max-width: 640px) {
  table.fichas thead { display: none; }
  table.fichas, table.fichas tbody, table.fichas tfoot, table.fichas tr, table.fichas td { display: block; width: 100%; }
  table.fichas tr { padding: .7rem .9rem; border-bottom: 1px solid #e3ebe8; }
  table.fichas tbody tr:last-child { border-bottom: 0; }
  table.fichas td { border: 0; padding: .18rem 0; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; text-align: right; white-space: normal; }
  table.fichas td::before { content: attr(data-label); font-size: .82rem; font-weight: 700; color: var(--suave); text-align: left; flex-shrink: 0; }
  table.fichas td:first-child { display: block; text-align: left; font-size: 1.02rem; padding-bottom: .3rem; }
  table.fichas td:first-child::before { content: none; }
  table.fichas td[data-label=""]::before, table.fichas td:empty { display: none; }
  table.fichas td.vacio { display: block; text-align: center; }
  table.fichas td.vacio::before { content: none; }
  table.fichas td.acciones { justify-content: flex-end; flex-wrap: wrap; }
  table.fichas tfoot tr { background: #f5f8f7; }
  table.fichas tbody tr:hover td { background: none; }
}
