/* 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: #1F4E8C;
  --primary-600: #173c6c;
  --primary-soft: #e9f0f8;
  --green: #3E8E3A;
  --green-soft: #ecf6ea;
  --amber: #f79009;
  --amber-soft: #fff4e5;
  --red: #f04438;
  --red-soft: #feeceb;
  --wa: #25d366;
  --nav: #12304f;
  --nav-2: #1c4270;
  --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(31, 78, 140, .18);
  --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: var(--rail, 216px) minmax(0, 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; }
.brand-stm { display: block; width: 100%; max-width: 160px; height: auto; margin: 0 auto; }
.brand-stm-big { display: block; width: 220px; max-width: 70vw; height: auto; margin: 0 auto; }

.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: var(--rail-fg, rgba(255, 255, 255, .62)); text-decoration: none; font-weight: 600; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.nav-item .nc { display: none; }
.nav-item .nl, .nav-out span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nav-item:hover { background: var(--rail-hover, rgba(255, 255, 255, .06)); color: var(--rail-fg-on, #fff); }
.nav-item.on { background: var(--rail-on, rgba(255, 255, 255, .1)); color: var(--rail-fg-on, #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: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.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-cam { left: 6px; top: 50%; transform: translateY(-50%); width: 42px; height: 40px; padding: 0; border: 0; border-radius: 10px; background: none; cursor: pointer; display: grid; place-items: center; color: var(--primary); }
.omni-cam:hover { background: var(--primary-soft); }
.omni-cam-c { position: absolute; right: 3px; bottom: 3px; width: 17px; height: 17px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; }
.omni-cam-c .ico { width: 11px; height: 11px; }
.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, #2a63ad 0%, #1F4E8C 100%); --tile-shadow: rgba(31, 78, 140, .55); }
.t-vendi { background: linear-gradient(135deg, #52a84d 0%, #2f7a2c 100%); --tile-shadow: rgba(62, 142, 58, .55); }
.t-mag { background: linear-gradient(135deg, #2b7a9e 0%, #1b4f73 100%); --tile-shadow: rgba(27, 79, 115, .55); }
.t-cli { background: linear-gradient(135deg, #3d4f66 0%, #1e2b3c 100%); --tile-shadow: rgba(30, 43, 60, .5); }

.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(31, 78, 140, .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: var(--label, #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 12px 32px; border-radius: 14px; margin-bottom: 18px; font-weight: 600; font-size: 14px; border: 1px solid; display: block; position: relative; line-height: 1.45; }
.flash::before { content: ""; position: absolute; left: 15px; top: 19px; width: 8px; height: 8px; border-radius: 50%; background: currentColor; } /* testo e link restano sulla stessa riga */
.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(31, 78, 140, .55), transparent 60%),
    radial-gradient(800px 500px at 90% 90%, rgba(62, 142, 58, .35), transparent 60%),
    radial-gradient(700px 400px at 80% 10%, rgba(42, 99, 173, .30), 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: rgb(15, 20, 48); transform: translateZ(0); /* senza blur: su alcuni telefoni (Samsung Internet) le icone non si disegnavano finché non si scorreva */
  }
  .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; }
  .nav-item .nl { display: none; } .nav-item .nc { display: block; white-space: nowrap; }
  .nav-item { min-width: 0; padding-left: 2px; padding-right: 2px; }
  .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; }
  /* pulsanti in alto ordinati: stessa larghezza, a griglia */
  .page-head .actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); width: 100%; }
  .page-head .actions > .btn, .page-head .actions > a, .page-head .actions > form > .btn { width: 100%; justify-content: center; }
  .page-head .actions > form { display: contents; }
  /* ricerca: campo e pulsante sulla stessa riga */
  .toolbar input[type=search] { max-width: none; flex: 1 1 200px; min-width: 0; }
  .toolbar .btn { flex: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* prezzo pieno barrato nelle proposte con sconto (2.42.0) */
.prev-pieno { color: var(--muted); font-weight: 600; font-size: .85em; margin-right: 3px; }
.prop-sconto { display: grid; gap: 4px; }

/* spunte obbligatorie mancanti (2.43.0) */
.cons-avviso { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: #fef3f2; color: #b42318; font-weight: 700; border: 1px solid #fecdca; }
label.cons-manca, input.cons-manca { outline: 2px solid #f04438; outline-offset: 2px; border-radius: 10px; background: #fef3f2; }

/* 2.67: autofatture e DDT (moduli a griglia, righe, "i") */
.fe-i { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border); font-size: 11px; font-style: italic; font-weight: 400; cursor: help; vertical-align: 1px; color: var(--muted); }
.af-pdf { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.af-form { grid-template-columns: repeat(4, 1fr); gap: 10px 14px; align-items: end; }
.af-form h2, .af-form .af-largo { grid-column: 1 / -1; }
.af-form h2 { margin: 8px 0 0; font-size: 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.af-form h2:first-of-type { margin-top: 0; }
.af-form label { display: grid; gap: 5px; }
.af-form label.check-row { display: flex; gap: 8px; align-items: center; font-weight: 500; } .af-form label.check-row input { width: auto; margin: 0; }
.af-err { color: #b42318; font-weight: 500; font-size: 12.5px; }
.af-righe { display: grid; gap: 8px; }
.af-rh { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.af-r { display: grid; grid-template-columns: 1fr 140px 110px; gap: 8px; }
.ddt-r { grid-template-columns: 110px 1fr 70px 64px 100px 90px; }
.af-tot { font-size: 14px; color: var(--muted); } .af-tot b { color: var(--text, #101828); }
.af-righe > .btn { justify-self: start; }
@media (max-width: 760px) {
  .af-form { grid-template-columns: 1fr 1fr; }
  .af-r { grid-template-columns: 1fr 1fr; } .af-r > input:first-child { grid-column: 1 / -1; }
  .ddt-r { grid-template-columns: 60px 56px 1fr 78px; } .ddt-r .ddt-descr { grid-column: 1 / -1; order: -2; } .ddt-r > input:first-child { grid-column: 1 / -1; order: -1; }
}
.ddt-r input, .af-r input { min-width: 0; }
.af-form .fe-cerca-cli { position: relative; flex: 0 1 320px; font-size: 14px; font-weight: 400; } .af-form .fe-cerca-cli input { width: 100%; }
.af-form .fe-cli-ris { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--sh-lg); overflow: hidden; }
.af-form .fe-cli-ris button { display: grid; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--border); background: none; cursor: pointer; font: inherit; }
.af-form label:not(.check-row) { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 6px; align-content: end; }
.af-form label:not(.check-row) > input, .af-form label:not(.check-row) > select, .af-form label:not(.check-row) > textarea { flex: 1 0 100%; width: 100%; }
.af-form label .af-err { flex: 1 0 100%; order: 1; }
.af-form .af-2 { grid-column: span 2; }
.af-form [hidden] { display: none !important; }
.af-form > *, .af-r > * { min-width: 0; } .af-form input, .af-form select { box-sizing: border-box; max-width: 100%; }
.riga-in { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; } .riga-in input { width: auto; }

/* 2.67.1: tendina compatta (al posto del menu a tutto schermo del telefono) */
.tnd { position: relative; }
.tnd-sel { display: none !important; }
.tnd-btn { width: 100%; text-align: left; font: inherit; font-size: 15px; padding: 10px 36px 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface, #fff); color: inherit; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; min-height: 42px; }
.tnd-btn::after { content: ''; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: translateY(-70%) rotate(45deg); }
.tnd.aperta .tnd-btn { border-color: #1aa37a; box-shadow: 0 0 0 3px rgba(26, 163, 122, .12); }
.tnd-btn:disabled { opacity: .7; cursor: default; }
.tnd-pan { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); max-height: min(60vh, 420px); overflow: auto; background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--sh-lg, 0 12px 30px rgba(16, 24, 40, .14)); padding: 4px 0; }
.tnd-op, .tnd-tit { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; text-align: left; font: inherit; font-size: 14.5px; line-height: 1.3; padding: 9px 14px; border: 0; background: none; color: inherit; }
.tnd-op { cursor: pointer; } .tnd-op:hover { background: rgba(16, 24, 40, .04); }
.tnd-op.on { color: #1aa37a; font-weight: 600; }
.tnd-op.on::after { content: '✓'; }
.tnd-tit { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--border); }
.tnd-apri { cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 14.5px; color: #1aa37a; } .tnd-apri b { font-size: 18px; font-weight: 500; }
.tnd-lista .tnd-op { padding-left: 22px; }
.fe-testa > label:first-child .tnd, .af-form label .tnd { flex: 1 0 100%; width: 100%; }

/* Prepara F24 (scadenze e bolli del commercialista) */
.sc-f24 { display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 12.5px; font-weight: 650; color: var(--primary); text-decoration: none; }
.sc-f24:hover { text-decoration: underline; }
.lbl-i { display: inline-flex; align-items: center; gap: 6px; }

/* Scontrino sulla cassa RT nella vendita al banco */
.rt-esito { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 12px; background: var(--primary-soft); color: var(--text); font-size: 14px; font-weight: 600; }
.rt-esito.ko { background: var(--amber-soft); color: #93370d; }
.rt-esito .rt-az { display: flex; flex-wrap: wrap; gap: 6px; }
