/* REDIVO Fidelity — stile unico per admin, portale, pagine cliente e scanner */
:root {
  --ink: #25303d; --slate: #8296a8; --bg: #f1f4f7; --paper: #fff; --line: #dde3ea; --muted: #66758a;
  --ok: #1f7a55; --ok-bg: #e5f4ec; --err: #b3261e; --err-bg: #fbeae9; --warn: #8a5a00; --warn-bg: #fdf3dc;
  --accent: #2e5b8a; --radius: 12px; --shadow: 0 1px 2px rgba(37,48,61,.06), 0 4px 16px rgba(37,48,61,.06);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: .2em 0 .8em; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .8em; }
code { background: #e9eef3; padding: .15em .45em; border-radius: 6px; font-size: .9em; word-break: break-all; }
.muted { color: var(--muted); }
small { font-size: .82em; }
[hidden] { display: none !important; }

/* barra superiore */
.top { display: flex; align-items: center; gap: 18px; padding: 10px 24px; background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand img { display: block; }
.area-tag { font-size: .8rem; color: var(--muted); border-left: 1px solid var(--line); padding-left: 14px; font-weight: 600; }
.main { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.main a { text-decoration: none; color: var(--ink); padding: 7px 12px; border-radius: 8px; font-weight: 500; }
.main a:hover { background: var(--bg); }
.main a.on { background: var(--ink); color: #fff; }
.who { display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.who form { margin: 0; }
.langs { display: flex; gap: 2px; }
.langs a { text-decoration: none; color: var(--muted); font-size: .75rem; font-weight: 600; padding: 3px 6px; border-radius: 6px; }
.langs a.on { color: var(--ink); background: var(--bg); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px; }

/* componenti */
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font: 600 .92rem var(--font); cursor: pointer; text-decoration: none; min-height: 40px; }
.btn:hover { border-color: var(--slate); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #334355; }
.btn.danger { color: var(--err); border-color: #f0c7c4; }
.btn.big { padding: 14px 22px; font-size: 1.05rem; min-height: 52px; width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
button.link.danger { color: var(--err); }
input, select, textarea { font: inherit; color: var(--ink); padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; width: 100%; min-height: 40px; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--ink); flex: none; margin-top: 2px; }
input[type=color] { padding: 2px; height: 40px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .86rem; font-weight: 600; color: #3b4a5c; }
label.check { flex-direction: row; align-items: flex-start; gap: 9px; font-weight: 400; font-size: .92rem; color: var(--ink); }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-weight: 700; font-size: .9rem; padding: 0 6px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid fieldset.wide { flex-direction: row; flex-wrap: wrap; gap: 16px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row label { flex: 1; min-width: 110px; }
.row label.grow { flex: 3; }
.row .eq { font-size: 1.4rem; padding-bottom: 6px; color: var(--muted); }
input.short { width: 90px; }
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; flex-wrap: wrap; }
.inline input, .inline select { width: auto; }
.wrapflex label { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
.tabs { display: flex; gap: 4px; background: var(--paper); padding: 4px; border-radius: 10px; box-shadow: var(--shadow); flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 7px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .86rem; }
.tabs a.on { background: var(--ink); color: #fff; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.note { font-size: .85rem; color: var(--muted); margin: -6px 0 18px; max-width: 860px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.cols.program { grid-template-columns: minmax(0, 1.3fr) minmax(300px, .9fr); }
@media (max-width: 860px) { .cols, .cols.program { grid-template-columns: 1fr; } }
.center { text-align: center; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.kpi span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.kpi strong { font-size: 1.65rem; letter-spacing: -.02em; line-height: 1.2; }
.kpi small { color: var(--muted); }
.chart svg { width: 100%; height: auto; display: block; }
.chart .b1 { fill: var(--ink); } .chart .b2 { fill: var(--slate); }
.chart .axis { stroke: var(--line); } .chart .lbl { font-size: 11px; fill: var(--muted); }
.chart figcaption { font-size: .82rem; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.dot.b1 { background: var(--ink); } .dot.b2 { background: var(--slate); }

/* tabelle */
table.grid { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.grid.card { padding: 0; overflow: hidden; display: table; }
.grid th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.grid td { padding: 10px 12px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.grid tr:last-child td { border-bottom: 0; }
.grid .r { text-align: right; font-variant-numeric: tabular-nums; }
.grid a { font-weight: 600; text-decoration: none; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; font-size: .86rem; }
.pill { display: inline-block; font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #eef1f4; color: var(--muted); white-space: nowrap; }
.st-active, .ac-active, .k-earn { background: var(--ok-bg); color: var(--ok); }
.st-demo { background: #e6eefb; color: var(--accent); }
.st-suspended, .k-reversal { background: var(--err-bg); color: var(--err); }
.ac-low, .k-adjust { background: var(--warn-bg); color: var(--warn); }
.k-redeem { background: #efe8fb; color: #5b3a9a; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 16px; }
dl.kv dt { color: var(--muted); font-size: .86rem; }
dl.kv dd { margin: 0; }
.big { font-size: 1.6rem; }
.links p { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.links span { font-weight: 600; min-width: 200px; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.plan { text-decoration: none; color: inherit; }
.plan .price { font-size: 1.8rem; display: block; }
.plan .price small { font-size: .9rem; color: var(--muted); }
ul.versions { list-style: none; padding: 0; margin: 0; font-size: .86rem; }
ul.versions li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.qr svg { width: 220px; height: 220px; }

/* ---------- carta fedeltà ---------- */
.loyalty-card { --brand: #25303d; background: var(--brand); color: #fff; border-radius: 18px; padding: 18px 18px 14px; box-shadow: 0 12px 30px rgba(37,48,61,.25);
  max-width: 360px; margin: 0 auto 18px; display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.loyalty-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; background: url(/static/img/r.png) center/contain no-repeat; opacity: .12; pointer-events: none; }
.loyalty-card header { display: flex; flex-direction: column; }
.loyalty-card .merchant { font-weight: 800; font-size: 1.15rem; }
.loyalty-card .title { font-size: .8rem; opacity: .75; text-transform: uppercase; letter-spacing: .08em; }
.loyalty-card .points { display: flex; align-items: baseline; gap: 8px; }
.loyalty-card .points strong { font-size: 2.6rem; line-height: 1; }
.loyalty-card .bar { height: 8px; background: rgba(255,255,255,.2); border-radius: 99px; overflow: hidden; }
.loyalty-card .bar i { display: block; height: 100%; background: #fff; border-radius: 99px; }
.loyalty-card .progress-label { margin: 0; font-size: .88rem; opacity: .9; }
.loyalty-card .ready { margin: 0; background: rgba(255,255,255,.16); padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: .9rem; }
.loyalty-card .qrbox { background: #fff; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; align-items: center; color: var(--ink); align-self: center; }
.loyalty-card .qrbox svg { width: 170px; height: 170px; display: block; }
.loyalty-card .qrbox small { font: 700 .95rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; margin-top: 4px; }
.loyalty-card footer { display: flex; justify-content: space-between; font-size: .8rem; opacity: .8; }
.loyalty-card .by { font-weight: 800; letter-spacing: .14em; }
.stamps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.stamps.g2, .stamps.g4 { grid-template-columns: repeat(4, 1fr); } .stamps.g3, .stamps.g6, .stamps.g9, .stamps.g12 { grid-template-columns: repeat(6, 1fr); }
.stamps.g8 { grid-template-columns: repeat(4, 1fr); } .stamps.g7, .stamps.g11 { grid-template-columns: repeat(6, 1fr); }
.stamps span { aspect-ratio: 1; border-radius: 50%; border: 2px dashed rgba(255,255,255,.55); }
.stamps span.on { background: #fff; border: 2px solid #fff; box-shadow: inset 0 0 0 4px var(--brand); }

/* ---------- pagine pubbliche ---------- */
body.pub { background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 14%, #f1f4f7) 0, #f1f4f7 320px); min-height: 100vh; }
.pubwrap { max-width: 460px; margin: 0 auto; padding: 14px 16px 40px; }
.pubwrap > .langs { justify-content: flex-end; margin-bottom: 8px; }
.pubcard { background: var(--paper); border-radius: 18px; padding: 22px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.pubcard h1 { margin-top: 0; }
.eyebrow { margin: 0; font-weight: 700; color: var(--slate); text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }
.lead { color: var(--muted); margin-top: -8px; }
.signup { margin-top: 10px; }
.phone { display: flex; gap: 8px; }
.phone select { width: 96px; flex: none; }
.hint { text-align: center; color: var(--muted); font-size: .9rem; margin: -4px 0 16px; }
ul.moves { list-style: none; padding: 0; margin: 0; }
ul.moves li { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.powered { text-align: center; font-size: .8rem; color: var(--muted); margin-top: 24px; }
.powered a { color: var(--ink); font-weight: 700; text-decoration: none; letter-spacing: .06em; }
.prose p { line-height: 1.6; }
body.login { background: var(--bg); }
.login-box { background: var(--paper); border-radius: 18px; box-shadow: var(--shadow); padding: 28px; margin-top: 8vh; }
.login-logo { height: 30px; display: block; margin-bottom: 18px; }

/* ---------- volantino A4 ---------- */
body.flyer { background: #ddd; }
.sheet { width: 210mm; min-height: 297mm; margin: 20px auto; background: #fff; padding: 22mm 18mm; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8mm; border-top: 14mm solid var(--brand); }
.sheet h1 { font-size: 34pt; line-height: 1.1; margin: 0; max-width: 150mm; }
.sheet .eyebrow { font-size: 14pt; color: var(--brand); }
.sheet .lead { font-size: 15pt; margin: 0; color: #3b4a5c; max-width: 150mm; }
.sheet .qr svg { width: 95mm; height: 95mm; }
.sheet .steps { text-align: left; font-size: 14pt; line-height: 1.8; }
.sheet .url { font: 700 13pt ui-monospace, monospace; }
.sheet footer { margin-top: auto; }
.noprint { text-align: center; }
@media print { body.flyer { background: #fff; } .sheet { margin: 0; } .noprint { display: none; } @page { size: A4; margin: 0; } }

/* ---------- scanner ---------- */
body.scanner { background: #1b232d; color: #fff; min-height: 100vh; min-height: 100dvh; user-select: none; -webkit-tap-highlight-color: transparent; }
.sc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: #25303d; }
.sc-top small { color: #b9c5d2; }
.sc-status { font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.sc-status.on { background: rgba(46,170,110,.2); color: #7fe0b0; } .sc-status.off { background: rgba(240,170,40,.22); color: #ffd27a; }
.sc-lock { background: none; border: 1px solid #44546a; color: #fff; border-radius: 9px; padding: 6px 10px; font: 600 .85rem var(--font); }
.sc-main { max-width: 520px; margin: 0 auto; padding: 18px 16px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.sc-main.center { justify-content: center; min-height: 80vh; text-align: center; }
.scanner .muted { color: #9fb0c2; }
.scanner .btn { background: #2d3a49; border-color: #3c4c60; color: #fff; min-height: 50px; }
.scanner .btn.primary { background: #fff; color: var(--ink); border-color: #fff; }
.scanner .btn.danger { color: #ff9b94; border-color: #6a3a3a; background: transparent; }
.scanner input, .scanner select { background: #2d3a49; border-color: #3c4c60; color: #fff; }
.big-input { font-size: 1.6rem !important; text-align: center; letter-spacing: .08em; min-height: 60px !important; }
.pin { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 4vh; }
.pin-logo { width: 54px; filter: brightness(1.4); }
.pin h1 { font-size: 1.3rem; margin: 0; }
.pin-dots { display: flex; gap: 16px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #8296a8; }
.pin-dots span.on { background: #fff; border-color: #fff; }
.shake { animation: shake .35s; } @keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.sc-err { color: #ff9b94; min-height: 1.5em; margin: 0; }
.keypad { display: grid; grid-template-columns: repeat(3, 84px); gap: 14px; }
.keypad button { height: 84px; border-radius: 50%; border: 0; background: #2d3a49; color: #fff; font: 600 1.7rem var(--font); }
.keypad button:active { background: #44566c; }
.keypad.small { grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.keypad.small button { height: 58px; border-radius: 12px; font-size: 1.4rem; }
.home { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { aspect-ratio: 1.15; border-radius: 18px; border: 1px solid #3c4c60; background: #25303d; color: #fff; font: 700 1.02rem var(--font); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 10px; }
.tile.primary { grid-column: 1 / -1; aspect-ratio: 2.4; background: #fff; color: var(--ink); font-size: 1.2rem; }
.tile .ico { font-size: 2rem; line-height: 1; }
.sc-warn { background: rgba(240,170,40,.18); color: #ffd27a; padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.panel { display: flex; flex-direction: column; gap: 14px; }
.panel h1 { margin: 0; font-size: 1.35rem; }
.row-btns { display: flex; gap: 10px; } .row-btns .btn { flex: 1; }
.cam { position: relative; border-radius: 18px; overflow: hidden; background: #000; text-align: center; }
.sc-video { width: 100%; display: block; aspect-ratio: 3/4; object-fit: cover; }
.cam-frame { position: absolute; inset: 18% 14%; border: 3px solid #fff; border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.cam p { position: absolute; bottom: 8px; left: 0; right: 0; margin: 0; font-weight: 600; }
.results { display: flex; flex-direction: column; gap: 8px; }
.result { display: grid; grid-template-columns: 1fr auto; text-align: left; gap: 2px 10px; padding: 12px 14px; border-radius: 12px; background: #25303d; border: 1px solid #3c4c60; color: #fff; font: inherit; }
.result span { color: #9fb0c2; font-size: .88rem; } .result .bal { grid-row: 1 / 3; grid-column: 2; align-self: center; color: #fff; font-weight: 800; font-size: 1.3rem; }
.cust { background: #25303d; border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.cust-head { display: flex; justify-content: space-between; gap: 10px; }
.cust h1 { margin: 0; font-size: 1.3rem; }
.balance { text-align: right; } .balance strong { font-size: 2.4rem; line-height: 1; display: block; } .balance span { color: #9fb0c2; font-size: .85rem; }
.cust .stamps span { border-color: #6a7d93; } .cust .stamps span.on { --brand: #25303d; }
.rewards { display: flex; flex-direction: column; gap: 8px; }
.btn.reward { background: #3d2f63 !important; border-color: #5b47a0 !important; color: #fff !important; justify-content: flex-start; }
.btn[data-armed] { background: #ffd27a !important; color: var(--ink) !important; }
.earn { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.amount { font-size: 2.2rem; font-weight: 800; text-align: center; padding: 6px; font-variant-numeric: tabular-nums; }
.amount-pad { display: flex; flex-direction: column; gap: 6px; }
.preview { text-align: center; margin: 0; color: #7fe0b0; font-weight: 700; min-height: 1.5em; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 22px; }
.stepper button { width: 64px; height: 64px; border-radius: 50%; border: 0; background: #2d3a49; color: #fff; font-size: 2rem; }
.stepper strong { font-size: 2.4rem; min-width: 50px; text-align: center; }
.scanner ul.moves li { border-color: #33414f; color: #c9d4df; }
.receipt { text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; padding-top: 6vh; }
.receipt .check { width: 96px; height: 96px; border-radius: 50%; background: #2eaa6e; display: grid; place-items: center; font-size: 3rem; font-weight: 800; }
.receipt.offline .check { background: #c98a10; }
.receipt h1 { margin: 10px 0 0; font-size: 1.9rem; }
.receipt .ready { color: #ffd27a; font-weight: 700; }
.receipt .row-btns { width: 100%; margin-top: 18px; }
.sc-paused h1 { font-size: 1.5rem; }
.sc-toast { position: fixed; left: 16px; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); max-width: 480px; margin: 0 auto; padding: 14px 16px; border-radius: 12px; font-weight: 600; z-index: 50; background: #b3261e; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.sc-toast.info { background: #3c4c60; } .sc-toast.ok { background: #1f7a55; }

/* ---------- portale negozio: terminale con menu laterale ---------- */
body.portal-app { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; background: #f4f6f8; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.side { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.side-head strong { display: block; font-size: 1.02rem; }
.side-head small { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.side-logo { width: 42px; height: 42px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; flex: none; }
.dot-on { width: 7px; height: 7px; border-radius: 50%; background: #2eaa6e; display: inline-block; }
.side-close { display: none; margin-left: auto; font-size: 1.6rem; color: var(--muted); cursor: pointer; }
.side nav { padding: 14px 14px 0; flex: 1; }
.side-scan { display: flex; align-items: center; gap: 10px; justify-content: center; background: var(--ink); color: #fff; text-decoration: none; padding: 13px; border-radius: 14px; font-weight: 700; margin-bottom: 14px; }
.side-sec { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 14px 8px 8px; }
.side-group { background: #f4f6f8; border-radius: 14px; overflow: hidden; }
.side-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; border-bottom: 1px solid #e7ebef; }
.side-item:last-child { border-bottom: 0; }
.side-item svg { flex: none; color: #4a5a6c; background: #fff; border-radius: 9px; padding: 6px; width: 32px; height: 32px; box-sizing: border-box; border: 1px solid var(--line); }
.side-item span { flex: 1; }
.side-item i { font-style: normal; color: #a3afbc; font-size: 1.2rem; }
.side-item:hover { background: #eaeef2; }
.side-item.on { background: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.side-item.on svg { background: var(--brand); color: #fff; border-color: var(--brand); }
.side-foot { padding: 14px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); }
.side-foot form, .side-foot .btn { width: 100%; }
.side-foot form .btn { width: 100%; }
.side-foot small { text-align: center; }
.side-langs .langs { justify-content: center; }
.portal-main { min-width: 0; }
.portal-top { display: none; }
.portal-content { max-width: 1120px; margin: 0 auto; padding: 30px 28px 60px; }
.portal-content > h1 { font-size: 2rem; margin: 2px 0 4px; }
.lead-p { color: var(--muted); margin: 0 0 22px; }
.side-veil { display: none; }
@media (max-width: 900px) {
  body.portal-app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 300px; z-index: 30; transform: translateX(-100%); transition: transform .2s; border-radius: 0 20px 20px 0; }
  .nav-toggle:checked ~ .side { transform: none; }
  .nav-toggle:checked ~ .side-veil { display: block; position: fixed; inset: 0; background: rgba(20,28,38,.35); z-index: 20; }
  .side-close { display: block; }
  .portal-top { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
  .burger { display: flex; flex-direction: column; gap: 4px; cursor: pointer; padding: 6px; }
  .burger span { width: 20px; height: 2px; background: var(--ink); border-radius: 2px; }
  .burger span:nth-child(2) { width: 14px; }
  .portal-top-name { font-weight: 700; }
  .portal-content { padding: 20px 16px 50px; }
}

/* dashboard */
.value-hero { background: var(--ink); color: #fff; border-radius: 20px; padding: 22px 24px; margin-bottom: 18px; position: relative; overflow: hidden; }
.value-hero::after { content: ""; position: absolute; right: -30px; top: -30px; width: 180px; height: 180px; background: url(/static/img/r.png) center/contain no-repeat; opacity: .08; }
.value-hero .eyebrow { color: #b9c5d2; }
.value-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 12px 0 10px; }
.value-grid strong { display: block; font-size: 1.9rem; letter-spacing: -.02em; }
.value-grid span { color: #c9d4df; font-size: .86rem; }
.value-note { color: #9fb0c2; font-size: .8rem; margin: 6px 0 0; max-width: 760px; }
@media (max-width: 700px) { .value-grid { grid-template-columns: 1fr 1fr; } }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 18px; }
.mcard { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 4px; }
.mcard header { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px 8px; flex-wrap: wrap; }
.mcard header span { font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mcard header em { font-style: normal; font-size: .74rem; font-weight: 700; background: #eef1f4; padding: 3px 9px; border-radius: 99px; color: #3b4a5c; }
.big-num { font-size: clamp(1.6rem, 2.4vw, 2.2rem); letter-spacing: -.03em; line-height: 1.1; margin-top: 10px; }
.mcard p { margin: 0; color: var(--muted); font-size: .88rem; }
.mcard footer { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: 4px; }
.spark { width: 100%; height: 46px; margin-top: 10px; }
.spark-line { fill: none; stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark-fill { fill: color-mix(in srgb, var(--brand) 12%, transparent); stroke: none; }
.meter { height: 8px; background: #eef1f4; border-radius: 99px; overflow: hidden; margin-top: 16px; }
.meter i { display: block; height: 100%; background: var(--brand); }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 700px) { .levels { grid-template-columns: 1fr 1fr; } }
.lvl-box { border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.lvl-box strong { font-size: 1.5rem; }
.lvl-box small { color: var(--muted); }
.lvl-dot { width: 12px; height: 12px; border-radius: 50%; margin-bottom: 4px; }
.lvl-member .lvl-dot { background: #3b4a5c; } .lvl-bronze .lvl-dot { background: #b87333; } .lvl-silver .lvl-dot { background: #a7b1bb; } .lvl-gold .lvl-dot { background: #e0b100; }
.lvl { font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; color: #fff; background: #3b4a5c; white-space: nowrap; }
.lvl.lvl-bronze { background: #b87333; } .lvl.lvl-silver { background: #8d98a4; } .lvl.lvl-gold { background: #c99a00; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid #eef1f4; }
.feed li:last-child { border-bottom: 0; }
.feed small { display: block; color: var(--muted); }
.feed time { color: var(--muted); font-size: .78rem; min-width: 64px; text-align: right; }
.feed-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #eef1f4; font-weight: 800; }
.feed-ic.k-earn { background: var(--ok-bg); color: var(--ok); } .feed-ic.k-redeem { background: #efe8fb; } .feed-ic.k-reversal { background: var(--err-bg); color: var(--err); }
.pos { color: var(--ok); } .neg { color: var(--err); }
.autopilot { background: #eef2f6; border: 1px solid var(--line); box-shadow: none; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.autopilot h2 { font-size: 1.3rem; margin: 0; }
.autopilot p { margin: 0; }
.eyebrow { margin: 0; font-weight: 700; color: var(--slate); text-transform: uppercase; letter-spacing: .08em; font-size: .76rem; }
.small { font-size: .82rem; }

/* archivio clienti */
.arch { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 980px) { .arch { grid-template-columns: 1fr; } }
.arch-search { display: flex; gap: 8px; margin-bottom: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--line); padding: 6px 13px; border-radius: 99px; font-size: .85rem; font-weight: 600; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.arch-bar { display: flex; justify-content: space-between; align-items: center; font-size: .86rem; color: var(--muted); margin: 4px 2px 8px; }
.cust-list { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.cust-list li { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid #eef1f4; }
.cust-list li:last-child { border-bottom: 0; }
.cust-list a { text-decoration: none; color: var(--ink); min-width: 0; }
.cust-list a small { display: block; color: var(--muted); }
.pts { font-weight: 700; font-size: .88rem; background: #eef1f4; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.arch-panel { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }
.arch-panel h2 { margin: 0; }
.arch-panel p { margin: 0; }
.seg-tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: #eef1f4; border-radius: 12px; padding: 4px; gap: 4px; }
.seg-tabs button { border: 0; background: none; padding: 8px; border-radius: 9px; font: 600 .86rem var(--font); cursor: pointer; color: var(--muted); }
.seg-tabs button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
textarea { font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 10px; width: 100%; resize: vertical; }
.note-box { background: #eef4fb; color: #24466e; border-radius: 12px; padding: 10px 12px; font-size: .84rem; }
.soon-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 12px; }
.soon-list li { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.soon-list small { display: block; color: var(--muted); margin-top: 2px; }

.review-btn { max-width: 360px; margin: 0 auto 16px; display: flex; }
.flyer .stars { font-size: 34pt; color: #e0b100; margin: 0; letter-spacing: 6px; }
.steps-list { margin: 0; padding-left: 20px; line-height: 1.8; }
/* carte fisiche: foglio A4 con 8 carte 85.6 × 54 mm */
body.cards-print { background: #ddd; }
.card-sheet { width: 210mm; height: 297mm; margin: 12px auto; background: #fff; padding: 15mm 15.4mm; display: grid; grid-template-columns: repeat(2, 85.6mm); grid-auto-rows: 54mm; gap: 8mm 8mm; align-content: start; page-break-after: always; box-sizing: border-box; }
.pcard { border: .2mm dashed #bbb; border-radius: 3mm; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 4mm 4mm 4mm 5mm; box-sizing: border-box; }
.pcard-l { display: flex; flex-direction: column; gap: 1mm; }
.pcard-l strong { font-size: 13pt; } .pcard-l small { font-size: 7pt; text-transform: uppercase; letter-spacing: .08em; opacity: .8; } .pcard-l span { font-size: 7pt; opacity: .8; margin-top: 3mm; }
.pcard-qr { background: #fff; border-radius: 2mm; padding: 1.5mm; display: flex; flex-direction: column; align-items: center; color: #25303d; }
.pcard-qr svg { width: 30mm; height: 30mm; display: block; } .pcard-qr b { font: 700 7pt ui-monospace, monospace; letter-spacing: .1em; }
@media print { body.cards-print { background: #fff; } .card-sheet { margin: 0; } .pcard { border: none; } @page { size: A4; margin: 0; } }

/* Wallet */
.wallet-btns{display:flex;flex-direction:column;gap:10px;margin:14px 0 4px}
.wbtn{display:flex;align-items:center;justify-content:center;gap:12px;background:#000;color:#fff;border-radius:12px;padding:10px 18px;text-decoration:none;font-weight:600;font-size:18px;line-height:1.1;min-height:52px}
.wbtn small{display:block;font-size:11px;font-weight:400;opacity:.85}
.wbtn .wico{width:26px;height:20px;border-radius:4px;background:linear-gradient(#3fa9f5 0 25%,#f5a623 25% 50%,#e94e3c 50% 75%,#5ac85a 75%)}
.wbtn.google{background:#1f1f1f}
.wbtn .wico.g{background:#fff;color:#4285f4;display:grid;place-items:center;font-weight:800;border-radius:50%;width:26px;height:26px}
.steps-list{padding-left:20px;display:flex;flex-direction:column;gap:12px}
.steps-list form,.steps-list .row{margin-top:6px}
