/* Ravague · paleta tomada de la fachada y el logo */
:root {
  --carbon: #26282A;      /* marco: barra lateral y encabezado */
  --guinda: #8A2A2B;      /* franja: separadores */
  --rojo: #E31E24;        /* acción principal */
  --rojo-osc: #B3191F;
  --azul: #1F3A9E;        /* información y enlaces */
  --celeste: #4FB3F0;     /* ayuda */
  --hueso: #F2F2EE;       /* fondo */
  --tinta: #1B1D1C;
  --tenue: #5D625F;
  --linea: #E1E2DC;
  --campo: #D5D6D0;
  --ok: #1E6B3F; --ok-bg: #E3F1E8;
  --warn: #8A4B00; --warn-bg: #FBEDE0;
  --err: #B3191F; --err-bg: #FDECEC;
  --info-bg: #E6ECFA;
  --radio: 10px;
  --titulo: "Barlow Condensed", "Arial Narrow", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-solo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Barlow, system-ui, sans-serif; color: var(--tinta); background: var(--hueso); font-size: 15px; line-height: 1.4; }
a { color: var(--azul); }
h1, h2, h3 { font-family: var(--titulo); margin: 0; line-height: 1.1; }
h1 { font-size: 32px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
small, .tenue { color: var(--tenue); }
.lbl { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--tenue); }

/* ---------- Estructura ---------- */
.app { display: flex; min-height: 100vh; }
.lateral { width: 250px; flex: none; background: var(--carbon); color: #D6D8D4; border-right: 4px solid var(--guinda);
  padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.marca { display: flex; align-items: center; gap: 10px; padding: 0 8px 12px; }
.marca img.r { width: 48px; } .marca img.w { width: 128px; }
.grupo { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #9EA39F; padding: 10px 12px 4px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: #D6D8D4; text-decoration: none; font-weight: 500; font-size: 14px; min-height: 36px; }
.nav:hover { background: #34373A; color: #fff; }
.nav.on { background: var(--rojo); color: #fff; }
.nav.pronto { opacity: .45; cursor: default; white-space: nowrap; }
.nav.pronto:hover { background: none; color: #D6D8D4; }
.nav svg { flex: none; }
.btn-ayuda { border: 1px solid var(--celeste); color: #fff; background: none; font: inherit; cursor: pointer; width: 100%; text-align: left; }
.pie-lateral { font-size: 12px; color: #9EA39F; padding: 8px 12px 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pie-lateral button { background: none; border: 0; color: #D6D8D4; font: inherit; cursor: pointer; text-decoration: underline; padding: 4px 0; }
.contenido { flex: 1; min-width: 0; padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 18px; }
.encabezado { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; }

/* Barra superior e inferior: solo teléfono */
.barra-movil, .nav-movil { display: none; }

/* ---------- Componentes ---------- */
.card { background: #fff; border: 1px solid var(--linea); border-radius: 12px; padding: 18px; }
.rejilla { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpi .valor { font-family: var(--titulo); font-size: 34px; font-weight: 700; margin-top: 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--campo); background: #fff; color: var(--tinta); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--tenue); }
.btn.primario { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.btn.primario:hover { background: var(--rojo-osc); }
.btn.secundario { border-color: var(--azul); color: var(--azul); }
.btn.chico { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.peligro { color: var(--err); border-color: #E7B3B5; }
form.en-linea { display: inline; }
label.campo { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--tenue); }
input, select, textarea { font: inherit; font-size: 15px; color: var(--tinta); border: 1px solid var(--campo); border-radius: 8px;
  padding: 0 12px; min-height: 44px; background: #fff; width: 100%; }
textarea { padding: 10px 12px; min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .nav:focus-visible { outline: 3px solid rgba(79,179,240,.6); outline-offset: 1px; }
input[type=checkbox] { width: 20px; min-height: 20px; height: 20px; accent-color: var(--rojo); padding: 0; }
.form-rejilla { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.busqueda { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.busqueda input[type=search] { flex: 1 1 260px; width: auto; }
.busqueda select { width: auto; }

.tabla-caja { overflow-x: auto; background: #fff; border: 1px solid var(--linea); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; background: #F6F6F3; color: var(--tenue); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid #ECEDE8; vertical-align: middle; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #ECEDE8; color: #3C403E; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }
.pill.info { background: var(--info-bg); color: var(--azul); }
.alerta { color: var(--err); font-weight: 700; }

.productos { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.producto { display: flex; flex-direction: column; gap: 6px; padding: 14px; }
.producto .foto { height: 96px; border-radius: 8px; background: #ECEDE8; display: flex; align-items: center; justify-content: center; color: #8A8F8B; font-size: 12px; overflow: hidden; }
.producto .foto img { width: 100%; height: 100%; object-fit: cover; }
.producto .nombre { font-weight: 600; line-height: 1.25; }
.producto .precio { font-size: 18px; font-weight: 700; }

.mensajes { display: flex; flex-direction: column; gap: 8px; }
.mensaje { border-radius: 10px; padding: 12px 14px; font-weight: 500; }
.mensaje.ok { background: var(--ok-bg); color: var(--ok); }
.mensaje.error { background: var(--err-bg); color: #8E1418; }
.vacio { text-align: center; padding: 32px 16px; color: var(--tenue); }

/* ---------- Ayuda (diálogo) ---------- */
dialog.ayuda { border: 0; border-radius: 18px; padding: 0; width: min(520px, 100vw); max-height: 92vh; }
dialog.ayuda::backdrop { background: rgba(20,21,20,.55); }
dialog.ayuda form, dialog.ayuda .hecho { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.tipos { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; }
.tipos label { border: 1px solid var(--campo); border-radius: 10px; min-height: 52px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 14px; cursor: pointer; padding: 4px; }
.tipos input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tipos input:checked + span { font-weight: 700; }
.tipos label:has(input:checked) { border: 2px solid var(--rojo); background: #FDECEC; color: #8E1418; }
.casilla { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #3C403E; font-weight: 400; }
.contexto { font-size: 12px; color: var(--tenue); background: #F6F6F3; border-radius: 8px; padding: 8px 10px; }


/* ---------- Iteraciones 2–5 ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--campo); background: #fff; color: var(--tinta); text-decoration: none; font-size: 14px; }
.chip.on { background: var(--carbon); border-color: var(--carbon); color: #fff; font-weight: 600; }
.lista-tarjetas { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.fila-cliente { display: flex; flex-direction: column; gap: 6px; padding: 14px; color: inherit; text-decoration: none; }
.fila-cliente:hover { border-color: var(--tenue); }
.nota-siguiente { font-size: 13px; background: #F6F6F3; border-radius: 8px; padding: 6px 10px; }
.nota-siguiente.vence { background: var(--warn-bg); color: var(--warn); }
.renglon { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid #ECEDE8; font-size: 14px; }
.btn.wa { background: #1E7A46; border-color: #1E7A46; color: #fff; }
.btn.grande { min-height: 54px; font-size: 18px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.aviso { background: var(--warn-bg); border-color: #F0CFAE; }
tfoot td { background: #FAFAF7; }
.pos { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.pos-productos { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.pos-ticket { flex: 1 1 340px; max-width: 420px; position: sticky; top: 16px; }
.ticket-caja { background: #fff; border: 1px solid var(--linea); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.ticket-lineas { display: flex; flex-direction: column; }
.ticket-linea { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid #ECEDE8; font-size: 14px; }
.ticket-totales { border-top: 2px solid var(--carbon); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.ticket-totales div { display: flex; justify-content: space-between; }
.ticket-totales .total { font-family: var(--titulo); font-size: 30px; font-weight: 700; }
.ticket-cobro { display: flex; flex-direction: column; gap: 10px; }
.ticket-estado { font-weight: 600; font-size: 15px; min-height: 20px; }
.ticket-estado.ok { color: var(--ok); } .ticket-estado.falta { color: var(--warn); } .ticket-estado.mal { color: var(--err); }
.kanban { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(220px, 1fr)); overflow-x: auto; }
.columna { background: #E7E8E3; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 220px; }
.tarjeta-pedido { display: flex; flex-direction: column; gap: 4px; padding: 12px; color: inherit; text-decoration: none; border-top: 3px solid var(--tenue); }
.tarjeta-pedido.nuevo { border-top-color: var(--rojo); } .tarjeta-pedido.en_ruta { border-top-color: var(--azul); } .tarjeta-pedido.entregado { border-top-color: var(--ok); }
.barra { background: #ECEDE8; border-radius: 999px; height: 8px; overflow: hidden; }
.barra > span { display: block; height: 100%; background: var(--azul); border-radius: 999px; }
.barra.llena > span { background: var(--rojo); }
.semana { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.parada { display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.parada.actual { border: 2px solid var(--rojo); }
.parada.hecha { opacity: .6; }
.grafica-barras { display: flex; align-items: flex-end; gap: 3px; height: 140px; border-bottom: 1px solid var(--campo); }
.grafica-barras span { flex: 1; background: var(--azul); border-radius: 3px 3px 0 0; min-height: 1px; }
.grafica-barras span.hoy { background: var(--rojo); }
.embudo div { display: flex; align-items: center; gap: 10px; font-size: 14px; margin-top: 8px; }
.embudo .eti { width: 150px; flex: none; }
.embudo .bar { flex: 1; background: #ECEDE8; border-radius: 4px; height: 24px; overflow: hidden; }
.embudo .bar span { display: block; height: 100%; background: var(--azul); }
@media (max-width: 900px) {
  .pos-ticket { position: static; max-width: none; }
  .kanban { grid-template-columns: repeat(4, 82vw); }
  .embudo .eti { width: 110px; }
}

/* ---------- Link de pedidos (público) ---------- */
.pub-barra { position: sticky; top: 0; z-index: 10; background: var(--carbon); border-bottom: 3px solid var(--guinda); display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; }
.pub-marca { display: flex; align-items: center; gap: 10px; } .pub-marca img { width: 44px; } .pub-marca img.w { width: 150px; }
.pub-carrito { display: flex; align-items: center; gap: 6px; color: #fff; text-decoration: none; font-weight: 700; border: 2px solid var(--rojo); border-radius: 999px; padding: 6px 14px; min-height: 44px; }
.pub-cliente { background: var(--info-bg); color: var(--azul); padding: 8px 18px; font-size: 14px; }
.pub-contenido { max-width: 1200px; margin: 0 auto; padding: 20px 18px 40px; display: flex; flex-direction: column; gap: 16px; }
.pub-hero h1 { font-size: 34px; } .pub-hero p { margin: 6px 0 0; color: var(--tenue); }
.pub-layout { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.pub-lateral { flex: 1 1 320px; max-width: 400px; position: sticky; top: 84px; }
.pub-pie { text-align: center; color: var(--tenue); font-size: 13px; padding: 20px; }
.opcion { display: flex; gap: 10px; align-items: center; border: 1px solid var(--campo); border-radius: 10px; padding: 12px 14px; cursor: pointer; background: #fff; }
.opcion input { width: 20px; min-height: 20px; height: 20px; flex: none; accent-color: var(--rojo); }
.opcion:has(input:checked) { border: 2px solid var(--rojo); background: #FFF6F6; }
@media (max-width: 900px) { .pub-lateral { position: static; max-width: none; } .pub-marca img.w { width: 110px; } .pub-hero h1 { font-size: 28px; } }

/* ---------- Teléfono ---------- */
@media (max-width: 900px) {
  .lateral { position: fixed; z-index: 30; left: 0; top: 0; transform: translateX(-110%); transition: transform .2s; height: 100%; }
  .app.menu-abierto .lateral { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .barra-movil { display: flex; position: sticky; top: 0; z-index: 20; background: var(--carbon); color: #fff; align-items: center;
    gap: 10px; padding: 10px 14px; border-bottom: 3px solid var(--guinda); }
  .barra-movil img { width: 36px; }
  .barra-movil .titulo { flex: 1; font-family: var(--titulo); font-size: 21px; font-weight: 700; }
  .circulo-ayuda { width: 44px; height: 44px; border-radius: 999px; border: 2px solid var(--celeste); background: none; color: #fff; font-weight: 700; font-size: 18px; }
  .nav-movil { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; height: 64px; background: #fff; border-top: 1px solid var(--linea); padding-bottom: env(safe-area-inset-bottom); }
  .nav-movil a, .nav-movil button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; font: inherit; font-size: 11px; font-weight: 600; color: var(--tenue); background: none; border: 0; }
  .nav-movil .on { color: var(--rojo); }
  .app { flex-direction: column; }
  .contenido { padding: 16px 14px 88px; }
  h1 { font-size: 26px; }
  .rejilla.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .valor { font-size: 28px; }
  td.producto-col { min-width: 170px; }
  dialog.ayuda { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; }
}
