:root {
  --ink: #1c2b36; --muted: #667885; --bg: #f4f8fb; --card: #fff; --line: #dce6ed;
  --blue: #2a7db0; --blue-dark: #1f6591; --blue-soft: #e5f2fa;
  --pink: #f08bb0; --pink-soft: #fdecf3; --mint-soft: #e2f4e9; --mint-ink: #226b3d;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden;
  font-family: ui-rounded, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px; line-height: 1.4;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.p-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.p-top img { height: 26px; width: auto; display: block; min-width: 0; }
.p-tools { display: flex; align-items: center; gap: 4px; }
.p-tools form { margin: 0; }
.p-lang, .p-out { font: inherit; font-size: 14px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; min-height: 36px; padding: 0 10px; }
.p-lang.on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-dark); font-weight: 700; }
.p-out { border-color: transparent; color: var(--muted); }
.p-main { flex: 1; width: 100%; max-width: 520px; margin: 0 auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
h1 { margin: 0; font-size: 22px; font-weight: 700; }
.p-hello { margin: 0; color: var(--muted); font-size: 15px; }
.p-flash { margin: 0; padding: 10px 14px; border-radius: 10px; overflow-wrap: anywhere; }
.p-flash.ok { background: var(--mint-soft); color: var(--mint-ink); }
.p-flash.error { background: var(--pink-soft); color: #9c2f5c; }
.p-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.p-card p { margin: 6px 0 0; }
.p-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.p-store { font-weight: 700; font-size: 19px; }
.p-big { font-size: 24px; font-weight: 700; color: var(--blue-dark); }
.p-muted { color: var(--muted); font-size: 15px; font-weight: 400; }
.p-badge { padding: 2px 10px; border-radius: 999px; font-size: 14px; font-weight: 700; background: var(--blue-soft); color: var(--blue-dark); white-space: nowrap; }
.p-badge.s-da_confermare { background: var(--pink-soft); color: #9c2f5c; }
.p-badge.s-a_meta { background: #eceff2; color: #4a5a66; }
.p-empty { margin: 0; color: var(--muted); }
.p-note { margin: 0; color: var(--muted); font-size: 15px; }
.p-form { display: flex; flex-direction: column; gap: 14px; }
.p-form label, fieldset legend { font-weight: 600; font-size: 15px; display: flex; flex-direction: column; gap: 6px; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset legend { grid-column: 1 / -1; padding: 0; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number] {
  font: inherit; font-size: 18px; font-weight: 400; padding: 12px; min-height: 50px; width: 100%;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.p-choice { position: relative; }
.p-choice input { position: absolute; opacity: 0; inset: 0; }
.p-choice span { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; min-height: 64px; justify-content: center; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-weight: 700; }
.p-choice small { font-weight: 400; color: var(--muted); }
.p-choice input:checked + span { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-dark); }
.p-choice input:focus-visible + span { outline: 3px solid var(--pink); outline-offset: 2px; }
.p-btn { display: block; width: 100%; text-align: center; text-decoration: none; font: inherit; font-weight: 700; padding: 14px; min-height: 52px; border: 2px solid var(--blue); border-radius: 12px; background: var(--blue); color: #fff; }
.p-btn.ghost { background: #fff; color: var(--blue-dark); }
.p-btn:disabled { opacity: .6; }
.p-link { text-align: center; color: var(--blue-dark); padding: 8px; }
.p-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.p-lines { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.p-lines li { display: grid; grid-template-columns: 5.6em 1fr auto; column-gap: 8px; row-gap: 1px; align-items: baseline; padding: 7px 14px; border-bottom: 1px solid var(--line); font-size: 16px; }
.p-lines li:last-child { border-bottom: 0; }
.p-bin { font-weight: 700; }
.p-ean { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.p-qty { font-weight: 700; color: var(--blue-dark); }
.p-name { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; color: var(--muted); font-size: 14px; }
.p-lines .p-more { display: block; color: var(--muted); }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

.p-logo { display: block; line-height: 0; }
a.p-link-card { display: block; color: inherit; text-decoration: none; border-color: var(--blue); border-width: 2px; }
a.p-link-card:active { background: var(--blue-soft); }

.p-sim { margin: 0; padding: 5px 10px; background: var(--pink-soft); color: #9c2f5c; font-weight: 700; font-size: 13px; text-align: center; border-bottom: 1px solid var(--line); }

/* ---------------- scansione */
.p-scanpage { display: flex; flex-direction: column; gap: 10px; }
.p-progress { margin: 0; }
.p-rowcard { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.p-rowmain { min-width: 0; flex: 1; }
.p-rowmain p, .p-scanpage .p-card p { margin: 0; }
.p-bin-big { font-size: 34px; font-weight: 800; line-height: 1.1; letter-spacing: .01em; overflow-wrap: anywhere; }
.p-row-name { margin-top: 4px; font-weight: 600; overflow-wrap: anywhere; }
.p-qty-big { margin-top: 6px; font-size: 30px; font-weight: 800; color: var(--blue-dark); }
.p-photo { width: 92px; height: 92px; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); flex: none; }
.p-scan { display: flex; gap: 8px; align-items: stretch; }
.p-scan input { flex: 1; min-width: 0; }
.p-btn.small { width: auto; min-height: 50px; padding: 0 14px; font-size: 15px; }
.p-status { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--blue-soft); color: var(--blue-dark); font-weight: 600; }
.p-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; }
.p-link-btn { font: inherit; background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 8px; }
.p-warn { color: #9c2f5c; font-weight: 600; }
.p-steprow { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.p-step { display: flex; align-items: center; gap: 4px; }
.p-step button { width: 48px; height: 48px; font: inherit; font-size: 24px; font-weight: 700; border: 2px solid var(--blue); border-radius: 12px; background: #fff; color: var(--blue-dark); }
.p-step output { min-width: 44px; text-align: center; font-size: 24px; font-weight: 800; }
.p-dates { display: flex; flex-direction: column; gap: 8px; }
.p-dates legend { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.p-flash-full { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; font-size: 26px; font-weight: 800; color: #fff; }
.p-flash-full[hidden] { display: none; }
.p-flash-full.ok { background: #2e9d57; }
.p-flash-full.error { background: #d23b6b; }

.p-compact { gap: 8px; }
.p-compact .p-card { padding: 10px 14px; }
.p-compact .p-bin-big { font-size: 28px; }
.p-compact .p-steprow { padding: 5px 10px; }
.p-compact .p-step button { width: 44px; height: 44px; }
.p-compact .p-dates { gap: 6px; }
.p-compact .p-row-name { font-size: 15px; }

[hidden] { display: none !important; }
