/* S2 Fit · Panel de administración */
:root {
  --negro: #000000; --vino: #582222; --beige: #e8dcc8; --hueso: #f5f4ef; --blanco: #ffffff;
  --suave: #5f5a55; --linea: #e2dccf; --verde: #2f6b45; --rojo: #9b2c2c; --amarillo: #8a6a12;
  --titulos: "Bookman Old Style", "Libre Baskerville", Georgia, serif;
  --textos: Calibri, "Carlito", "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--hueso); color: var(--negro); font-family: var(--textos); font-size: 16px; line-height: 1.45; }
h1, h2, h3 { font-family: var(--titulos); font-weight: 400; margin: 0; line-height: 1.2; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--vino); outline-offset: 2px; }
.suave { color: var(--suave); }
.error { color: var(--rojo); min-height: 1.2em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 999px; padding: 10px 20px; font-weight: 700; text-decoration: none; }
.btn-negro { background: var(--negro); color: var(--blanco); }
.btn-negro:hover { background: var(--vino); }
.btn-borde { background: var(--blanco); border-color: #cfc7b9; }
.btn-borde:hover { border-color: var(--negro); }
.btn-chico { padding: 6px 14px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.enlace { background: none; border: 0; padding: 0; text-decoration: underline; color: var(--suave); font-size: 15px; }
.enlace:hover { color: var(--negro); }
.peligro { color: var(--rojo); }

/* Entrada */
.entrada { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.entrada-caja { width: min(400px, 100%); background: var(--blanco); border-radius: 8px; padding: 36px 30px; display: grid; gap: 16px; text-align: center; }
.entrada-caja img { margin: 0 auto; }
.entrada-caja h1 { font-size: 28px; }
.entrada-caja .campo { text-align: left; }

/* Campos */
.campo { display: grid; gap: 4px; }
.campo label, .campo > span { font-weight: 700; font-size: 14px; }
.campo input, .campo select, .campo textarea { width: 100%; border: 1px solid #d6cfc2; border-radius: 6px; padding: 9px 11px; background: var(--blanco); }
.campo textarea { min-height: 84px; resize: vertical; }
.campo small { color: var(--suave); font-size: 13px; }
.rejilla-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* Cabecera del panel */
.panel-cab { position: sticky; top: 0; z-index: 10; background: var(--blanco); border-bottom: 1px solid var(--linea); display: flex; align-items: center; gap: 24px; padding: 0 24px; min-height: 64px; flex-wrap: wrap; }
.pestanas { display: flex; gap: 4px; margin-right: auto; overflow-x: auto; }
.pestanas button { background: none; border: 0; padding: 20px 12px 18px; border-bottom: 3px solid transparent; font-weight: 700; color: var(--suave); white-space: nowrap; }
.pestanas button[aria-current="page"] { color: var(--negro); border-color: var(--vino); }
.globo { background: var(--vino); color: var(--blanco); border-radius: 999px; font-size: 12px; padding: 1px 7px; margin-left: 4px; }
.panel-acciones { display: flex; gap: 18px; }
.demo { background: var(--beige); padding: 10px 24px; font-size: 15px; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.contenido { width: min(1240px, 100% - 32px); margin: 28px auto 80px; display: grid; gap: 28px; }
.seccion-cab { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.seccion-cab h1 { font-size: 30px; }
.tarjeta { background: var(--blanco); border: 1px solid var(--linea); border-radius: 8px; padding: 22px; display: grid; gap: 16px; }
.tarjeta h2 { font-size: 21px; }

/* Pedidos */
.filtros { display: flex; gap: 6px; flex-wrap: wrap; }
.filtro { border: 1px solid var(--linea); background: var(--blanco); border-radius: 999px; padding: 6px 14px; font-size: 15px; }
.filtro[aria-pressed="true"] { background: var(--negro); color: var(--blanco); border-color: var(--negro); }
.pedido { background: var(--blanco); border: 1px solid var(--linea); border-left: 5px solid #cfc7b9; border-radius: 8px; padding: 18px 20px; display: grid; grid-template-columns: 1.1fr 1.3fr auto; gap: 18px; align-items: start; }
.pedido.confirmado { border-left-color: var(--verde); }
.pedido.rechazado { border-left-color: var(--rojo); opacity: .8; }
.pedido.pendiente { border-left-color: #c9a227; }
.pedido h3 { font-size: 20px; }
.pedido ul { margin: 0; padding-left: 18px; }
.pedido .total { font-weight: 700; font-size: 18px; }
.estado { display: inline-block; font-size: 13px; font-weight: 700; border-radius: 999px; padding: 2px 10px; }
.estado.pendiente { background: #f6ecc8; color: var(--amarillo); }
.estado.confirmado { background: #dcefe2; color: var(--verde); }
.estado.rechazado { background: #f5dcdc; color: var(--rojo); }
.pedido-botones { display: grid; gap: 8px; min-width: 170px; }
.btn-ok { background: var(--verde); color: var(--blanco); }
.btn-no { background: var(--blanco); border-color: var(--rojo); color: var(--rojo); }
.vacio { text-align: center; color: var(--suave); padding: 40px 16px; background: var(--blanco); border: 1px dashed var(--linea); border-radius: 8px; }

/* Inventario */
.productos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.prod { background: var(--blanco); border: 1px solid var(--linea); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; text-align: left; padding: 0; }
.prod:hover { border-color: var(--negro); }
.prod-foto { aspect-ratio: 4 / 5; background: #ebebed; display: grid; place-items: center; }
.prod-foto img { width: 100%; height: 100%; object-fit: cover; }
.prod-foto .logo-vacio { width: 30%; opacity: .2; height: auto; object-fit: contain; }
.prod-info { padding: 12px 14px 14px; display: grid; gap: 4px; }
.prod-info h3 { font-size: 18px; }
.prod-info .fila { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.inactivo { opacity: .55; }
.chip { font-size: 12px; background: var(--hueso); border-radius: 999px; padding: 1px 8px; }

/* Descuentos */
.prod { position: relative; }
.prod.marcado { border-color: var(--vino); box-shadow: 0 0 0 2px var(--vino); }
.check-prod { position: absolute; top: 10px; left: 10px; z-index: 1; width: 28px; height: 28px; border-radius: 6px; background: var(--blanco); border: 2px solid var(--vino); color: var(--vino); display: grid; place-items: center; font-weight: 700; }
.prod.marcado .check-prod { background: var(--vino); color: var(--blanco); }
.barra-desc { position: sticky; top: 64px; z-index: 5; }

/* Tablas tipo Excel */
.tabla-scroll { overflow-x: auto; border: 1px solid var(--linea); border-radius: 8px; background: var(--blanco); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--linea); text-align: right; white-space: nowrap; }
th { background: var(--hueso); font-weight: 700; position: sticky; top: 0; }
th:first-child, td:first-child { text-align: left; }
tfoot td { font-weight: 700; background: var(--hueso); }
td input { width: 110px; text-align: right; border: 1px solid transparent; border-radius: 4px; padding: 4px 6px; background: #fbfaf6; }
td input:hover, td input:focus { border-color: #cfc7b9; background: var(--blanco); }
.num-neg { color: var(--rojo); }

/* Finanzas */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: var(--blanco); border: 1px solid var(--linea); border-radius: 8px; padding: 16px; display: grid; gap: 4px; }
.kpi span { color: var(--suave); font-size: 14px; }
.kpi strong { font-family: var(--titulos); font-weight: 400; font-size: 24px; }
.kpi.destacado { background: var(--vino); color: var(--blanco); border-color: var(--vino); }
.kpi.destacado span { color: #e8d6d0; }
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-linea { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.form-linea .campo { flex: 1 1 140px; }

/* Bolsillos */
.bolsillos { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.bolsillo { border: 1px solid var(--linea); border-radius: 8px; padding: 16px; display: grid; gap: 2px; background: var(--hueso); }
.bolsillo-nombre { font-weight: 700; }
.bolsillo-nombre small { font-weight: 400; color: var(--suave); }
.bolsillo strong { font-family: var(--titulos); font-weight: 400; font-size: 26px; margin-top: 6px; }
.bolsillo-mov { display: flex; justify-content: space-between; font-size: 14px; color: var(--suave); border-top: 1px solid var(--linea); padding-top: 6px; margin-top: 6px; }
.bolsillo-mov + .bolsillo-mov { border-top: 0; padding-top: 0; margin-top: 2px; }
.config summary { cursor: pointer; font-weight: 700; }
.config[open] { display: grid; gap: 12px; }
table.excel tr.grupo td { background: var(--beige); font-weight: 700; text-align: left; }
table.excel td:first-child { white-space: normal; min-width: 300px; }
td input.celda-nombre { width: calc(100% - 4px); text-align: left; max-width: 340px; }
td input.celda-corta { width: 64px; }
table.excel td input { background: var(--blanco); border-color: #e2dccf; }
table.excel td.acciones { white-space: nowrap; }
.venta-directa { background: var(--hueso); border-radius: 8px; padding: 12px; }

/* Editor lateral */
.velo { position: fixed; inset: 0; background: rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; }
.velo.abierto { opacity: 1; pointer-events: auto; }
.editor { position: fixed; top: 0; right: 0; height: 100%; width: min(620px, 100%); background: var(--hueso); z-index: 40; transform: translateX(100%); transition: transform .25s; display: flex; flex-direction: column; }
.editor.abierto { transform: none; }
.editor-cab { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--linea); background: var(--blanco); }
.editor-cab h2 { font-size: 24px; }
.editor-cuerpo { flex: 1; overflow: auto; padding: 20px 22px 40px; display: grid; gap: 18px; align-content: start; }
.cerrar { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--hueso); font-size: 22px; line-height: 1; }
.color-caja { background: var(--blanco); border: 1px solid var(--linea); border-radius: 8px; padding: 14px; display: grid; gap: 12px; }
.color-fila { display: grid; grid-template-columns: 1.4fr 60px 100px auto; gap: 10px; align-items: end; }
.color-fila input[type="color"] { height: 40px; padding: 2px; }
.fotos { display: flex; gap: 8px; flex-wrap: wrap; }
.foto { position: relative; width: 82px; height: 102px; border-radius: 4px; overflow: hidden; background: #ebebed; }
.foto img { width: 100%; height: 100%; object-fit: cover; }
.foto button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: var(--blanco); line-height: 1; font-size: 15px; }
.subir { width: 82px; height: 102px; border: 1.5px dashed #bfb6a6; border-radius: 4px; display: grid; place-items: center; text-align: center; font-size: 13px; color: var(--suave); cursor: pointer; padding: 6px; }
.subir:hover { border-color: var(--negro); color: var(--negro); }
.subir input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.interruptor { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 15px; }
.interruptor input { width: 18px; height: 18px; accent-color: var(--vino); }
.barra-guardar { position: sticky; bottom: -40px; background: var(--hueso); padding: 14px 0 0; display: flex; gap: 12px; justify-content: space-between; align-items: center; }

.aviso { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 14px); background: var(--negro); color: var(--blanco); padding: 11px 20px; border-radius: 999px; z-index: 60; opacity: 0; transition: .2s; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
.aviso.ver { opacity: 1; transform: translate(-50%, 0); }
.aviso.mal { background: var(--rojo); }

@media (max-width: 820px) {
  .panel-cab { padding: 0 12px; gap: 10px; }
  .pestanas { order: 3; width: 100%; }
  .panel-acciones { margin-left: auto; }
  .pedido { grid-template-columns: 1fr; }
  .dos-col { grid-template-columns: 1fr; }
  .color-fila { grid-template-columns: 1fr 56px 90px; }
  .color-fila .enlace { grid-column: 1 / -1; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
