/* ---------- Oggi: tre riquadri, senza scorrere (design/nuovo-layout.html, 4/12/2026) ---------- */
/* barra a 4 voci: i nomi restano su una riga anche a 320 px; pallino degli ordini nuovi */
.navbtn > span:not(.visually-hidden) { white-space: nowrap; }
.nav-dot {
  position: absolute; top: 5px; left: calc(50% + 10px); width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 0 2px var(--surface);
}
@media (max-width: 359px) {
  .mainnav { gap: 2px; padding-left: max(4px, var(--sa-l)); padding-right: max(4px, var(--sa-r)); }
  .navbtn { padding: 0 2px; font-size: 0.6875rem; letter-spacing: -.01em; }
}

/* Su "Oggi" la pagina è alta quanto lo schermo: i riquadri si adattano allo spazio che resta.
   Lo scorrimento rimane solo come rete di sicurezza (testo molto ingrandito, schermi bassissimi). */
body[data-view="today"] .app { height: 100dvh; display: flex; flex-direction: column; }
body[data-view="today"] .topbar, body[data-view="today"] .mode-note { flex: none; }
body[data-view="today"] #view-today { flex: 1; width: 100%; min-height: 0; display: flex; flex-direction: column; padding-top: 12px; padding-bottom: 12px; }
.today { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; container: today / size; }
.today > * { flex: none; }
.today[aria-busy="true"] { opacity: .7; transition: opacity .2s; }
.today-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 2px; }
.today-title { margin: 0; font-size: 1.25rem; line-height: 1.2; }
.today-title::first-letter { text-transform: uppercase; }
.today-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin: 4px 0 0; font-size: 0.8125rem; color: var(--muted); }
.today-head .bk-refresh { flex: none; border: 1px solid var(--line); background: var(--surface); }

.quad {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 2fr) minmax(0, 3fr); gap: 12px;
}
/* I riquadri prendono lo spazio che resta sotto la data, senza diventare troppo alti. */
.today > .quad { flex: 1 1 0; min-height: 300px; max-height: max(calc(100cqw * 1.4), 520px); }
.tl {
  min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 16px; margin: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm);
  color: var(--text); font: inherit; text-align: center;
}
button.tl { cursor: pointer; }
.tl-wide { grid-column: 1 / -1; align-items: center; justify-content: center; gap: 0; }
.tl-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--k-soft, var(--surface-2)); color: var(--k, var(--muted)); flex: none; }
.tl-ico svg, .late-head svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tl-wide .tl-ico { margin-bottom: 12px; }
/* tre sole misure di testo: 40 il numero, 15 il nome, 13 il dettaglio */
.tl-wide > b { font-size: 2.5rem; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tl-wide > strong { font-size: 0.9375rem; font-weight: 600; margin-top: 6px; }
.tl-wide > small { font-size: 0.8125rem; color: var(--text-2); margin-top: 6px; }
.tl.is-late { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger); }
.tl.is-late .tl-ico { background: var(--surface); color: var(--danger); }
.tl.is-fine .tl-ico { background: var(--ok-soft); color: var(--ok); }
.tl-go {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 0; border: 0; background: transparent;
  color: inherit; font: inherit; cursor: pointer; width: 100%;
}
.tl-h { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
.tl-h .tl-ico { width: 30px; height: 30px; border-radius: 9px; }
.tl-h b { font-size: 0.9375rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-n { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tl-n > b { font-size: 2.5rem; line-height: 1; color: var(--k); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tl-n > strong { font-size: 0.9375rem; font-weight: 600; margin-top: 6px; }
.tl-n > small { min-height: 2lh; font-size: 0.8125rem; line-height: 1.5; color: var(--muted); margin-top: 6px; }
.tl-n small .warn { color: var(--warn); font-weight: 600; }
.tl-n > .lock-ico { width: 28px; height: 28px; color: var(--muted); }
.tl-f { display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 8px; }
.tl-next {
  display: block; width: 100%; min-height: var(--tap); padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 0.8125rem; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-next b { font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 2px; }
.tl-note { min-height: 44px; display: grid; place-items: center; font-size: 0.8125rem; color: var(--muted); }
.tl-value { min-height: 44px; display: grid; place-items: center; border-radius: 10px; background: var(--k-soft); color: var(--k); font-size: 0.9375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-f .bk-arrive { width: 100%; margin: 0; justify-content: center; }
.tl.is-locked-block { opacity: .55; cursor: not-allowed; }

@container today (max-width: 330px) {
  .tl:not(.tl-wide) { padding-inline: 10px; }
  .tl-h { gap: 6px; }
  .tl-h .tl-ico { width: 26px; height: 26px; }
  .tl-h b { font-size: 0.875rem; }
}
/* schermo basso: stessi caratteri, solo spazi e numeri più contenuti */
@container today (max-height: 600px) {
  .quad { gap: 10px; grid-template-rows: minmax(0, 3fr) minmax(0, 5fr); }
  .tl { padding: 10px; gap: 6px; border-radius: 14px; }
  .tl-go { gap: 6px; }
  .tl-wide .tl-ico { width: 28px; height: 28px; margin-bottom: 4px; }
  .tl-wide > b, .tl-n > b { font-size: 1.875rem; }
  .tl-wide > strong, .tl-wide > small, .tl-n > strong, .tl-n > small { margin-top: 2px; line-height: 1.3; }
  .tl-h .tl-ico { width: 26px; height: 26px; }
  .tl-h b { font-size: 0.875rem; }
  .tl-f { gap: 2px; padding-top: 4px; }
}
@container today (max-height: 470px) {
  .quad { grid-template-rows: minmax(0, 2fr) minmax(0, 5fr); }
  .tl-wide .tl-ico { display: none; }
}
/* schermi molto bassi (telefoni piccoli, telefono in orizzontale) */
@container today (max-height: 420px) {
  .tl-wide > strong, .tl-wide > small { margin-top: 0; }
  .tl-n > small { min-height: 0; }
  .tl-h .tl-ico { display: none; }
  .tl { padding-block: 8px; gap: 4px; }
  .tl-go { gap: 4px; }
  .today-title { font-size: 1.0625rem; }
}
@media (max-height: 620px) and (max-width: 767px) {
  body[data-view="today"] #view-today { padding-top: 8px; padding-bottom: 8px; }
  body[data-view="today"] .app { padding-bottom: calc(60px + var(--sa-b)); }
  body[data-view="today"] .navbtn { min-height: 48px; gap: 0; }
  body[data-view="today"] .today { gap: 6px; }
  body[data-view="today"] .today-sub { margin-top: 0; }
}
