/* PC System gestionale - stile moderno (v2.1)
   Superfici chiare e morbide, ombre leggere, sfumature solo sui bottoni principali. */

@font-face {
  font-family: "Jakarta";
  src: url("fonts/jakarta.woff2") format("woff2-variations"), url("fonts/jakarta.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e5e8f0;
  --border-strong: #d3d8e4;
  --text: #14182b;
  --muted: #667085;
  --primary: #3d5afe;
  --primary-600: #2f47e0;
  --primary-soft: #eef1ff;
  --green: #12b76a;
  --green-soft: #e7f8ef;
  --amber: #f79009;
  --amber-soft: #fff4e5;
  --red: #f04438;
  --red-soft: #feeceb;
  --wa: #25d366;
  --nav: #0f1430;
  --nav-2: #1a2150;
  --r-lg: 18px;
  --r: 12px;
  --sh-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --sh: 0 1px 3px rgba(16, 24, 40, .05), 0 10px 28px -10px rgba(16, 24, 40, .10);
  --sh-lg: 0 2px 6px rgba(16, 24, 40, .06), 0 24px 48px -16px rgba(16, 24, 40, .18);
  --ring: 0 0 0 4px rgba(61, 90, 254, .16);
  --font: "Jakarta", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.ico { flex: none; display: block; }
:focus-visible { outline: none; box-shadow: var(--ring); }
kbd {
  font-family: var(--font); font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(255, 255, 255, .22); color: inherit;
}

/* ---------- Struttura ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.rail {
  background: linear-gradient(180deg, var(--nav) 0%, var(--nav-2) 100%);
  color: #fff;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; padding: 0 8px 28px; }
.brand-pc {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800; letter-spacing: -0.02em; color: #fff;
  background: linear-gradient(135deg, #5b7bff 0%, #8b5cf6 100%);
  box-shadow: 0 6px 16px -4px rgba(91, 123, 255, .6);
}
.brand-sys { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; color: #fff; }
.brand.big { justify-content: center; padding: 0 0 8px; }
.brand.big .brand-pc { width: 56px; height: 56px; border-radius: 16px; font-size: 20px; }
.brand.big .brand-sys { color: var(--text); font-size: 20px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  color: rgba(255, 255, 255, .62); text-decoration: none; font-weight: 600; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.on { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 3px 0 0 #7b93ff; }
.nav-out { margin-top: 8px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 12px; align-items: center;
  padding: 14px 32px;
  background: rgba(244, 246, 251, .82);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid rgba(229, 232, 240, .7);
}
.content { padding: 28px 32px 64px; max-width: 1320px; width: 100%; }

/* Barra di ricerca / pistola ottica */
.omnibox { position: relative; flex: 1; max-width: 720px; }
.omnibox input[type=search] {
  width: 100%; height: 48px;
  padding: 0 16px 0 48px;
  font: inherit; font-size: 15px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text);
  box-shadow: var(--sh-sm);
  transition: border-color .15s, box-shadow .15s;
}
.omnibox input[type=search]:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.omni-ico { position: absolute; left: 15px; top: 13px; color: #98a2b3; }
.omni-results {
  position: absolute; left: 0; right: 0; top: 56px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--sh-lg);
  max-height: 70vh; overflow: auto; padding: 6px;
}
.omni-results a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; text-decoration: none; }
.omni-results a:hover, .omni-results a.sel { background: var(--primary-soft); }
.omni-results small { color: var(--muted); display: block; }
.omni-results .grp { font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 12px 4px; }
.omni-results .omni-empty { padding: 12px; color: var(--muted); }

.privacy-btn {
  display: flex; align-items: center; height: 48px; padding: 0 16px;
  font: inherit; font-weight: 600; font-size: 14px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); cursor: pointer;
  box-shadow: var(--sh-sm);
}
.privacy-btn:hover { border-color: var(--border-strong); }
.privacy-btn > span { display: flex; gap: 8px; align-items: center; }
.privacy-btn .pv-on { display: none; }
html.privacy .privacy-btn { background: var(--text); border-color: var(--text); color: #fff; }
html.privacy .privacy-btn .pv-on { display: flex; }
html.privacy .privacy-btn .pv-off { display: none; }

/* Modalità cliente */
.costo-codice { display: none; }
html.privacy .costo-reale { display: none; }
html.privacy .costo-codice { display: inline; }
html.privacy .riservato { display: none !important; }

/* ---------- Testate ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; }
.page-head p { margin: 6px 0 0; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.back:hover { color: var(--primary); }

/* ---------- Bottoni grandi della dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 20px; }
.tile {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 172px; padding: 20px;
  border-radius: 22px;
  text-decoration: none; color: #fff;
  box-shadow: 0 14px 30px -14px var(--tile-shadow, rgba(16, 24, 40, .4));
  transition: transform .2s ease, box-shadow .2s ease;
}
.tile::after {
  content: ""; position: absolute; z-index: -1;
  width: 220px; height: 220px; right: -70px; top: -90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 70%);
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 22px 40px -16px var(--tile-shadow, rgba(16, 24, 40, .5)); }
.tile:active { transform: translateY(0) scale(.99); }
.tile-ico {
  width: 52px; height: 52px; margin-bottom: auto;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .2); border-radius: 15px;
  backdrop-filter: blur(4px);
}
.tile-ico .ico { width: 28px; height: 28px; }
.tile-t { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin-top: 18px; }
.tile-s { font-size: 13px; font-weight: 500; opacity: .85; }
.tile kbd { position: absolute; top: 18px; right: 18px; }
.t-rip { background: linear-gradient(135deg, #ff9f43 0%, #ff5f6d 100%); --tile-shadow: rgba(255, 95, 109, .65); }
.t-vendi { background: linear-gradient(135deg, #22c55e 0%, #0ea5a4 100%); --tile-shadow: rgba(14, 165, 164, .6); }
.t-mag { background: linear-gradient(135deg, #4f7bff 0%, #7c4dff 100%); --tile-shadow: rgba(92, 90, 255, .6); }
.t-cli { background: linear-gradient(135deg, #f43f5e 0%, #c026d3 100%); --tile-shadow: rgba(214, 47, 140, .55); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 26px; }
.stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 20px; background: var(--surface);
  border-radius: var(--r-lg); border: 1px solid var(--border); box-shadow: var(--sh-sm);
  text-decoration: none; transition: border-color .15s, box-shadow .15s;
}
.stat b { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-weight: 500; font-size: 13.5px; }
.stat:hover { border-color: var(--border-strong); box-shadow: var(--sh); }
.stat-hot { background: var(--green-soft); border-color: #b5ebd0; }
.stat-hot b { color: #027a48; }

/* ---------- Pannelli e liste ---------- */
.cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
.cols-even { grid-template-columns: 1fr 1fr; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--sh-sm); }
.panel + .panel { margin-top: 20px; }
.cols > .panel + .panel { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.link { color: var(--primary); font-weight: 600; text-decoration: none; font-size: 14px; }
.link:hover { color: var(--primary-600); text-decoration: underline; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.empty a { color: var(--primary); font-weight: 600; }

.worklist, .debtlist { list-style: none; margin: 0 -8px; padding: 0; }
.worklist a, .debtlist a { display: flex; align-items: center; gap: 14px; padding: 11px 8px; text-decoration: none; border-radius: 12px; transition: background .12s; }
.worklist a:hover, .debtlist a:hover { background: var(--surface-2); }
.wl-num { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; min-width: 58px; }
.wl-main, .dl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wl-main b, .dl-main b { font-weight: 650; }
.wl-main small, .dl-main small, .wl-side small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dl-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.dl-amt { font-weight: 700; font-variant-numeric: tabular-nums; color: #d92d20; }

/* ---------- Badge ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.st-accettata { background: #f0f2f7; color: #475467; }
.st-lavorazione { background: var(--primary-soft); color: var(--primary-600); }
.st-ricambi { background: var(--amber-soft); color: #b54708; }
.st-pronta { background: var(--green-soft); color: #027a48; }
.st-consegnata { background: #f2f4f7; color: #667085; }
.st-annullata { background: var(--red-soft); color: #b42318; }
.b-ok { background: var(--green-soft); color: #027a48; }
.b-no { background: var(--red-soft); color: #b42318; }
.b-neutro { background: #f0f2f7; color: #475467; }
.b-neutro::before, .b-no::before { display: none; }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px;
  font: inherit; font-weight: 600; font-size: 14.5px;
  border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); color: var(--text);
  box-shadow: var(--sh-sm);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); border-color: #c1c8d6; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px -6px rgba(61, 90, 254, .7); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-amber { background: linear-gradient(135deg, #ff9f43, #ff5f6d); border: 0; color: #fff; box-shadow: 0 6px 16px -6px rgba(255, 95, 109, .7); }
.btn-amber:hover { background: linear-gradient(135deg, #f59234, #f2505f); }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; box-shadow: 0 6px 16px -6px rgba(37, 211, 102, .7); }
.btn-wa:hover { background: #1fbe5b; border-color: #1fbe5b; }
.btn-mail { background: #0ea5e9; border-color: #0ea5e9; color: #fff; box-shadow: 0 6px 16px -6px rgba(14, 165, 233, .7); }
.btn-mail:hover { background: #0b93d1; border-color: #0b93d1; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 6px 16px -6px rgba(18, 183, 106, .7); }
.btn-green:hover { background: #0ea35d; border-color: #0ea35d; }
.btn-danger { color: #b42318; border-color: #fbd0cc; background: #fff; }
.btn-danger:hover { background: var(--red-soft); border-color: #f9b4ae; }
.btn-ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn-ghost:hover { background: rgba(16, 24, 40, .05); border-color: transparent; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { min-height: 50px; font-size: 15.5px; padding: 0 22px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Form ---------- */
.form { display: grid; gap: 16px; }
.form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; }
.form legend { font-weight: 700; font-size: 15px; margin-bottom: 4px; padding: 0; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 13.5px; color: #344054; }
.form label .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=search], input[type=date], input:not([type]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 13px;
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r);
  box-shadow: var(--sh-sm);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #98a2b3; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.money-in { position: relative; }
.money-in input { padding-left: 32px; }
.money-in::before { content: "€"; position: absolute; left: 13px; top: 11px; color: var(--muted); font-weight: 600; z-index: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface);
  font-weight: 600; font-size: 13.5px; color: #344054; cursor: pointer; user-select: none;
  transition: all .15s;
}
.chip span:hover { border-color: #b8c0d0; }
.chip input:checked + span { background: var(--primary-soft); color: var(--primary-600); border-color: #b7c3ff; }
.chip input:focus-visible + span { box-shadow: var(--ring); }
button.chip-btn {
  min-height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: #344054;
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; transition: all .15s;
}
button.chip-btn:hover { background: var(--primary-soft); border-color: #b7c3ff; color: var(--primary-600); }

/* ---------- Tabelle ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th:first-child { border-top-left-radius: 10px; }
.tbl th:last-child { border-top-right-radius: 10px; }
.tbl td { padding: 12px; border-bottom: 1px solid #eef0f5; vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.rowlink { cursor: pointer; }
.tbl tr.rowlink:hover td { background: var(--surface-2); }
.tbl .r { text-align: right; }
.tbl td.r { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .sub { color: var(--muted); font-size: 12.5px; }
.tbl tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--border); }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: #98a2b3; }

/* Filtri */
.tabs { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; padding: 4px; background: #e9ecf4; border-radius: 14px; }
.tabs a { display: inline-flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 13.5px; color: #475467; }
.tabs a:hover { color: var(--text); }
.tabs a b { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: rgba(16, 24, 40, .07); }
.tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--sh-sm), 0 1px 3px rgba(16, 24, 40, .08); }
.tabs a.on b { background: var(--primary-soft); color: var(--primary-600); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search] { max-width: 340px; }
.toolbar select { width: auto; }

/* ---------- Messaggi ---------- */
.flash { padding: 12px 16px; border-radius: 14px; margin-bottom: 18px; font-weight: 600; font-size: 14px; border: 1px solid; display: flex; gap: 10px; align-items: center; }
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.flash-ok { background: var(--green-soft); border-color: #b5ebd0; color: #05603a; }
.flash-err { background: var(--red-soft); border-color: #fbd0cc; color: #912018; }
.flash-warn { background: var(--amber-soft); border-color: #fedf89; color: #93370d; }
.alert-box { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--amber-soft); border: 1px solid #fedf89; color: #7a2e0e; font-weight: 500; }
.alert-box a { color: inherit; }

/* ---------- Scheda riparazione ---------- */
.ticket-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.ticket-num { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.stepper { display: flex; margin: 0 0 22px; padding: 5px; list-style: none; background: #e9ecf4; border-radius: 16px; gap: 4px; }
.stepper li { flex: 1; }
.stepper button {
  width: 100%; min-height: 44px; padding: 6px 8px;
  font: inherit; font-weight: 600; font-size: 13.5px;
  border: 0; border-radius: 12px; background: transparent; color: #667085; cursor: pointer;
  transition: background .15s, color .15s;
}
.stepper button:hover { background: rgba(255, 255, 255, .6); color: var(--text); }
.stepper .done button { color: #344054; }
.stepper .done button::before { content: "✓ "; color: var(--green); }
.stepper .now button { background: var(--surface); color: var(--primary-600); box-shadow: var(--sh-sm), 0 2px 6px rgba(16, 24, 40, .08); }
.stepper .now.pronta button { background: var(--green); color: #fff; }
.stepper .now.consegnata button { background: var(--text); color: #fff; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); }
.timeline li { position: relative; display: grid; grid-template-columns: 124px 1fr; gap: 10px; padding: 6px 0 10px 8px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; }

.sum-box { display: grid; gap: 8px; padding: 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.sum-box div { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; color: #475467; }
.sum-box .big { font-size: 20px; font-weight: 800; color: var(--text); padding-top: 8px; border-top: 1px dashed var(--border-strong); }

/* ---------- Conto cliente ---------- */
.saldo-card { padding: 22px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh); }
.saldo-card.debito { background: linear-gradient(160deg, #fff5f4 0%, #ffffff 60%); border-color: #fbd0cc; }
.saldo-card.ok { background: linear-gradient(160deg, #effbf5 0%, #ffffff 60%); border-color: #b5ebd0; }
.saldo-card .lbl { font-weight: 600; color: var(--muted); font-size: 14px; }
.saldo-card .amt { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 4px 0 14px; }
.saldo-card.debito .amt { color: #d92d20; }
.saldo-card.ok .amt { color: #027a48; }
.addline { display: grid; gap: 12px; }
.addline .scan { position: relative; }
.addline .scan input[id] { padding-left: 46px; font-size: 16px; min-height: 50px; border-radius: 14px; }
.addline .scan .ico { position: absolute; left: 15px; top: 14px; color: #98a2b3; z-index: 1; }
.suggest { position: absolute; left: 0; right: 0; top: 56px; z-index: 10; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--sh-lg); max-height: 320px; overflow: auto; padding: 6px; }
.suggest button { display: flex; width: 100%; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 0; border-radius: 10px; background: none; font: inherit; text-align: left; cursor: pointer; color: var(--text); }
.suggest button:hover, .suggest button.sel { background: var(--primary-soft); }
.suggest small { color: var(--muted); }
.costinfo { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.mov-pag td { color: #027a48; }
#cart .chip-btn { min-height: 26px; padding: 0 9px; font-size: 12px; }
#cart .chips { gap: 4px !important; }
#cart input { min-height: 38px !important; }

/* ---------- Articolo ---------- */
.photo-box { display: grid; place-items: center; aspect-ratio: 4 / 3; border: 2px dashed var(--border-strong); border-radius: 18px; background: var(--surface-2); overflow: hidden; color: var(--muted); text-align: center; padding: 10px; transition: border-color .15s, background .15s; }
.photo-box:hover { border-color: var(--primary); background: var(--primary-soft); }
.photo-box img { width: 100%; height: 100%; object-fit: contain; }
.photo-box .ico { margin: 0 auto 6px; }
.ocr-words { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ocr-words button { padding: 6px 11px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); font: inherit; font-size: 13px; cursor: pointer; }
.ocr-words button:hover { border-color: var(--primary); background: var(--primary-soft); }
.price-calc { display: grid; gap: 10px; padding: 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.margin-line { font-size: 13.5px; color: var(--muted); }
.margin-line b { color: var(--text); }

/* Scanner fotocamera */
.scanner-modal { position: fixed; inset: 0; z-index: 100; background: rgba(15, 20, 48, .6); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; }
.scanner-modal[hidden] { display: none; }
.scanner-card { background: var(--surface); border-radius: 22px; box-shadow: var(--sh-lg); padding: 18px; width: min(480px, 100%); }
#scanner-view { width: 100%; min-height: 260px; border-radius: 14px; overflow: hidden; background: #000; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background:
    radial-gradient(900px 500px at 10% 10%, rgba(124, 77, 255, .45), transparent 60%),
    radial-gradient(800px 500px at 90% 90%, rgba(255, 95, 109, .35), transparent 60%),
    radial-gradient(700px 400px at 80% 10%, rgba(14, 165, 164, .35), transparent 60%),
    var(--nav);
}
.login-card { width: min(420px, 100%); background: rgba(255, 255, 255, .96); border-radius: 26px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45); padding: 34px 30px; }
.login-card.wide { width: min(520px, 100%); }
.login-card > .muted { text-align: center; margin: 0 0 24px; }
.login-card h1 { font-size: 22px; margin: 12px 0 6px; }

/* ---------- Responsive ---------- */
.cols > *, .tiles > *, .stats > *, .grid2 > *, .grid3 > *, .main, .content { min-width: 0; }
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .cols, .cols-even { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; z-index: 50;
    flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(15, 20, 48, .96); backdrop-filter: blur(12px);
  }
  .brand, .nav-out { display: none; }
  .nav { flex-direction: row; justify-content: space-around; }
  .nav-item { flex-direction: column; gap: 3px; padding: 7px 4px; font-size: 10.5px; text-align: center; flex: 1; border-radius: 12px; }
  .nav-item.on { box-shadow: none; }
  .topbar { padding: 10px 16px; }
  .privacy-btn { padding: 0 13px; }
  .privacy-btn span span { display: none; }
  .content { padding: 20px 16px 110px; }
  h1 { font-size: 24px; }
  .tile { min-height: 146px; padding: 16px; border-radius: 20px; }
  .tile-t { font-size: 17px; }
  .tile-s, .tile kbd { display: none; }
  .tile-ico { width: 46px; height: 46px; }
  .stats { grid-template-columns: 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .stepper { flex-wrap: wrap; }
  .stepper li { flex: 1 1 30%; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
  .page-head .actions .btn-lg { min-height: 46px; font-size: 14.5px; }
  .ticket-head .btn-row { width: 100%; }
  .hide-m { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
