/* Da fare: liste inset e fogli compatti, condivisi con il flusso Android. */
body.prep-screen { background: #f2f2f7; }
body.prep-screen #app { padding-bottom: 24px; min-width: 0; }
body.prep-screen #toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
.prep-v2 { max-width: 900px; margin: 0 auto; color: #202124; }
.prep-v2-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 4px; background: transparent; border: 0; }
.prep-v2-heading h1 { font-size: clamp(30px, 5vw, 40px); margin: 0; }
.prep-v2-heading p { color: #86868b; margin: 10px 0 0; }
.prep-v2-tools { display: flex; gap: 8px; }
.prep-v2-group { margin: 12px 0 24px; }
.prep-v2-group h2 { font-size: 13px; font-weight: 500; text-transform: uppercase; color: #86868b; margin: 0 8px 8px; letter-spacing: .03em; }
.prep-v2-card { background: white; border-radius: 18px; }
.prep-v2-row { display: flex; align-items: center; gap: 8px; min-height: 78px; padding: 12px 16px; position: relative; }
.prep-v2-row + .prep-v2-row::before { content: ''; position: absolute; left: 16px; right: 0; top: 0; border-top: 1px solid #e5e5ea; }
.prep-v2-row .grow { min-width: 0; flex: 1; }
.prep-v2-row b { font-size: 18px; overflow-wrap: anywhere; }
.prep-v2-row .meta { margin-top: 4px; color: #86868b; font-size: 15px; overflow-wrap: anywhere; }
.prep-v2-row button.prep-done { border: 1px solid #195542; color: #195542; background: white; border-radius: 50%; width: 48px; height: 48px; min-width: 48px; min-height: 48px; padding: 0; font-size: 13px; box-shadow: none; }
.prep-menu { position: relative; flex: none; margin: 0; }
.prep-menu > summary { list-style: none; cursor: pointer; color: #86868b; font-size: 24px; width: 32px; height: 32px; min-height: 32px; padding: 0; display: grid; place-items: center; border-radius: 12px; }
.prep-menu > summary::-webkit-details-marker { display: none; }
.prep-menu[open] > summary { background: #e8eee9; }
.prep-menu > div { position: absolute; right: 0; top: 100%; z-index: 20; width: min(280px, calc(100vw - 48px)); background: white; box-shadow: 0 8px 32px #0003; border-radius: 14px; padding: 6px; }
.prep-menu > div button { display: flex; text-align: left; width: 100%; background: white; border: 0; color: #202124; padding: 12px; box-shadow: none; }
.prep-menu > div button:hover { background: #f2f2f7; }
.prep-empty { text-align: center; color: #86868b; padding: 24px; }
body.prep-screen #dialog { max-width: 520px; width: calc(100% - 24px); border-radius: 24px; box-sizing: border-box; }
body.prep-screen #dialog form > .primary { width: 100%; background: #195542; border-radius: 12px; margin-top: 16px; }
.prep-date { border: 0; padding: 0; margin: 16px 0; min-width: 0; }
.prep-date legend { font-weight: 600; margin-bottom: 6px; }
.prep-date > div { display: flex; width: fit-content; max-width: 100%; background: #f2f2f7; border-radius: 10px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.prep-date > div label { display: block; position: relative; margin: 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: #86868b; }
.prep-date > div label:has(input:checked) { background: white; color: #195542; }
.prep-date input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.prep-date label:focus-within { outline: 2px solid #195542; }
body.prep-screen #dialog input[hidden] { display: none; }
body.prep-screen #dialog .number-control { max-width: 100%; }
@media (max-width: 480px) {
  body.prep-screen #app { padding-left: 12px; padding-right: 12px; }
  .prep-v2-row { padding: 12px; gap: 4px; }
  .prep-v2-row .prep-menu > summary { width: 32px; }
  .prep-v2-heading { gap: 4px; }
  body.prep-screen #dialog { max-height: calc(100dvh - 24px); overflow-y: auto; padding: 16px; }
}

.prep-date > label:has(input[hidden]), #preserve-form > label:has(input[hidden]) { display: none; }
body.prep-screen #dialog-body { min-width: 0; }
body.prep-screen #dialog .number-control input { min-width: 0; }
@media (max-width: 767px) {
  body.prep-screen #app { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
}

.prep-v2-row .prep-menu { margin-right: 4px; }
@media (max-width: 480px) {
  .prep-v2-row .prep-menu { margin-right: 8px; }
}
@media (max-width: 767px) {
  body.prep-screen .work-header { height: 52px; min-height: 0; max-height: 52px; padding: 4px 12px; }
  body.prep-screen .work-header .work-brand { gap: 8px; }
  body.prep-screen .work-header strong { font-size: 15px; }
  body.prep-screen .work-header .edition { font-size: 10px; margin-top: 1px; }
  body.prep-screen .work-header #account { min-height: 32px; padding: 4px 10px; }
}
/* Da fare a tendina */
.prep-group-fold > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 48px; cursor: pointer; padding: 0 8px; }
.prep-group-fold > summary::-webkit-details-marker { display: none; }
.prep-group-fold > summary h2 { margin: 0; font-size: 17px; text-transform: none; letter-spacing: 0; color: inherit; font-weight: 600; }
.prep-group-fold > summary .prep-fold-count { color: #86868b; font-size: 17px; }
.last-labels-day > summary { display: flex; justify-content: space-between; align-items: center; min-height: 48px; padding: 0 14px; cursor: pointer; list-style: none; }
.last-labels-day > summary::-webkit-details-marker { display: none; }
.last-labels-day + .last-labels-day { border-top: 1px solid var(--ios-line, #e5e5ea); }
.prep-group-fold > summary .prep-fold-count::after { content: "  ›"; display: inline-block; color: var(--ios-accent, #1f5b42); transition: transform .15s; }
.prep-group-fold[open] > summary .prep-fold-count::after { content: "  ⌄"; }

/* Barra fissa in cima a Da fare */
.prep-toolbar { position: sticky; top: 0; z-index: 12; background: var(--ios-bg, #f2f2f7); padding: 8px 0 10px; margin: 0 0 8px; display: grid; gap: 8px; }
.prep-toolbar-main { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prep-add-big { position: relative; }
.prep-add-big > summary, .prep-toolbar .prep-receipt-big { display: flex; align-items: center; justify-content: center; min-height: 58px; border-radius: 14px; font-size: 20px; font-weight: 800; list-style: none; cursor: pointer; }
.prep-add-big > summary { background: var(--ios-accent, #1f5b42); color: #fff; }
.prep-add-big > summary::-webkit-details-marker { display: none; }
.prep-add-big > summary::after { content: none !important; }
.prep-add-big > div { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; gap: 6px; padding: 10px; background: #fff; border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.prep-add-big > div button { min-height: 50px; font-size: 17px; justify-content: flex-start; }
.prep-toolbar .prep-receipt-big { background: #fff; color: var(--ios-accent, #1f5b42); border: 2px solid var(--ios-accent, #1f5b42); }
.prep-toolbar-more { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.prep-toolbar-more button { flex: 0 0 auto; min-height: 44px; white-space: nowrap; font-size: 15px; }
@media (min-width: 768px) { .prep-toolbar-more { flex-wrap: wrap; overflow: visible; } }
.prep-toolbar .prep-add-big { width: 100%; }
.prep-toolbar .prep-add-big > summary { width: 100% !important; height: auto !important; min-height: 58px !important; padding: 0 16px !important; display: flex !important; color: #fff !important; background: var(--ios-accent, #1f5b42) !important; border-radius: 14px !important; font-size: 20px !important; font-weight: 800 !important; }
.prep-toolbar .prep-add-big[open] > summary { background: #174634 !important; }
.prep-toolbar .prep-add-big > div { right: auto; width: auto; }

.last-label-title { color: var(--ios-text, #1c1c1e); font-size: 18px; line-height: 1.4; overflow-wrap: anywhere; }
.last-label-title b, .last-label-title .last-label-type { font-size: 18px; font-weight: 700; }
.last-labels-day .prep-v2-row > button { flex-shrink: 0; }
