@font-face { font-family: "Hanken Grotesk"; src: url("/static/fonts/hanken-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url("/static/fonts/hanken-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url("/static/fonts/hanken-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Spline Sans Mono"; src: url("/static/fonts/spline-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Spline Sans Mono"; src: url("/static/fonts/spline-mono-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* Scena d'uso: secondo schermo, stanza buia, sessione lunga. Solo tema scuro, caldo, a contrasto alto. */
:root {
  color-scheme: dark;
  --bg: oklch(0.17 0.012 65);
  --surface: oklch(0.215 0.014 65);
  --line: oklch(0.32 0.016 65);
  --line-soft: oklch(0.26 0.014 65);
  --text: oklch(0.94 0.018 85);
  --muted: oklch(0.74 0.02 80);
  --accent: oklch(0.78 0.16 62);
  --accent-ink: oklch(0.2 0.03 60);
  --gain: oklch(0.82 0.16 150);
  --warn: oklch(0.84 0.14 95);
  --loss: oklch(0.72 0.17 25);
  --sans: "Hanken Grotesk", system-ui, sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line) var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1rem/1.5 var(--sans); caret-color: var(--accent); accent-color: var(--accent);
}
::selection { background: var(--accent); color: var(--accent-ink); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
a { color: var(--accent); text-underline-offset: 0.2em; }
h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: 800; line-height: 1.15; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem); letter-spacing: -0.02em; }
h2 { font-size: 1.125rem; letter-spacing: -0.01em; }
p { margin: 0; }
.num, b, .scambio b, td.n, .netto, .spread, .rapporto { font-family: var(--mono); font-variant-numeric: tabular-nums slashed-zero; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--accent); color: var(--accent-ink); padding: 0.5rem 1rem; border-radius: 6px; z-index: 10; }
.skip:focus { top: 0.75rem; }

/* testata */
.testata {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface);
}
.marchio { color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.125rem; letter-spacing: -0.01em; display: inline-flex; align-items: baseline; gap: 0.6rem; }
.menu { display: flex; gap: 0.25rem; }
.menu a { color: var(--muted); text-decoration: none; padding: 0.4rem 0.75rem; border-radius: 6px; font-weight: 600; transition: color 0.2s var(--ease), background 0.2s var(--ease); }
.menu a:hover { color: var(--text); background: var(--line-soft); }
.menu a[aria-current="page"] { color: var(--accent-ink); background: var(--accent); }
.utente { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.nick { color: var(--muted); font-size: 0.9375rem; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0.25rem; text-decoration: underline; text-underline-offset: 0.2em; }

main { max-width: 68rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; display: grid; gap: 1.5rem; }
.sotto { color: var(--muted); max-width: 65ch; }

/* controlli */
.comandi { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1rem; }
.campo { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.875rem; color: var(--muted); }
input, select {
  font: 500 1rem var(--mono); color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.55rem 0.7rem; min-height: 2.75rem; min-width: 11rem;
}
select { font-family: var(--sans); font-weight: 600; }
input:hover, select:hover { border-color: var(--muted); }
button.primario, a.primario, button.secondario, a.secondario {
  font: 600 1rem var(--sans); min-height: 2.75rem; padding: 0.55rem 1.25rem; border-radius: 6px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
button.primario, a.primario { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
button.primario:hover, a.primario:hover { background: oklch(0.83 0.15 66); }
button.secondario, a.secondario { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.secondario:hover, a.secondario:hover { border-color: var(--muted); }
button:active { transform: translateY(1px); }

.avviso { padding: 0.75rem 1rem; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); }
.avviso.err { border-color: var(--loss); }

/* quadro tassi */
.quadro { display: grid; gap: 0.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tassi { margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 2rem; }
.tassi div { display: flex; gap: 0.5rem; align-items: baseline; }
.tassi dt { color: var(--muted); font-size: 0.9375rem; }
.tassi dd { margin: 0; font: 700 1rem var(--mono); font-variant-numeric: tabular-nums slashed-zero; }
.fresco { color: var(--muted); font-size: 0.9375rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.fresco.datato { color: var(--warn); }
.fresco strong { color: var(--warn); }

/* opportunità: righe separate da filetti, nessuna card */
.elenco { list-style: none; margin: 0; padding: 0; }
.op { display: grid; gap: 1rem 2rem; padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.intesta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 1rem; }
.intesta h2 { font-size: 1.25rem; }
.spread { font-weight: 700; color: var(--accent); font-size: 1.125rem; }
.liq { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.9375rem; }
.ico { flex: none; }
.liq-ok { color: var(--gain); }
.liq-lento { color: var(--warn); }
.liq-molto_lento { color: var(--loss); }

.gambe { display: grid; gap: 1rem; }
.gamba { display: grid; gap: 0.2rem; align-content: start; }
.gamba h3 { font-size: 0.875rem; color: var(--muted); font-weight: 600; margin-bottom: 0.2rem; }
.scambio { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; }
.scambio .verbo { color: var(--muted); min-width: 3.5rem; font-size: 0.9375rem; }
.scambio b { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; }
.scambio .cosa { overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 0.875rem; }
.meta .num { color: var(--text); }

.esito { display: grid; gap: 0.2rem; align-content: start; }
.netto { font-size: 1.625rem; font-weight: 700; letter-spacing: -0.02em; }
.netto .unita { font: 600 0.9375rem var(--sans); color: var(--muted); letter-spacing: 0; }
.guadagno { color: var(--gain); }
.perdita { color: var(--loss); }
.attenzione { color: var(--warn); }
.disclaimer { color: var(--muted); max-width: 65ch; padding-top: 0.5rem; }

@media (min-width: 52rem) {
  .op { grid-template-columns: minmax(0, 1fr) minmax(0, 12rem); }
  .intesta { grid-column: 1 / -1; }
  .gambe { grid-template-columns: 1fr 1fr; grid-column: 1; }
  .esito { grid-column: 2; grid-row: 2; padding-left: 1.5rem; border-left: 1px solid var(--line-soft); }
}
@media (min-width: 52rem) and (min-width: 64rem) {
  .op { grid-template-columns: minmax(0, 1fr) 16rem; }
}

/* sezioni secondarie */
.blocco { display: grid; gap: 0.75rem; }
.vuoto, .centrato { display: grid; gap: 0.75rem; max-width: 52ch; }
.centrato { margin: 4rem auto 0; justify-items: start; }
.vuoto-inline { color: var(--muted); }
.id { font-size: 1.25rem; padding: 0.5rem 0.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; user-select: all; }

.grafico { margin: 0; }
.grafico svg { width: 100%; height: auto; max-width: 46rem; display: block; }
.grafico .griglia { stroke: var(--line-soft); stroke-width: 1; }
.grafico .asse { fill: var(--muted); font: 500 11px var(--mono); }
.grafico .serie { fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.grafico .ultimo { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }

.tabella-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 32rem; }
th, td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line-soft); text-align: left; }
thead th { color: var(--muted); font-weight: 600; font-size: 0.875rem; border-bottom-color: var(--line); }
tbody th { font-weight: 600; }
.n { text-align: right; white-space: nowrap; }

.righe { list-style: none; margin: 0; padding: 0; }
.righe li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line-soft); }
.righe .meta { display: block; }

@media (prefers-reduced-motion: no-preference) {
  .op { animation: entra 0.5s var(--ease) both; }
  .op:nth-child(2) { animation-delay: 0.05s; }
  .op:nth-child(3) { animation-delay: 0.1s; }
  .op:nth-child(n+4) { animation-delay: 0.15s; }
  @keyframes entra { from { opacity: 0.001; transform: translateY(6px); } }
}

/* lega, filtri, icone */
.lega select { min-width: 0; min-height: 2.25rem; padding: 0.25rem 0.6rem; font-size: 0.9375rem; }
.lega-fissa { color: var(--muted); font-size: 0.9375rem; }
.filtri { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.filtri input, .filtri select { min-width: 9.5rem; }
.filtri .stretto input { min-width: 0; width: 7.5rem; }
input[type="search"] { font-family: var(--sans); font-weight: 500; }
input::placeholder { color: var(--muted); opacity: 1; }
.icona { flex: none; display: inline-block; object-fit: contain; vertical-align: middle; }
.icona.s24 { width: 24px; height: 24px; }
.icona.s32 { width: 32px; height: 32px; }
.icona.s40 { width: 40px; height: 40px; }
.icona.vuota { background: var(--line-soft); border-radius: 6px; }
.nome { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem; }
.nome:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 0.2em; }
.intesta h2 .nome { gap: 0; }
.intesta { align-items: center; }
.categoria { color: var(--muted); font-size: 0.875rem; }
.riepilogo { color: var(--muted); }
.riepilogo b { color: var(--text); }

/* il rapporto è la cifra da digitare in gioco: la parte più grande della riga */
.rapporto {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; width: fit-content; max-width: 100%;
  margin: 0.2rem 0 0.5rem; padding: 0.5rem 0.9rem 0.5rem 0.6rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem); line-height: 1; letter-spacing: -0.02em;
}
.rapporto b { font-weight: 700; }
.rapporto .due { color: var(--accent); font-weight: 700; }
.pagine { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 1rem 0; }
.spento { opacity: 0.45; cursor: default; }

/* esplora */
.movimenti { display: grid; gap: 1rem 2rem; }
@media (min-width: 40rem) { .movimenti { grid-template-columns: 1fr 1fr; } }
.righe.compatta li { padding: 0.4rem 0; }
.neutro { color: var(--muted); }
.titolo-oggetto { display: flex; align-items: center; gap: 1rem; }
.dettaglio { padding-bottom: 0.5rem; }
.intervalli { display: flex; gap: 0.25rem; }
.intervalli a { color: var(--muted); text-decoration: none; padding: 0.4rem 0.9rem; border-radius: 6px; font-weight: 600; border: 1px solid var(--line); }
.intervalli a:hover { color: var(--text); border-color: var(--muted); }
.intervalli a.attivo { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

/* prenotazioni */
.riserva { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.9375rem; }
.riserva.mia { color: var(--accent); }
.riserva.altrui { color: var(--warn); }
.azioni { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
button.piccolo, a.piccolo { min-height: 2.25rem; padding: 0.3rem 0.9rem; font-size: 0.9375rem; }
.prenotati h2 { margin-bottom: 0.25rem; }
code.num { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 0.1rem 0.35rem; font-size: 0.9em; }

/* mercato avanzato */
.sottomenu { display: flex; flex-wrap: wrap; gap: 0.25rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--line); }
.sottomenu a { color: var(--muted); text-decoration: none; padding: 0.35rem 0.8rem; border-radius: 6px; font-weight: 600; font-size: 0.9375rem; border: 1px solid transparent; transition: color 0.2s var(--ease), border-color 0.2s var(--ease); }
.sottomenu a:hover { color: var(--text); border-color: var(--line); }
.sottomenu a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }
.badge { display: inline-block; min-width: 1.25rem; padding: 0 0.35rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 700 0.75rem/1.25rem var(--mono); text-align: center; }
.stella { display: inline; }
.stella button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.stoppino { stroke: var(--muted); stroke-width: 1.5; }
.corpo.su { fill: var(--gain); stroke: var(--gain); stroke-width: 1.5; }
.corpo.giu { fill: var(--bg); stroke: var(--loss); stroke-width: 1.5; }
.barra.su { fill: var(--gain); }
.barra.giu { fill: var(--loss); }
.tessere { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.tessera a { display: grid; gap: 0.25rem; padding: 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--text); transition: border-color 0.2s var(--ease); }
.tessera a:hover { border-color: var(--muted); }
.t-nome { font-weight: 800; font-size: 1.125rem; }
.t-var { font: 700 1.5rem var(--mono); font-variant-numeric: tabular-nums slashed-zero; }
.t-meta { color: var(--muted); font-size: 0.875rem; }
.tessera.su2 .t-var, .tessera.su1 .t-var { color: var(--gain); }
.tessera.giu2 .t-var, .tessera.giu1 .t-var { color: var(--loss); }
.tessera.su2 a { border-color: var(--gain); }
.tessera.giu2 a { border-color: var(--loss); }
.inserzioni { display: grid; gap: 0; }
.ins { display: grid; gap: 0.6rem; padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.ins-testa { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; }
.ins-nome { flex: 1 1 14rem; display: grid; gap: 0.1rem; }
.ins-nome h2 { font-size: 1.125rem; }
.ins-prezzo { text-align: right; }
.ins-prezzo .netto { font-size: 1.375rem; }
.mods { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; color: var(--text); font-size: 0.9375rem; }
.mods .impl { color: var(--muted); }
.stato.on { color: var(--gain); font-weight: 600; }
.stato.off { color: var(--muted); }
.whisper { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.whisper code { overflow-wrap: anywhere; }
.in-riga { display: flex; gap: 0.5rem; justify-content: flex-end; }
.in-riga input { min-width: 0; width: 8rem; min-height: 2.25rem; padding: 0.25rem 0.5rem; }

/* ricerca per proprietà */
.ricerca { align-items: flex-end; }
.blocco-ricerca { flex: 1 1 100%; margin: 0; padding: 0.75rem 0 0; border: 0; border-top: 1px solid var(--line-soft); display: grid; gap: 0.75rem; min-width: 0; }
.blocco-ricerca > legend { padding: 0 0.5rem 0 0; font-weight: 800; font-size: 1.0625rem; float: left; width: 100%; margin-bottom: 0.25rem; }
.blocco-ricerca > legend + * { clear: both; }
.contatori { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; }
.contatore { display: flex; align-items: center; gap: 0.5rem; }
.contatore span { min-width: 7rem; font-weight: 600; font-size: 0.9375rem; color: var(--muted); }
.contatore input, .filtro-mm input { min-width: 0; width: 5rem; min-height: 2.5rem; padding: 0.35rem 0.5rem; }
.opzioni-prop { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-end; }
.riga-prop { display: grid; gap: 0.5rem; grid-template-columns: 1fr 1fr; align-items: start; }
.riga-prop .tipo-prop { grid-column: 1 / -1; min-width: 0; font-size: 0.9375rem; }
.riga-prop .prop-cerca { grid-column: 1 / -1; position: relative; }
.riga-prop .prop-testo { width: 100%; font-family: var(--sans); font-weight: 500; }
.riga-prop input[type="number"] { min-width: 0; width: 100%; }
.tier-box { grid-column: 1 / -1; display: grid; gap: 0.4rem; padding: 0.5rem 0.75rem; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; }
.tier-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.suggerimenti { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin: 0.25rem 0 0; padding: 0.25rem; list-style: none; max-height: 18rem; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px -8px oklch(0 0 0 / 0.6); }
.suggerimenti[hidden], .tier-box[hidden] { display: none; }
.suggerimenti button { display: block; width: 100%; text-align: left; padding: 0.5rem 0.6rem; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: 500 0.9375rem var(--sans); cursor: pointer; }
.suggerimenti button:hover, .suggerimenti button:focus-visible { background: var(--line-soft); }
.avanzati > summary { cursor: pointer; font-weight: 800; font-size: 1.0625rem; }
.avanzati[open] { gap: 1rem; }
.gruppo-filtri { margin: 0; padding: 0; border: 0; display: grid; gap: 0.5rem; min-width: 0; }
.gruppo-filtri > legend { padding: 0; font-weight: 600; color: var(--muted); font-size: 0.9375rem; }
.griglia-filtri { display: grid; gap: 0.6rem 1rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.griglia-filtri select { min-width: 0; width: 100%; }
.filtro-mm { display: grid; grid-template-columns: 1fr auto auto; gap: 0.4rem; align-items: center; font-size: 0.9375rem; color: var(--muted); font-weight: 600; }
.tier { display: inline-block; padding: 0 0.4rem; border-radius: 4px; font: 700 0.75rem/1.4rem var(--mono); border: 1px solid var(--line); background: var(--surface); color: var(--text); vertical-align: 0.05em; white-space: nowrap; }
button.tier { font: 600 0.8125rem/1.4 var(--sans); padding: 0.2rem 0.5rem; cursor: pointer; border-radius: 6px; }
.tier.prefisso { border-color: var(--accent); color: var(--accent); }
.tier.suffisso { border-style: dashed; border-color: var(--muted); color: var(--text); }
button.tier:hover { background: var(--line-soft); }
@media (min-width: 52rem) {
  .riga-prop { grid-template-columns: 15rem 1fr 6rem 6rem; }
  .riga-prop .tipo-prop { grid-column: auto; }
  .riga-prop .prop-cerca { grid-column: auto; }
}
