:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --line: #e2e0da;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #7b7a75;
  --accent: #c2410c;
  --accent-soft: #fbe7dc;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #0f7a3d;
  --good-soft: #e1f3e8;
  --warn: #9a6200;
  --warn-soft: #fbf0d6;
  --bad: #b42323;
  --bad-soft: #fbe3e3;
  --grid: #e8e6e1;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.06);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --line: #33332f;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --text-3: #8e8d85;
    --accent: #f28c5b;
    --accent-soft: #3a2419;
    --series-1: #3987e5;
    --series-2: #d95926;
    --good: #5cc98a;
    --good-soft: #17301f;
    --warn: #e5b84c;
    --warn-soft: #33290f;
    --bad: #f07b7b;
    --bad-soft: #3a1a1a;
    --grid: #2b2b28;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif; }
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: baseline; gap: 8px; padding: 4px 10px 18px; font-weight: 700; font-size: 18px; flex-wrap: wrap; }
.brand small { font-weight: 500; font-size: 12px; color: var(--text-3); width: 100%; margin-left: 18px; margin-top: -4px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
nav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 14px 10px 4px; }
nav a { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 8px; color: var(--text-2); text-decoration: none; }
nav a:hover { background: var(--surface-2); color: var(--text); }
nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav a .badge { font-size: 11px; background: var(--bad); color: #fff; border-radius: 10px; padding: 0 6px; }
.side-foot { margin-top: auto; padding-top: 12px; }
main { min-width: 0; padding: 20px 28px 60px; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.top h1 { font-size: 22px; margin: 0; flex: 1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.menu { display: none; }

.btn { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 7px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
a.btn { text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--text-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.danger.armed { background: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card h3 { margin: 0 0 10px; font-size: 14px; color: var(--text-2); font-weight: 600; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.kpi .lbl { color: var(--text-2); font-size: 12.5px; }
.kpi .val { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.two { grid-template-columns: 1.6fr 1fr; margin-bottom: 14px; }
.meter { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--good); border-radius: 4px; }

.alert { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--warn-soft); color: var(--warn); }
.alert a { color: inherit; font-weight: 600; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .muted, .muted { color: var(--text-3); }
.empty { color: var(--text-3); padding: 8px 0; }

.toolbar { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 180px; max-width: 360px; }
.info { color: var(--text-2); background: var(--surface-2); padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--text-2); font-weight: 600; background: var(--surface-2); cursor: pointer; user-select: none; position: sticky; top: 0; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; background: var(--surface-2); }
td.wrap { white-space: normal; min-width: 180px; max-width: 320px; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.neg { color: var(--bad); }
.pos { color: var(--good); }

input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-2); }
label.chk { flex-direction: row; align-items: center; gap: 8px; }
label.chk input { width: auto; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form .full { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--text-3); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 50; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal-card { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); width: min(760px, 100%); }
.modal-head, .modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 18px; }
.modal-head { border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 16px 18px; }
.modal-foot { border-top: 1px solid var(--line); justify-content: flex-end; }
.modal-foot .spacer { flex: 1; }

.bom { margin-top: 6px; }
.bom table td, .bom table th { padding: 6px 8px; }
.bom select, .bom input { padding: 5px 8px; }
.costbox { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }
.costbox div { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--text-2); }
.costbox b { display: block; font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 12px; text-align: left; cursor: pointer; font: inherit; color: var(--text); }
.tile:hover { border-color: var(--accent); }
.tile b { display: block; }
.tile span { color: var(--text-3); font-size: 12px; }
.tile .price { font-size: 18px; font-weight: 700; color: var(--accent); margin-top: 6px; display: block; }

.chart svg { width: 100%; height: 240px; display: block; }
.chart .legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: 12.5px; z-index: 60; box-shadow: var(--shadow); }
.tip[hidden] { display: none; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; z-index: 70; box-shadow: var(--shadow); }
.toast[hidden] { display: none; }
.section-title { font-size: 15px; margin: 22px 0 10px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; width: 240px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .menu { display: inline-block; }
  main { padding: 16px; }
  .two { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
}

.pathrow { display: flex; gap: 6px; }
.pathrow input { flex: 1; min-width: 0; }
tr.muted td { color: var(--text-3); }
.kpi a { color: inherit; }
@media (max-width: 900px) { .pathrow { flex-wrap: wrap; } }

/* ---------------------------------------------------------------- icone e decorazioni */
.brand .star { width: 18px; height: 18px; fill: var(--accent); align-self: center; }
.brand small { margin-left: 26px; }
.garland { display: none; }
nav a .lbl { display: flex; align-items: center; gap: 9px; }
.ic { display: inline-block; width: 1.3em; text-align: center; flex: none; }
.top h1 .ic { margin-right: 8px; }
.kic { margin-right: 6px; }
.empty-ic { display: block; font-size: 30px; margin-bottom: 6px; }
.card.empty { text-align: center; padding: 28px; }

/* ---------------------------------------------------------------- tema natalizio */
body.xmas {
  --bg: #f8f3ea; --surface: #fffdf8; --surface-2: #f3ece0; --line: #e6dccb;
  --text: #1d1a16; --text-2: #574f45; --text-3: #867c70;
  --accent: #b3261e; --accent-soft: #f9e1dd; --pine: #1f6f43; --gold: #a87400;
  --good: #1f6f43; --good-soft: #e0f0e6; --grid: #ece3d4;
  --side-bg: linear-gradient(180deg, #17482f 0%, #0f3321 100%); --side-text: rgba(255, 250, 240, .86);
  --snow: #c9d6e3;
  background: radial-gradient(1200px 400px at 70% -120px, #fbe9e4 0%, transparent 70%), var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) body.xmas {
    --bg: #0e1712; --surface: #142019; --surface-2: #1b2a21; --line: #2a3b30;
    --text: #f6f1e7; --text-2: #cfc6b5; --text-3: #97907f;
    --accent: #e5675c; --accent-soft: #3b1c19; --pine: #4fb07a; --gold: #e0b45a;
    --good: #5cc98a; --good-soft: #17301f; --grid: #22332a;
    --side-bg: linear-gradient(180deg, #0f2a1c 0%, #0a1d13 100%); --snow: #ffffff;
    background: radial-gradient(1200px 400px at 70% -120px, #2a1512 0%, transparent 70%), var(--bg);
  }
}
body.xmas .side { background: var(--side-bg); border-right: 0; color: var(--side-text); }
body.xmas .brand { color: #fff; }
body.xmas .brand .star { fill: #f3d27a; filter: drop-shadow(0 0 6px rgba(243, 210, 122, .6)); }
body.xmas .brand small { color: rgba(255, 250, 240, .6); }
body.xmas .garland { display: block; width: 100%; height: 24px; margin: -8px 0 6px; }
body.xmas nav .grp { color: #f3d27a; opacity: .85; }
body.xmas nav a { color: var(--side-text); }
body.xmas nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
body.xmas nav a.on { background: #b3261e; color: #fff; box-shadow: inset 3px 0 0 #f3d27a; }
body.xmas nav a .badge { background: #f3d27a; color: #3b2a00; font-weight: 700; }
body.xmas .side-foot .btn { color: var(--side-text); border-color: rgba(255, 255, 255, .25); }
body.xmas .top h1 { color: var(--text); }
body.xmas .btn.primary { background: linear-gradient(180deg, #c53a2f, #a8231b); border-color: #a8231b; }
body.xmas .card { box-shadow: 0 1px 2px rgba(60, 30, 10, .04); }
body.xmas .kpis .card:nth-child(odd) { border-top: 3px solid var(--accent); }
body.xmas .kpis .card:nth-child(even) { border-top: 3px solid var(--pine); }
body.xmas .card h3 { color: var(--text); }
body.xmas .tile { border-top: 3px solid var(--pine); }
body.xmas .tile:nth-child(3n+2) { border-top-color: var(--accent); }
body.xmas .tile:nth-child(3n) { border-top-color: var(--gold); }
body.xmas .modal-head { background: linear-gradient(90deg, var(--accent-soft), transparent); border-radius: 14px 14px 0 0; }

.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; padding: 20px 24px; border-radius: 14px; overflow: hidden; color: #fff;
  background: linear-gradient(135deg, #7e1812 0%, #b3261e 55%, #c8452f 100%); box-shadow: 0 6px 24px rgba(120, 20, 10, .18); }
.hero-kicker { color: #f3d27a; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
.hero-title { font-size: 28px; font-weight: 800; margin: 4px 0 6px; line-height: 1.15; }
.hero-title span { color: #f3d27a; font-variant-numeric: tabular-nums; }
.hero-sub { color: rgba(255, 255, 255, .9); }
.hero-sub a { color: #fff; font-weight: 600; }
.hero-art { width: 220px; height: 160px; flex: none; margin: -12px -8px -20px 0; }

#snow { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
#snow i { position: absolute; top: -12px; border-radius: 50%; background: var(--snow, #fff); animation: snowfall linear infinite; }
@keyframes snowfall {
  0% { transform: translate(0, -12px); }
  50% { transform: translate(24px, 50vh); }
  100% { transform: translate(-12px, 105vh); }
}
@media (prefers-reduced-motion: reduce) { #snow { display: none; } }
@media (max-width: 700px) { .hero-art { display: none; } .hero-title { font-size: 22px; } }
/* rifiniture */
#snow { z-index: 0; }
.app { position: relative; z-index: 1; }
nav { flex: 1; min-height: 0; }
nav a { padding: 6px 10px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
body.xmas main a:not(.btn) { color: var(--pine); }
body.xmas main .hero a { color: #fff; }

/* ---------------------------------------------------------------- bilancio */
.bil2 { grid-template-columns: 1fr 1fr; margin-bottom: 14px; align-items: start; }
table.bil td, table.bil th { padding: 6px 8px; white-space: normal; }
table.bil td.cod { width: 34px; color: var(--text-3); font-size: 12px; }
table.bil tbody tr { cursor: default; }
table.bil tbody tr:hover { background: transparent; }
table.bil tr.sec td { background: var(--surface-2); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); }
table.bil tr.sub td { border-top: 1px solid var(--text-3); background: var(--surface-2); }
table.bil tr.tot td { font-weight: 600; }
table.bil tr.grand td { border-top: 2px solid var(--text); font-size: 15px; font-weight: 700; }
table.bil .pctc { color: var(--text-3); font-size: 12px; width: 70px; }
table.bil td.num { white-space: nowrap; }
.tablewrap.flat { border: 0; }
table.months td, table.months th { padding: 6px 7px; font-size: 12.5px; }
.minibar { display: inline-block; width: 60px; height: 6px; background: var(--surface-2); border-radius: 3px; vertical-align: middle; overflow: hidden; }
.minibar i { display: block; height: 100%; background: var(--good); }
details summary { cursor: pointer; color: var(--text-2); }
.print-head { display: none; }
@media (max-width: 1100px) { .bil2 { grid-template-columns: 1fr; } }
@media print {
  .side, .top .actions, .menu, #snow, .alert button, #bChiudi, .toast, .tip { display: none !important; }
  .app { display: block; }
  main { padding: 0; }
  body, body.xmas { background: #fff !important; color: #000; }
  .card { break-inside: avoid; box-shadow: none; border-color: #ccc; }
  .print-head { display: block; margin-bottom: 12px; }
  .print-head h2 { margin: 0 0 4px; }
  .top h1 { display: none; }
  .bil2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(3, 1fr) !important; }
  .bil2 .card, .card:has(table) { break-inside: auto; }
  table.bil tr { break-inside: avoid; }
  details { display: none; }
  @page { size: A4; margin: 14mm; }
}

/* ---------------------------------------------------------------- schede nei moduli, editor prodotto, negozio */
.modal-card.wide { width: min(1100px, 100%); }
.ftabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: -4px -2px 14px; padding-bottom: 0; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.ftab { font: inherit; border: 0; background: transparent; color: var(--text-2); padding: 9px 12px; border-bottom: 3px solid transparent; cursor: pointer; border-radius: 6px 6px 0 0; }
.ftab:hover { background: var(--surface-2); color: var(--text); }
.ftab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tcount { font-size: 11px; color: var(--text-3); font-weight: 500; }
.fpane[hidden] { display: none !important; }
#frm.tabbed { display: block; }
.fpane { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.fpane .info { margin: 0; }
.counter { text-align: right; }
table.mini td, table.mini th { padding: 5px 6px; white-space: nowrap; }
table.mini input, table.mini select { padding: 5px 7px; }
table.mini tbody tr, table.ready tbody tr { cursor: default; }
table.mini tbody tr:hover { background: transparent; }
table.ready tbody tr { cursor: pointer; }
.vtab td { vertical-align: middle; }
.subrow td { background: var(--surface-2); padding: 10px !important; white-space: normal !important; }
.gen { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; align-items: end; margin-bottom: 12px; padding: 12px; background: var(--surface-2); border-radius: 10px; }
.genbtns { display: flex; gap: 6px; flex-wrap: wrap; grid-column: 1 / -1; }
.empty-box { border: 1px dashed var(--line); border-radius: 10px; padding: 16px; color: var(--text-2); text-align: center; }
.imgs { display: flex; flex-direction: column; gap: 10px; }
.imgrow { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: start; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.imgrow .thumb { width: 96px; height: 96px; border-radius: 8px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 26px; overflow: hidden; position: relative; }
.imgrow .thumb img { width: 100%; height: 100%; object-fit: cover; }
.imgrow .thumb span { position: absolute; bottom: 0; left: 0; right: 0; font-size: 11px; background: rgba(0,0,0,.55); color: #fff; text-align: center; padding: 1px; }
.imgf { display: grid; gap: 8px; }
.imgb { display: flex; flex-direction: column; gap: 4px; }
.segtabs { display: inline-flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 10px; margin-bottom: 12px; }
.segtabs a { padding: 6px 14px; border-radius: 8px; text-decoration: none; color: var(--text-2); }
.segtabs a.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; margin: 2px 4px 2px 0; border-radius: 10px; background: var(--surface-2); color: var(--text-2); cursor: pointer; }
.chip.imp { background: var(--bad-soft); color: var(--bad); }
.chip:hover { outline: 1px solid var(--text-3); }
.minibar.wide { width: 90px; }
.tile em { display: block; font-style: normal; color: var(--accent); font-size: 13px; margin-top: 2px; }
.tile[hidden] { display: none; }
body.xmas main a.btn { color: var(--text); }
body.xmas main a.btn.primary { color: #fff; }
@media (max-width: 900px) { .fpane { grid-template-columns: 1fr; } .imgrow { grid-template-columns: 70px 1fr; } .imgrow .thumb { width: 70px; height: 70px; } .imgb { flex-direction: row; grid-column: 1 / -1; } }
.cklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cklist li { display: flex; gap: 8px; align-items: center; }
.cklist input[type=checkbox] { width: auto; flex: none; }
.cklist input[type=text].done { text-decoration: line-through; color: var(--text-3); }
input.bad { border-color: var(--bad); }
tr.muted td { color: var(--text-3); }
.ghead { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.gpay { min-width: 180px; }
.tile.big { padding: 16px; min-height: 104px; position: relative; }
.tile.big b { font-size: 15px; }
.tile.big .price { font-size: 20px; }
.badge-sold { position: absolute; top: 8px; right: 8px; background: var(--good); color: #fff; border-radius: 10px; font-size: 12px; padding: 1px 7px; font-weight: 700; }
.cklist.big li { font-size: 15px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.cklist.big span.done { text-decoration: line-through; color: var(--text-3); }
.giorno .segtabs { margin-bottom: 14px; }

/* ---------------------------------------------------------------- cassa: lettore, conto, pagamento */
.cassa-bar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 12px; }
.cassa-bar label.f { min-width: 240px; }
.scanwrap { display: flex; gap: 6px; flex: 1; min-width: 240px; max-width: 520px; }
.scanwrap input { flex: 1; font-size: 16px; padding: 10px 12px; }
.rete { font-size: 12.5px; padding: 4px 10px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.rete.good { background: var(--good-soft); color: var(--good); }
.rete.warn { background: var(--warn-soft); color: var(--warn); }
.rete.bad { background: var(--bad-soft); color: var(--bad); }
.cassa { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.conto { position: sticky; top: 12px; }
.conto-righe { display: grid; max-height: 46vh; overflow-y: auto; }
.criga { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.cnome { font-size: 13.5px; }
.cq { display: flex; align-items: center; gap: 2px; }
.cq b { min-width: 22px; text-align: center; }
.cprezzo { font-weight: 600; }
.conto-tot { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 0 8px; font-size: 15px; }
.conto-tot b { font-size: 26px; color: var(--accent); }
.conto-az { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.paga { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.paga-btn { padding: 14px 10px; font-size: 15px; font-weight: 600; white-space: normal; }
.paga-btn small { font-weight: 500; opacity: .8; }
.btn:disabled { opacity: .45; cursor: default; }
.paga-tot { font-size: 34px; font-weight: 700; color: var(--accent); text-align: center; margin: 4px 0 12px; }
.resto { font-size: 16px; margin-top: 4px; }
.alert.ok { background: var(--good-soft); color: var(--good); }
.alert.ok .btn { margin-left: 6px; }
@media (max-width: 900px) {
  .cassa { grid-template-columns: 1fr; }
  .conto { order: -1; position: static; }
  .conto-righe { max-height: none; }
}

/* ---------------------------------------------------------------- accesso online */
body.accesso .side, body.accesso .menu { display: none; }
body.accesso .app { grid-template-columns: 1fr; }
.accesso-card { max-width: 540px; margin: 4vh auto; }
.passi { padding-left: 20px; line-height: 1.6; }
.passi li { margin-bottom: 12px; }
.chiave { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; letter-spacing: .06em; background: var(--surface-2); color: var(--text); padding: 8px 12px; border-radius: 8px; margin-top: 6px; word-break: break-all; user-select: all; }

/* ---------------------------------------------------------------- etichette */
.anteprima { overflow: auto; max-height: 75vh; background: var(--surface-2); padding: 10px; border-radius: 8px; }
.anteprima .foglio { zoom: .5; margin-bottom: 16px; }
.foglio { position: relative; width: 210mm; height: 297mm; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.eti-cella { position: absolute; }
.eti { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6mm; padding: 1.5mm; color: #000; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; overflow: hidden; }
.eti svg { display: block; }
.eti-nome { font-size: 7.5pt; font-weight: 600; text-align: center; line-height: 1.15; max-height: 2.3em; overflow: hidden; }
.eti-prezzo { font-size: 11pt; font-weight: 700; }
.eti-cod { font-size: 6.5pt; letter-spacing: .08em; }
.anteprima .eti { outline: 1px dashed #c8c8c8; }
#stampa { display: none; }
@page etichette { size: A4; margin: 0; }
@media print {
  body.stampa-etichette > *:not(#stampa) { display: none !important; }
  body.stampa-etichette #stampa { display: block; }
  body.stampa-etichette #stampa .foglio { page: etichette; box-shadow: none; break-after: page; }
}
label.f > .pill { align-self: flex-start; }
