@layer components {
  :root { --enc-h: 56px; }
  .enc { position: sticky; top: 0; z-index: 30; background: var(--surface); }
  .enc-in { height: var(--enc-h); display: flex; align-items: center; gap: var(--s2); padding: 0 var(--gutter-r) 0 var(--gutter); }
  .marca { display: flex; align-items: center; gap: var(--s2); text-decoration: none; color: var(--text); margin-right: auto; min-height: 44px; min-width: 0; }
  .mono { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font: 700 1.2rem var(--f-titulo); flex: none; overflow: hidden; }
  .mono img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
  /* nombre del local: paso step-2 de la escala fluida, fuente de títulos del tema; si no entra, 2 líneas balanceadas (nunca se corta) */
  .marca-txt { font-family: var(--f-titulo); font-weight: 700; font-size: var(--step-2); line-height: 1.05; text-wrap: balance; overflow-wrap: anywhere; min-width: 0; }
  .enc-nav { display: none; gap: var(--s4); margin-right: var(--s4); }
  .enc-nav a { color: var(--text); font-weight: 600; text-decoration: none; padding: var(--s3) var(--s1); }
  .enc-nav a:hover { color: var(--brand); text-decoration: underline; }
  .pill .largo { display: none; }
  .pill svg { flex: none; }
  .btn-lista { position: relative; min-width: 44px; min-height: 44px; border-radius: var(--r-m); border: 2px solid var(--brand); background: transparent; color: var(--brand); display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 var(--s2); cursor: pointer; }
  .cuenta { font-weight: 700; font-size: .95rem; }

  .layout { max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter-r) 0 var(--gutter); }
  main { min-width: 0; padding-bottom: var(--s8); }
  .ejemplo { display: inline-block; margin-top: var(--s3); padding: 2px var(--s3); border: 2px dashed var(--line); border-radius: var(--r-s); font-size: var(--step--1); font-weight: 700; color: var(--text-2); }

  /* Hoy */
  .hoy { padding-top: var(--s4); }
  .hoy h1 { font-size: var(--step-4); }
  .estado-largo { color: var(--text-2); margin: var(--s1) 0 var(--s4); font-weight: 600; }
  /* flex (no grilla fija): un bloque oculto sale del flujo y el que queda ocupa todo el ancho */
  .hoy-grid { display: flex; flex-direction: column; gap: var(--s4); }
  .hoy-grid > * { min-width: 0; flex: 0 0 auto; }
  .layout > * { min-width: 0; }
  .tarjeta-menu { background: var(--brand); color: var(--on-brand); border-radius: var(--r-m); padding: var(--s4); display: grid; gap: var(--s2); }
  .tarjeta-menu h2 { font-size: var(--step-1); }
  .tarjeta-menu ul { display: grid; gap: 2px; }
  .tarjeta-menu .precio { font: 700 var(--step-3)/1 var(--f-titulo); }
  .tarjeta-menu .btn { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
  .tarjeta-menu small { opacity: .9; }
  .promos-t { font-size: var(--step-1); margin-bottom: var(--s2); }
  .carrusel { display: flex; gap: var(--s3); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: var(--s2); margin-right: calc(var(--gutter-r) * -1); padding-right: var(--gutter-r); }
  .promo { flex: 0 0 min(78%, 300px); scroll-snap-align: start; background: var(--surface-2); border: 1px solid var(--surface-3); border-left: 6px solid var(--accent); border-radius: var(--r-m); padding: var(--s4); display: grid; gap: var(--s2); align-content: start; }
  .promo h3 { font-size: var(--step-1); }
  .promo .vig { font-size: var(--step--1); font-weight: 700; color: var(--text-2); }
  .promo .valor { font: 700 var(--step-2)/1 var(--f-titulo); font-variant-numeric: tabular-nums; }
  .promo .btn { margin-top: var(--s1); }

  /* Categorías */
  .cats { position: sticky; top: var(--enc-h); z-index: 20; background: var(--surface); margin: 0 calc(var(--gutter) * -1) 0 calc(var(--gutter) * -1); padding: var(--s2) var(--gutter-r) var(--s2) var(--gutter); border-bottom: 1px solid var(--surface-3); }
  .cats ul { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; }
  .cats a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s4); border-radius: var(--r-full); background: var(--brand-soft); color: var(--text); text-decoration: none; font-weight: 600; white-space: nowrap; }
  .cats a[aria-current="true"] { background: var(--brand); color: var(--on-brand); }

  /* Carta */
  .actualizado { color: var(--text-2); font-size: var(--step--1); margin: var(--s4) 0 var(--s2); }
  .cat { padding-top: var(--s4); scroll-margin-top: calc(var(--enc-h) + 64px); }
  .cat > h2 { font-size: var(--step-3); }
  .cat-nota { color: var(--text-2); font-size: .95rem; margin-top: var(--s1); }
  .cat-sep { margin-top: var(--s4); }
  .grilla { display: grid; gap: var(--s3); margin-top: var(--s3); grid-template-columns: minmax(0,1fr); }
  .prod-wrap { container-type: inline-size; }
  .prod { background: var(--surface-2); border: 1px solid var(--surface-3); border-radius: var(--r-m); overflow: hidden; display: grid; grid-template-columns: 1fr; height: 100%; }
  .prod-foto { aspect-ratio: 4/3; background: var(--brand-soft); overflow: hidden; }
  .prod-foto img { width: 100%; height: 100%; object-fit: cover; }
  .prod-cuerpo { padding: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
  .prod-foto { align-self: start; }
  .prod h3 { font-size: var(--step-1); }
  .prod .desc { color: var(--text-2); font-size: .95rem; }
  .prod .alerg { font-size: var(--step--1); color: var(--text-2); }
  .fila-precio { margin-top: auto; display: flex; align-items: baseline; gap: var(--s2); }
  .fila-precio::before { content: ""; order: 1; flex: 1; border-bottom: 2px dotted var(--line); transform: translateY(-4px); min-width: 12px; }
  .fila-precio .u { order: 0; color: var(--text-2); font-size: var(--step--1); font-weight: 600; }
  .fila-precio .p { order: 2; font: 700 var(--step-2)/1 var(--f-titulo); font-variant-numeric: tabular-nums; }
  .fila-precio .p s { font-size: var(--step--1); font-weight: 500; color: var(--text-2); margin-right: 6px; }
  .fila-precio .p .promo-p { color: var(--danger); }
  .variantes { display: flex; flex-wrap: wrap; gap: var(--s2); border: 0; padding: 0; margin: 0; }
  .variantes label { flex: 1 1 calc(50% - 8px); }
  .variantes input { position: absolute; opacity: 0; }
  .variantes span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; padding: 0 var(--s2); border: 2px solid var(--line); border-radius: var(--r-s); font-weight: 600; cursor: pointer; line-height: 1.15; }
  .variantes input:checked + span { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
  .variantes input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
  .acciones { display: grid; gap: var(--s2); }
  .prod.agotado .prod-foto { filter: grayscale(.6); }
  .prod.agotado h3, .prod.agotado .fila-precio { opacity: .7; }
  .tag-agotado { display: inline-flex; align-items: center; gap: 6px; background: var(--danger-soft); color: var(--danger); font-weight: 700; font-size: var(--step--1); padding: 4px var(--s3); border-radius: var(--r-full); width: fit-content; }
  .apoyo { font-size: var(--step--1); color: var(--text-2); }
  .aviso-nocobra { margin: var(--s6) 0 0; padding: var(--s3); background: var(--brand-soft); border-radius: var(--r-s); font-size: .95rem; }
  .esqueleto { height: 112px; border-radius: var(--r-m); background: var(--surface-2); margin-top: var(--s3); }
  @media (prefers-reduced-motion: no-preference) { .esqueleto { animation: pulso 1.2s ease-in-out infinite alternate; } @keyframes pulso { to { opacity: .5; } } }

  /* Tarjeta horizontal cuando hay lugar (container query) */
  @container (min-width: 340px) {
    .prod { grid-template-columns: 96px 1fr; }
    .prod-foto { aspect-ratio: 1; width: 96px; height: 96px; margin: var(--s3) 0 0 var(--s3); border-radius: var(--r-s); }
    .prod .acciones { grid-column: 1 / -1; }
    .prod-cuerpo { padding: var(--s3); }
  }
  @container (min-width: 340px) { .prod { grid-template-areas: "f c" "a a"; } .prod-foto { grid-area: f; } .prod-cuerpo { grid-area: c; } .prod .acciones { grid-area: a; padding: 0 var(--s3) var(--s3); } }
  @container (max-width: 339px) { .prod { grid-template-rows: auto 1fr auto; } .prod .acciones { padding: 0 var(--s3) var(--s3); } }

  /* Info */
  .info { padding-top: var(--s8); }
  .info h2 { font-size: var(--step-3); margin-bottom: var(--s3); }
  .info-grid { display: grid; gap: var(--s6); }
  .tabla-horarios { width: 100%; border-collapse: collapse; }
  .tabla-horarios th, .tabla-horarios td { text-align: left; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--surface-3); font-variant-numeric: tabular-nums; }
  .tabla-horarios th { font-weight: 600; text-transform: capitalize; width: 34%; vertical-align: top; }
  .tabla-horarios td span { display: block; white-space: nowrap; }
  .tabla-horarios tr.hoy-fila { background: var(--brand-soft); font-weight: 700; }
  .tabla-horarios tr.hoy-fila th { box-shadow: inset 4px 0 0 var(--brand); }
  .bloque { display: grid; gap: var(--s2); margin-bottom: var(--s4); }
  .bloque h3 { font-size: var(--step-1); }
  .chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
  .tel { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
  .tel code { font: 600 1.1rem var(--f-cuerpo); font-variant-numeric: tabular-nums; user-select: all; }
  .copiado { font-size: var(--step--1); color: var(--ok); font-weight: 700; }
  .enlace { color: var(--brand); font-weight: 600; }

  .pie { margin-top: var(--s8); background: var(--surface-2); padding-bottom: calc(var(--s6) + env(safe-area-inset-bottom, 0px)); }
  .pie-in { max-width: 1280px; margin: 0 auto; padding: var(--s4) var(--gutter-r) 0 var(--gutter); display: grid; gap: var(--s1); font-size: .95rem; color: var(--text-2); }
  .pie-in strong { color: var(--text); font-family: var(--f-titulo); font-size: var(--step-1); }

  /* Barra inferior móvil */
  .barra-pedido { position: fixed; left: var(--s3); right: var(--s3); bottom: calc(var(--s3) + env(safe-area-inset-bottom, 0px)); min-height: 56px; z-index: 40; border-radius: var(--r-m); border: 0; background: var(--brand); color: var(--on-brand); font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px color-mix(in oklch, var(--text) 25%, transparent); }
  body.con-barra .pie { padding-bottom: calc(var(--s12) + 56px + env(safe-area-inset-bottom, 0px)); }

  /* Lista de pedido */
  .hoja { border: 0; padding: 0; background: var(--surface); color: var(--text); width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; }
  .hoja::backdrop { background: color-mix(in oklch, var(--text) 50%, transparent); }
  .hoja-in { display: grid; gap: var(--s4); padding: 0 var(--gutter-r) var(--s6) var(--gutter); align-content: start; }
  .hoja-enc { position: sticky; top: 0; background: var(--surface); display: flex; justify-content: space-between; align-items: center; padding: var(--s3) 0; z-index: 2; }
  .cerrar { min-width: 44px; min-height: 44px; border-radius: var(--r-m); border: 2px solid var(--line); background: transparent; font-size: 1.6rem; line-height: 1; cursor: pointer; }
  .li { display: grid; grid-template-columns: 1fr auto; gap: var(--s2) var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--surface-3); }
  .li .nom { font-weight: 700; }
  .li .sub { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
  .li .upd { font-size: var(--step--1); color: var(--ok); font-weight: 700; }
  .stepper { display: inline-flex; align-items: center; gap: var(--s2); }
  .stepper button { min-width: 44px; min-height: 44px; border-radius: var(--r-s); border: 2px solid var(--line); background: var(--surface); font-size: 1.3rem; cursor: pointer; }
  .stepper output { min-width: 3.5ch; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
  .total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; padding-top: var(--s2); }
  .total .v { font: 700 var(--step-2) var(--f-titulo); font-variant-numeric: tabular-nums; }
  .total small { display: block; font-weight: 500; color: var(--text-2); }
  .modo { border: 0; padding: 0; margin: 0; display: flex; gap: var(--s2); flex-wrap: wrap; }
  .modo legend { font-weight: 600; margin-bottom: var(--s2); padding: 0; }
  .radio { flex: 1; }
  .radio input { position: absolute; opacity: 0; }
  .radio span { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 2px solid var(--line); border-radius: var(--r-s); font-weight: 600; cursor: pointer; }
  .radio input:checked + span { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
  .radio input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
  .lista-campos { display: grid; gap: var(--s3); }
  .lista-acciones { display: grid; gap: var(--s2); }
  .aviso-cerrado, .aviso-largo { padding: var(--s3); border-radius: var(--r-s); background: var(--accent); color: var(--on-accent); font-weight: 600; }
  .vacio { padding: var(--s6) 0; color: var(--text-2); }

  @media (min-width: 640px) { .grilla { grid-template-columns: repeat(2, minmax(0,1fr)); } .pill .largo { display: inline; } .pill .corto { display: none; } }
  @media (min-width: 960px) {
    .enc-nav { display: flex; }
    .layout { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: var(--s8); }
    .cats { position: sticky; top: calc(var(--enc-h) + var(--s4)); align-self: start; margin: var(--s4) 0 0; padding: 0; border: 0; background: transparent; }
    .cats ul { flex-direction: column; overflow: visible; gap: var(--s1); }
    .cats a { border-radius: var(--r-s); background: transparent; width: 100%; }
    .cats a:hover { background: var(--brand-soft); }
    .cat { scroll-margin-top: calc(var(--enc-h) + var(--s4)); }
    .grilla { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .hoy-grid { flex-direction: row; align-items: flex-start; }
    #menu-dia { flex: 5 1 0; } #promos { flex: 7 1 0; }
    .carrusel { flex-wrap: wrap; overflow: visible; margin-right: 0; padding-right: 0; }
    .promo { flex: 1 1 220px; }
    .info-grid { grid-template-columns: 1fr 1fr; }
    .barra-pedido { display: none !important; }
    body.con-barra .pie { padding-bottom: var(--s6); }
    .hoja { position: fixed; inset: 0 0 0 auto; width: 400px; max-width: 100vw; border-left: 1px solid var(--surface-3); }
  }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
}
