*{box-sizing:border-box}body{margin:0;font-family:system-ui,Arial;background:#f4f6f8;color:#1d2733}.login{min-height:100vh;display:grid;place-items:center}.card{background:white;padding:30px;border-radius:14px;box-shadow:0 8px 30px #0001;width:min(400px,92%)}input,select,textarea,button{width:100%;padding:11px;margin:6px 0;border:1px solid #ccd4dc;border-radius:8px}button{cursor:pointer;background:#1f2937;color:white;border:0}.app header{background:#111827;color:white;padding:18px 5%;display:flex;justify-content:space-between}.app header a{color:white}.app nav{display:flex;gap:8px;padding:12px 5%;background:white;overflow:auto}.app nav button{width:auto;margin:0}.app main{padding:24px 5%}.hidden{display:none!important}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:12px}.box{background:white;padding:16px;border-radius:12px;border:1px solid #e3e7eb}.low{border-left:5px solid #d33}.ok{border-left:5px solid #3a6}.table{width:100%;border-collapse:collapse;background:white}.table td,.table th{padding:10px;border-bottom:1px solid #eee;text-align:left}small{color:#b42318}/* Buscador de productos */
.toolbar {
    margin-bottom: 16px;
}

.toolbar input {
    width: 100%;
    max-width: 500px;
    font-size: 16px;
    padding: 13px 15px;
    background: white;
}

/* Estados de stock */
.stock-ok {
    color: #18794e;
    font-weight: 600;
}

.stock-bajo {
    color: #b54708;
    font-weight: 600;
}

.stock-agotado {
    color: #b42318;
    font-weight: 600;
}

/* Tabla más cómoda */
.table th {
    background: #f8fafc;
    font-weight: 600;
}

.table tr:hover {
    background: #f8fafc;
}

.table td,
.table th {
    padding: 12px;
}
/* =========================================================
AUTOCOMPLETADO DE PERSONAS
========================================================= */

.persona-autocomplete {
    position: relative;
}

.persona-sugerencias {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;

    background: white;
    border: 1px solid #ccc;
    border-radius: 6px;

    margin-top: 4px;

    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);

    max-height: 250px;
    overflow-y: auto;
}

.persona-sugerencia {
    display: block;
    width: 100%;

    padding: 10px 12px;

    border: 0;
    border-bottom: 1px solid #eee;

    background: white;

    text-align: left;

    cursor: pointer;

    font-size: 14px;
}

.persona-sugerencia:hover {
    background: #f2f2f2;
}

.persona-sugerencia small {
    display: block;
    margin-top: 3px;
    color: #777;
}

.persona-nueva {
    font-weight: normal;
    border-top: 1px solid #ddd;
}

.persona-sugerencia {
    color: #1d2733;
}

.persona-sugerencia mark {
    background: #fff3b0;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.persona-sugerencia.activa {
    background: #eef2f6;
}

.persona-sugerencia {
    background: #1f2937;
    color: #ffffff;
    border-bottom: 1px solid #2d3947;
}

.persona-sugerencia:hover {
    background: #2d3947;
}

.persona-sugerencia.activa {
    background: #374151;
}

.persona-sugerencia mark {
    background: #fbbf24;
    color: #1f2937;
}

.persona-sugerencia {
    background: #374151;
    color: #ffffff;
    border-bottom: 1px solid #4b5563;
}

.persona-sugerencia:hover {
    background: #4b5563;
}

.persona-sugerencia.activa {
    background: #6b7280;
}

.persona-sugerencia mark {
    background: #fefce8;
    color: #1f2937;
}

.categoria-grupo {
    margin-bottom: 24px;
}

.categoria-titulo {
    margin: 0 0 10px;
    padding: 8px 12px;
    background: #eef2f6;
    border-left: 5px solid #1f2937;
    border-radius: 6px;
    font-size: 15px;
}

details.categoria-nueva-box,
details.producto-nuevo-box {
    background: white;
    border: 1px solid #e3e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

details.categoria-nueva-box summary,
details.producto-nuevo-box summary {
    cursor: pointer;
    font-weight: 600;
}

/* ===== Registro de entregas ===== */
.reg-filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 16px; align-items: end; margin-bottom: 16px; }
.reg-filtros label { display: block; margin-bottom: 4px; font-size: .9rem; }
.reg-filtros input { width: 100%; box-sizing: border-box; }
.reg-acciones { display: flex; gap: 8px; }
.reg-acciones button, .reg-paginado button { width: auto; padding: 10px 18px; }
.reg-secundario { background: #fff; color: #1e293b; border: 1px solid #cbd5e1; }
.reg-secundario:disabled { opacity: .5; cursor: default; }
.reg-resumen { margin: 8px 0; color: #475569; font-size: .95rem; }
.reg-tabla-wrap { overflow-x: auto; background: #fff; border-radius: 8px; }
.reg-tabla { width: 100%; border-collapse: collapse; }
.reg-tabla th, .reg-tabla td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #e5e7eb; }
.reg-tabla th { background: #f8fafc; font-weight: 600; }
.reg-tabla th.num, .reg-tabla td.num { text-align: right; }
.reg-vacio { padding: 24px; text-align: center; color: #64748b; background: #fff; border-radius: 8px; }
.reg-paginado { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* ===== Registro: detalle / comprobante ===== */
#registro.reg-modo-detalle > *:not(#registroDetalle) { display: none; }
#registro:not(.reg-modo-detalle) #registroDetalle { display: none; }

.reg-fila { cursor: pointer; }
.reg-fila:hover td { background: #f1f5f9; }
.reg-ver { width: auto; padding: 6px 16px; }
.reg-barra { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 16px; }
.reg-barra button { width: auto; padding: 10px 18px; }

.comprobante { background: #fff; color: #111; max-width: 820px; margin: 0 auto; padding: 32px 36px; border: 1px solid #cbd5e1; border-radius: 6px; }
.comp-cabecera { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 16px; border-bottom: 2px solid #111; }
.comp-titulo { font-size: 1.5rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.comp-sub { color: #475569; margin-top: 4px; }
.comp-ident { text-align: right; line-height: 1.7; }
.comp-ident span, .comp-datos span { color: #64748b; font-size: .85rem; margin-right: 6px; }
.comp-bloque { margin-top: 24px; }
.comp-bloque h3 { margin: 0 0 8px; font-size: .95rem; text-transform: uppercase; letter-spacing: .5px; color: #334155; border-bottom: 1px solid #cbd5e1; padding-bottom: 4px; }
.comp-datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 24px; }
.comp-datos div { display: flex; flex-direction: column; }
.comp-tabla { width: 100%; border-collapse: collapse; }
.comp-tabla th, .comp-tabla td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #e2e8f0; }
.comp-tabla th { background: #f1f5f9; font-size: .85rem; text-transform: uppercase; }
.comp-tabla th.num, .comp-tabla td.num { text-align: right; }
.comp-tabla tfoot td { font-weight: 700; border-top: 2px solid #111; border-bottom: none; }
.comp-obs { white-space: pre-wrap; margin: 0; }
.comp-firmas { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 72px; text-align: center; }
.comp-firmas .linea { border-top: 1px solid #111; margin-bottom: 6px; }
.comp-firmas small { color: #64748b; }
.comp-pie { margin-top: 32px; font-size: .8rem; color: #64748b; text-align: right; }

@media print {
  body * { visibility: hidden; }
  #registroDetalle, #registroDetalle * { visibility: visible; }
  .no-print, .no-print * { visibility: hidden !important; display: none !important; }
  #registroDetalle { position: absolute; left: 0; top: 0; width: 100%; }
  .comprobante { border: none; max-width: none; padding: 0; }
  @page { size: A4; margin: 15mm; }
}

/* ===== Lista de entradas ===== */
.ent-lista { margin-top: 40px; padding-top: 24px; border-top: 1px solid #cbd5e1; }
.ent-lista h3 { margin: 0 0 16px; }
.ent-lista select { width: 100%; box-sizing: border-box; }

/* ===== Planilla imprimible de entradas ===== */
#entImpresion { display: none; }
.planilla .comp-tabla thead { display: table-header-group; }
.planilla .comp-tabla tr { break-inside: avoid; }

@media print {
  body.imprimiendo-entradas main > section { display: none !important; }
  body.imprimiendo-entradas #entImpresion { display: block; position: absolute; left: 0; top: 0; width: 100%; }
  body.imprimiendo-entradas #entImpresion,
  body.imprimiendo-entradas #entImpresion * { visibility: visible; }
}

/* Productos: filtros por categoria en fila (2026-09-30) */
#peChips{display:flex!important;flex-wrap:wrap;gap:8px;margin:12px 0 18px}
#peChips button{width:auto!important;margin:0!important;padding:6px 16px!important;white-space:nowrap}

/* Productos: hover de chips legible (hover-chips, 2026-09-30) */
#peChips .pe-chip:hover:not(:disabled){background:#eef3f6;color:#1f2937;border-color:#1b3a4b}
#peChips .pe-chip.activo:hover:not(:disabled){background:#1b3a4b;color:#fff;border-color:#1b3a4b}

/* =========================================================
DASHBOARD PROFESIONAL - STOCK
========================================================= */

.dashboard-resumen {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 0 0 24px 0;
}

.dashboard-card {
    background: white;
    border: 1px solid #e3e7eb;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 2px 8px #00000008;
}

.dashboard-card-label {
    display: block;
    color: #667085;
    font-size: 13px;
    margin-bottom: 8px;
}

.dashboard-card strong {
    display: block;
    font-size: 28px;
    line-height: 1.1;
    color: #1d2733;
}

.dashboard-stock {
    background: white;
    border: 1px solid #e3e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 8px #00000008;
    overflow: hidden;
}

.dashboard-stock-header {
    padding: 20px 22px;
    border-bottom: 1px solid #e3e7eb;
}

.dashboard-stock-header h3 {
    margin: 0 0 4px 0;
    font-size: 20px;
}

.dashboard-stock-header p {
    margin: 0;
    color: #667085;
    font-size: 14px;
}

.table-container {
    width: 100%;
    overflow-x: auto;
}

.stock-dashboard-table {
    min-width: 760px;
}

.stock-dashboard-table th {
    white-space: nowrap;
}

.stock-dashboard-table td:nth-child(3),
.stock-dashboard-table td:nth-child(4),
.stock-dashboard-table th:nth-child(3),
.stock-dashboard-table th:nth-child(4) {
    text-align: right;
}

.stock-dashboard-table td:nth-child(5),
.stock-dashboard-table td:nth-child(6),
.stock-dashboard-table th:nth-child(5),
.stock-dashboard-table th:nth-child(6) {
    text-align: center;
}

@media (max-width: 900px) {

    .dashboard-resumen {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 520px) {

    .dashboard-resumen {
        grid-template-columns: 1fr;
    }

}

/* =========================================================
FILTROS DEL DASHBOARD DE STOCK
========================================================= */

.dashboard-stock-filtros {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 16px;
}

.dashboard-stock-filtros input,
.dashboard-stock-filtros select {
    width: auto;
    margin: 0;
    background: white;
}

.dashboard-stock-filtros input {
    flex: 1;
    min-width: 240px;
}

.dashboard-stock-filtros select {
    min-width: 210px;
}

.stock-dashboard-sin-resultados {
    padding: 28px 20px;
    text-align: center;
    color: #667085;
    background: white;
    border-top: 1px solid #e3e7eb;
}

@media (max-width: 700px) {

    .dashboard-stock-filtros {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-stock-filtros input,
    .dashboard-stock-filtros select {
        width: 100%;
        min-width: 0;
    }

}

/* Filas del stock coloreadas por estado */
table tbody tr.fila-stock-bajo td { background: #fff1e0; }
table tbody tr.fila-stock-agotado td { background: #f6b3b3; }
table tbody tr.fila-stock-bajo:hover td { background: #ffe5c7; }
table tbody tr.fila-stock-agotado:hover td { background: #f19a9a; }

/* Programa Celiacos: tabla de beneficiarios (solo presentacion) */
#celiacosContent table { width: 100% !important; table-layout: fixed !important; border-collapse: collapse !important; }
#celiacosContent table th,
#celiacosContent table td { text-align: center !important; vertical-align: middle !important; }
#celiacosContent table tbody tr td { padding: 12px 6px !important; border-bottom: 1px solid #dbe2e8 !important; }
#celiacosContent table tbody tr:hover td { background: #eef4f8; }
#celiacosContent table tr > :nth-child(1) { width: 6% !important; }
#celiacosContent table tr > :nth-child(2) { width: 17% !important; }
#celiacosContent table tr > :nth-child(3) { width: 10% !important; }
#celiacosContent table tr > :nth-child(4) { width: 11% !important; }
#celiacosContent table tr > :nth-child(5) { width: 10% !important; }
#celiacosContent table tr > :nth-child(6) { width: 10% !important; }
#celiacosContent table tr > :nth-child(7) { width: 7% !important; }
#celiacosContent table tr > :nth-child(8) { width: 9% !important; }
#celiacosContent table tr > :nth-child(9) { width: 20% !important; }
#celiacosContent table td:last-child > div {
  display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 6px !important; padding: 8px !important; min-width: 0;
  border: 1px solid #dbe2e8; border-radius: 10px; background: #f8fafc;
}
#celiacosContent table td:last-child button { padding: 7px 4px !important; }
#celiacosContent table td:last-child button[data-cel-entrega],
#celiacosContent table td:last-child button[data-cel-ver-entrega],
#celiacosContent table td:last-child button[data-cel-anular] { grid-column: 1 / -1; }

/* === Dashboard: detalle de vencimientos por producto === */
table.stock-dashboard-table tbody tr[data-producto-id] { cursor: pointer; }
table.stock-dashboard-table tbody tr[data-producto-id]:focus-visible { outline: 2px solid #1f5f7a; outline-offset: -2px; }
table.stock-dashboard-table tbody tr[data-producto-id] > td:first-child::before {
  content: "\203A"; display: inline-block; width: 1em; margin-right: 6px;
  color: #6b7785; font-weight: 700; transition: transform .15s ease;
}
table.stock-dashboard-table tbody tr[data-producto-id].abierta > td:first-child::before { transform: rotate(90deg); color: #1f5f7a; }
table.stock-dashboard-table tbody tr.venc-detalle-fila > td { padding: 0; background: #f7f9fb; }
table.stock-dashboard-table tbody tr.venc-detalle-fila:hover > td { background: #f7f9fb; }
.venc-panel { padding: 16px 20px 18px 38px; border-left: 3px solid #1f5f7a; animation: venc-in .15s ease-out; }
.venc-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.venc-panel-titulo { font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #52606d; }
.venc-panel-total { font-size: .85rem; color: #52606d; }
.venc-panel-total strong { color: #1d2b36; }
.venc-tabla-wrap { overflow-x: auto; }
.venc-tabla { width: 100%; max-width: 520px; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid #e3e7eb; border-radius: 10px; overflow: hidden; }
.venc-tabla th, .venc-tabla td { padding: 9px 14px; font-size: .9rem; text-align: left; border-bottom: 1px solid #eef1f4; background: #fff; }
.venc-tabla th { font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #6b7785; background: #fafbfc; }
.venc-tabla tbody tr:last-child td { border-bottom: 0; }
.venc-tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.venc-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.venc-ok { background: #e7f6ee; color: #18794e; }
.venc-pronto { background: #fff1e0; color: #b54708; }
.venc-vencido { background: #fde4e4; color: #b42318; }
.venc-neutro { background: #eef1f4; color: #52606d; }
.venc-msg { font-size: .9rem; color: #52606d; }
.venc-error { color: #b42318; }
@keyframes venc-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .venc-panel { animation: none; } table.stock-dashboard-table tbody tr[data-producto-id] > td:first-child::before { transition: none; } }
@media (max-width: 600px) { .venc-panel { padding-left: 16px; } }
@media print { table.stock-dashboard-table tbody tr.venc-detalle-fila { display: none; } table.stock-dashboard-table tbody tr[data-producto-id] > td:first-child::before { content: none; } }
