:root {
  --color-bg: #faf9f6;
  --color-surface: #ffffff;
  --color-text: #1c1c1c;
  --color-muted: #6b6b6b;
  --color-primary: #b3452e;
  --color-primary-dark: #8f371f;
  --color-border: #e6e2da;
  --color-danger: #c0392b;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-primary);
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 16px;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  height: 78px;
  width: auto;
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  width: 100%;
  max-width: 400px;
}

.card h1 {
  margin-top: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 4px;
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  color: var(--color-text);
}

.field input[type="checkbox"],
.field input[type="radio"] {
  width: auto;
}

button,
.btn {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

button:hover,
.btn:hover {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-danger {
  background: var(--color-danger);
}

.error {
  background: #fdecea;
  color: var(--color-danger);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.notice {
  background: #e5f6e8;
  color: #237a3e;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.muted {
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* Dashboard — sidebar di navigazione (stile "editorial": tipografia sicura, molto spazio bianco) */
:root {
  --sidebar-width: 260px;
}

.sidebar-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 30;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.sidebar-toggle span {
  width: 18px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
}

.sidebar-toggle.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.sidebar-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 15, 0.45);
  z-index: 19;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  max-width: 82vw;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 32px 26px;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-brand a {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--color-text);
  text-decoration: none;
  margin-bottom: 36px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar-nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.sidebar-nav a:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.sidebar-nav a.active {
  background: var(--color-bg);
  color: var(--color-primary);
  font-weight: 700;
}

.sidebar-nav-external {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
}

.sidebar-logout {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.sidebar-logout button {
  width: 100%;
}

.dash-topbar {
  display: flex;
  justify-content: center;
  padding: 24px 20px 0;
}

.dash-topbar-logo {
  height: 28px;
  width: auto;
}

.dash-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 32px;
}

@media (min-width: 900px) {
  .sidebar-toggle,
  .sidebar-backdrop {
    display: none;
  }

  .sidebar {
    transform: none;
    box-shadow: none;
  }

  .dash-topbar {
    justify-content: flex-start;
    margin-left: var(--sidebar-width);
    padding: 32px 40px 0;
  }

  .dash-topbar-logo {
    height: 32px;
  }

  .dash-container {
    margin: 0 0 0 var(--sidebar-width);
    max-width: 760px;
    padding: 24px 40px 32px;
  }
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.category-block {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.category-block-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.category-name-input {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  background: none;
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--color-text);
}

.category-name-input:hover {
  border-color: var(--color-border);
}

.category-name-input:focus {
  border-color: var(--color-primary);
  outline: none;
  background: var(--color-surface);
}

/* Un piccolo bordo attorno a ciascun piatto per distinguerlo visivamente dagli altri
   all'interno della stessa categoria (racchiude anche i pannelli Allergeni/Dettagli). */
.menu-item-card {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  margin: 10px 12px;
  overflow: hidden;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}

.item-row:last-child {
  border-bottom: none;
}

.item-main {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.item-desc {
  font-size: 0.8rem;
  color: var(--color-muted);
}

.item-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.details-fields .field {
  margin-top: 10px;
}

.details-fields .field:first-child {
  margin-top: 0;
}

.details-fields label {
  display: block;
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-bottom: 4px;
}

.details-fields textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font: inherit;
  resize: vertical;
}

.new-item-photo-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-basis: 100%;
  font-size: 0.85rem;
}

.item-price-input {
  width: 78px;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  text-align: right;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--color-muted);
  cursor: pointer;
  user-select: none;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
}

.icon-btn:hover {
  color: var(--color-danger);
}

.new-item-form,
.new-category-form,
.new-table-form {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.new-item-form input,
.new-category-form input,
.new-table-form input,
.new-item-form textarea {
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font: inherit;
}

.new-item-form textarea {
  width: 100%;
  resize: vertical;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fef3e2;
  color: #a15c00;
  font-weight: 600;
}

.badge-muted {
  background: #eef1f4;
  color: #5b6672;
}

.table-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-card img {
  width: 72px;
  height: 72px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.table-card .table-info {
  flex: 1;
}

.table-card .table-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Public menu */
.menu-header {
  background: linear-gradient(155deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  padding: calc(30px + env(safe-area-inset-top, 0px)) 20px 28px;
  text-align: center;
  border-radius: 0 0 22px 22px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.menu-header h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.menu-header-logo {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 12px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: #fff;
}

.table-banner {
  display: inline-block;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  backdrop-filter: blur(2px);
}

/* Barra rapida delle categorie: sticky nativo (nessun JS per l'aggancio in alto),
   segue lo scroll fino al bordo superiore dello schermo e vi resta ancorata */
.category-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.category-nav-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-nav-inner::-webkit-scrollbar {
  display: none;
}

.category-nav-pill {
  flex-shrink: 0;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.category-nav-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.menu-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 4px;
  margin-bottom: 20px;
}

.menu-category-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.menu-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item-main {
  flex: 1;
  min-width: 0;
}

.menu-item-name {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.35;
}

.menu-item-desc {
  font-size: 0.87rem;
  font-style: italic;
  color: var(--color-muted);
  margin-top: 3px;
  line-height: 1.45;
}

.menu-item-ingredients {
  font-size: 0.78rem;
  color: var(--color-muted);
  margin-top: 4px;
}

.menu-item-photo {
  width: 68px;
  height: 68px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
}

.menu-item-price {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-primary-dark);
  white-space: nowrap;
  align-self: flex-start;
}

.allergen-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--color-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 2px 9px 2px 7px;
  margin: 6px 6px 0 0;
}

.allergen-pill-icon {
  font-size: 0.9em;
  line-height: 1;
}

.badge-special {
  background: linear-gradient(135deg, #f7d68a, #e8a838);
  color: #6b4400;
}

.empty-state {
  text-align: center;
  color: var(--color-muted);
  padding: 56px 16px;
}

.empty-state-icon {
  font-size: 2.4rem;
  margin-bottom: 10px;
}

.empty-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* Allergeni */
.allergen-panel {
  padding: 6px 14px 10px;
  border-bottom: 1px solid var(--color-border);
}

.allergen-panel:last-child {
  border-bottom: none;
}

.allergen-panel summary {
  font-size: 0.8rem;
  color: var(--color-muted);
  cursor: pointer;
}

.allergen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 12px;
  margin-top: 8px;
}

.allergen-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
}

.filter-bar {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.filter-bar summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--color-text);
}

.order-type-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* Stato ordine (tracciamento lato cliente, con polling) — vive dentro .bottom-dock,
   insieme alla barra del carrello, così il cliente lo trova sempre nello stesso
   posto in basso allo schermo invece che in cima alla pagina. */
.order-status-card {
  padding: 16px 18px;
  border-bottom: 1px solid var(--color-border);
}

@keyframes order-status-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(179, 69, 46, 0.45);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(179, 69, 46, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(179, 69, 46, 0);
  }
}

.order-status-card.pulse {
  animation: order-status-pulse 1s ease-out;
}

.order-status-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.order-status-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.order-status-track {
  display: flex;
  justify-content: space-between;
  position: relative;
}

.order-status-track::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8%;
  right: 8%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.order-status-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  color: var(--color-muted);
  text-align: center;
}

.order-status-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
}

.order-status-step.done .order-status-dot {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.order-status-step.done {
  color: var(--color-text);
}

.order-status-step.current span {
  font-weight: 700;
  color: var(--color-primary-dark);
}

.order-status-card.cancelled .order-status-dot {
  border-color: var(--color-danger);
}

.order-status-total {
  margin-top: 12px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--color-text);
}

.order-status-payment {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-status-payment #order-status-pay-btn {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.payment-badge-pending {
  background: #fef3e2;
  color: #a15c00;
}

.payment-badge-paid {
  background: #e5f6e8;
  color: #237a3e;
}

.payment-badge-failed {
  background: #fdecea;
  color: var(--color-danger);
}

.payment-badge-refunded {
  background: #eef1f4;
  color: #5b6672;
}

.order-status-eta {
  margin-top: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.order-status-note {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--color-muted);
}

.order-status-staffnote {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--color-bg);
  font-size: 0.82rem;
  color: var(--color-text);
}

.order-status-card.cancelled .order-status-note {
  color: var(--color-danger);
  font-weight: 600;
}

/* Dividi il conto: utility di calcolo, indipendente dai colori di brand del locale */
.split-person-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.split-person-name {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  background: var(--color-surface);
  color: var(--color-text);
}

.split-person-remove {
  flex-shrink: 0;
}

.split-person-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.split-person-0 { background: #1a5fa8; }
.split-person-1 { background: #6a3fa0; }
.split-person-2 { background: #237a3e; }
.split-person-3 { background: #a15c00; }
.split-person-4 { background: #147d63; }
.split-person-5 { background: #a3175c; }

.split-item-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.split-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  min-width: 110px;
  text-align: left;
}

.split-chip-name {
  font-weight: 600;
}

.split-chip-price {
  font-size: 0.75rem;
  opacity: 0.85;
}

.split-chip-owner {
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 2px;
}

.split-chip-unassigned {
  background: #eef1f4;
  color: #5b6672;
}

.split-chip-shared {
  background: #e6e9fd;
  color: #3b4bcc;
}

.split-chip-person-0 { background: #e3f0fd; color: #1a5fa8; }
.split-chip-person-1 { background: #f0e7fb; color: #6a3fa0; }
.split-chip-person-2 { background: #e5f6e8; color: #237a3e; }
.split-chip-person-3 { background: #fef3e2; color: #a15c00; }
.split-chip-person-4 { background: #e0f5f0; color: #147d63; }
.split-chip-person-5 { background: #fde3ec; color: #a3175c; }

.split-totals-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.split-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
}

.split-total-row .split-person-swatch {
  margin-right: 6px;
}

.split-total-unassigned {
  color: var(--color-muted);
  border-bottom: none;
}

/* Selettore lingua */
.lang-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--color-surface);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 6px;
  margin: 0 0 20px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.lang-btn {
  background: transparent;
  color: var(--color-muted);
  border: none;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.lang-btn.active {
  background: var(--color-primary);
  color: #fff;
}

.menu-item-allergens {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 4px;
}

.menu-item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

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

.qty-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-primary-dark);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.qty-btn:hover {
  background: var(--color-bg);
}

.qty-btn:active {
  background: var(--color-border);
}

.qty-input {
  width: 40px;
  padding: 7px 4px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
  /* le frecce native del browser sono ridondanti con i pulsanti +/- */
  -moz-appearance: textfield;
  appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Modale "Come vuoi ricevere il tuo ordine?" — appare al tap su "Continua", non mentre si sfoglia il menu */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 15, 0.5);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.menu-item-photo.js-item-photo {
  cursor: pointer;
}

/* Anteprima a tutto schermo della foto del piatto, aperta al tap sulla miniatura */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.lightbox-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  padding: 4px 8px;
}

.modal {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.modal.open {
  transform: translateY(0);
}

.modal h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 800;
  padding-right: 28px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-muted);
  cursor: pointer;
  padding: 4px;
}

@media (min-width: 640px) {
  .modal {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: 90%;
    max-width: 440px;
    border-radius: 16px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -46%);
  }

  .modal.open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%);
  }
}

/* Riepilogo carrello — appare al tap su "Continua"/"Invia ordine", permette di aggiungere
   una nota per piatto (es. "senza cipolla") prima di procedere all'invio */
.cart-review-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.cart-review-item:last-child {
  border-bottom: none;
}

.cart-review-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
}

.cart-review-item-qty {
  color: var(--color-muted);
  font-weight: 700;
  flex-shrink: 0;
}

.cart-review-item-note {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--color-bg);
  color: var(--color-text);
}

/* Zona fissa in basso: card di stato ordine (se presente) + carrello, sempre nello stesso posto */
.bottom-dock {
  position: sticky;
  bottom: 0;
  z-index: 15;
  background: var(--color-surface);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
  border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.cart-bar {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-summary {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.cart-summary #cart-total {
  font-weight: 700;
  color: var(--color-text);
  font-size: 1rem;
}

#cart-submit {
  min-width: 140px;
}

#cart-submit:disabled {
  background: var(--color-border);
  color: var(--color-muted);
  cursor: not-allowed;
}

/* Comande */
.status-pending {
  background: #fef3e2;
  color: #a15c00;
}

.status-in_progress {
  background: #e3f0fd;
  color: #1a5fa8;
}

.status-served {
  background: #e5f6e8;
  color: #237a3e;
}

.status-cancelled {
  background: #fdecea;
  color: var(--color-danger);
}

.order-type-dine_in {
  background: #eee;
  color: #444;
}

.order-type-takeaway {
  background: #f0e7fb;
  color: #6a3fa0;
}

.order-type-delivery {
  background: #e0f5f0;
  color: #147d63;
}

.onboarding-page {
  background: var(--color-bg);
  min-height: 100vh;
}

.onboarding-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 32px 20px 24px;
  border-bottom: 1px solid var(--color-border);
}

.onboarding-logo {
  height: 26px;
  width: auto;
}

.onboarding-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 280px;
}

.onboarding-progress-bar {
  display: flex;
  gap: 6px;
  width: 100%;
}

.onboarding-progress-bar span {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--color-border);
}

.onboarding-progress-bar span.is-done {
  background: var(--color-primary);
}

.onboarding-progress-label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-muted);
}

.onboarding-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 40px;
}

.onboarding-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

.onboarding-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.onboarding-divider::before,
.onboarding-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.onboarding-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.onboarding-nav form {
  margin: 0;
}

@media (min-width: 640px) {
  .dash-container,
  .topbar-inner,
  .tabs {
    padding-left: 24px;
    padding-right: 24px;
  }
}

.guide-page {
  background: var(--color-bg);
  min-height: 100vh;
}

.guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border);
}

.guide-logo {
  height: 24px;
  width: auto;
}

.guide-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.guide-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

.guide-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 24px 0 44px;
  padding: 16px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.guide-toc a {
  font-size: 0.9rem;
  color: var(--color-primary);
  text-decoration: none;
}

.guide-toc a:hover {
  text-decoration: underline;
}

.guide-section {
  margin-bottom: 44px;
  scroll-margin-top: 16px;
  padding-top: 28px;
  border-top: 1px solid var(--color-border);
}

.guide-section:first-of-type {
  padding-top: 0;
  border-top: none;
}

.guide-section h2 {
  font-size: 1.4rem;
  margin: 0 0 12px;
}

.guide-section h3 {
  font-size: 1.05rem;
  margin: 22px 0 8px;
}

.guide-section p {
  line-height: 1.6;
}

.guide-shot {
  margin: 16px 0;
}

.guide-shot img {
  width: 100%;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}

.guide-shots {
  display: grid;
  gap: 16px;
  margin: 16px 0;
}

.guide-shots-2 {
  grid-template-columns: 1fr 1fr;
}

.guide-shots figure {
  margin: 0;
}

.guide-shots img {
  width: 100%;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}

.guide-shots figcaption {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: 6px;
}

@media (max-width: 640px) {
  .guide-shots-2 {
    grid-template-columns: 1fr;
  }
}

.guide-footer {
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-muted);
}
