/* Lowbird — design system condiviso (web app, backoffice, box dell'estensione, Mini App).
   Carta fredda e inchiostro; verde "affare" e rosso "caro" hanno un significato (prezzo sotto o sopra
   la media), non sono decorazione. Archivo per tutto: condensato e pesante per i prezzi, come un
   cartellino. L'elemento distintivo è la barra del prezzo (.prange). */

:root {
  --bg: #f5f6f3;
  --surface: #ffffff;
  --surface-2: #eef0ec;
  --text: #18212b;
  --muted: #5f6a73;
  --faint: #939c9f;
  --border: #daddd5;
  --accent: #2453c7;
  --accent-soft: #e6ecfa;
  --good: #0f8a5c;
  --good-soft: #e3f3ea;
  --bad: #c24a2c;
  --bad-soft: #fbe9e3;
  --warn: #9a6400;
  --warn-soft: #fbf1dc;
  --amazon: #ffd814;
  --radius: 12px;
  --radius-sm: 7px;
  --radius-xs: 4px;
  --gap: 16px;
  --shadow: 0 1px 0 rgb(24 33 43 / 4%);
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161b;
    --surface: #181e24;
    --surface-2: #1f272e;
    --text: #e9ece8;
    --muted: #9ba5aa;
    --faint: #6c767b;
    --border: #2a333a;
    --accent: #7c9cf0;
    --accent-soft: #1d2a47;
    --good: #45c88f;
    --good-soft: #13302a;
    --bad: #f08a6c;
    --bad-soft: #3a211b;
    --warn: #e8b453;
    --warn-soft: #33290f;
    --shadow: none;
    color-scheme: dark;
  }
}

/* prezzi: Archivo condensato e pesante, cifre incolonnate */
.price-tag, .current, .embed-price, .tile .foot b, .stats b, .kpi b {
  font-family: var(--font); font-stretch: 78%; font-weight: 760; font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.015em; }
h1 { font-size: 24px; font-stretch: 92%; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.num, .price, .kpi b, td.num { font-variant-numeric: tabular-nums; }

/* --- layout ------------------------------------------------------------------------------------ */

main { max-width: 1200px; margin: 0 auto; padding: 20px 24px 48px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: var(--gap); }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.grid { display: grid; gap: var(--gap); }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
@media (max-width: 900px) { .grid.two, .grid.side { grid-template-columns: 1fr; } }

/* --- barra superiore --------------------------------------------------------------------------- */

.topbar { position: sticky; top: 0; z-index: 10; display: flex; gap: 20px; align-items: center; height: 52px; padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar .brand { font-weight: 750; color: var(--text); display: flex; gap: 8px; align-items: center; }
.topbar .brand:hover { text-decoration: none; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: var(--muted); padding: 6px 10px; border-radius: var(--radius-sm); }
.topbar nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.topbar nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); font-weight: 600; }
.user { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 13px; }

/* --- pannelli ---------------------------------------------------------------------------------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card > h2, .card-head { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.card-head h2 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 14px 16px 0; }

/* --- controlli --------------------------------------------------------------------------------- */

input, select, textarea, button { font: inherit; }
input, select, textarea { height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; min-height: 96px; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { height: 16px; width: 16px; accent-color: var(--accent); }
button { height: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--accent);
  color: #fff; font-weight: 500; cursor: pointer; white-space: nowrap; transition: filter .15s, background .15s; }
button:hover { filter: brightness(1.06); }
button:disabled { opacity: .5; cursor: default; filter: none; }
button.ghost, button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
button.ghost:hover, button.secondary:hover { background: var(--surface-2); }
button.danger, button.secondary.danger { background: var(--surface); color: var(--bad); border-color: var(--border); }
button.danger:hover { background: var(--bad-soft); }
button.link { background: none; color: var(--accent); padding: 0; height: auto; border: 0; }
button.small, select.small, input.small { height: 28px; font-size: 13px; padding: 0 10px; }
.search { width: 100%; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

/* --- testi e stati ----------------------------------------------------------------------------- */

.hint, .muted { color: var(--muted); }
.hint { font-size: 13px; }
.faint { color: var(--faint); }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.error, .ko { color: var(--bad); }
.ok { color: var(--good); }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.active { background: var(--good-soft); color: var(--good); }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.error { background: var(--bad-soft); color: var(--bad); }
.badge.muted { background: var(--surface-2); color: var(--muted); }
.mp { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--surface-2); font-size: 11px; font-weight: 700; color: var(--muted); }
.meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; }

/* --- KPI --------------------------------------------------------------------------------------- */

.stats, .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stats > div, .kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface); }
.stats small, .kpi small { color: var(--muted); font-size: 12px; }
.stats b, .kpi b { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.stats small + small { font-size: 11px; }

/* --- tabelle ----------------------------------------------------------------------------------- */

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 12px; font-weight: 500; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; white-space: nowrap; }
td.title { max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- prodotti ---------------------------------------------------------------------------------- */

.thumb { width: 48px; height: 48px; flex: none; display: grid; place-items: center; background: #fff; border-radius: var(--radius-sm);
  border: 1px solid var(--border); overflow: hidden; }
.thumb img { max-width: 90%; max-height: 90%; object-fit: contain; }
.thumb.big { width: 100%; height: 220px; border: 0; background: #fff; border-radius: var(--radius); }
.list { display: flex; flex-direction: column; }
.listing { display: flex; gap: 12px; align-items: center; padding: 10px 4px; border-top: 1px solid var(--border); color: inherit; }
.listing:first-child { border-top: 0; }
.listing:hover { background: var(--surface-2); text-decoration: none; }
.info { flex: 1; min-width: 0; }
.title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.price { text-align: right; font-weight: 600; font-size: 16px; white-space: nowrap; }
.price small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.price.good { color: var(--good); }

/* scheda prodotto nelle griglie: immagine su fondo bianco (le foto Amazon lo hanno), prezzo e barra */
.tile { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; color: inherit; transition: border-color .15s; }
.tile:hover { border-color: color-mix(in srgb, var(--text) 30%, var(--border)); text-decoration: none; }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile.target-hit { border-color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.tile .img { position: relative; height: 0; padding-top: 72%; background: #fff; border-bottom: 1px solid var(--border); overflow: hidden; }
.tile .img img { position: absolute; inset: 14px; width: calc(100% - 28px); height: calc(100% - 28px); object-fit: contain; }
.tile .body { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; flex: 1; }
.tile .name { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.tile .foot { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.tile .foot b { font-size: 24px; line-height: 1.1; }
.tile .foot b.good { color: var(--good); }
.tile-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12.5px; min-height: 0; }
.tile-meta:empty { display: none; }
.tile-target { color: var(--muted); }
.tile-target.hit { color: var(--good); font-weight: 650; }
.tile-checked { font-size: 12px; color: var(--faint); }

/* pagina prodotto */
.product-head { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; }
.product-head h1 { font-size: 18px; line-height: 1.35; }
.current { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 10px 0 2px; font-variant-numeric: tabular-nums; }
form.watch, form.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.watch input { width: 120px; }
form.add { display: flex; gap: 8px; }
form.add input { flex: 1; }
@media (max-width: 700px) { .product-head { grid-template-columns: 1fr; } form.add { flex-direction: column; } }

/* --- grafico ----------------------------------------------------------------------------------- */

.chart .axis { stroke: var(--border); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart .area { fill: color-mix(in srgb, var(--accent) 9%, transparent); stroke: none; }
.chart .dots circle { fill: var(--accent); }
.chart .target { stroke: var(--good); stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.chart .tick { fill: var(--faint); font-size: 11px; }
.chart .target-label { fill: var(--good); }

/* --- login ------------------------------------------------------------------------------------- */

.login { max-width: 380px; margin: 14vh auto; padding: 28px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); }
.login h1 { font-size: 22px; }
.login p { color: var(--muted); margin: 6px 0 18px; }
.login form { display: flex; flex-direction: column; gap: 10px; }
.login button { width: 100%; }

.ranges { display: inline-flex; gap: 2px; padding: 2px; background: var(--surface-2); border-radius: var(--radius-sm); }
.ranges button { border: 0; background: transparent; color: var(--muted); }
.ranges button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
ul.bullets { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
ul.bullets li { margin: 4px 0; }

/* --- embed (box dell'estensione su Amazon, Mini App di Telegram) ------------------------------------ */
main.embed { max-width: none; padding: 12px 14px 14px; }
html:has(main.embed), body:has(main.embed) { background: var(--surface); }
.embed-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 12.5px; color: var(--muted); }
.embed-head .brand { display: inline-flex; gap: 8px; align-items: center; font-weight: 760; font-stretch: 88%; color: var(--text); }
.embed-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.embed-price { font-size: 32px; line-height: 1.05; }
.embed-open { font-size: 13px; white-space: nowrap; }
main.embed .prange { margin: 8px 0 4px; }
.embed-facts { display: flex; gap: 4px 14px; flex-wrap: wrap; margin: 4px 0 0; font-size: 12.5px; }
main.embed .ranges { margin-top: 10px; }
.embed-empty { text-align: center; padding: 16px 0; }
.embed-login { margin: 8px 0 0; }

/* --- acquisto e footer ---------------------------------------------------------------------------- */
a.button { display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border-radius: var(--radius-sm);
  background: var(--amazon); color: #0f1111; font-weight: 650; text-decoration: none; }
a.button:hover { filter: brightness(0.97); text-decoration: none; }
.buy { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.buy .hint { font-size: 12px; max-width: 460px; }
.site-footer { max-width: 1200px; margin: 0 auto; padding: 16px 24px 32px; display: flex; gap: 16px; justify-content: space-between;
  flex-wrap: wrap; color: var(--faint); font-size: 12px; border-top: 1px solid var(--border); }

/* --- accesso con i provider social ----------------------------------------------------------------- */
.providers { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 16px; }
.provider { display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 500; text-decoration: none; }
.provider:hover { background: var(--surface-2); text-decoration: none; }
.provider-google::before { content: "G"; font-weight: 700; color: #4285f4; }
.dev-hint { margin: 4px 0 8px; }

/* --- documenti legali ------------------------------------------------------------------------------ */
.legal { max-width: 760px; margin: 0 auto; line-height: 1.6; }
.legal h2 { margin-top: 20px; font-size: 16px; }
.legal ul { padding-left: 20px; }
.legal-links { display: inline-flex; gap: 12px; }
.legal-links a { color: inherit; }

/* --- offerte e coupon ------------------------------------------------------------------------------ */
.promos { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; }
.badge.deal { background: #cc0c39; color: #fff; }
.badge.coupon { background: #e6f4ea; color: #137333; }
.badge.muted { background: var(--surface-2); color: var(--muted); }
.effective { color: #137333; font-weight: 600; }
.chart .deal-band { fill: #cc0c39; opacity: .08; }
.chart .line.effective { stroke: #137333; stroke-dasharray: 4 3; fill: none; }
.deal-now { padding: 10px 12px; border: 1px solid #f3c2cd; border-radius: var(--radius-sm); background: #fff5f7; margin-bottom: 12px; }
.deal-now .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.deal-price { display: flex; gap: 10px; align-items: baseline; margin: 6px 0 2px; font-size: 22px; }
.deal-price s { font-size: 15px; }
.deal-price .good { font-size: 15px; font-weight: 600; }

/* usato: serie separata dal prezzo del nuovo */
.chart .line.used { stroke: #c2410c; stroke-dasharray: 6 4; fill: none; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.chart-legend span::before { content: ""; display: inline-block; width: 16px; height: 0; margin-right: 5px; vertical-align: 3px; border-top: 2px solid var(--accent); }
.chart-legend .lg-effective::before { border-top: 2px dashed #137333; }
.chart-legend .lg-used::before { border-top: 2px dashed #c2410c; }
.used-box { margin-top: 8px; padding: 8px 10px; border-radius: var(--radius-sm); background: #fff7ed; border: 1px solid #fed7aa; font-size: 14px; }
.used-box b { color: #c2410c; }
.used-box .hint { margin: 2px 0 0; }
@media (prefers-color-scheme: dark) { .used-box { background: rgba(194, 65, 12, .12); border-color: rgba(194, 65, 12, .35); } }

/* avvisi */
.topbar .bell { position: relative; text-decoration: none; font-size: 18px; line-height: 1; }
.topbar .bell .count { position: absolute; top: -6px; right: -10px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: #cc0c39; color: #fff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.alert-options { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; margin-top: 4px; }
.alert-options input.pct { width: 56px; padding: 2px 6px; margin-left: 4px; }
.alerts-list { list-style: none; margin: 0; padding: 0; }
.alerts-list li { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.alerts-list li:first-child { border-top: 0; }
.alerts-list li.unread .alert-body a { font-weight: 600; }
.alerts-list li.unread .alert-icon::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 4px; vertical-align: top; }
.alert-icon { font-size: 18px; line-height: 1.4; white-space: nowrap; }
.alert-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.alert-body a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-body span { font-size: 14px; color: var(--muted); }
.email-pref { margin: 0 0 12px; }
form.watch .alert-options input[type="checkbox"] { width: auto; }
form.watch .alert-options input.pct { width: 56px; }

/* ribassi */
.tile .img { position: relative; }
.tile .drop-badge { position: absolute; top: 8px; left: 8px; background: #cc0c39; color: #fff; font-weight: 700; font-size: 13px;
  padding: 2px 8px; border-radius: 999px; }
.tile .foot s { font-size: 13px; margin-left: 6px; }

/* interessi */
.composer { display: flex; flex-direction: column; gap: 8px; margin-bottom: var(--gap); }
.composer-label { font-size: 16px; font-weight: 600; }
.composer-input { width: 100%; font-size: 17px; padding: 12px 14px; border-radius: var(--radius); }
.composer-body { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--border); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.filters .field:first-child { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select { width: 100%; }
.with-unit { display: flex; align-items: center; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.chip.soft { background: var(--surface-2); color: var(--muted); }
.chips.small .chip { font-size: 12px; padding: 1px 8px; }
.chip-x { border: 0; background: none; color: inherit; padding: 0 0 0 2px; cursor: pointer; font-size: 15px; line-height: 1; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; user-select: none; }
.toggle input { display: none; }
.toggle.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 500; }
button.toggle { height: auto; background: var(--surface); color: var(--text); border-color: var(--border); font-weight: 400; }
.preview { background: var(--surface-2); border-radius: var(--radius); padding: 12px; }
.preview-head { margin: 0 0 8px; }
.preview-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.preview-item { display: flex; align-items: center; gap: 10px; padding: 6px; background: var(--surface); border-radius: var(--radius-sm); color: inherit; min-width: 0; }
.preview-item:hover { text-decoration: none; box-shadow: var(--shadow); }
.preview-title { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.composer-actions { justify-content: flex-start; }
.interest-list { list-style: none; margin: 0; padding: 0; }
.interest { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.interest:first-child { border-top: 0; }
.interest.paused .interest-main { opacity: .6; }
.interest-main { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; }
.interest-name { font-weight: 600; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-top: var(--gap); }
.choices { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.choice.on { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 3px; }
.prefs-row { gap: 16px; margin-bottom: 8px; }
.prefs-row label { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 640px) {
  .composer-input { font-size: 16px; }
  .preview-items { grid-template-columns: 1fr; }
}

/* collegamento Telegram */
.claim { max-width: 560px; margin: 8vh auto; text-align: center; }
.claim-ok { display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 12px; }
.claim-icon { font-size: 44px; line-height: 1; }
.claim h1 { margin: 4px 0; }

/* Mini App di Telegram: colori del tema dell'utente */
body.tg {
  --surface: var(--tg-theme-bg-color, #ffffff);
  --surface-2: var(--tg-theme-secondary-bg-color, #f2f3f5);
  --text: var(--tg-theme-text-color, #16181d);
  --muted: var(--tg-theme-hint-color, #6a7080);
  --accent: var(--tg-theme-button-color, #4f46e5);
  --border: color-mix(in srgb, var(--tg-theme-hint-color, #6a7080) 25%, transparent);
  background: var(--surface);
  color: var(--text);
}
body.tg main.embed { padding: 12px 14px 20px; }
body.tg .embed-head .brand { color: var(--text); }
body.tg a { color: var(--tg-theme-link-color, var(--accent)); }
.tg-actions { display: flex; flex-direction: column; gap: 14px; margin: 14px 0; padding: 14px; border-radius: var(--radius); background: var(--surface-2); }
.tg-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tg-row input { flex: 1; min-width: 120px; }
.tg-field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.tg-check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.tg-check select { width: auto; padding: 2px 6px; }
.tg-primary { width: 100%; padding: 12px; font-size: 16px; font-weight: 600; background: var(--tg-theme-button-color, var(--accent));
  color: var(--tg-theme-button-text-color, #fff); border: 0; border-radius: var(--radius-sm); }


/* --- barra del prezzo (elemento distintivo) ------------------------------------------------------ */
.prange { --tone: var(--muted); display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.prange.good { --tone: var(--good); }
.prange.bad { --tone: var(--bad); }
.prange-verdict { margin: 0; font-weight: 650; color: var(--tone); }
.prange-track { position: relative; height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, var(--good-soft), var(--surface-2) 50%, var(--bad-soft)); }
.prange-avg { position: absolute; top: -3px; width: 2px; height: 14px; margin-left: -1px; background: var(--faint); border-radius: 1px; }
.prange-dot { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--tone); box-shadow: 0 0 0 3px var(--surface); }
.prange-ends { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.prange.compact { gap: 5px; margin: 2px 0 0; }
.prange.compact .prange-track { height: 6px; }
.prange.compact .prange-dot { width: 10px; height: 10px; margin: -5px 0 0 -5px; box-shadow: 0 0 0 2px var(--surface); }
.prange.compact .prange-avg { top: -2px; height: 10px; }
.prange-short { margin: 0; font-size: 12.5px; color: var(--tone); font-weight: 600; }

/* --- home ---------------------------------------------------------------------------------------- */
.hero-add { margin-bottom: 20px; }
.hero-add input { height: 46px; font-size: 16px; padding: 0 14px; border-radius: var(--radius); }
.hero-add button { height: 46px; padding: 0 20px; border-radius: var(--radius); font-weight: 650; }
.section-head { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; margin: 8px 0 10px; }
.section-head h2 { font-size: 17px; }
.recent { margin-bottom: 22px; }
.recent-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.recent-list li { display: grid; grid-template-columns: 26px minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 14px; border-top: 1px solid var(--border); }
.recent-list li:first-child { border-top: 0; }
.recent-list li.unread .recent-title { font-weight: 650; }
.recent-title { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-what { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) {
  .recent-list li { grid-template-columns: 26px minmax(0, 1fr); }
  .recent-what, .recent-list li .hint { grid-column: 2; }
}
.empty-state { text-align: left; padding: 28px; }
.empty-state h2 { margin-bottom: 6px; }
.empty-state p { margin: 0; color: var(--muted); max-width: 60ch; }

/* --- scheda prodotto ------------------------------------------------------------------------------ */
.product-hero { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: 28px; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: var(--gap); }
.product-media { aspect-ratio: 1; display: grid; place-items: center; background: #fff; border-radius: var(--radius-sm); padding: 12px; }
.product-media img { width: 100%; height: 100%; object-fit: contain; }
.product-main { min-width: 0; max-width: 680px; }
.product-main h1 { font-size: 22px; line-height: 1.3; font-stretch: 100%; font-weight: 650; margin: 4px 0 10px; }
.product-main .meta { font-size: 13px; }
.brand-name { color: var(--muted); font-weight: 600; }
.product-price { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.product-price .current { font-size: 46px; line-height: 1; margin: 0; }
.product-price .effective { font-size: 15px; }
.product-main .prange { margin: 14px 0 6px; max-width: 520px; }
.product-main .prange-verdict { font-size: 16px; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.chart-card { margin-bottom: var(--gap); }
.chart-card .refs { margin: 10px 0 0; }
.chart-wrap { width: 100%; margin-top: 8px; }
.chart { display: block; max-width: 100%; }
.detail-bottom { align-items: start; }
.alerts-form { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.alerts-form .field { max-width: 260px; font-size: 13.5px; color: var(--muted); }
.switches { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.switches legend { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; padding: 0; }
.switches label { display: flex; align-items: center; gap: 8px; }
.switches input.pct { width: 64px; height: 30px; }
@media (max-width: 760px) {
  .product-hero { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .product-media { max-width: 260px; margin: 0 auto; }
  .product-price .current { font-size: 38px; }
}

/* marchio: la barra del prezzo in miniatura */
.mark { position: relative; display: inline-block; width: 26px; height: 7px; border-radius: 999px; vertical-align: middle;
  background: linear-gradient(90deg, var(--good), var(--surface-2) 55%, var(--bad)); }
.mark::after { content: ""; position: absolute; left: 30%; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%;
  background: var(--text); box-shadow: 0 0 0 2px var(--surface); }
.topbar .brand { font-weight: 760; font-stretch: 88%; font-size: 16px; gap: 10px; }
.brand-foot { display: inline-flex; gap: 8px; align-items: center; }
.tile .img { position: relative; }


/* --- mobile -------------------------------------------------------------------------------------- */
.topbar .brand { white-space: nowrap; }
@media (max-width: 760px) {
  main { padding: 16px 16px 40px; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px 0; gap: 6px 12px; }
  .topbar nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -8px; padding-bottom: 6px; }
  .topbar nav a { white-space: nowrap; }
  .topbar .user { margin-left: auto; gap: 8px; }
  .topbar .user > span { display: none; }
  h1 { font-size: 21px; }
  .hero-add { flex-direction: column; }
  form.add.hero-add input { flex: none; width: 100%; }
  .hero-add button { width: 100%; }
}

/* suggerimento al passaggio del mouse sui grafici (`data-tip`, ui_kit::tooltip) */
.tooltip { position: fixed; z-index: 1000; pointer-events: none; max-width: 320px; padding: 6px 9px; border-radius: 6px; background: var(--text); color: var(--surface); font-size: 12px; line-height: 1.45; white-space: pre-line; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.chart-wrap { position: relative; }
.chart { cursor: crosshair; }
.chart .hover-guide { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart .hover-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; padding: 6px 9px; border-radius: 6px; background: var(--text); color: var(--surface); font-size: 12px; line-height: 1.45; white-space: pre-line; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
