:root {
  --noche: #0A0F1E; --naranja: #FF8A3D; --crema: #FFF6E9; --mostaza: #F2B705; --gris: #5B6275;
  --linea: #EADFCB; --card: #FFFFFF; --ok: #2F7D5B; --error: #B42318;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --text: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--text); background: var(--crema); color: var(--noche); }
input, textarea, select { font-size: 16px; font-family: inherit; }
button, a { touch-action: manipulation; }
button { user-select: none; -webkit-user-select: none; font-family: inherit; color: inherit; }

.app { max-width: 520px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }

.demo { background: #1A2135; color: var(--crema); padding: 10px 16px; font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.demo b { color: var(--mostaza); }
.demo input { flex: 1; min-width: 160px; padding: 9px 12px; border-radius: 10px; border: 0; }

.head { background: var(--noche); color: var(--crema); padding: calc(22px + env(safe-area-inset-top, 0px)) 18px 20px; }
.head h1 { font-family: var(--display); font-weight: 800; margin: 0; font-size: 32px; letter-spacing: -.5px; line-height: 1.05; }
.head p { margin: 6px 0 0; opacity: .85; font-size: 15px; }
.estado { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 6px 12px; border-radius: 99px; background: rgba(255,246,233,.1); font-size: 13px; font-weight: 700; }
.estado::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mostaza); }
.estado.abierto::before { background: #5CC48E; }

.chips { position: sticky; top: 0; z-index: 5; background: var(--crema); display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; border-bottom: 1px solid var(--linea); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; padding: 9px 16px; border-radius: 99px; border: 1.5px solid var(--linea); background: #fff; font-weight: 700; font-size: 14px; cursor: pointer; transition: transform 120ms var(--ease); }
.chip:active { transform: scale(.96); }
.chip.on { background: var(--noche); color: var(--crema); border-color: var(--noche); }

section h2 { font-family: var(--display); font-weight: 800; margin: 22px 16px 8px; font-size: 21px; scroll-margin-top: 70px; }
.item { background: var(--card); margin: 8px 14px; border-radius: 18px; padding: 14px 14px 14px 16px; display: flex; gap: 12px; align-items: center; border: 2px solid transparent; box-shadow: 0 1px 2px rgba(10,15,30,.06); transition: border-color 150ms; }
.item.sel { border-color: var(--naranja); }
.item .info { flex: 1; min-width: 0; }
.item .n { font-weight: 700; font-size: 16px; }
.item .d { color: var(--gris); font-size: 13.5px; margin-top: 2px; }
.item .p { font-weight: 800; margin-top: 6px; }
.item .p span { background: #FCE9B5; padding: 1px 6px; border-radius: 6px; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty span { min-width: 18px; text-align: center; font-weight: 800; }
.rnd { width: 40px; height: 40px; border-radius: 50%; border: 0; font-size: 22px; font-weight: 800; cursor: pointer; line-height: 1; transition: transform 100ms var(--ease); }
.rnd:active { transform: scale(.9); }
.add { background: var(--naranja); color: var(--noche); }
.sub { background: #F1E8D8; }

.pie { text-align: center; color: var(--gris); font-size: 13px; margin: 28px 16px 8px; line-height: 1.6; }
.pie a { color: var(--noche); font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--naranja); }

.bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); width: calc(100% - 28px); max-width: 492px; background: var(--naranja); color: var(--noche); border: 0; border-radius: 18px; padding: 17px 20px; font-size: 16px; font-weight: 800; display: none; justify-content: space-between; cursor: pointer; box-shadow: 0 10px 30px rgba(10,15,30,.25); transition: transform 120ms var(--ease); z-index: 10; }
.bar.show { display: flex; }
.bar:active { transform: translateX(-50%) scale(.98); }

.velo { position: fixed; inset: 0; background: rgba(10,15,30,.5); opacity: 0; pointer-events: none; transition: opacity 200ms; z-index: 20; }
.velo.show { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 105%); width: 100%; max-width: 520px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: #fff; border-radius: 24px 24px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom, 0px)); z-index: 21; transition: transform 280ms var(--ease); }
.sheet.show { transform: translate(-50%, 0); }
.sheet .asa { width: 44px; height: 5px; border-radius: 3px; background: var(--linea); margin: 4px auto 12px; }
.sheet h3 { font-family: var(--display); font-weight: 800; margin: 0 0 12px; font-size: 24px; }
.linea { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0 4px; font-size: 15px; }
.linea small { color: var(--gris); display: block; font-size: 13px; }
.nota { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--linea); margin-bottom: 4px; background: #FFFCF7; }
.seg { display: flex; gap: 8px; margin: 14px 0; }
.seg button { flex: 1; padding: 13px; border-radius: 12px; border: 1.5px solid var(--linea); background: #FBF5EA; font-weight: 700; cursor: pointer; }
.seg button.on { background: var(--noche); color: var(--crema); border-color: var(--noche); }
label { display: block; font-size: 13px; font-weight: 700; color: var(--gris); margin: 12px 0 5px; }
.f { width: 100%; padding: 13px; border-radius: 12px; border: 1.5px solid var(--linea); background: #fff; }
.f:focus, .nota:focus { outline: 2px solid var(--naranja); outline-offset: 1px; }
.total { display: flex; justify-content: space-between; font-family: var(--display); font-weight: 800; font-size: 24px; margin-top: 16px; }
.aviso { color: var(--gris); font-size: 13px; margin-top: 4px; }
.err { color: var(--error); font-size: 14px; margin-top: 8px; min-height: 18px; font-weight: 600; }
.enviar { width: 100%; margin-top: 12px; padding: 17px; border: 0; border-radius: 16px; background: var(--noche); color: var(--crema); font-size: 17px; font-weight: 800; cursor: pointer; transition: transform 100ms var(--ease), opacity 150ms; }
.enviar:active { transform: scale(.98); }
.enviar:disabled { opacity: .4; }
.sabor { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--linea); }

@media (hover: hover) and (pointer: fine) {
  .chip:hover { border-color: var(--noche); }
  .add:hover { filter: brightness(1.05); }
  .enviar:hover { opacity: .92; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
