:root {
  --bg: #0e1116; --panel: #161b22; --panel2: #1c232c; --line: #2a323d;
  --text: #e6edf3; --muted: #8b96a3; --accent: #4f9dff;
  --up: #3fb950; --down: #f0524f;
  --v-opp: #3fb950; --v-ver: #d9a72b; --v-cau: #f08a3c; --v-trap: #f0524f; --v-old: #6e7681; --v-none: #444c56;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: inherit; text-decoration: none; }
main { max-width: 1280px; margin: 0 auto; padding: 16px 20px 8px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: rgba(14,17,22,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.logo { background: var(--accent); color: #fff; border-radius: 6px; padding: 3px 6px; font-size: 12px; letter-spacing: .5px; }
.asof { color: var(--muted); font-size: 13px; }
.asof b { color: var(--text); font-weight: 600; }
.asof .warn { color: var(--v-ver); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.kpi:hover { border-color: var(--accent); }
.kpi .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.kpi .n { font-size: 24px; font-weight: 700; margin-top: 4px; }
.kpi .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
h2 { margin: 0; font-size: 17px; }
h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: transparent; color: var(--muted); border: 0; padding: 6px 12px; cursor: pointer; font: inherit; }
.seg button.on { background: var(--panel2); color: var(--text); }

.flows { display: grid; grid-template-columns: 1fr 220px; gap: 12px; }
.chart { position: relative; min-height: 320px; }
.legend { list-style: none; margin: 0; padding: 0; font-size: 13px; max-height: 340px; overflow: auto; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.legend li:hover { background: var(--panel2); }
.legend li.off { opacity: .35; }
.legend li.sel { background: var(--panel2); outline: 1px solid var(--accent); }
.legend .sw { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.legend .val { margin-left: auto; font-variant-numeric: tabular-nums; }

.filters { display: flex; gap: 8px; }
input[type=search], select { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; }
input[type=search] { width: 220px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 4px 11px; cursor: pointer; font: inherit; font-size: 12px; }
.chip.on { color: var(--text); border-color: var(--accent); background: rgba(79,157,255,.12); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; user-select: none; }
th.sorted::after { content: " ▾"; }
th.sorted.asc::after { content: " ▴"; }
td { padding: 7px 8px; border-bottom: 1px solid #1f262f; white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel2); }
.num { text-align: right; }
.sym { font-weight: 700; }
.name { color: var(--muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; margin-left: 6px; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--muted); }
.more { display: block; margin: 12px auto 0; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 16px; cursor: pointer; font: inherit; }

.badge { display: inline-block; border-radius: 5px; padding: 2px 7px; font-size: 11px; font-weight: 600; letter-spacing: .3px; }
.pbar { display: inline-block; width: 46px; height: 6px; background: #222a33; border-radius: 3px; vertical-align: middle; margin-left: 6px; overflow: hidden; }
.pbar i { display: block; height: 100%; }

.tip { position: absolute; pointer-events: none; background: #0b0e13; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; white-space: nowrap; z-index: 3; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.tip .row { display: flex; justify-content: space-between; gap: 14px; }

/* dettaglio */
.back { color: var(--muted); display: inline-block; margin-bottom: 12px; }
.back:hover { color: var(--text); }
.dhead { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.dhead h1 { margin: 0; font-size: 26px; }
.dhead h1 small { color: var(--muted); font-weight: 400; font-size: 16px; margin-left: 8px; }
.dhead .meta { color: var(--muted); margin-top: 4px; }
.price { text-align: right; }
.price .px { font-size: 28px; font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat .l { color: var(--muted); font-size: 12px; } .stat .n { font-size: 17px; font-weight: 600; margin-top: 2px; }
.score { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.score .big { font-size: 34px; font-weight: 700; }
.fam { display: grid; grid-template-columns: 90px 1fr 44px; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.fam .bar { position: relative; height: 10px; background: #222a33; border-radius: 5px; }
.fam .bar .mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--muted); }
.fam .bar i { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.why { margin-top: 12px; font-size: 13px; list-style: none; padding-left: 0; }
.why li { margin: 3px 0; }
.ftable td:first-child { white-space: normal; }
.fgroup td { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; padding-top: 14px; border-bottom: 0; cursor: default; }
.empty { color: var(--muted); font-style: italic; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }

@media (max-width: 900px) {
  .flows, .grid2 { grid-template-columns: 1fr; }
  .legend { display: flex; flex-wrap: wrap; max-height: none; }
  input[type=search] { width: 150px; }
}

/* selettore grafici: solo testo */
.chart-tabs { display: flex; gap: 22px; flex-wrap: wrap; margin: 2px 2px 12px; font-size: 13px; }
.chart-tabs button { background: none; border: 0; padding: 4px 0; color: var(--muted); cursor: pointer; font: inherit; border-bottom: 2px solid transparent; }
.chart-tabs button:hover { color: var(--text); }
.chart-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.chart-tabs button.off-btn { text-transform: uppercase; letter-spacing: .5px; font-size: 11px; }

/* super opportunita' */
:root { --v-super: #f5c542; }
.kpi.super { border-color: rgba(245,197,66,.45); background: linear-gradient(160deg, rgba(245,197,66,.12), var(--panel) 60%); }
.kpi.super .n { color: var(--v-super); }
.kpi.on { outline: 1px solid var(--accent); }
.checks { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13px; columns: 2; column-gap: 24px; }
.checks li { margin: 4px 0; break-inside: avoid; }
.checks .ok { color: var(--up); } .checks .ko { color: var(--down); }
.zone-label { fill: var(--muted); font-size: 11px; }
.sym-label { fill: var(--text); font-size: 10.5px; font-weight: 600; pointer-events: none; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; }
@media (max-width: 900px) { .checks { columns: 1; } }
[hidden] { display: none !important; }

/* novita' del giorno */
.news { padding: 12px 18px; }
.news-head { display: flex; justify-content: space-between; align-items: baseline; cursor: pointer; user-select: none; }
.news-head h2 { font-size: 15px; }
.news-head .muted { font-size: 12px; }
.news-body { margin-top: 10px; display: grid; gap: 8px; }
.news-row { display: grid; grid-template-columns: 190px 1fr; gap: 10px; align-items: start; font-size: 13px; }
.news-row .lbl { color: var(--muted); padding-top: 3px; }
.news-row .lbl b { color: var(--text); margin-left: 4px; }
.tk { display: inline-block; margin: 0 4px 4px 0; padding: 2px 8px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); font-weight: 600; font-size: 12px; cursor: pointer; }
.tk:hover { border-color: var(--accent); }
.tk small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.delta { font-size: 12px; font-weight: 500; margin-left: 6px; }
.delta.same { color: var(--muted); }
.news.closed .news-body { display: none; }
@media (max-width: 700px) { .news-row { grid-template-columns: 1fr; gap: 2px; } }

/* selettore grafici: rettangoli piccoli come quelli in alto */
.chart-tabs { gap: 8px; margin: 0 0 12px; }
.chart-tabs button { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px;
  color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--line); }
.chart-tabs button:hover { border-color: var(--accent); color: var(--text); }
.chart-tabs button.on { color: var(--text); border-color: var(--accent); background: linear-gradient(160deg, rgba(79,157,255,.14), var(--panel) 70%); }
.chart-tabs button.off-btn { font-size: 12px; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }

/* accesso e watchlist */
.top-r { display: flex; align-items: center; gap: 16px; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.who .enter { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.who .link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.who .link:hover { color: var(--text); }
.login { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; width: min(380px, 92vw); }
.login::backdrop { background: rgba(0,0,0,.6); }
.login label { display: block; color: var(--muted); font-size: 12px; margin-top: 14px; }
.login input { display: block; width: 100%; margin-top: 6px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 15px; }
.login #login-code { letter-spacing: 6px; font-size: 20px; text-align: center; }
.login .err { color: var(--down); min-height: 18px; margin: 10px 0 0; font-size: 13px; }
.login-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.login-btns button { border-radius: 8px; padding: 7px 16px; font: inherit; cursor: pointer; }
.login-btns .ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.login-btns .primary { background: var(--accent); color: #fff; border: 0; font-weight: 600; }
.login-btns .primary:disabled { opacity: .5; }
.star { background: none; border: 0; cursor: pointer; font-size: 16px; line-height: 1; color: var(--muted); padding: 0 2px; }
.star:hover { color: var(--v-super); }
.star.on { color: var(--v-super); }
.dhead h1 .star { font-size: 22px; margin-right: 8px; vertical-align: 2px; }
th.star-col, td.star-col { width: 26px; padding-left: 4px; padding-right: 0; }
.chip.wl b { color: var(--v-super); margin-left: 3px; }
.chip.wl.on { border-color: var(--v-super); background: rgba(245,197,66,.12); }

/* pagina di accesso: prima di entrare non si vede nient'altro */
body.gated .top, body.gated #home, body.gated #detail, body.gated .foot { display: none !important; }
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.gate-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px 28px 22px; width: min(400px, 100%); }
.gate-brand { font-weight: 700; font-size: 20px; display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.gate label { display: block; color: var(--muted); font-size: 12px; margin-top: 16px; }
.gate input { display: block; width: 100%; margin-top: 6px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 15px; }
.gate #login-code { letter-spacing: 6px; font-size: 22px; text-align: center; }
.gate .err { color: var(--down); min-height: 18px; margin: 10px 0 0; font-size: 13px; }

/* ---------- registrazione ---------- */
.gate .names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gate-switch { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }
.gate-switch .link, .support .link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

/* ---------- scadenza e sostegno ---------- */
.who .badge { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); white-space: nowrap; cursor: pointer; }
.who .badge:hover { background: var(--panel2); filter: brightness(1.15); }
.who .badge.trial { color: #e0b341; border-color: #e0b34155; }
.who .badge.off { color: var(--down); border-color: currentColor; }
body.locked #home, body.locked #detail, body.locked .foot { display: none !important; }
#locked { filter: blur(7px); pointer-events: none; user-select: none; opacity: .75; padding: 0 20px; }
#locked .kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 16px 0; }
#locked .kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
#locked .kpi b { font-size: 24px; }
#locked .fake-chart { height: 220px; display: flex; align-items: flex-end; gap: 6px; }
#locked .fake-chart i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; opacity: .7; }
#locked table { width: 100%; border-collapse: collapse; }
#locked td, #locked th { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; }
.support { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(480px, 94vw); }
.support::backdrop { background: rgba(0,0,0,.55); }
.support-card { padding: 24px 26px 20px; }
.support h2 { margin: 0 0 6px; font-size: 20px; }
.support p { font-size: 14px; line-height: 1.5; }
.support .steps { padding-left: 20px; font-size: 14px; line-height: 1.5; }
.support .steps li { margin: 10px 0; }
.support .code { font-family: ui-monospace, monospace; font-size: 15px; background: var(--panel2); padding: 2px 8px; border-radius: 6px; letter-spacing: 1px; }
.support .pays { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.support .pay { flex: 1; min-width: 140px; text-align: center; border-radius: 10px; padding: 10px 12px; font-weight: 700; text-decoration: none; border: 1px solid var(--line); color: var(--text); }
.support .pay small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 2px; }
.support .pay.paypal { background: #0070ba; color: #fff; border-color: #0070ba; }
.support .pay.paypal small { color: #dbeafe; }
.support .pay.satispay { background: var(--panel2); color: #ef4a3f; }
.support .claim { display: flex; gap: 10px; margin-top: 8px; }
.support .claim label { flex: 1; color: var(--muted); font-size: 12px; }
.support .claim input, .support .claim select { display: block; width: 100%; margin-top: 4px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; }
.support .ok { color: var(--up); background: color-mix(in srgb, var(--up) 12%, transparent); padding: 10px 12px; border-radius: 8px; }
.support .err { color: var(--down); min-height: 16px; margin: 6px 0 0; font-size: 13px; }
@media (max-width: 640px) { #locked .kpis { grid-template-columns: repeat(2, 1fr); } }
