:root {
  --primario: #dc2626;
  --primario-osc: #b91c1c;
  --acento: #ef4444;
  --fondo: #fef2f2;
  --tarjeta: #ffffff;
  --texto: #1c1917;
  --texto-suave: #78716c;
  --borde: #fecaca;
  --ok: #16a34a;
  --ok-fondo: #dcfce7;
  --info-fondo: #e0f2fe;
  --info: #0369a1;
  --peligro: #dc2626;
  --radio: 14px;
  --sombra: 0 1px 3px rgba(28, 25, 23, 0.1), 0 4px 12px rgba(28, 25, 23, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.45;
}

a { color: var(--primario); text-decoration: none; }
a:hover { text-decoration: underline; }

.contenedor { max-width: 760px; margin: 0 auto; padding: 16px; }
.contenedor-ancho { max-width: 1000px; margin: 0 auto; padding: 16px; }

/* ---------- Encabezado ---------- */
.cabecera {
  background: linear-gradient(135deg, #dc2626, #ea580c);
  color: #fff;
  padding: 18px 16px;
  text-align: center;
}
.cabecera h1 { font-size: 1.4rem; margin-bottom: 4px; }
.cabecera .sub { opacity: 0.95; font-size: 0.9rem; }
.cabecera .meta { margin-top: 8px; font-size: 0.82rem; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.cabecera .meta span { background: rgba(255,255,255,0.18); padding: 3px 10px; border-radius: 999px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--primario);
  color: #fff;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--primario-osc); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-secundario { background: #e7e5e4; color: var(--texto); }
.btn-secundario:hover { background: #d6d3d1; }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #15803d; }
.btn-info { background: var(--info); }
.btn-info:hover { background: #075985; }
.btn-peligro { background: var(--peligro); }
.btn-peligro:hover { background: #b91c1c; }
.btn-mini { padding: 6px 10px; font-size: 0.8rem; border-radius: 8px; }

/* ---------- Tarjetas ---------- */
.tarjeta {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 14px;
  margin-bottom: 14px;
}

/* ---------- Menú ---------- */
.pestanas { display: flex; gap: 8px; overflow-x: auto; padding: 14px 16px 4px; }
.pestana {
  border: 1px solid var(--borde);
  background: #fff;
  color: var(--texto);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.pestana.activa { background: var(--primario); border-color: var(--primario); color: #fff; }

.item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: var(--sombra);
}
.item .img {
  width: 76px; height: 76px;
  border-radius: 10px;
  background: #fecaca;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
.item .info { flex: 1; min-width: 0; }
.item .info h3 { font-size: 1rem; }
.item .info p { color: var(--texto-suave); font-size: 0.84rem; margin: 2px 0 6px; }
.item .precio { font-weight: 700; color: var(--primario); }
.item .control { display: flex; align-items: center; gap: 8px; }
.item .control .cant { font-weight: 700; min-width: 24px; text-align: center; }
.boton-circ {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--primario);
  background: #fff;
  color: var(--primario);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Barra flotante del carrito */
.barra-carrito {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #1c1917;
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 50;
}
.barra-carrito .info-cant { font-weight: 700; }
.barra-carrito .total { color: #fca5a5; font-weight: 700; }
body.con-carrito { padding-bottom: 64px; }

/* ---------- Formularios ---------- */
.campo { margin-bottom: 12px; }
.campo label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; color: var(--texto); }
.campo input, .campo select, .campo textarea {
  width: 100%;
  border: 1px solid #d6d3d1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
}
.campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: 2px solid var(--acento);
  border-color: var(--acento);
}
.campo textarea { min-height: 70px; resize: vertical; }

.fila { display: flex; gap: 10px; }
.fila .campo { flex: 1; }

/* Métodos de pago */
.pago-opcion {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 2px solid #d6d3d1;
  border-radius: var(--radio);
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  background: #fff;
}
.pago-opcion.seleccionada { border-color: var(--primario); background: #fef2f2; }
.pago-opcion .radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #d6d3d1; flex-shrink: 0; }
.pago-opcion.seleccionada .radio { border-color: var(--primario); background: var(--primario); box-shadow: inset 0 0 0 3px #fff; }
.pago-opcion .etiqueta { flex: 1; }
.pago-opcion .etiqueta b { display: block; }
.pago-opcion .etiqueta small { color: var(--texto-suave); }

.qr-caja { text-align: center; }
.qr-caja img { max-width: 220px; width: 100%; border-radius: 10px; border: 1px solid var(--borde); }

/* ---------- Avisos ---------- */
.aviso { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 0.9rem; }
.aviso-ok { background: var(--ok-fondo); color: #14532d; }
.aviso-error { background: #fee2e2; color: #7f1d1d; }
.aviso-info { background: var(--info-fondo); color: #0c4a6e; }

/* ---------- Tablas / listas ---------- */
.lista-orden { list-style: none; }
.lista-orden li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed #e7e5e4; font-size: 0.9rem; }
.lista-orden li:last-child { border-bottom: none; }
.lista-orden .p { color: var(--texto-suave); }

/* ---------- Panel del vendedor ---------- */
.topbar {
  background: #1c1917;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.topbar .brand { font-weight: 800; margin-right: auto; }
.topbar a { color: #fca5a5; }
.topbar a:hover { color: #fff; text-decoration: none; }

.estadisticas { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px; text-align: center; box-shadow: var(--sombra); }
.stat .num { font-size: 1.4rem; font-weight: 800; color: var(--primario); }
.stat .eti { font-size: 0.78rem; color: var(--texto-suave); }

.orden { border-left: 5px solid var(--primario); }
.orden.estado-nuevo { border-left-color: var(--info); }
.orden.estado-confirmado { border-left-color: var(--acento); }
.orden.estado-listo { border-left-color: var(--ok); }
.orden.estado-entregado { border-left-color: #a8a29e; }
.orden.estado-cancelado { border-left-color: var(--peligro); opacity: 0.75; }

.orden .encabezado { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.orden .encabezado b { font-size: 0.95rem; }
.etiqueta { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.et-nuevo { background: var(--info-fondo); color: var(--info); }
.et-confirmado { background: #fef3c7; color: #92400e; }
.et-listo { background: var(--ok-fondo); color: #14532d; }
.et-entregado { background: #e7e5e4; color: #44403c; }
.et-cancelado { background: #fee2e2; color: #7f1d1d; }
.et-pagado { background: var(--ok-fondo); color: #14532d; }
.et-pendiente { background: #fef3c7; color: #92400e; }
.et-rechazado { background: #fee2e2; color: #7f1d1d; }

.acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Login del panel ---------- */
.pantalla-login {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.caja-login { max-width: 340px; width: 100%; }

/* ---------- Overlay ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(28, 25, 23, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal { background: #fff; border-radius: var(--radio); max-width: 460px; width: 100%; padding: 18px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-bottom: 12px; }

/* ---------- Mensaje de éxito ---------- */
.exito {
  text-align: center;
  padding: 30px 16px;
}
.exito .icono {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: var(--ok-fondo);
  color: var(--ok);
  font-size: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

/* ---------- Editor ---------- */
.fila-item-editor {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}
.fila-item-editor .col-acciones { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background: #d6d3d1;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}
.switch .slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ---------- Pie ---------- */
.pie { text-align: center; color: var(--texto-suave); font-size: 0.78rem; padding: 20px 16px 70px; }

.hidden { display: none !important; }

/* ---------- Alerta del panel ---------- */
#banner-alertas {
  background: #1c1917;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 0.85rem;
  flex-wrap: wrap;
}
#banner-alertas .btn { background: #fca5a5; color: #7f1d1d; }
#banner-alertas .btn:hover { background: #fbbf24; }

.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: #1c1917;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  max-width: 92vw;
  text-align: center;
}

/* ---------- Progreso del pedido en el panel ---------- */
.progreso {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 8px 0;
  font-size: 0.72rem;
  color: var(--texto-suave);
}
.progreso span {
  padding: 2px 8px;
  border-radius: 999px;
  background: #f5f5f4;
  border: 1px solid #e7e5e4;
  white-space: nowrap;
}
.progreso span.ok {
  background: var(--ok-fondo);
  color: #14532d;
  border-color: #bbf7d0;
  font-weight: 600;
}
.progreso b { flex: 1; height: 2px; background: #e7e5e4; min-width: 6px; border-radius: 2px; }
.progreso b.ok { background: var(--ok); }

/* ---------- Pasos del pedido ---------- */
.pasos { display: flex; justify-content: space-between; gap: 4px; }
.paso { flex: 1; text-align: center; opacity: 0.45; }
.paso .punto {
  width: 34px; height: 34px;
  margin: 0 auto 4px;
  border-radius: 50%;
  background: #e7e5e4;
  color: #78716c;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.paso .eti { font-size: 0.72rem; color: var(--texto-suave); }
.paso.activo { opacity: 1; }
.paso.activo .punto { background: var(--primario); color: #fff; }
.paso.hecho .punto { background: var(--ok); color: #fff; }

@media (min-width: 640px) {
  .grilla-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .grilla-menu .item { margin-bottom: 0; }
}
