:root {
  /* Paleta tomada del isologo de Cosalta (ovalo rojo, arcos celeste y verde) */
  --rojo: #d2232a;
  --rojo-oscuro: #a51820;
  --celeste: #4fc3e8;
  --verde: #0b3d2e;
  --verde-claro: #14603f;
  --verde-marca: #7cb342;
  --amarillo: #f2b705;
  --texto: #10241c;
  --fondo: #f4f7f5;
  --borde: #cfd8d3;
}

* { box-sizing: border-box; }

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
}

.icono { flex-shrink: 0; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  padding-bottom: 160px; /* deja lugar a la barra inferior fija */
}

header {
  background: var(--rojo);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 { font-size: 1.1rem; margin: 0; }

.header__usuario { display: flex; align-items: center; gap: 10px; }
#btn-salir {
  background: transparent;
  border: 1px solid #fff;
  color: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.estado-barra {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: #e4ede8;
  font-size: 0.85rem;
  font-weight: 600;
}

.estado-barra span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff;
}
.estado--ok { color: #146c2e; }
.estado--error { color: var(--rojo); }

main { padding: 16px; max-width: 640px; margin: 0 auto; }

section { margin-bottom: 24px; }

section h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--rojo-oscuro); }

input[type="search"] {
  width: 100%;
  padding: 14px;
  font-size: 1.1rem;
  border: 2px solid var(--borde);
  border-radius: 10px;
}

#lista-clientes { list-style: none; padding: 0; margin: 8px 0 0; max-height: 240px; overflow-y: auto; }

.opcion-cliente {
  width: 100%;
  text-align: left;
  padding: 14px;
  margin-bottom: 8px;
  border: 2px solid var(--borde);
  border-radius: 10px;
  background: #fff;
  font-size: 1rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.opcion-cliente span { color: #5b6b63; font-size: 0.85rem; }

#cliente-actual {
  font-weight: 700;
  font-size: 1.05rem;
  padding: 10px 0;
}

#lista-productos { list-style: none; padding: 0; margin: 0; }

.producto {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 2px solid var(--borde);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}

.producto__foto {
  width: 56px;
  height: 56px;
  object-fit: contain;
  object-position: center;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--borde);
  padding: 3px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.producto__info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.producto__info strong { font-size: 1.05rem; }
.producto__info span { color: #5b6b63; }

.stepper { display: flex; align-items: center; gap: 12px; }

.stepper__btn {
  width: 48px;
  height: 48px;
  font-size: 1.6rem;
  border-radius: 50%;
  border: none;
  background: var(--rojo);
  color: #fff;
  line-height: 1;
}
.stepper__btn:active { background: var(--rojo-oscuro); }

.stepper__valor { min-width: 28px; text-align: center; font-size: 1.2rem; font-weight: 700; }

.barra-inferior {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 3px solid var(--rojo);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
}

.resumen-pedido { flex: 1; }
.resumen-pedido strong { display: block; font-size: 1.3rem; }
.resumen-pedido span { color: #5b6b63; }

#btn-enviar-pedido {
  flex: 1;
  min-height: 56px;
  font-size: 1.15rem;
  font-weight: 700;
  background: var(--amarillo);
  color: var(--texto);
  border: none;
  border-radius: 12px;
}
#btn-enviar-pedido:disabled { opacity: 0.5; }

#btn-sincronizar {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  background: var(--rojo);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
}

.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translate(-50%, -150%);
  background: var(--texto);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  transition: transform 0.25s ease;
  z-index: 10;
}
.toast.visible { transform: translate(-50%, 0); }
.toast--exito { background: #146c2e; }
.toast--alerta { background: #a8710a; }
.toast--error { background: var(--rojo); }
