/* Area clienti AZ: stesso stile del sito (carta, inchiostro, righe sottili, rosso AZ), pensata prima per il telefono. */
/* carattere dei titoli: lo stesso del sito, servito da azautoricambi.ch */
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("https://azautoricambi.ch/?azs_font=600") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("https://azautoricambi.ch/?azs_font=700") format("woff2"); }

:root {
  --paper: #f5f3ee; --paper-2: #ebe7de; --white: #fffdf9;
  --ink: #16181b; --ink-2: #2a2d31; --graphite: #4a4d52; --muted: #5d6065;
  --line: #d9d5cc; --line-2: #b9b3a7;
  --red: #b80000; --red-d: #8e0000; --green: #1d6b35; --amber: #8a5300;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --w: 1100px; --pad: clamp(14px, 4vw, 28px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.5 var(--text); -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; -webkit-tap-highlight-color: transparent; }
::selection { background: var(--ink); color: var(--paper); }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
img { max-width: 100%; }
h1, h2 { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .01em; line-height: 1.02; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); }
h2 { font-size: 1.35rem; }
p { margin: 0; }
.w { width: 100%; max-width: var(--w); margin: 0 auto; padding: 0 var(--pad); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--white); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.right { text-align: right; }
.ic { width: 20px; height: 20px; flex: none; }

/* ---------- testata ---------- */
.top { background: var(--ink); color: var(--paper); position: sticky; top: 0; z-index: 20; }
.top-in { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding-top: env(safe-area-inset-top); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; }
.brand:hover { color: var(--paper); }
.brand img { width: 34px; height: 34px; border-radius: 50%; background: var(--white); }
.brand span { display: flex; flex-direction: column; line-height: 1; }
.brand b { font-family: var(--display); font-weight: 700; font-size: 1.35rem; text-transform: lowercase; letter-spacing: .01em; }
.brand small { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: #b9b6ae; margin-top: 3px; }
.top-cart { position: relative; display: grid; place-items: center; width: 46px; height: 46px; color: var(--paper); border-radius: 3px; }
.top-cart:hover { color: var(--paper); background: var(--ink-2); }
.top-cart .ic { width: 25px; height: 25px; }
.top-cart .n { position: absolute; top: 4px; right: 2px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--red);
  color: #fff; font: 600 .72rem/19px var(--text); text-align: center; transform: scale(0); transition: transform .2s var(--ease); }
.top-cart.has .n { transform: scale(1); }
.top-cart.bump .n { animation: bump .35s var(--ease); }
@keyframes bump { 40% { transform: scale(1.35); } }
.langs { display: flex; gap: 2px; }
.langs a { color: #b9b6ae; text-decoration: none; font: 600 .85rem/1 var(--text); padding: 10px 8px; letter-spacing: .06em; }
.langs a.on, .langs a:hover { color: var(--paper); }
.tabs { background: var(--paper-2); color: var(--ink); border-bottom: 1px solid var(--line); }
.tabs-in { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.tabs-in::-webkit-scrollbar { display: none; }
.tabs a { display: flex; align-items: center; gap: 7px; padding: 12px 12px 10px; white-space: nowrap; text-decoration: none; font-weight: 500;
  font-size: .95rem; color: var(--graphite); border-bottom: 2px solid transparent; scroll-snap-align: start; min-height: 46px; }
.tabs a .ic { width: 18px; height: 18px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--red); }

/* ---------- pagina ---------- */
.main { flex: 1; padding-top: 26px; padding-bottom: 48px; }
.page-head { margin-bottom: 20px; }
.page-head .sub { color: var(--graphite); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-head.row { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumb { margin-bottom: 10px; font-size: .95rem; }
.crumb a { color: var(--graphite); text-decoration: none; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 3px; padding: 18px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-hd { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-bottom: 12px; }
.panel-hd .sub { width: 100%; color: var(--muted); font-size: .92rem; }
.panel-hd .more { display: inline-flex; align-items: center; gap: 4px; font-size: .92rem; text-decoration: none; color: var(--graphite); }
.panel-hd .more .ic { width: 16px; height: 16px; }
.cols, .stack { display: grid; gap: 18px; margin-top: 18px; }
@media (min-width: 900px) { .cols { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; } }
.note { color: var(--muted); font-size: .88rem; margin-top: 14px; }
.hint { color: var(--graphite); font-size: .92rem; margin-top: 10px; }
.empty { color: var(--graphite); padding: 22px 0; display: flex; gap: 8px; align-items: center; }
.empty.ok { color: var(--green); font-weight: 500; }
.empty-page { padding: 40px 0; display: grid; gap: 18px; justify-items: start; }

/* ---------- messaggi ---------- */
.flash { display: grid; gap: 8px; margin-bottom: 18px; }
.msg { display: flex; gap: 8px; align-items: flex-start; padding: 11px 14px; border-radius: 3px; background: var(--white); border: 1px solid var(--line-2); font-size: .95rem; }
.msg.ok { border-color: #9cc3a8; background: #f1f8f2; color: #14502a; }
.msg.error { border-color: #e2a9a9; background: #fdf3f2; color: var(--red-d); }
.msg.warn { border-color: #e1c58e; background: #fdf7ea; color: #6b4300; }
.msg .ic { width: 18px; height: 18px; margin-top: 2px; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 3px; font-size: .95rem; max-width: min(92vw, 440px);
  box-shadow: 0 8px 24px rgba(22,24,27,.25); transition: opacity .2s var(--ease), transform .25s var(--ease); z-index: 60; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red-d); }

/* ---------- pulsanti e campi ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 3px;
  border: 1.5px solid var(--ink); background: var(--white); color: var(--ink); font: 600 .98rem/1 var(--text); text-decoration: none;
  cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease); }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: scale(.98); }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.dark:hover { background: var(--ink-2); }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.red:hover { background: var(--red-d); border-color: var(--red-d); color: #fff; }
.btn.ghost { border-color: var(--line-2); background: transparent; }
.btn.ghost:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: .9rem; }
.btn.icon { padding: 0; width: 38px; }
.btn.big { min-height: 52px; width: 100%; font-size: 1.05rem; }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn .ic { width: 18px; height: 18px; }
.link { background: none; border: 0; padding: 6px 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; text-decoration: underline; text-underline-offset: 3px; }
.form { display: grid; gap: 14px; }
.form h2 { margin-bottom: 2px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 500; font-size: .93rem; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--white); border: 1.5px solid var(--line-2); border-radius: 3px;
  padding: 11px 12px; min-height: 46px; width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22,24,27,.12); }
input::placeholder, textarea::placeholder { color: #75787c; }
input[disabled] { background: var(--paper-2); color: var(--graphite); }

/* ---------- accesso ---------- */
body.auth .main { display: grid; place-items: start center; padding-top: clamp(28px, 8vh, 80px); }
.auth-box { width: 100%; max-width: 420px; background: var(--white); border: 1px solid var(--line); border-radius: 3px; padding: clamp(20px, 5vw, 32px); }
.auth-box h1 { font-size: clamp(1.7rem, 6vw, 2.1rem); }
.auth-box .lead { color: var(--graphite); margin: 10px 0 20px; }
.auth-links { margin-top: 16px; font-size: .95rem; }
.auth-box .note { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; }

/* ---------- ricerca ---------- */
.bigsearch { display: flex; gap: 8px; margin-bottom: 18px; }
.bigsearch input { min-height: 54px; font-size: 1.05rem; border-color: var(--ink); }
.bigsearch .btn { min-height: 54px; padding: 0 18px; }
@media (max-width: 520px) { .bigsearch .btn span { display: none; } .bigsearch .btn { width: 54px; padding: 0; } }
.smallsearch { display: flex; gap: 6px; margin: 12px 0 16px; max-width: 520px; }
.smallsearch .btn { width: 46px; padding: 0; min-height: 46px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips a { white-space: nowrap; text-decoration: none; padding: 8px 14px; min-height: 40px; display: inline-flex; align-items: center; border: 1.5px solid var(--line-2);
  border-radius: 20px; font-size: .93rem; font-weight: 500; background: var(--white); color: var(--graphite); }
.chips a.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- riquadri cifre ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.kpi { display: grid; gap: 4px; align-content: start; padding: 14px 16px; background: var(--white); border: 1px solid var(--line); border-radius: 3px; text-decoration: none; color: var(--ink);
  transition: border-color .15s var(--ease); }
.kpi:hover { border-color: var(--ink); color: var(--ink); }
.kpi .k { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--graphite); }
.kpi b { font-family: var(--display); font-size: 1.85rem; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi b.ok { font-family: var(--text); font-size: 1rem; font-weight: 500; color: var(--green); }
.kpi .k2 { font-size: .9rem; color: var(--graphite); }
.kpi.alert .k2 { color: var(--red); font-weight: 600; }

/* ---------- articoli ---------- */
.items, .cart { list-style: none; margin: 0; padding: 0; }
.item, .cart li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; padding: 14px 0; border-top: 1px solid var(--line); align-items: center; }
.items .item:first-child { border-top: 0; padding-top: 4px; }
.item-main { min-width: 0; }
.item-code { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-weight: 600; }
.brand-tag { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--graphite); border: 1px solid var(--line-2); padding: 1px 6px; border-radius: 2px; font-weight: 500; }
.item-desc { color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .86rem; margin-top: 5px; }
.stock { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.stock::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stock.magazzino { color: var(--green); }
.stock.ordine { color: var(--amber); }
.item-price { display: grid; justify-items: end; align-self: start; padding-top: 1px; }
.item-price .list { color: var(--muted); text-decoration: line-through; font-size: .86rem; font-variant-numeric: tabular-nums; }
.item-price .net { font-family: var(--display); font-weight: 700; font-size: 1.35rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.item-add { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.qty { width: 74px; min-height: 44px; text-align: center; padding: 8px 6px; }
@media (min-width: 720px) {
  .item { grid-template-columns: minmax(0, 1fr) 130px auto; }
  .item-add { grid-column: auto; }
}
.item-add.done .btn { background: var(--green); border-color: var(--green); }

/* ---------- carrello ---------- */
.cart li { grid-template-columns: minmax(0, 1fr) auto; }
.cart li.off { opacity: .7; }
.cart-qty { display: flex; gap: 6px; align-items: center; grid-column: 1 / 2; }
.cart-line { grid-column: 2; grid-row: 1; align-self: start; font-family: var(--display); font-weight: 700; font-size: 1.25rem; }
@media (min-width: 720px) { .cart li { grid-template-columns: minmax(0, 1fr) auto 110px; } .cart-qty { grid-column: 2; grid-row: 1; } .cart-line { grid-column: 3; align-self: center; } }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-top: 2px solid var(--ink); padding: 14px 0 22px; }
.cart-total b { font-family: var(--display); font-size: 1.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cart-total small { color: var(--muted); }
.send { max-width: 620px; margin-left: auto; }
.send + form { margin-top: 10px; max-width: 620px; margin-left: auto; }

/* ---------- documenti ---------- */
.docs { list-style: none; margin: 0; padding: 0; }
.docs li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "link tot pdf" "s s s"; gap: 4px 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.panel:not(.flush) .docs li { padding-left: 0; padding-right: 0; }
.docs li:first-child { border-top: 0; }
.doc-link { grid-area: link; display: grid; text-decoration: none; min-width: 0; }
.doc-t { font-weight: 500; }
.doc-d { font-size: .88rem; color: var(--graphite); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-s { grid-area: s; }
.doc-s:empty { display: none; }
.doc-tot { grid-area: tot; font-weight: 600; }
.doc-pdf { grid-area: pdf; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-size: .85rem; font-weight: 600; color: var(--graphite);
  min-height: 40px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 3px; }
.doc-pdf:hover { border-color: var(--ink); }
.doc-pdf .ic { width: 17px; height: 17px; }
@media (min-width: 720px) {
  .docs li { grid-template-columns: minmax(0, 1fr) 130px 110px auto; grid-template-areas: "link s tot pdf"; }
  .doc-s:empty { display: block; }
}
.badge { display: inline-block; font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 3px 7px; border-radius: 2px;
  background: var(--paper-2); color: var(--graphite); white-space: nowrap; }
.badge.ok { background: #e3f0e6; color: #1b5a30; }
.badge.err { background: #f8e1e0; color: var(--red-d); }
.badge.warn { background: #f7ebd2; color: #6b4300; }
table.lines { width: 100%; border-collapse: collapse; font-size: .95rem; }
.lines th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--graphite); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line-2); background: var(--paper); }
.lines td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.lines th.num { text-align: right; }
.lines tr.txt td { color: var(--graphite); font-style: italic; }
.lines tfoot td { border-top: 1px solid var(--line-2); background: var(--paper); }
.lines tfoot td.lbl { white-space: nowrap; }
.lines tfoot tr.open td { color: var(--red-d); }
.lines tr.late td:first-child a { color: var(--red-d); }
.lines.compact td { padding: 6px 8px; font-size: .9rem; }
@media (max-width: 600px) {
  .lines .m-hide { display: none; }
  .lines th, .lines td { padding: 9px 10px; }
}
.panel.flush { overflow-x: auto; }

/* ---------- ordini ---------- */
.orders { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.orders li { display: grid; gap: 10px; }
.order-hd { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
details summary { cursor: pointer; color: var(--graphite); font-size: .95rem; min-height: 32px; display: flex; align-items: center; }
details .lines { margin-top: 6px; }

/* ---------- piede ---------- */
.foot { border-top: 1px solid var(--line); color: var(--graphite); font-size: .88rem; padding-bottom: env(safe-area-inset-bottom); }
.foot-in { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 20px; padding-top: 18px; padding-bottom: 22px; }
.foot a { color: var(--graphite); }
.foot .ic { width: 17px; height: 17px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.page-head .sub.signed { color: var(--green); font-weight: 500; }
.page-head .sub.signed .ic { width: 18px; height: 18px; }
