/* Ususú Pedidos — paleta y tipografía del Brief de diseño (estilo «panel»: limpio y funcional) */
:root {
  --crema: #FFF8F0;
  --durazno: #F2B6A0;
  --durazno-suave: #FBE1D6;
  --coral: #D45556;
  --coral-oscuro: #BC4446;
  --miel: #F4B63F;
  --menta: #8FD3C7;
  --menta-oscura: #2A7369;
  --chocolate: #522D28;
  --choco-suave: #8A6B66;
  --blanco: #FFFFFF;
  --linea: #EEDFD6;
  --wa: #187A42;
  /* Botones de acción: coral oscuro, con contraste 5,2 sobre texto blanco */
  --accion: #BC4446;
  --accion-activa: #A63B3D;
  --r: 16px;
  --sombra: 0 2px 10px rgba(82, 45, 40, .08);
  --titulos: 'Quicksand', system-ui, sans-serif;
  --texto: 'Manrope', system-ui, sans-serif;
  --tabs-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light dark; background: var(--crema); }
/* Campos y listas desplegables siempre claros, aunque el teléfono esté en modo oscuro */
input, select, textarea, .sheet, .panel, .card, .lrow, .cline { color-scheme: light; }
body {
  margin: 0;
  background: var(--crema);
  color: var(--chocolate);
  font: 500 16px/1.45 var(--texto);
  -webkit-tap-highlight-color: transparent;
}
body.noscroll { overflow: hidden; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
#main { padding: 0 16px calc(var(--tabs-h) + 230px); }
h1, h2, h3, h4 { font-family: var(--titulos); font-weight: 700; margin: 0; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
button, input, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.muted { color: var(--choco-suave); margin: 4px 0 0; font-size: 14px; }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
[hidden] { display: none !important; }

/* Encabezados */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 10px; }
.logo { height: 44px; width: auto; }
.rate-chip {
  border: 0; background: var(--blanco); box-shadow: var(--sombra);
  padding: 8px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.sub {
  display: flex; align-items: center; gap: 8px; padding: 12px 0; position: sticky; top: 0;
  background: var(--crema); z-index: 5;
}
.back {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--blanco);
  box-shadow: var(--sombra); font-size: 26px; line-height: 1; cursor: pointer; padding-bottom: 4px;
}

/* Buscador y chips */
.search input {
  width: 100%; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--linea);
  background: var(--blanco) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="none" stroke="%238A6B66" stroke-width="2"><circle cx="8" cy="8" r="6"/><path d="m13 13 4 4"/></svg>') no-repeat 14px center;
  padding-left: 40px; outline: none;
}
.search input:focus { border-color: var(--coral); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--linea); background: var(--blanco); border-radius: 999px;
  padding: 7px 14px; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--chocolate); color: var(--blanco); border-color: var(--chocolate); }

/* Tarjetas de «Arma tu cajita» */
.box-cta { display: grid; gap: 10px; margin-top: 12px; }
.box-card {
  display: flex; align-items: center; gap: 12px; text-align: left; border: 0; cursor: pointer;
  border-radius: var(--r); padding: 14px 16px; background: var(--durazno-suave);
}
.box-card.saludable { background: #E3F4F0; }
.box-card b { font-family: var(--titulos); font-size: 17px; display: block; }
.box-card small { color: var(--choco-suave); }
.box-card.saludable b { color: var(--menta-oscura); }
.box-emoji { font-size: 28px; }

/* Cuadrícula de productos */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.card {
  background: var(--blanco); border-radius: var(--r); box-shadow: var(--sombra);
  overflow: hidden; display: flex; flex-direction: column;
}
.ph {
  position: relative; aspect-ratio: 1; background: var(--durazno-suave);
  display: grid; place-items: center; overflow: hidden;
}
.ph img { width: 100%; height: 100%; object-fit: cover; }
.noph { font-size: 40px; opacity: .7; }
.badge {
  position: absolute; top: 8px; left: 8px; background: var(--miel); color: var(--chocolate);
  font-style: normal; font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 999px;
}
.card .info { padding: 10px 12px 6px; flex: 1; }
.card h3 { font-size: 15px; }
.price { color: var(--coral-oscuro); font-weight: 700; margin: 2px 0 0; }
.card .btn.add, .card .stepper { margin: 4px 10px 12px; }
.hint {
  grid-column: 1 / -1; text-align: left; border: 1px dashed var(--menta-oscura); color: var(--menta-oscura);
  background: transparent; border-radius: 12px; padding: 10px 12px; cursor: pointer;
}

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 999px; padding: 11px 18px; font-family: var(--titulos);
  font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none; text-align: center;
  min-height: 44px;
}
.btn.primary { background: var(--accion); color: var(--blanco); }
.btn.primary:active { background: var(--accion-activa); }
.btn.primary:disabled { background: var(--linea); color: var(--choco-suave); cursor: default; }
.btn.ghost { background: var(--blanco); color: var(--chocolate); border: 1px solid var(--linea); }
.btn.ghost:disabled { opacity: .5; }
.btn.danger { background: var(--blanco); color: var(--coral-oscuro); border: 1px solid #F0C4C2; }
.danger-text { color: var(--coral-oscuro) !important; }
.btn.wa { background: var(--wa); color: var(--blanco); }
.btn.add { background: var(--accion); color: var(--blanco); min-height: 44px; padding: 8px 12px; }
.btn.add:active, .fab:active { background: var(--accion-activa); }
.btn.big { min-height: 52px; font-size: 17px; }
.btn.small { min-height: 38px; padding: 7px 14px; font-size: 14px; }
.icon {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--linea);
  background: var(--blanco); font-size: 18px; cursor: pointer; flex: none;
}
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.row.left { justify-content: flex-start; }
.stack { display: grid; gap: 10px; margin-top: 16px; }

.stepper {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--durazno-suave); border-radius: 999px; padding: 2px; min-height: 48px;
}
.stepper button {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--blanco);
  font-size: 20px; font-weight: 700; color: var(--coral-oscuro); cursor: pointer;
}
.stepper span { font-weight: 700; min-width: 28px; text-align: center; }
.cline .stepper { width: 156px; margin-top: 8px; }

/* Barras inferiores */
#bar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto; padding: 0 12px 10px; z-index: 10; pointer-events: none;
}
#bar > * { pointer-events: auto; }
.cartbar {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--chocolate); color: var(--blanco); border: 0; border-radius: var(--r);
  padding: 14px 16px; box-shadow: 0 6px 20px rgba(82, 45, 40, .3); cursor: pointer; font-size: 15px;
}
.boxbar {
  background: var(--blanco); border-radius: var(--r); padding: 12px 14px;
  box-shadow: 0 -2px 24px rgba(82, 45, 40, .18);
}
.boxbar p { margin: 6px 0 0; font-size: 14px; }
.prog { height: 8px; background: var(--durazno-suave); border-radius: 99px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--menta-oscura); border-radius: 99px; transition: width .2s; }

#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; display: flex; justify-content: space-around;
  background: var(--blanco); border-top: 1px solid var(--linea);
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
}
#tabs button {
  flex: 1; max-width: 180px; border: 0; background: none; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 700;
  color: var(--choco-suave); cursor: pointer; font-family: var(--titulos);
}
#tabs button span { font-size: 22px; filter: grayscale(1); opacity: .6; }
#tabs button.on { color: var(--coral-oscuro); }
#tabs button.on span { filter: none; opacity: 1; }

/* Listas */
.list { display: grid; gap: 10px; margin-top: 14px; }
.group { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--choco-suave); margin: 10px 4px 0; }
.lrow {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  background: var(--blanco); border: 0; border-radius: 14px; padding: 10px 12px; box-shadow: var(--sombra); cursor: pointer;
}
.lrow b { display: block; font-family: var(--titulos); font-size: 16px; }
.lrow small { color: var(--choco-suave); }
.thumb { width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: var(--durazno-suave); display: grid; place-items: center; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .noph { font-size: 24px; }
.chev { font-size: 22px; color: var(--choco-suave); }
.tag { font-style: normal; font-size: 12px; font-weight: 700; background: var(--linea); padding: 2px 8px; border-radius: 99px; }
.cline {
  display: flex; gap: 12px; align-items: flex-start; background: var(--blanco); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--sombra);
}
.cline .price { white-space: nowrap; }

.fab {
  position: fixed; right: max(16px, calc(50% - 264px)); bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom));
  z-index: 9; border: 0; border-radius: 999px; background: var(--accion); color: var(--blanco);
  font-family: var(--titulos); font-weight: 700; font-size: 16px; padding: 14px 20px;
  box-shadow: 0 6px 18px rgba(188, 68, 70, .4); cursor: pointer; min-height: 52px;
}

/* Paneles, totales y mensaje */
.panel { background: var(--blanco); border-radius: var(--r); padding: 16px; box-shadow: var(--sombra); margin-top: 14px; }
.panel h3 { margin-bottom: 10px; }
.seg { display: flex; background: var(--durazno-suave); border-radius: 999px; padding: 4px; margin-top: 8px; }
.seg > button, .seg > label {
  flex: 1; border: 0; background: none; border-radius: 999px; padding: 10px; font-weight: 700;
  font-family: var(--titulos); cursor: pointer; text-align: center; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.seg > button.on, .seg > label:has(input:checked) { background: var(--blanco); box-shadow: var(--sombra); color: var(--coral-oscuro); }
.seg.small > label { font-size: 14px; padding: 8px; }
.seg input[type=radio] { accent-color: var(--coral); margin: 0; }
.rate { display: flex; align-items: center; gap: 8px; }
.rate small { display: block; color: var(--choco-suave); font-size: 13px; }
.rate b { font-size: 20px; font-family: var(--titulos); }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--linea); }
.panel .total:first-child { border-top: 0; }
.rate + #paytotals, .field.inline + #paytotals { margin-top: 10px; }
.total.big b { font-size: 24px; font-family: var(--titulos); color: var(--coral-oscuro); }
.total.big { margin-top: 10px; }
.label { margin: 20px 4px 8px; font-size: 15px; }
.msg {
  white-space: pre-wrap; word-break: break-word; margin: 0; background: #E9F7EE; border-radius: 14px;
  padding: 14px; font: 500 14px/1.5 var(--texto); border: 1px solid #CDEBD7;
}
.banner { background: var(--durazno-suave); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 10px 0 0; }
.banner.warn { background: #FFF1D6; }
.empty { text-align: center; padding: 40px 12px; color: var(--choco-suave); display: grid; gap: 12px; justify-items: center; grid-column: 1 / -1; }
.empty p { margin: 0; }

/* Formularios y hojas */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 700; font-size: 14px; }
.field small { color: var(--choco-suave); font-size: 13px; }
.field input, .field select {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--linea);
  background: var(--crema); outline: none; min-height: 48px;
}
.field input:focus, .field select:focus { border-color: var(--coral); background: var(--blanco); }
.field.inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pct { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.pct input { width: 72px; text-align: center; padding: 10px; border-radius: 12px; border: 1px solid var(--linea); background: var(--crema); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--coral); }
.photo-pick { display: flex; gap: 14px; align-items: center; }
.ph.big { width: 120px; height: 120px; border-radius: 16px; flex: none; aspect-ratio: auto; }

#sheet-root { position: fixed; inset: 0; z-index: 50; display: none; }
#sheet-root.open { display: block; }
.scrim { position: absolute; inset: 0; background: rgba(82, 45, 40, .4); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
  background: var(--blanco); border-radius: 22px 22px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto; animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: 0; } }

#toast {
  position: fixed; left: 50%; top: 16px; transform: translate(-50%, -80px); z-index: 60;
  background: var(--chocolate); color: var(--blanco); padding: 12px 18px; border-radius: 14px;
  font-weight: 600; font-size: 14px; max-width: calc(100% - 32px); transition: transform .25s; box-shadow: var(--sombra);
}
#toast.show { transform: translate(-50%, 0); }
#toast.error { background: var(--coral-oscuro); }

/* Inicio de sesión */
.login { padding-top: 12vh; display: grid; gap: 18px; justify-items: center; }
.login-logo { width: 120px; height: 120px; border-radius: 28px; }
.login .form { width: 100%; }

/* Tamaños en el formulario del postre */
.size-row { display: grid; grid-template-columns: 1fr 84px 42px; gap: 8px; align-items: center; margin-bottom: 8px; }
.size-row .icon { width: 42px; height: 42px; }
.card .muted.small { margin-top: 2px; }

/* Cajita como producto y pestañas de 3 */
.card.box-product .ph { background: #E3F4F0; }
.card.box-product h3 { color: var(--menta-oscura); }
.seg.three > button { font-size: 14px; padding: 10px 4px; }
.lrow.custom { border: 1px dashed var(--linea); box-shadow: none; }
.lrow .price { white-space: nowrap; }
.lrow small { display: block; }

/* Números de ancho fijo: los precios no «bailan» al cambiar */
.price, .total, .rate b, .stepper span, .cartbar, .boxbar, .rate-chip, .lrow small, .msg { font-variant-numeric: tabular-nums; }

/* Ventanas de confirmación propias */
#dialog-root { position: fixed; inset: 0; z-index: 55; display: none; place-items: center; padding: 16px; }
#dialog-root.open { display: grid; }
#dialog-root .scrim { position: absolute; inset: 0; background: rgba(82, 45, 40, .45); }
.dialog {
  position: relative; width: 100%; max-width: 380px; background: var(--blanco); border-radius: 22px;
  padding: 22px 18px 16px; box-shadow: 0 12px 40px rgba(82, 45, 40, .25); animation: pop .16s ease-out;
}
.dialog p { margin: 0 0 18px; font-family: var(--titulos); font-weight: 700; font-size: 18px; line-height: 1.35; }
.dialog .row { margin: 0; justify-content: flex-end; }
.dialog .row .btn { flex: 1; }
.btn.danger-fill { background: var(--accion); color: var(--blanco); }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

/* Tarjetas «fantasma» mientras carga */
.skel { background: linear-gradient(90deg, var(--durazno-suave) 25%, #FDEFE8 50%, var(--durazno-suave) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
.skel-card { background: var(--blanco); border-radius: var(--r); box-shadow: var(--sombra); overflow: hidden; }
.skel-card .skel.ph { aspect-ratio: 1; border-radius: 0; }
.skel-line { height: 14px; margin: 12px; }
.skel-line.short { width: 50%; }
.skel-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 0 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel, .sheet, .dialog { animation: none; } }

/* Catálogo para clientes: sin barra de pestañas */
body.cliente { --tabs-h: 0px; }
body.cliente #main { padding-bottom: 170px; }
.empty.sent { padding-top: 12vh; }
.empty.sent h2 { font-size: 26px; color: var(--chocolate); }
.empty.sent p { color: var(--chocolate); font-size: 16px; }

/* Pedidos (dueño) */
.badge-n {
  font-style: normal; background: var(--accion); color: var(--blanco); border-radius: 99px;
  font-size: 11px; padding: 1px 6px; margin-left: 2px; vertical-align: 1px;
}
.top .icon { flex: none; }
.lrow.order { border-left: 4px solid var(--linea); }
.lrow.order.nuevo { border-left-color: var(--accion); }
.lrow.order.confirmado { border-left-color: var(--miel); }
.lrow.order.entregado { border-left-color: var(--menta-oscura); }
.tag.st-nuevo { background: #FBE1D6; color: var(--coral-oscuro); }
.tag.st-confirmado { background: #FDEBC4; color: #7A5200; }
.tag.st-entregado { background: #E3F4F0; color: var(--menta-oscura); }
.tag.st-cancelado { background: var(--linea); color: var(--choco-suave); }
.seg.status > button { font-size: 13px; padding: 8px 2px; }
.olist { display: grid; gap: 8px; }
.oline { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--crema); border-radius: 12px; }
.oline small { display: block; color: var(--choco-suave); font-size: 13px; margin-top: 2px; }
.oline > b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.link-box { background: var(--crema); border: 1px dashed var(--linea); border-radius: 12px; padding: 10px 12px; font-size: 14px; word-break: break-all; margin: 10px 0 0; }
#tabs button span { position: relative; }
