/* iPad: visual overrides only; existing actions retain their payloads. */
body.banco-app { --ios-bg: #f2f2f7; --ios-card: #fff; --ios-text: #202124; --ios-muted: #86868b; --ios-line: #e5e5ea; --ios-accent: #195542; }
body[data-view=line] .voice-tap { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: 180px; z-index: 33; display: grid; place-items: center; width: 56px; height: 56px; min-height: 56px; padding: 0; border: 0; border-radius: 50%; background: var(--ios-accent); color: var(--ios-primary-text, #fff); box-shadow: 0 3px 12px #0003; }
.voice-tap.listening { animation: voice-pulse 1s ease-in-out infinite; }
@keyframes voice-pulse { 50% { box-shadow: 0 0 0 10px #7fc79f55; transform: scale(1.06); } }
.voice-choices { display: grid; gap: 12px; }
.voice-choices button { min-height: 60px; font-size: 20px; }
#toast button { border: 0; padding: 8px; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; }
body[data-view=line] #toast { z-index: 34; }
@media (prefers-reduced-motion: reduce) { .voice-tap.listening { animation: none; outline: 4px solid #7fc79f; } }
body.banco-app.authenticated { background: var(--ios-bg); color: var(--ios-text); }
.banco-app #app { min-width: 0; box-sizing: border-box; }
.banco-app .work-header { min-height: 52px; padding: 8px 16px; background: var(--ios-card); }
.banco-app .work-header strong { font-size: 16px; }
.banco-app .work-header .edition { font-size: 10px; }
.banco-app #nav a, .banco-app #nav .nav-more { font-size: 11px; color: var(--ios-muted); }
.banco-app.authenticated #nav a.active, .banco-app #nav .nav-more.active { background: transparent !important; color: var(--ios-accent) !important; }
.banco-app #nav .b-icon { stroke-width: 1.7; }
.banco-app .workspace-heading h1 { font-size: 30px; }
body[data-view=line] .service-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
body[data-view=line] .service-grid .product-tile { min-width: 0; background: var(--ios-card); box-shadow: none; border: 0; border-radius: 16px; overflow: hidden; }
body[data-view=line] .service-grid .tap { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; position: relative; width: 100%; min-height: 166px; height: auto; padding: 38px 14px 14px; background: var(--ios-card); color: var(--ios-text); border: 0; box-shadow: none; text-align: left; }
body[data-view=line] .tile-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 42px; }
body[data-view=line] .service-grid .tap .name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font-size: 17px !important; font-weight: 600; line-height: 1.25; color: var(--ios-text); text-align: left; min-width: 0; }
body[data-view=line] .service-grid .tap img { width: 40px !important; height: 40px !important; flex: 0 0 40px; object-fit: cover; border-radius: 10px; margin: 0; position: static; }
body[data-view=line] .service-grid .stock { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 10px; }
body[data-view=line] .service-grid .fresh-count { font-size: 30px !important; font-weight: 600; line-height: 1.1; color: var(--ios-text); background: transparent; padding: 0; }
body[data-view=line] .service-grid .stock-unit { font-size: 15px; font-weight: 400; color: var(--ios-muted); }
body[data-view=line] .service-grid .freezer-count { position: absolute; right: 14px; top: 12px; color: var(--ios-muted); font-size: 13px !important; font-weight: 400; background: transparent; padding: 0; }
body[data-view=line] .service-grid .portion { width: 100%; min-height: 36px; padding: 8px 4px; font-size: 11px; background: var(--ios-card) !important; color: var(--ios-accent); border-top: 1px solid var(--ios-line); border-radius: 0; }
body[data-view=line] .service-grid > .notice { grid-column: 1 / -1; }
body[data-view=line] .service-ready { border: 0; flex-direction: column; align-items: stretch; text-align: center; padding: 32px 0 12px; }
body[data-view=line] .start-service { width: 100%; min-height: 58px; border-radius: 16px; }
body[data-view=line] .service-shortcuts a { color: var(--ios-accent); border-color: var(--ios-line); }
body[data-view=line] .service-bar { background: var(--ios-card); border-color: var(--ios-line); }
body[data-view=line] .service-bar button { border-radius: 12px; color: var(--ios-accent); background: var(--ios-bg); }
.ios-stock-group { margin: 20px 0; }
.ios-stock-group h2 { font-size: 13px; text-transform: uppercase; font-weight: 500; color: var(--ios-muted); margin: 0 8px 8px; }
.ios-stock-card { border-radius: 16px; overflow: hidden; background: var(--ios-card); }
.ios-stock-item { margin: 0; padding: 0; border: 0; background: transparent; }
.ios-stock-item + .ios-stock-item { border-top: 1px solid var(--ios-line); }
.ios-stock-item summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; padding: 12px 16px; list-style: none; cursor: pointer; }
.ios-stock-item summary::-webkit-details-marker { display: none; }
.ios-stock-item summary b { font-size: 17px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.ios-stock-item summary > span { flex-shrink: 0; font-size: 16px; font-variant-numeric: tabular-nums; }
.ios-stock-detail { padding: 0 16px 16px; }
.ios-stock-detail p { color: var(--ios-muted); font-size: 14px; }
.ios-stock-item summary::after { content: none; }
.ios-stock-item .stock-row { padding: 12px 16px; }
.ios-stock-detail, .ios-stock-detail p, .inventory-read { overflow-wrap: anywhere; }
.ios-stock-detail .reserve-count { display: flex; justify-content: space-between; margin: 8px 0; }
.ios-stock-detail .reserve-count > div { background: var(--ios-bg); }
body[data-view=inventory] .stock-row { grid-template-columns: minmax(0,1fr); }
body[data-view=inventory] .stock-row label { min-width: 0; }
body[data-view=inventory] .workspace-heading { align-items: center; }
body[data-view=inventory] .workspace-heading button { background: transparent !important; color: var(--ios-accent); font-size: 13px; padding: 8px; }
@media (min-width: 768px) {
  body[data-view=line] .service-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
/* Barra in alto solo sugli schermi medi: sopra i 1100 px il menu e' la colonna fissa a sinistra (approved-ui.css). */
@media (min-width: 768px) and (max-width: 1099px) {
  .banco-app.authenticated #nav { position: sticky !important; top: 0 !important; background: var(--ios-card) !important; }
  .banco-app.authenticated #nav a { flex-direction: column; font-size: 11px; gap: 4px; }
}
@media (min-width: 1000px) {
  body[data-view=line] .service-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media (max-width: 767px) {
  .banco-app.authenticated #nav { background: var(--ios-card) !important; }
  .banco-app .service-bar { grid-template-columns: 1fr 1fr; }
  .banco-app .service-bar button[data-action=fullscreen] { grid-column: 1 / -1; min-height: 32px; }
  body[data-view=line] #app { padding-bottom: calc(210px + env(safe-area-inset-bottom)); }
  body[data-view=inventory] .workspace-heading h1 { font-size: 28px; }
}
@media (prefers-color-scheme: dark) and (max-width: 0px) {
  body.banco-app { color-scheme: dark; --ios-bg: #000; --ios-card: #1c1c1e; --ios-text: #f2f2f7; --ios-muted: #98989f; --ios-line: #38383a; --ios-accent: #7fc79f; }
  body.banco-app.prep-screen { background: var(--ios-bg); }
  .banco-app :is(.prep-v2,.prep-v2-row,.work-header,.service-heading) { color: var(--ios-text); }
  .banco-app :is(.card,.prep-v2-card,.prep-menu > div,dialog,.navigation-sheet) { background: var(--ios-card); color: var(--ios-text); border-color: var(--ios-line); }
  .banco-app :is(.muted,.meta,.service-ready p,.prep-v2-heading p,.prep-v2-group h2) { color: var(--ios-muted); }
  .banco-app :is(.prep-menu > div button,.prep-v2-row button.prep-done) { background: var(--ios-card); color: var(--ios-accent); border-color: var(--ios-accent); }
  .banco-app .prep-v2-row + .prep-v2-row::before { border-color: var(--ios-line); }
  .banco-app :is(input,select,textarea,.number-control,.prep-date > div) { background: #2c2c2e; color: var(--ios-text); border-color: var(--ios-line); }
  .banco-app :is(.number-control button,.quiet,.service-shortcuts a .b-icon) { color: var(--ios-accent); }
  .banco-app :is(.primary,.button.primary,.bar button.primary),body.prep-screen #dialog form > .primary { background: var(--ios-accent) !important; color: #123d2c; }
  .banco-app :is(.prep-date > div label:has(input:checked),.prep-menu[open] > summary,.prep-menu > div button:hover) { background: #2c2c2e; color: var(--ios-accent); }
  .banco-app .inventory-history { border-color: var(--ios-line); }
  .banco-app :is(.dialog-head,.service-heading,.notice) { background: var(--ios-card); color: var(--ios-text); border-color: var(--ios-line); }
  .banco-app :is(.ios-stock-detail button,.service-heading button) { color: var(--ios-accent); background: var(--ios-card); border-color: var(--ios-line); }
  .banco-app .navigation-destinations a { color: var(--ios-text); }
  .banco-app #toast { background: var(--ios-card); color: var(--ios-text); }
}

/* Pulsante principale della barra Servizio sempre leggibile (Claude) */
body[data-view=line] .service-bar button.primary { background: #194e38 !important; color: #fff !important; }
@media (prefers-color-scheme: dark) and (max-width: 0px) { body[data-view=line] .service-bar button.primary { background: #7fc79f !important; color: #0b2a1d !important; } }

/* Prodotti, Impostazioni e fogli: presentation only. */
body.banco-app { --ios-accent: #194e38; --ios-primary-text: #fff; --ios-ready-bg: #e8f3ec; --ios-attention: #895000; --ios-attention-bg: #fff2df; }
body[data-view=targets] .target-cards { display: block; background: var(--ios-card); border-radius: 16px; overflow: hidden; }
body[data-view=targets] .target-card { border: 0; border-radius: 0; margin: 0; background: var(--ios-card); }
body[data-view=targets] .target-card + .target-card { border-top: 1px solid var(--ios-line); }
body[data-view=targets] .target-card > summary { display: flex; align-items: center; gap: 12px; list-style: none; min-height: 72px; }
body[data-view=targets] .target-card > summary::-webkit-details-marker { display: none; }
body[data-view=targets] .target-card > summary::after { content: '›'; color: var(--ios-muted); font-size: 24px; flex: none; }
body[data-view=targets] .target-card[open] > summary::after { transform: rotate(90deg); }
body[data-view=targets] .product-summary-copy { flex: 1; min-width: 0; overflow-wrap: anywhere; }
body[data-view=targets] .product-summary-copy strong { font-size: 17px; font-weight: 600; color: var(--ios-text); }
body[data-view=targets] .product-summary-copy small { display: block; margin-top: 4px; color: var(--ios-muted); font-size: 13px; }
body[data-view=targets] .target-card summary .target-status { margin: 0; padding: 5px 8px; border-radius: 8px; max-width: 120px; font-size: 12px; font-weight: 500; color: var(--ios-muted); background: var(--ios-bg); }
body[data-view=targets] .target-status[data-state=ready] { color: var(--ios-accent) !important; background: var(--ios-ready-bg) !important; }
body[data-view=targets] .target-status[data-state=attention] { color: var(--ios-attention) !important; background: var(--ios-attention-bg) !important; }
.banco-app :is(.target-content,.product-group,.product-flags) { background: var(--ios-card); color: var(--ios-text); }
.banco-app .product-group .product-flags { background: var(--ios-card); }
.banco-app .target-content { background: var(--ios-bg); padding: 16px; }
.banco-app .product-group { min-width: 0; padding: 16px; border-radius: 14px; }
.banco-app .product-group legend { color: var(--ios-muted); font-size: 13px; font-weight: 600; }
.banco-app :is(.product-flags label,.daily-targets label) { border-color: var(--ios-line); }
.banco-app :is(.product-flags,.daily-targets) { grid-template-columns: minmax(0,1fr); }
.banco-app .product-flags .check { overflow-wrap: anywhere; }
.banco-app .unified-product-form > .actions > .primary { width: 100%; min-height: 56px; border-radius: 14px; font-size: 17px; }
body[data-view=settings] .ios-settings-group { margin: 24px 0; }
body[data-view=settings] .ios-settings-group > h2 { margin: 0 16px 8px; font-size: 13px; font-weight: 500; text-transform: uppercase; color: var(--ios-muted); }
body[data-view=settings] .ios-settings-inset { border-radius: 16px; overflow: hidden; background: var(--ios-card); }
body[data-view=settings] .compact-settings { margin: 0; padding: 16px; border-radius: 0; background: var(--ios-card); color: var(--ios-text); }
body[data-view=settings] .compact-settings + .compact-settings { border-top: 1px solid var(--ios-line); }
body[data-view=settings] .compact-settings h2 { font-size: 15px; color: var(--ios-muted); }
body[data-view=settings] .compact-settings :is(p,small) { color: var(--ios-muted); overflow-wrap: anywhere; }
body[data-view=settings] .settings-buttons { display: flex; flex-direction: column; background: transparent; margin: 0; border-radius: 0; }
body[data-view=settings] .compact-settings :is(button,a.button),body[data-view=settings] .ios-data-row :is(summary,a) { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 52px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--ios-line); border-radius: 0; background: var(--ios-card); color: var(--ios-accent); text-decoration: none; text-align: left; font-size: 16px; font-weight: 400; overflow-wrap: anywhere; }
body[data-view=settings] .compact-settings :is(button,a.button)::after,body[data-view=settings] .ios-data-row :is(summary,a)::after { content: '›'; margin-left: auto; color: var(--ios-muted); font-size: 24px; flex: none; }
body[data-view=settings] .compact-settings button.primary { padding: 12px; border-radius: 12px; margin: 8px 0; }
body[data-view=settings] .compact-settings button.primary::after { color: inherit; }
body[data-view=settings] .ios-data-row { margin: 0; padding: 0 16px; }
body[data-view=settings] .ios-data-row summary { list-style: none; color: var(--ios-text); }
body[data-view=settings] .ios-data-row summary::-webkit-details-marker { display: none; }
.banco-app #dialog { width: calc(100% - 24px); max-width: 680px; box-sizing: border-box; background: var(--ios-bg); color: var(--ios-text); }
.banco-app #dialog .dialog-head { display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; gap: 6px; background: var(--ios-bg); border-bottom: 1px solid var(--ios-line); padding: 14px 16px; }
.banco-app #dialog-title { grid-column: 2; text-align: center; font-size: 18px; overflow-wrap: anywhere; }
.banco-app #dismiss { grid-column: 3; padding: 0; color: var(--ios-accent); background: transparent; }
.banco-app #dialog-body { min-width: 0; overflow-wrap: anywhere; }
.banco-app #dialog-body :is(.muted,small,.meta) { color: var(--ios-muted); }
.banco-app #dialog :is(form > .primary,.actions > .primary,.label-controls > .primary,.receipt-controls > .primary) { width: 100%; min-height: 54px; border-radius: 14px; margin-top: 12px; font-size: 17px; }
.banco-app :is(.unified-product-form,#dialog-body) :is(input,select,textarea) { min-width: 0; background: var(--ios-card); color: var(--ios-text); border-color: var(--ios-line); }
.banco-app :is(.unified-product-form,#dialog-body) .pair { grid-template-columns: repeat(2,minmax(0,1fr)); }
.banco-app :is(.unified-product-form,#dialog-body) :is(label,fieldset,.actions,.grow) { min-width: 0; }
.banco-app #dialog :is(.freeze-options,.label-part,.receipt-part,.notice) { background: var(--ios-card); color: var(--ios-text); border-color: var(--ios-line); }
/* Keep these after all contextual button rules, including the service bar. */
body.banco-app :is(button.primary,a.button.primary),body.banco-app.prep-screen #dialog form > .primary { background: var(--ios-accent) !important; color: var(--ios-primary-text) !important; }
@media (max-width: 600px) {
  body[data-view=targets] .intro { flex-wrap: wrap; }
  body[data-view=targets] .intro > button { width: 100%; }
  .banco-app :is(.unified-product-form,#dialog-body) .pair { grid-template-columns: minmax(0,1fr); }
  .banco-app .day-row { grid-template-columns: minmax(0,1fr) minmax(0,156px); }
  .banco-app #dialog .freeze-options { flex-wrap: wrap; }
  .banco-app #dialog { width: 100%; max-width: 100%; }
  body[data-view=targets] .target-card summary .target-status { max-width: 94px; }
}
@media (prefers-color-scheme: dark) and (max-width: 0px) {
  body.banco-app { --ios-accent: #7fc79f; --ios-primary-text: #0b2a1d; --ios-ready-bg: #203c2e; --ios-attention: #f3bc70; --ios-attention-bg: #3a2d1c; }
  .banco-app :is(.target-card summary:active,.settings-buttons button:hover) { background: #2c2c2e; }
  .banco-app :is(.unified-product-form,#dialog-body) :is(input,select,textarea) { background: #2c2c2e; }
  .banco-app input[type=checkbox] { background: #48484a; }
  .banco-app input[type=checkbox]:checked { background: var(--ios-accent); }
  .banco-app :is(.product-group,.ios-settings-group,#dialog-body) .muted { color: var(--ios-muted); }
}

body[data-view=line] .service-grid { display: block; padding-right: 28px; }
.service-letter-group { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 10px; margin-bottom: 18px; scroll-margin-top: 90px; }
.service-letter-group h2 { font-size: 32px; font-weight: 800; margin: 8px 0; }
.service-letter-group + .service-letter-group { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--ios-line); }
.service-letter-tiles { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.service-letter-index { position: fixed; right: 2px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; max-height: 65%; overflow-y: auto; z-index: 15; } /* % e non vh: nella WebView Android vh può valere 0 */
.service-letter-index button { min-height: 24px; padding: 3px 7px; font-size: 14px; color: var(--ios-accent); background: var(--ios-card); }
@media(min-width:700px) { .service-letter-tiles { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media(min-width:1100px) { .service-letter-tiles { grid-template-columns: repeat(4,minmax(0,1fr)); } }
/* Native SPA sections: the outer header and adaptive #nav remain in place. */
.native-section { display:block; min-width:0; width:100%; }
:host { display:block; min-width:0; color:#202124; background:transparent; font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; --green:#195542; --muted:#86868b; --line:#e5e5ea; --cream:#f2f2f7; }
:host .section-body { margin:0; background:transparent; color:inherit; font-family:inherit; }
:host .section-body main, :host .shopping-section .main { margin:0; padding:16px 0 32px; max-width:none; }
:host .section-body header { position:static; padding:0; border:0; background:transparent; display:flex; justify-content:flex-end; min-height:44px; }
:host .section-body header .brand, :host .section-body .local-status { display:none; }
:host .section-body footer { margin:16px 0; padding:12px 0; border-top:1px solid #e5e5ea; flex-wrap:wrap; }
:host h1, :host h2, :host h3, :host .supplier-card h2 { font-family:inherit; letter-spacing:normal; }
:host h1 { font-size:28px; font-weight:700; }
:host .intro, :host .pagehead { margin:16px 0 24px; }
:host .card, :host .panel, :host .supplier-card, :host .recipe-card { border-radius:16px; background:white; border:1px solid #e5e5ea; box-shadow:none; }
:host .shopping-tabs { display:flex; gap:8px; flex-wrap:wrap; margin:8px 0; }
:host .shopping-tabs button { min-height:44px; padding:8px 12px; border-radius:12px; background:white; color:#195542; border:1px solid #e5e5ea; }
:host .shopping-tabs button.active { color:white; background:#195542; }
:host button, :host input, :host select { font-family:inherit; }
:host input, :host select, :host textarea { max-width:100%; }
:host .toolbar, :host .filters, :host .pagehead { flex-wrap:wrap; }
:host .product-info { min-width:0; overflow-wrap:anywhere; }
:host dialog { width:min(900px,calc(100vw - 24px)); max-height:90dvh; border:1px solid #e5e5ea; border-radius:18px; background:white; color:#202124; }
@media(max-width:600px){
 :host .supplier-grid { grid-template-columns:1fr; }
 :host .main { padding:12px 0 24px; }
 :host .pagehead { align-items:flex-start; }
 :host h1 { font-size:26px; }
 :host .row { flex-wrap:wrap; }
 :host .row-actions { flex-wrap:wrap; }
 :host input, :host select, :host textarea { font-size:16px; }
}
/* Controllo linea raggruppato per lettera: le sezioni occupano tutta la riga, le tessere stanno nella griglia interna. */
body[data-view=control] .control-grid { display: block; padding-right: 28px; }
body[data-view=control] .control-grid .service-letter-tiles .product-tile { min-width: 0; }
/* Service entry, control sheets and read-only action history. */
.service-shortcuts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.service-shortcuts>a{box-sizing:border-box;min-height:100px;padding:16px;border:1px solid var(--ios-line,#dce3dd);border-radius:18px;background:var(--ios-surface,#fff);font-size:16px;line-height:1.35;flex-wrap:wrap}
.service-shortcuts>a span{flex:1;min-width:0}
.service-shortcuts>a .b-icon:last-child{display:none}
#control-choice-form,.action-history,.actions-day,#control-next-form{font-size:16px}
#control-choice-form button,#control-next-form button,.action-history-row button,.actions-day~button,[data-action=control-cancel]{min-height:48px;font-size:16px}
#control-choice-form select,#control-choice-form summary,.actions-day>summary{min-height:48px;font-size:16px}
#control-choice-form label,body[data-view=azioni] #app{font-size:16px}
body[data-view=control] .service-bar button,body[data-view=control] #dialog button{min-height:48px;font-size:16px}
body[data-view=control] .control-grid .name,body[data-view=control] .control-choice,body[data-view=control] .list-filters label{font-size:16px}
#control-choice-form small{display:block;font-size:16px;line-height:1.4}
#control-choice-form .control-answer{flex-wrap:wrap;font-size:18px}
#control-choice-form .control-answer small{flex-basis:100%;padding-left:36px}
#control-next-form button{width:100%;margin:16px 0}
.action-history-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 0;border-bottom:1px solid var(--ios-line,#dce3dd);overflow-wrap:anywhere}
.action-history-row>div,.action-history-row>span{min-width:0;flex:1}
.action-history-row p{margin:6px 0;font-size:16px}
.action-history h2{font-size:20px}
@media(min-width:768px){.service-shortcuts{grid-template-columns:repeat(4,minmax(0,1fr))}}
/* Controllo linea: nome prodotto grande nel foglio */
.control-product-name { font-size: 26px; font-weight: 700; line-height: 1.2; margin: 0 0 2px; }
.control-auto { font-size: 16px; padding: 12px 14px; border-radius: 12px; background: var(--ios-card, #fff); margin: 8px 0; }

.control-done .control-choice{color:#16803c!important;font-weight:700}
.actions-day summary{min-height:48px;display:flex;align-items:center;font-size:16px;cursor:pointer}
.actions-day .action-history,.actions-day .action-service{margin:8px 0;padding-left:12px}

.actions-day button,.action-history summary,.action-service summary,#control-choice-form button{min-height:48px;font-size:16px}.action-history-row{flex-wrap:wrap;font-size:16px}.control-product-name{font-size:28px}.action-history-row del{opacity:.65}

#control-choice-form small,#control-choice-form summary,#control-choice-form select,.actions-day small{font-size:16px}#control-choice-form select{min-height:48px}
/* Telefoni: Controllo linea compatto, 3 tessere per fila e niente foto */
@media (max-width: 599px) {
  body[data-view=control] .control-grid .service-letter-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  body[data-view=control] .control-tile img { display: none; }
  body[data-view=control] .control-tile { min-height: 0; padding: 10px 6px; gap: 6px; }
  body[data-view=control] .control-tile .name { font-size: 15px; line-height: 1.2; }
  body[data-view=control] .control-tile .control-choice { font-size: 13px; padding: 4px 6px; }
  body[data-view=control] .service-letter-group { grid-template-columns: 26px minmax(0, 1fr); gap: 6px; }
  body[data-view=control] .service-letter-group h2 { font-size: 24px; }
}
/* Dentro l app Android: niente intestazione web doppia */
body.in-android > header.work-header { display: none; }
@media (max-width: 599px) {
  body[data-view=control] .control-grid { padding-right: 40px; }
  body[data-view=control] .control-tile .name, body[data-view=control] .control-tile .name-word { font-size: 15px !important; }
}
@media (max-width: 599px) {
  body[data-view=control] .control-tile .name, body[data-view=control] .control-tile .name-word { font-size: 14px !important; }
  body[data-view=control] .control-tile .name-word { white-space: normal !important; overflow-wrap: anywhere !important; }
  body[data-view=control] .control-tile .control-choice { font-size: 12px !important; line-height: 1.2; }
}
@media (max-width: 599px) {
  body[data-view=control] .control-tile { padding: 8px 2px !important; }
  body[data-view=control] .control-tile .name, body[data-view=control] .control-tile .name-word { font-size: 13px !important; letter-spacing: -0.1px; }
  body[data-view=control] .control-grid .service-letter-tiles { gap: 6px; }
  body[data-view=control] .control-grid { padding-right: 34px; }
}

/* Product display preferences, scoped to Service and its live preview. */
.service-grid { --service-auto-columns: 3; }
body[data-view=line] .service-grid .service-letter-tiles,
#dialog .display-preview .service-letter-tiles { grid-template-columns: repeat(var(--service-phone-columns,3),minmax(0,1fr)); gap: 8px; }
body[data-view=line] .service-grid .product-tile,
#dialog .display-preview .product-tile { border-left: 5px solid var(--category-border,transparent); min-width: 0; }
body[data-view=line] .service-grid .tap,
#dialog .display-preview .tap { min-height: 148px; padding: 12px 8px; height: auto; }
body[data-view=line] .service-grid.size-small .tap,
#dialog .display-preview.size-small .tap { min-height: 120px; }
body[data-view=line] .service-grid.size-large .tap,
#dialog .display-preview.size-large .tap { min-height: 184px; }
body[data-view=line] .service-grid .tap .name,
#dialog .display-preview .tap .name { font-size: var(--product-name-size,18px) !important; display: block; overflow: visible; overflow-wrap: anywhere; line-height: 1.25; }
body[data-view=line] .service-grid .fresh-count,
#dialog .display-preview .fresh-count { font-size: var(--product-stock-size,16px) !important; }
body[data-view=line] .service-grid .tap img,
#dialog .display-preview .tap img { width: var(--product-image-size,44px) !important; height: var(--product-image-size,44px) !important; max-width: 100%; flex: 0 1 auto; }
body[data-view=line] .service-grid .tile-title,
#dialog .display-preview .tile-title { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
body[data-view=line] .service-grid .freezer-count,
#dialog .display-preview .freezer-count { position: static; font-size: var(--product-stock-size,16px) !important; }
body[data-view=line] .service-grid .portion,
#dialog .display-preview .portion { min-height: 48px; font-size: 12px; white-space: normal; }
.service-grid.photos-no .tap img,
.service-grid.hide-freezer .freezer-count { display: none !important; }
.display-controls button,.display-controls select,.display-controls input:not([type=checkbox]),
#display-grid button,#display-grid .display-toggle { min-height: 48px; }
.display-toggle { display: flex; align-items: center; gap: 10px; min-height: 48px; cursor: pointer; }
.display-toggle input { width: 24px; height: 24px; flex: 0 0 24px; }
.display-product-controls { display: flex; flex-direction: column; gap: 4px; padding: 4px; }
#dialog #display-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
#dialog #display-grid .display-tile { min-width: 0; }
#dialog #display-grid .drag-handle { min-width: 48px; position: static; }
#dialog .display-preview .tap { width: 100%; text-align: left; display: flex; flex-direction: column; align-items: stretch; cursor: default; }
#dialog .display-preview .stock { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 10px; }
#dialog .display-preview .name { white-space: normal; }
#dialog .display-preview { display: block; }
body[data-view=line] .service-grid .name-word,
#dialog .display-preview .name-word { display: inline; white-space: normal; overflow-wrap: anywhere; }
#dialog #display-grid button { white-space: normal; }
#dialog #display-grid .display-toggle { font-size: 14px; }
#dialog [data-action=display-save],
body[data-view=line] .service-letter-index button { min-height: 48px; min-width: 48px; }
@media(max-width:599px) {
 .service-grid.photos-auto .tap img { display: none !important; }
 #dialog .display-controls .pair { grid-template-columns: minmax(0,1fr); }
}
@media(min-width:600px) {
 body[data-view=line] .service-grid .service-letter-tiles,
 #dialog .display-preview .service-letter-tiles { grid-template-columns: repeat(var(--service-tablet-columns,var(--service-auto-columns)),minmax(0,1fr)); }
 #dialog #display-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media(min-width:1100px) { .service-grid { --service-auto-columns: 4; } }
/* Modalità scura: testi che non si leggevano (giorni degli obiettivi, scorte, tasti Servizio, coda stampa) */
@media (prefers-color-scheme: dark) and (max-width: 0px) {
  .banco-app .day-row { background: #2c2c2e !important; color: #f2f2f7 !important; }
  .banco-app .day-row > span:first-child { color: #f2f2f7 !important; font-weight: 600; }
  .banco-app .ios-stock-detail .reserve-count strong { color: #f2f2f7 !important; }
  .banco-app .service-shortcuts a { background: #1c1c1e !important; color: #f2f2f7 !important; }
  .banco-app .service-shortcuts a span { color: #f2f2f7 !important; }
  .banco-app .label-row.recovered-label { background: #3a1f1d !important; }
  .banco-app .label-row.recovered-label :is(b, span, .meta) { color: #ffd2cc !important; }
}
/* Giorni degli obiettivi più leggibili anche in chiaro */
.banco-app .day-row > span:first-child { font-size: 16px; font-weight: 600; }

.date-weekday { display: block; margin-top: 4px; font-size: 15px; font-weight: 600; color: var(--ios-accent, #1f5b42); text-transform: capitalize; }
/* Solo modalità chiara (richiesta del titolare): niente tema scuro neanche se iPad/telefono sono in modalità notte. */
:root { color-scheme: light only; }
.lots-block { margin: 14px 0; padding: 12px 14px; border-radius: 14px; background: var(--ios-card, #fff); }
.lots-block h3 { margin: 0 0 8px; font-size: 18px; }
.lots-block .inventory-read { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; }

/* Production dates sheet: touch targets and wrapping on phones. */
.production-dates{color:#242820;background:#fff;overflow-wrap:anywhere}.production-dates button,.production-dates input{min-height:48px}.production-dates input{width:100%;box-sizing:border-box}.production-dates .actions{display:flex;flex-wrap:wrap;gap:8px}.production-list article{padding:16px 0;border-bottom:1px solid #d9ddd4}.production-list p{line-height:1.6}.production-dates .lots-block{margin-top:24px}
button[data-action="lots-open"],#label-date-form button,#label-date-form input,#dialog-body:has(.reprint-count) button{min-height:48px}

.product-dates-entry{margin:0 0 12px}.product-dates-entry button{width:100%;min-height:52px;font-size:1.05rem;font-weight:700}

.production-dates h2{font-size:22px;color:#242820}
.production-dates .production-current h3,.production-dates .production-undated h3{font-size:22px;font-weight:700;line-height:1.3;margin:0 0 8px;color:#242820}
.production-dates .production-list p,.production-dates .production-undated p{font-size:18px;line-height:1.5;margin:0 0 12px;color:#30362d}
.production-dates button{font-size:17px;min-height:48px;white-space:normal}
.production-dates .production-undated{background:#fff3d6;border:2px solid #a46b12;border-radius:12px;padding:16px;margin:16px 0}
.production-dates .production-past{margin-top:24px;border-top:1px solid #ccd2c6;padding-top:12px}
.production-dates .production-past summary{font-size:20px;font-weight:700;min-height:48px;cursor:pointer;padding:12px 0;box-sizing:border-box}
.production-dates .production-search{margin-top:28px;font-size:16px}
.production-dates .actions>button{flex:1 1 140px;margin:0;min-width:0}

.target-card>summary .production-date-badge.blue{display:inline-block;margin:0;padding:6px 8px;border:1px solid #bcd2d8;border-radius:8px;background:var(--b-cold,#e8f2f5);color:var(--b-ice,#176780);font-size:12px;font-weight:700;line-height:1.3;max-width:105px;flex-shrink:0}

/* Fullscreen must override the desktop sidebar selector (three classes). */
body.banco-app.authenticated.service-fullscreen { padding-left: 0 !important; }
body.banco-app.authenticated.service-fullscreen #app { width: 100%; max-width: none; margin-inline: 0; padding-left: max(16px,env(safe-area-inset-left)) !important; }
body[data-view=line] .service-grid { padding-right: var(--letter-index-width,64px); }
body[data-view=control] .control-grid { padding-right: var(--letter-index-width,64px); }
.service-letter-index { top: 150px; bottom: auto; right: 2px; transform: none; height: calc(100dvh - 250px); max-height: none; overflow: visible; display: grid; grid-auto-flow: column; grid-template-rows: repeat(var(--letter-rows,12),minmax(44px,1fr)); grid-auto-columns: 48px; gap: 0; padding: 0 4px; border: 0; background: transparent; }
.service-letter-index button,body[data-view=line] .service-letter-index button { min-width: 44px; min-height: 44px; height: 100%; padding: 0; font-size: 22px; font-weight: 800; border-radius: 8px; }
.service-letter-index button.letter-selected { background: var(--ios-accent); color: #fff; box-shadow: 0 0 0 2px #fff; }
.production-date-badge{white-space:nowrap;max-width:none!important;width:auto!important;margin-right:6px}
body[data-view=line] .toolbar.service-heading{padding-right:calc(var(--letter-index-width,64px) + 8px)}

body[data-view=line] .service-grid .vacuum-line-empty .fresh-count,
#dialog .display-preview .vacuum-line-empty .fresh-count { font-size: 24px !important; font-weight: 700; white-space: normal; }
.vacuum-line-empty .stock { flex-direction: column; }

.task-add-grid.indexed-products,.target-cards.indexed-products { display:block; padding-right:var(--letter-index-width,72px); }
.indexed-products .letter-cards { padding-right:0; }
.product-letter-index { z-index:20; }
#dialog .indexed-products { padding-right:max(112px,var(--letter-index-width,72px)); }
#dialog .product-letter-index { position:fixed; z-index:30; }
/* Phone/WebView layout. The letter headings remain available without an overlay. */
@media (max-width: 600px) {
  body.banco-app.authenticated { padding-left: 0; }
  .banco-app #app { width: 100%; min-width: 0; padding-inline: 12px !important; box-sizing: border-box; }
  .banco-app .service-letter-index { display: none !important; }
  .banco-app :is(.indexed-products,.service-grid,.control-grid,.kitchen-heading,.service-heading),
  .banco-app #dialog .indexed-products { --letter-index-width: 0px !important; padding-right: 0 !important; }
  .banco-app .service-letter-group { grid-template-columns: minmax(0,1fr); gap: 6px; }
  .banco-app :is(.target-cards,.task-add-grid,.kitchen-grid) { grid-template-columns: minmax(0,1fr); }
  body[data-view=targets] .target-card > summary { display: grid; grid-template-columns: 36px minmax(0,1fr) 20px; gap: 8px; }
  body[data-view=targets] .target-card > summary .summary-photo { width: 36px; height: 36px; grid-column: 1; grid-row: 1; object-fit: cover; }
  body[data-view=targets] .product-summary-copy { grid-column: 2; grid-row: 1; overflow-wrap: break-word; word-break: normal; }
  body[data-view=targets] .target-card > summary::after { grid-column: 3; grid-row: 1; }
  body[data-view=targets] .target-card > summary :is(.target-status,.production-date-badge) { grid-column: 2 / -1; max-width: 100% !important; white-space: normal; margin: 0; justify-self: start; }
  body[data-view=targets] .target-card > summary .target-pick:not([hidden]) { grid-column: 1; grid-row: 2; }
  .banco-app :is(.intro,.toolbar,.actions,.task,.label-row,.kitchen-history-row,.dialog-head) { flex-wrap: wrap; }
  .banco-app :is(.intro,.toolbar,.actions) > * { min-width: 0; max-width: 100%; }
  .banco-app :is(.pair,.list-filters,.product-flags,.daily-targets,#display-grid) { grid-template-columns: minmax(0,1fr) !important; }
  .banco-app :is(button,a.button,summary) { min-height: 44px; box-sizing: border-box; }
  .banco-app :is(button,a.button) { white-space: normal; overflow-wrap: break-word; max-width: 100%; }
  .banco-app :is(input,select,textarea,fieldset,.grow,.target-content,.product-group) { min-width: 0; max-width: 100%; box-sizing: border-box; }
  .banco-app :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { min-height: 44px; font-size: 16px; }
  .banco-app #dialog { width: calc(100% - 16px); max-width: calc(100% - 16px); max-height: calc(100dvh - 24px); padding: 12px; box-sizing: border-box; }
  .banco-app :is(.grow,.production-dates,.label-row b,.kitchen-card strong) { overflow-wrap: break-word; word-break: normal; }
  .banco-app .day-row { grid-template-columns: minmax(0,1fr) minmax(0,130px); }
  .banco-app .service-bar { flex-wrap: wrap; }
  .banco-app :is(.prep-v2-row,.last-label-title,.account-list .task) { flex-wrap: wrap; }
  .banco-app .prep-v2-row > .grow { flex: 1 1 180px; }
  .banco-app .compact-actions > button { flex: 1 1 140px; }
  .banco-app :is(.product-photo-editor,.freeze-options,.label-controls,.receipt-controls) { flex-wrap: wrap; }
  /* Shared stylesheet is also loaded inside Recipes and Shopping shadow roots. */
  :host .section-body { min-width: 0; }
  :host :is(main,header,footer,.intro,.toolbar,.dialog-top,.detail-actions,.form-row,.row,.actions,.review-row) { min-width: 0; flex-wrap: wrap; }
  :host :is(button,.btn,.icon,.text-button,summary) { min-height: 44px; min-width: 44px; white-space: normal; box-sizing: border-box; }
  :host :is(input,select,textarea,fieldset,label,.product-info,.field) { min-width: 0; max-width: 100%; box-sizing: border-box; }
  :host :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { min-height: 44px; font-size: 16px; }
  :host :is(.intro > div,.search) { min-width: 0; }
  :host :is(.form-two,.formgrid,.recipe-content,.kitchen-layout,.supplier-grid,.stats-bottom) { grid-template-columns: minmax(0,1fr) !important; }
  :host dialog { width: calc(100% - 16px); max-width: calc(100% - 16px); max-height: calc(100dvh - 24px); box-sizing: border-box; }
  :host :is(.detail-actions,.step-navigation) { flex-wrap: wrap; }
  :host .detail-actions button { flex: 1 1 100px; }
  :host :is(.list-footer,.dialog-actions,.review-actions,.row-actions,.section-heading,.servings) { flex-wrap: wrap; }
  :host .list-footer > * { min-width: 0; max-width: 100%; }
  :host .formgrid .wide { grid-column: 1 / -1; }
  :host .banco-recipes .toolbar select { max-width: 100%; font-size: 16px; }
  :host .step-navigation button { font-size: 18px; }
  :host :is(h1,h2,h3,.product-info,.current-step,.note) { overflow-wrap: break-word; }
  :host .banco-recipes .cook-mode .recipe-content.kitchen-layout { grid-template-columns: minmax(0,1fr); }
}
html.android-shell .service-letter-index { display: none !important; }
html.android-shell :is(.indexed-products,.service-grid,.control-grid,.kitchen-heading,.service-heading),
html.android-shell #dialog .indexed-products { --letter-index-width: 0px !important; padding-right: 0 !important; }
html.android-shell body.banco-app #app { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
html.android-shell .service-bar { bottom: calc(90px + env(safe-area-inset-bottom)); }
html.android-shell #dialog { max-height: calc(100dvh - 114px); margin-bottom: calc(100px + env(safe-area-inset-bottom)); }
:host-context(.android-shell) .section-body { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
:host-context(.android-shell) dialog { max-height: calc(100dvh - 114px); margin-bottom: calc(100px + env(safe-area-inset-bottom)); }
:host-context(.android-shell) #add-floating { bottom: calc(106px + env(safe-area-inset-bottom)); }
