/* ---------- modifica di piatti e categorie ---------- */
.btn .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.edit-form { display: flex; flex-direction: column; gap: 16px; }
.edit-form > * { flex-shrink: 0; }

.edit-pane { display: flex; flex-direction: column; gap: 14px; }
.edit-pane[hidden] { display: none; }
.edit-warn { margin: -6px 0 0; font-size: 0.8125rem; color: var(--warn); }
.field-hint { font-size: 0.8125rem; font-weight: 400; color: var(--muted); }

/* editor della descrizione: barra con grassetto, corsivo, elenco */
.rte { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.rte:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.rte-bar { display: flex; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.rte-bar button {
  width: var(--tap); height: var(--tap); display: grid; place-items: center; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); font: inherit; font-size: 1.0625rem; cursor: pointer;
}
.rte-bar button:hover { background: var(--surface-3); color: var(--text); }
.rte-bar button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.rte-bar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.rte-bar svg circle { fill: currentColor; stroke: none; }
.rte-area {
  min-height: 120px; max-height: 40dvh; overflow-y: auto; padding: 10px 12px;
  font-size: max(16px, 1rem); font-weight: 400; line-height: 1.5; color: var(--text); outline: none; overflow-wrap: anywhere;
}
.rte-area p { margin: 0 0 .6em; }
.rte-area p:last-child { margin-bottom: 0; }
.rte-area ul, .rte-area ol { margin: 0 0 .6em; padding-left: 1.3em; }

.edit-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.edit-price { flex: 1 1 140px; }
.edit-switch { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-size: 0.875rem; font-weight: 600; color: var(--text-2); cursor: pointer; }

/* categorie del piatto: albero con caselle, stessa gerarchia della vista Categorie */
.edit-cats { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
.edit-cats legend { padding: 0; margin-bottom: 2px; font-size: 0.875rem; font-weight: 600; color: var(--text-2); }
.cat-pick { list-style: none; margin: 0; padding: 4px 0; border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 46dvh; overflow-y: auto; }
.cat-pick label { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 4px 12px 4px calc(12px + var(--depth, 0) * 22px); cursor: pointer; font-size: 0.9375rem; }
.cat-pick label:hover { background: var(--surface-2); }
.cat-pick input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--accent); }
.cat-pick [data-depth="0"] { font-weight: 700; }
.cat-pick [data-depth="0"]:not(:first-child) { border-top: 1px solid var(--line); }
.cat-pick [data-depth="2"] label { font-size: 0.875rem; color: var(--text-2); }

/* Sezioni "Dove compare", "Orari di visibilità", "Allergeni" (piatto e categoria) */
.edit-block { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0; padding: 4px 12px 12px; display: grid; gap: 8px; min-width: 0; }
.edit-block[hidden] { display: none; }
.edit-block legend { padding: 0 4px; font-size: 0.875rem; font-weight: 600; color: var(--text-2); }
.edit-block .edit-switch { justify-content: space-between; color: var(--text); font-weight: 500; font-size: 0.9375rem; }
.edit-block .edit-row > .field { flex: 1 1 120px; }
.sched-body { display: grid; gap: 10px; }
.sched-body[hidden] { display: none; }
/* 7 giorni: 4 per riga a 320 px, tutti in fila da 390 px in su; ogni giorno è un bersaglio da 44 px */
.day-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
@media (min-width: 380px) { .day-pick { grid-template-columns: repeat(7, 1fr); } }
.day { position: relative; display: grid; place-items: center; min-height: var(--tap); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 600; cursor: pointer; user-select: none; }
.day input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.day:has(input:checked) { background: var(--text); color: var(--bg); border-color: var(--text); }
.day:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.allergen-pick { max-height: none; columns: 2 150px; column-gap: 0; }
.allergen-pick li { break-inside: avoid; }

/* Foto del piatto (in cima alla modifica): attuale, ottimizzazione, prima/dopo */
#edit-photo-body { display: grid; gap: 10px; min-width: 0; }
.photo-now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.photo-now img, .photo-ph { width: 72px; height: 72px; flex: none; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface-2); }
.photo-ph { display: grid; place-items: center; color: var(--muted); }
.photo-ph svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.photo-now b { display: block; font-size: 0.9375rem; color: var(--text); }
.photo-now small { font-size: 0.8125rem; color: var(--muted); }
.photo-pick { position: relative; }
.photo-pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-busy { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-size: 0.9375rem; font-weight: 500; color: var(--text); }
.photo-new { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.photo-new img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.photo-badge { position: absolute; left: 8px; top: 8px; background: var(--ok); color: #fff; font-size: 0.75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.photo-compare { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.photo-compare > div { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; min-width: 0; }
.photo-compare > .after { border-color: var(--ok); background: var(--ok-soft); }
.photo-compare dt { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.photo-compare dd { margin: 2px 0 0; font-size: 0.875rem; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.photo-gain { margin: 0; font-size: 0.9375rem; font-weight: 700; color: var(--ok); }
.photo-gain.none { color: var(--muted); font-weight: 500; }
.photo-warn { font-size: 0.8125rem; color: var(--warn); background: var(--warn-soft); border-radius: var(--radius-sm); padding: 8px 10px; margin: 0; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-actions > * { flex: 1 1 140px; }

/* Salva/Annulla sempre a portata di pollice, in fondo al pannello */
.edit-foot {
  position: sticky; bottom: -16px; margin: 0 -16px -16px; padding: 12px 16px; /* la barra Home la rispetta già il pannello */
  display: flex; justify-content: flex-end; gap: 10px; background: var(--surface); border-top: 1px solid var(--line);
}
.edit-foot .btn { min-width: 110px; }
@media (max-width: 420px) { .edit-foot .btn { flex: 1; } }
/* ricerca in prenotazioni e ordini */
.list-search { margin: 0 0 10px; }

/* nome della categoria: tutto toccabile per modificarla, con una piccola matita come segnale */
button.cat-text {
  border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
  min-height: var(--tap); border-radius: 8px; padding: 4px 6px; margin-left: -6px;
}
button.cat-text:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cat-meta .ico-edit { width: 12px; height: 12px; margin-left: 6px; vertical-align: -1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* lettura incompleta da FW360 */
.load-warn { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 0.875rem; }
.load-warn p { margin: 0; flex: 1 1 200px; }
