/* =====================================================================
   DI SARNO AGENT · design system (prototipo)
   Palette calda "bottega italiana": crema, bordeaux, oro, oliva.
   Nessuna dipendenza esterna: font di sistema Apple/Android/Windows.
   ===================================================================== */

:root {
  --bg: #f4efe7;
  --bg-2: #efe8dc;
  --surface: #fffcf7;
  --surface-2: #faf5ec;
  --line: #e7ddce;
  --line-strong: #d8cab5;

  --ink: #1d1712;
  --ink-2: #4b4037;
  --muted: #8b7e71;

  --brand: #8b1d2c;        /* bordeaux Di Sarno */
  --brand-2: #a8273a;
  --brand-ink: #fff7f2;
  --brand-soft: #f6e2df;

  --gold: #b3862c;
  --gold-2: #d6ab52;
  --gold-soft: #f4e8cf;

  --olive: #4e6a2a;
  --olive-soft: #e4ecd6;
  --amber: #a5640b;
  --amber-soft: #fbeed8;
  --orange: #c2560e;       /* «Da ricontattare» */
  --orange-soft: #fde6d3;
  --red: #b1261d;
  --red-soft: #fbe5e1;

  --rail: #1e1814;
  --rail-2: #2a221c;
  --rail-ink: #e9dfd2;

  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;

  --shadow-sm: 0 1px 2px rgba(44, 28, 14, .06);
  --shadow: 0 1px 2px rgba(44, 28, 14, .05), 0 8px 24px -12px rgba(44, 28, 14, .18);
  --shadow-lg: 0 24px 60px -24px rgba(44, 28, 14, .35);

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-num: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;

  --touch: 48px;
  --rail-w: 96px;
  --summary-w: 400px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.serif { font-family: var(--font-display); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Banner prototipo ---------- */
.demo-ribbon {
  position: fixed; z-index: 90; left: calc(var(--rail-w) + 16px); bottom: 16px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px 14px; border-radius: 999px;
  background: rgba(29, 23, 18, .88); color: #f6ecdc;
  font-size: 12px; letter-spacing: .02em;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.demo-ribbon b { color: var(--gold-2); font-weight: 600; letter-spacing: .08em; }
.demo-ribbon button {
  border: 0; background: rgba(255,255,255,.12); color: inherit;
  border-radius: 999px; padding: 6px 10px; font-size: 12px;
}

/* =====================================================================
   LOGIN
   ===================================================================== */
.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
  background: var(--surface);
}
.login-art {
  position: relative; overflow: hidden; color: #fbf3e6;
  background:
    radial-gradient(120% 80% at 10% 0%, rgba(214,171,82,.35), transparent 55%),
    radial-gradient(90% 70% at 100% 100%, rgba(168,39,58,.55), transparent 60%),
    linear-gradient(160deg, #2a1d17 0%, #4a1820 55%, #6d1826 100%);
  padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 22px 22px; mask-image: linear-gradient(180deg, transparent, #000 40%, transparent);
}
.brand-lockup { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.brand-mark {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--gold-2), var(--gold));
  color: #2a1d17; font: 700 22px/1 var(--font-display); font-style: italic;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 10px 30px -10px rgba(0,0,0,.5);
}
.brand-name { font: 600 13px/1.2 var(--font-ui); letter-spacing: .22em; text-transform: uppercase; opacity: .9; }
.brand-name small { display: block; font-size: 11px; letter-spacing: .14em; opacity: .65; margin-top: 4px; font-weight: 500; }
.login-hero { position: relative; z-index: 1; max-width: 520px; }
.login-hero h1 {
  font: 400 clamp(40px, 5vw, 64px)/1.02 var(--font-display); margin: 0 0 20px;
  letter-spacing: -.01em;
}
.login-hero h1 em { color: var(--gold-2); font-style: italic; }
.login-hero p { font-size: 17px; opacity: .78; max-width: 420px; margin: 0; }
.login-chips { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.login-chips span {
  padding: 8px 14px; border-radius: 999px; font-size: 13px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
}
.login-form-wrap { display: grid; place-items: center; padding: 40px 24px; }
.login-form { width: 100%; max-width: 400px; }
.login-form h2 { font: 400 34px/1.1 var(--font-display); margin: 0 0 6px; }
.login-form .sub { color: var(--muted); margin: 0 0 32px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.input {
  width: 100%; height: 56px; padding: 0 18px; border-radius: var(--radius);
  border: 1.5px solid var(--line); background: var(--surface-2);
  font-size: 16px; outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
.input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(139,29,44,.12); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--touch); padding: 0 20px; border-radius: var(--radius);
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 15px; transition: transform .15s var(--ease), background .2s, box-shadow .2s, border-color .2s;
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-color: transparent; color: var(--brand-ink);
  box-shadow: 0 10px 24px -12px rgba(139,29,44,.8), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #2a1d17; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-2); }
.btn-lg { min-height: 58px; font-size: 16px; border-radius: 16px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.login-note {
  margin-top: 22px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--gold-soft); color: #6b4f16; font-size: 13px; display: flex; gap: 10px;
}

/* =====================================================================
   SHELL: rail laterale + contenuto
   ===================================================================== */
.shell { min-height: 100vh; padding-left: var(--rail-w); }
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail-w); z-index: 40;
  background: var(--rail); color: var(--rail-ink);
  display: flex; flex-direction: column; align-items: center; padding: 18px 0;
}
.rail .brand-mark { width: 48px; height: 48px; font-size: 20px; border-radius: 15px; margin-bottom: 26px; }
.rail nav { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 0 8px; }
.rail a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 66px; width: 100%; padding: 10px 2px; border-radius: 16px; text-decoration: none;
  text-align: center; line-height: 1.15;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; color: #a99a8a;
  transition: background .2s, color .2s;
}
.rail a svg.i { width: 24px; height: 24px; flex: none; }
.rail a span { display: block; width: 100%; text-align: center; white-space: nowrap; letter-spacing: 0; }
@media (max-width: 1100px) { .rail a span { white-space: normal; font-size: 10px; } .rail a { min-height: 72px; } }
.rail a:hover { color: #f3e8da; background: var(--rail-2); }
.rail a.active { color: #2a1d17; background: linear-gradient(160deg, var(--gold-2), var(--gold)); }
.rail .spacer { flex: 1; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, #5a2a2f, var(--brand)); color: #fbeee2; font-weight: 700; font-size: 14px;
  box-shadow: 0 0 0 3px rgba(214,171,82,.35);
}

.page { padding: 28px clamp(16px, 3vw, 40px) 88px; max-width: 1480px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.page-head h1 { font: 400 clamp(30px, 3.4vw, 44px)/1.05 var(--font-display); margin: 6px 0 0; letter-spacing: -.01em; }
.page-head h1 em { font-style: italic; color: var(--brand); }

/* ---------- Card ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title h3 { margin: 0; font: 600 15px/1.2 var(--font-ui); }
.link { color: var(--brand); font-weight: 600; text-decoration: none; font-size: 14px; background: none; border: 0; padding: 0; }

/* =====================================================================
   DASHBOARD
   ===================================================================== */
.hero-card {
  position: relative; overflow: hidden; border-radius: var(--radius-xl); color: #fbf1e3;
  background:
    radial-gradient(80% 120% at 100% 0%, rgba(214,171,82,.35), transparent 50%),
    linear-gradient(135deg, #2b1e18, #5a1a24 70%, #7b1b2b);
  padding: 30px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: center;
  box-shadow: var(--shadow-lg);
}
.hero-card h2 { font: 400 clamp(26px, 3vw, 36px)/1.1 var(--font-display); margin: 6px 0 10px; }
.hero-card p { margin: 0 0 22px; opacity: .78; max-width: 460px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-card .btn-ghost { color: #fbf1e3; border-color: rgba(255,255,255,.2); }
.hero-card .btn-ghost:hover { background: rgba(255,255,255,.08); }
.goal { display: flex; align-items: center; gap: 22px; justify-self: end; }
.goal-ring { position: relative; width: 150px; height: 150px; }
.goal-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.goal-ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.goal-ring .val b { display: block; font: 600 30px/1 var(--font-num); }
.goal-ring .val small { font-size: 12px; opacity: .7; }
.goal-legend div { font-size: 13px; opacity: .75; }
.goal-legend strong { display: block; font: 600 22px/1.2 var(--font-num); opacity: 1; margin-bottom: 8px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 20px 0; }
.kpi { padding: 18px 20px; }
.kpi .lbl { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .val { font: 600 28px/1.15 var(--font-num); margin: 6px 0 4px; letter-spacing: -.01em; }
.kpi .delta { font-size: 12px; font-weight: 600; display: inline-flex; gap: 4px; padding: 3px 8px; border-radius: 999px; }
.delta.up { color: var(--olive); background: var(--olive-soft); }
.delta.down { color: var(--red); background: var(--red-soft); }
.kpi svg.spark { width: 100%; height: 36px; margin-top: 8px; }

.dash-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }
.dash-grid > * { min-width: 0; } /* evita lo sbordamento orizzontale su smartphone */
.list-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 6px; border-top: 1px solid var(--line);
}
.list-row:first-child { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .s { font-size: 13px; color: var(--muted); }
.mono-badge {
  width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center;
  font: italic 600 17px/1 var(--font-display); color: var(--brand); background: var(--brand-soft);
}
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.bozza { background: var(--gold-soft); color: #7a5a17; }
.pill.validato { background: #e6eefb; color: #2b56a8; }
.pill.spedito { background: var(--olive-soft); color: var(--olive); }
.pill.fatturato { background: var(--bg-2); color: var(--ink-2); }
.pill.lock { background: var(--bg-2); color: var(--ink-2); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 220px; padding-top: 10px; }
.chart-bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart-bars .b i {
  display: block; width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #d9c3a3, #c9ab80);
  transition: height .8s var(--ease);
}
.chart-bars .b.now i { background: linear-gradient(180deg, var(--brand-2), var(--brand)); }
.chart-bars .b small { font-size: 11px; color: var(--muted); }

/* =====================================================================
   NUOVO ORDINE
   ===================================================================== */
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--summary-w); gap: 20px; align-items: start; }

/* Selettore cliente */
.picker-search { position: relative; margin-bottom: 18px; }
.picker-search svg.i { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.picker-search .input { padding-left: 50px; height: 60px; font-size: 17px; border-radius: 18px; background: var(--surface); }
.cust-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cust-card {
  text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--radius-lg);
  padding: 18px; display: flex; flex-direction: column; gap: 14px; min-height: 150px;
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.cust-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.cust-card .top { display: flex; gap: 12px; align-items: center; }
.cust-card .nm { font-weight: 700; font-size: 16px; line-height: 1.25; }
.cust-card .ct { font-size: 13px; color: var(--muted); }
.cust-card .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.scope-note { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); margin: 18px 2px 0; }

/* Barra contesto ordine */
.ctx-bar {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; margin-bottom: 14px;
}
.ctx-tile {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; min-height: 72px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.ctx-tile .grow { flex: 1; min-width: 0; }
.ctx-tile .lbl { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ctx-tile .v { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.select-wrap { position: relative; }
.select {
  appearance: none; -webkit-appearance: none; width: 100%; height: 44px; padding: 0 40px 0 12px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 15px;
}
.select:disabled { opacity: 1; color: var(--ink); background: var(--bg-2); }
.select-wrap::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none;
}
.select-wrap.locked::after { display: none; }
.lock-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2);
  display: grid; place-items: center; color: var(--ink-2); flex: none;
}

/* Toolbar catalogo */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.search { position: relative; flex: 1; }
.search svg.i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { height: 52px; padding-left: 46px; background: var(--surface); border-radius: 16px; }
.seg { display: inline-flex; padding: 4px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line); }
.seg button {
  border: 0; background: transparent; height: 42px; min-width: 46px; padding: 0 12px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; color: var(--muted);
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; margin-bottom: 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 14px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 8px;
}
.chip .dot { width: 10px; height: 10px; border-radius: 50%; }
.chip.on { background: var(--ink); color: #fbf3e6; border-color: var(--ink); }
.chip small { opacity: .6; font-weight: 600; }

/* Tile prodotto (illustrazione tipografica) */
.ptile {
  position: relative; border-radius: 14px; display: grid; place-items: center; overflow: hidden; flex: none;
  font: italic 500 22px/1 var(--font-display); letter-spacing: -.02em;
}
.ptile::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(70% 60% at 30% 20%, rgba(255,255,255,.55), transparent 60%);
}
.ptile span { position: relative; z-index: 1; }

/* Griglia */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.pcard {
  position: relative; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-lg);
  padding: 10px; display: flex; flex-direction: column; gap: 10px; text-align: left;
  transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
}
.pcard:hover { box-shadow: var(--shadow); }
.pcard.sel { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(139,29,44,.12), var(--shadow); }
.pcard .ptile { width: 100%; aspect-ratio: 4 / 3; font-size: 40px; border-radius: 14px; }
.pcard .body { padding: 2px 6px 0; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.pcard .ref { font-size: 11px; color: var(--muted); letter-spacing: .04em; font-weight: 600; }
.pcard .nm { font-weight: 700; line-height: 1.25; font-size: 15px; }
.pcard .fmt { font-size: 12px; color: var(--muted); }
.pcard .foot { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 4px 4px 2px; }
.pcard .foot .price { padding-left: 4px; }
.pcard .foot .add-btn { width: 100%; justify-content: center; }
.pcard .foot .stepper { width: 100%; }
.pcard .foot .stepper input { flex: 1; width: auto; min-width: 0; }
.price { font: 700 18px/1 var(--font-num); letter-spacing: -.01em; }
.price small { font: 500 12px/1 var(--font-ui); color: var(--muted); margin-left: 2px; }
.check {
  position: absolute; top: 18px; right: 18px; width: 30px; height: 30px; border-radius: 50%; z-index: 2;
  display: grid; place-items: center; background: rgba(255,255,255,.85); border: 1.5px solid var(--line-strong);
  color: transparent; transition: all .2s var(--ease);
}
.sel .check { background: var(--brand); border-color: var(--brand); color: #fff; transform: scale(1.05); }
.check svg.i { width: 16px; height: 16px; stroke-width: 3; }
.badge-best {
  position: absolute; top: 18px; left: 18px; z-index: 2; padding: 4px 9px; border-radius: 999px;
  background: rgba(29,23,18,.78); color: #f6e6c7; font-size: 11px; font-weight: 700; letter-spacing: .04em;
}
.add-btn {
  height: 44px; min-width: 44px; padding: 0 14px; border-radius: 12px; border: 0;
  background: var(--ink); color: #fbf3e6; font-weight: 700; display: inline-flex; align-items: center; gap: 6px;
}
.add-btn svg.i { width: 18px; height: 18px; stroke-width: 2.4; }

/* Stepper quantità */
.stepper {
  display: inline-flex; align-items: center; height: 44px; border-radius: 12px; background: var(--bg-2);
  border: 1px solid var(--line); overflow: hidden; flex: none;
}
.stepper button { width: 44px; height: 44px; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink); }
.stepper button:active { background: var(--line); }
.stepper button svg.i { width: 18px; height: 18px; stroke-width: 2.4; }
.stepper input {
  width: 52px; height: 44px; border: 0; background: transparent; text-align: center; font: 700 16px var(--font-num);
  outline: none; -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Lista */
.plist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.prow {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  padding: 10px 14px; border-top: 1px solid var(--line); transition: background .2s;
}
.prow:first-child { border-top: 0; }
.prow.sel { background: linear-gradient(90deg, rgba(139,29,44,.06), transparent 60%); box-shadow: inset 3px 0 0 var(--brand); }
.prow .ptile { width: 52px; height: 52px; font-size: 20px; border-radius: 12px; }
.prow .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .sub { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.prow .pr { text-align: right; }
.prow .pr .lvl { font-size: 11px; color: var(--muted); }
.stock-ok { color: var(--olive); }
.stock-low { color: var(--amber); }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .serif { font-size: 24px; color: var(--ink); margin-bottom: 6px; }

/* ---------- Riepilogo ordine ---------- */
.summary {
  position: sticky; top: 20px; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow);
  overflow: hidden;
}
.summary-head { padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.summary-head .row1 { display: flex; justify-content: space-between; align-items: center; }
.summary-head h3 { margin: 0; font: 400 24px/1.1 var(--font-display); }
.summary-head .cnt { font-size: 13px; color: var(--muted); font-weight: 600; }
.summary-lines { overflow-y: auto; flex: 1; padding: 6px 14px; min-height: 120px; }
.sline { padding: 12px 2px; border-top: 1px solid var(--line); animation: slideIn .35s var(--ease); }
.sline:first-child { border-top: 0; }
.sline .l1 { display: flex; gap: 10px; align-items: flex-start; }
.sline .ptile { width: 40px; height: 40px; font-size: 16px; border-radius: 10px; }
.sline .nm { font-weight: 700; font-size: 14px; line-height: 1.25; }
.sline .meta { font-size: 12px; color: var(--muted); }
.sline .tot { margin-left: auto; text-align: right; font: 700 15px var(--font-num); white-space: nowrap; }
.sline .tot s { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.sline .l2 { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.sline .l2 .stepper button { width: 38px; }
.sline .l2 .stepper input { width: 38px; }
.sline .l2 .disc input { width: 34px; }
.sline .l2 .icon-btn { width: 40px; }
.sline .l2 .icon-btn.danger { margin-left: auto; }
.disc {
  display: inline-flex; align-items: center; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-2); padding: 0 10px 0 4px; gap: 2px;
}
.disc input { width: 46px; height: 42px; border: 0; background: transparent; text-align: right; font: 700 15px var(--font-num); outline: none; }
.disc span { font-weight: 700; color: var(--muted); }
.disc.over { border-color: var(--amber); background: var(--amber-soft); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; color: var(--ink-2); flex: none;
}
.icon-btn:hover { background: var(--bg-2); }
.icon-btn.danger:hover { color: var(--red); background: var(--red-soft); border-color: #f0c9c2; }
.reused { font-size: 11px; font-weight: 700; color: var(--olive); }
.summary-foot { padding: 16px 22px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.tot-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--ink-2); padding: 3px 0; }
.tot-row.big { font-size: 15px; color: var(--ink); padding-top: 10px; margin-top: 8px; border-top: 1px dashed var(--line-strong); align-items: baseline; }
.tot-row.big b { font: 700 32px/1 var(--font-num); letter-spacing: -.02em; }
.summary-foot .btn { margin-top: 14px; }
.summary-empty { text-align: center; padding: 34px 18px; color: var(--muted); font-size: 14px; }
.summary-empty .serif { font-size: 20px; color: var(--ink); margin-bottom: 4px; }

@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.pop { animation: pop .35s var(--ease); }

/* ---------- Accordion storico prezzi ---------- */
.history { margin-top: 22px; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.history-head h2 { font: 400 26px/1.1 var(--font-display); margin: 0; }
.acc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 10px; overflow: hidden; }
.acc-h {
  width: 100%; border: 0; background: transparent; display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; min-height: 68px; text-align: left;
}
.acc-h .ptile { width: 44px; height: 44px; font-size: 18px; border-radius: 12px; }
.acc-h .grow { flex: 1; min-width: 0; }
.acc-h .nm { font-weight: 700; }
.acc-h .sm { font-size: 12px; color: var(--muted); }
.acc-h .chev { transition: transform .3s var(--ease); color: var(--muted); }
.acc.open .acc-h .chev { transform: rotate(180deg); }
.acc-b { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s var(--ease); }
.acc.open .acc-b { grid-template-rows: 1fr; }
.acc-b > div { overflow: hidden; }
.acc-inner { padding: 4px 16px 16px; }
.hist-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hist-table th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.hist-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.hist-table tr:last-child td { border-bottom: 0; }
.hist-table .r { text-align: right; }
.hist-table tr.last td { background: var(--gold-soft); }
.hist-table tr.last td:first-child { border-radius: 10px 0 0 10px; }
.hist-table tr.last td:last-child { border-radius: 0 10px 10px 0; }
.diff { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.diff.lower { background: var(--olive-soft); color: var(--olive); }
.diff.higher { background: var(--red-soft); color: var(--red); }
.diff.same { background: var(--bg-2); color: var(--muted); }
.acc-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.cmp { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.cmp b { display: block; font: 700 18px var(--font-num); color: var(--ink); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* =====================================================================
   OVERLAY: modale, bottom sheet, toast
   ===================================================================== */
.scrim { position: fixed; inset: 0; background: rgba(29,23,18,.45); z-index: 80; opacity: 0; transition: opacity .25s; backdrop-filter: blur(2px); }
.scrim.show { opacity: 1; }
.modal {
  position: fixed; z-index: 81; left: 50%; top: 50%; width: min(480px, calc(100vw - 32px));
  transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: all .3s var(--ease);
  background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 26px;
}
.modal.show { transform: translate(-50%, -50%); opacity: 1; }
.modal h3 { font: 400 26px/1.15 var(--font-display); margin: 0 0 8px; }
.modal p { color: var(--ink-2); margin: 0 0 18px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.modal textarea.input { height: 96px; padding: 14px 18px; resize: none; }
.toast-wrap { position: fixed; z-index: 95; top: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; gap: 10px; align-items: center; padding: 12px 18px; border-radius: 16px; font-weight: 600; font-size: 14px;
  background: var(--ink); color: #fbf3e6; box-shadow: var(--shadow-lg); animation: toastIn .35s var(--ease);
}
.toast svg.i { color: var(--gold-2); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }

.sheet {
  position: fixed; z-index: 81; left: 0; right: 0; bottom: 0; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(100%); transition: transform .35s var(--ease);
}
.sheet.show { transform: none; }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line-strong); margin: 10px auto 2px; }
.sheet .summary { position: static; max-height: none; border: 0; box-shadow: none; border-radius: 0; flex: 1; min-height: 0; }

.mobile-bar { display: none; }
.tabbar { display: none; }

/* Pannello prototipo (permessi simulati) */
.demo-panel .opt { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.demo-panel .opt:first-of-type { border-top: 0; }
.demo-panel .opt b { display: block; }
.demo-panel .opt small { color: var(--muted); }
.switch { position: relative; width: 54px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease); }
.switch input:checked + i { background: var(--olive); }
.switch input:checked + i::after { transform: translateX(22px); }


/* =====================================================================
   I MIEI CLIENTI · card / tabella / «Da ricontattare»
   ===================================================================== */
.pill.recall { background: var(--orange-soft); color: var(--orange); }
.pill.recall svg.i { width: 13px; height: 13px; }
.cust-toolbar { margin-bottom: 12px; }
.chip svg.i { width: 16px; height: 16px; }
.chip-recall { color: var(--orange); }
.chip-recall small { background: var(--orange-soft); color: var(--orange); opacity: 1; border-radius: 999px; padding: 1px 8px; }
.chip-recall.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.chip-recall.on small { background: rgba(255,255,255,.22); color: #fff; }
div.cust-card { cursor: default; }
div.cust-card:hover { transform: none; }
.cust-card.is-recall { border-color: #f1c7a5; box-shadow: inset 4px 0 0 var(--orange); }
.cust-foot { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.cust-foot .last { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.cust-foot .last small { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.cust-foot .last b { font-size: 16px; margin-left: auto; }
.cust-foot .last span { font-size: 12px; color: var(--muted); }
.cust-foot .btn { width: 100%; }
.cust-foot .last.off b { color: var(--orange); }

.cust-table-card { overflow: hidden; }
.cust-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cust-table th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 14px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.cust-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cust-table tr:last-child td { border-bottom: 0; }
.cust-table .r { text-align: right; }
.cust-table tbody tr { transition: background .15s; }
.cust-table tbody tr:hover { background: var(--surface-2); }
.cust-table tr.is-recall td:first-child { box-shadow: inset 4px 0 0 var(--orange); }
.cust-table .cn { display: flex; align-items: center; gap: 12px; }
.cust-table .cn .mono-badge { width: 40px; height: 40px; font-size: 15px; border-radius: 12px; }
.cust-table .cn b { display: block; font-weight: 700; }
.cust-table .cn small { color: var(--muted); font-size: 12px; }
.cust-table .c-loc-inline { display: none; }
.cust-table .c-disc { font-weight: 700; }
.last-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.last-cell .d { font-weight: 700; }
.last-cell .d.off { color: var(--orange); }
.last-cell small { color: var(--muted); font-size: 12px; }
.cust-table .btn { min-height: 44px; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* =====================================================================
   I MIEI ORDINI · righe cliccabili e dettaglio
   ===================================================================== */
a.row-link { color: inherit; text-decoration: none; border-radius: 12px; transition: background .15s; }
a.row-link:hover { background: var(--surface-2); }
.row-link .chev { color: var(--muted); display: grid; place-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; text-decoration: none; margin-bottom: 10px; font-size: 14px; }
.back-link:hover { color: var(--brand); }
.back-link svg.i { width: 18px; height: 18px; }
.pill-lg { font-size: 14px; padding: 8px 16px; text-transform: capitalize; }
.btn-danger { background: var(--red); color: #fff; border-color: transparent; }
.btn-danger-ghost { color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-soft); border-color: #f0c9c2; }

.od-head { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px 24px; padding: 20px 22px; margin-bottom: 16px; align-items: center; }
.od-cust { display: flex; gap: 14px; align-items: center; }
.od-head .lbl { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.od-head .v { font-weight: 700; font-size: 16px; }
.od-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.od-steps { grid-column: 1 / -1; display: flex; list-style: none; margin: 0; padding: 14px 0 0; border-top: 1px solid var(--line); }
.od-steps li { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; font-size: 14px; position: relative; }
.od-steps li:not(:last-child)::after { content: ''; flex: 1; height: 2px; background: var(--line); margin: 0 12px; border-radius: 2px; }
.od-steps li.done::after { background: var(--olive); }
.od-steps i { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 13px; background: var(--bg-2); border: 1.5px solid var(--line); flex: none; }
.od-steps i svg.i { width: 15px; height: 15px; stroke-width: 2.6; }
.od-steps li.done { color: var(--olive); }
.od-steps li.done i { background: var(--olive); border-color: var(--olive); color: #fff; }
.od-steps li.now { color: var(--ink); }
.od-steps li.now i { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 5px var(--brand-soft); }

.od-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--summary-w); gap: 20px; align-items: start; }
.od-lines { padding-bottom: 8px; overflow: hidden; }
.odl { display: grid; grid-template-columns: minmax(0, 1fr) 120px 96px 80px 110px; gap: 14px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.odl.ed { grid-template-columns: minmax(0, 1fr) 140px 96px 90px 110px 44px; }
.odl.head { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding-top: 14px; padding-bottom: 10px; border-top: 0; }
.odl .r, .odl-u, .odl-t { text-align: right; }
.odl-p { display: flex; gap: 12px; align-items: center; min-width: 0; }
.odl-p .ptile { width: 44px; height: 44px; font-size: 17px; border-radius: 12px; flex: none; }
.odl-p .nm { font-weight: 700; font-size: 14px; line-height: 1.25; }
.odl-p .meta { font-size: 12px; color: var(--muted); }
.odl-u small { color: var(--muted); font-size: 12px; }
.odl-t { font-weight: 700; font-size: 15px; white-space: nowrap; }
.odl-t s { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.odl .ro { font-weight: 600; }
.odl .stepper button { width: 38px; }
.odl .stepper input { width: 52px; }
.odl .disc input { width: 40px; }
.od-side { position: sticky; top: 20px; overflow: hidden; }
.od-actions { margin-top: 16px; }
.od-actions .btn { margin-top: 0; }
.od-sec { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.od-sec .btn { min-width: 0; padding: 0 12px; }
.od-lock { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); margin-top: 8px; }
.od-lock svg.i { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.od-readonly { display: flex; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--bg-2); color: var(--ink-2); font-size: 13px; margin-bottom: 12px; }
.od-readonly b { display: block; color: var(--ink); font-size: 14px; }

@media (max-width: 1440px) {
  /* dettaglio ordine: righe a tutta larghezza, totale e azioni sotto */
  .od-layout { grid-template-columns: minmax(0, 1fr); }
  .od-side { position: static; }
}
@media (max-width: 1440px) and (min-width: 761px) {
  .od-side .summary-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; align-items: start; }
  .od-side .od-actions { margin-top: 0; }
}
@media (max-width: 1100px) {
  .cust-table .c-loc { display: none; }
  .cust-table .c-loc-inline { display: inline; }
  .od-head { grid-template-columns: minmax(0, 1fr); }
  /* righe ordine → card */
  .odl.head { display: none; }
  .odl, .odl.ed { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "p p" "q d" "u t"; gap: 10px 12px; padding: 14px 16px; }
  .odl.ed { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "p p p" "q d x" "u u t"; }
  .odl-p { grid-area: p; } .odl-q { grid-area: q; } .odl-d { grid-area: d; justify-self: end; }
  .odl-u { grid-area: u; text-align: left; font-size: 13px; color: var(--ink-2); align-self: center; }
  .odl-t { grid-area: t; } .odl-x { grid-area: x; }
  .odl.ed .odl-d { justify-self: start; }
  .odl:not(.ed) .odl-q, .odl:not(.ed) .odl-d { font-size: 13px; color: var(--ink-2); }
  .odl:not(.ed) .odl-d::before { content: 'sconto '; color: var(--muted); font-weight: 500; }
}
@media (max-width: 900px) {
  .cust-table th, .cust-table td { padding: 12px 10px; }
  .cust-table .c-act .btn span { display: none; }
  .cust-table .c-act .btn { width: 44px; padding: 0; }
}
@media (max-width: 760px) {
  .cust-toolbar .search .input { height: 52px; }
  /* tabella clienti → righe compatte impilate */
  .cust-table thead { display: none; }
  .cust-table, .cust-table tbody { display: block; }
  .cust-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px; border-bottom: 1px solid var(--line); }
  .cust-table tr:last-child { border-bottom: 0; }
  .cust-table td { display: block; padding: 0; border: 0; }
  .cust-table tr.is-recall td:first-child { box-shadow: none; }
  .cust-table tr.is-recall { box-shadow: inset 4px 0 0 var(--orange); }
  .cust-table .c-name { grid-column: 1 / -1; }
  .cust-table .c-lv, .cust-table .c-disc { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
  .cust-table .c-disc { text-align: left; justify-self: end; }
  .cust-table .c-disc::before { content: 'Sconto'; font-weight: 500; color: var(--muted); }
  .cust-table .c-last { align-self: center; }
  .cust-table .c-act .btn span { display: inline; }
  .cust-table .c-act .btn { width: auto; padding: 0 14px; }
  .od-head { padding: 16px; }
  .od-facts .v { font-size: 14px; }
  .od-steps li { font-size: 0; gap: 0; }
  .od-steps li.now { font-size: 12px; gap: 6px; }
  .od-steps li:not(:last-child)::after { margin: 0 6px; }
  .od-side { margin-bottom: 20px; }
}


/* =====================================================================
   Correzioni round 3: elenco ordini con azioni, ultima vendita, scelta cliente
   ===================================================================== */
.order-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.order-row:first-child { border-top: 0; }
.order-row .row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 6px; border-radius: 12px; color: inherit; text-decoration: none; transition: background .15s; }
.order-row .row-main:hover { background: var(--surface-2); }
.order-row .grow { flex: 1; min-width: 0; }
.order-row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-row .s { font-size: 13px; color: var(--muted); }
.order-row .amt { font-weight: 700; min-width: 96px; text-align: right; }
.row-acts { display: flex; gap: 8px; flex: none; width: 372px; justify-content: flex-end; }
.row-acts .btn { min-height: 44px; padding: 0 14px; gap: 7px; font-size: 14px; }
.row-acts .btn svg.i { width: 18px; height: 18px; }
.row-acts .act-edit { color: var(--ink); }
.row-acts .act-del { color: var(--red); }
.row-acts .act-del:not([disabled]):hover { background: var(--red-soft); border-color: #f0c9c2; }
.row-acts .act-val { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: var(--brand-ink); border-color: transparent; }
.row-acts.ro .ro-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.row-acts.ro svg.i { width: 14px; height: 14px; }
.order-row.is-draft .row-main { box-shadow: inset 3px 0 0 var(--gold); }

.last-sale { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; font-size: 12px; color: var(--ink-2); margin-top: 6px; padding: 6px 8px; border-radius: 10px; background: var(--bg-2); }
.last-sale svg.i { width: 13px; height: 13px; align-self: center; color: var(--gold); }
.last-sale .ls-l { color: var(--muted); font-weight: 600; }
.last-sale b { font-size: 13px; color: var(--ink); }
.last-sale .ls-u { color: var(--muted); }
.last-sale .ls-d { font-weight: 700; color: var(--olive); }
.last-sale .ls-t { color: var(--muted); margin-left: auto; }
.last-sale.on { background: var(--gold-soft); color: #5b4313; }
.last-sale.none { color: var(--muted); font-style: italic; }
.last-sale.in-sum { margin: 6px 0 2px; padding: 4px 8px; }
.prow .last-sale { margin-top: 4px; display: inline-flex; }

.cust-table.pick tbody tr { cursor: pointer; }
.cust-table.pick tbody tr:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

@media (max-width: 1100px) {
  .order-row { flex-wrap: wrap; gap: 6px 14px; }
  .order-row .row-main { flex-basis: 100%; }
  .row-acts { width: auto; flex: 1; justify-content: flex-end; padding: 0 6px 6px; }
}
@media (max-width: 760px) {
  .row-acts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 0 6px; }
  .row-acts.ro { display: flex; }
  .row-acts .btn { padding: 0 8px; }
  .order-row .amt { min-width: 0; }
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 1280px) {
  :root { --summary-w: 360px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .ctx-bar { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .demo-ribbon .long { display: none; }
}
@media (max-width: 1100px) {
  :root { --rail-w: 84px; --summary-w: 340px; }
  .hero-card { grid-template-columns: 1fr; }
  .goal { justify-self: start; }
  .dash-grid { grid-template-columns: 1fr; }
  .ctx-bar { grid-template-columns: minmax(0, 1fr); }
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
}
/* iPad verticale: catalogo + riepilogo ancora affiancati, compatti */
@media (max-width: 900px) and (min-width: 761px) {
  :root { --rail-w: 76px; --summary-w: 320px; }
  .rail a span { font-size: 10px; }
  .page { padding: 20px 16px 40px; }
  .seg .lbl { display: none; }
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prow { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .prow .ptile { width: 44px; height: 44px; }
  .prow .pr { display: none; }
  .prow .nm { white-space: normal; }
  .sline .l2 { gap: 6px; }
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 340px; padding: 36px; }
}
/* Smartphone: catalogo a tutta larghezza, riepilogo in bottom sheet */
@media (max-width: 760px) {
  :root { --rail-w: 0px; }
  .shell { padding-left: 0; padding-bottom: 84px; }
  .rail { display: none; }
  .tabbar {
    display: flex; position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; height: 76px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); gap: 4px;
    background: rgba(30,24,20,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    border-radius: 14px; text-decoration: none; color: #a99a8a; font-size: 11px; font-weight: 600;
  }
  .tabbar a.active { color: var(--gold-2); }
  .tabbar a svg.i { width: 24px; height: 24px; }
  .page { padding: 18px 14px 28px; }
  .page-head { margin-bottom: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .val { font-size: 22px; }
  .hero-card { padding: 22px; border-radius: 22px; }
  .goal-ring { width: 120px; height: 120px; }
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 280px; padding: 28px 22px; }
  .login-hero h1 { font-size: 38px; }
  .login-chips { display: none; }
  .order-layout { grid-template-columns: minmax(0, 1fr); }
  .order-layout > .summary { display: none; }
  .toolbar .seg .lbl { display: none; }
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pcard .ptile { font-size: 32px; }
  .check { top: 16px; right: 16px; }
  .badge-best { display: none; }
  .prow { grid-template-columns: 48px minmax(0, 1fr) auto; padding: 10px 12px; gap: 12px; }
  .prow .ptile { width: 48px; height: 48px; }
  .prow .pr { display: none; }
  .prow .nm { white-space: normal; font-size: 14px; }
  .mobile-bar {
    display: flex; position: fixed; z-index: 55; left: 12px; right: 12px; bottom: 88px;
    align-items: center; gap: 12px; padding: 10px 10px 10px 18px; border-radius: 20px;
    background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: #fff7f2; border: 0; text-align: left;
    box-shadow: 0 18px 40px -14px rgba(139,29,44,.8);
  }
  .mobile-bar .grow { flex: 1; }
  .mobile-bar small { display: block; opacity: .8; font-size: 12px; }
  .mobile-bar b { font: 700 20px var(--font-num); }
  .mobile-bar .go { background: rgba(255,255,255,.16); border-radius: 14px; padding: 12px 14px; font-weight: 700; display: flex; gap: 6px; align-items: center; }
  .history { margin-bottom: 90px; }
  .hist-table { font-size: 13px; }
  /* bollino PROTOTIPO: striscia sottile in alto, fuori dal contenuto (non copre controlli) */
  body { padding-top: calc(40px + env(safe-area-inset-top)); }
  .demo-ribbon {
    top: 0; bottom: auto; left: 0; right: 0; z-index: 70; height: calc(40px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 10px 0 16px; border-radius: 0; justify-content: space-between;
    box-shadow: none; background: rgba(29, 23, 18, .96);
  }
  .demo-ribbon .long { display: none; }
  .ctx-tile { min-height: 64px; }
  .ctx-bar { gap: 8px; }
}
