/* Algoriam — stile "Arena": bianco, monospace, bordi netti. */
:root {
  --ink: #111111;
  --muted: #555555;
  --paper: #ffffff;
  --line: #111111;
  --soft: #e6e6e6;
  --up: #0a7a3d;
  --down: #c0392b;
  --tab-energy: #dff2e8;
  --tab-metal: #f6ecd9;
  --tab-index: #e3e9f8;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: var(--mono); font-size: 14px; line-height: 1.5; overflow-x: hidden; }
a { color: var(--ink); }
a:hover { color: var(--muted); }
button { font-family: inherit; color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ── header ── */
.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 24px; padding: 16px 32px; border-bottom: 2px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand b { font-size: 26px; letter-spacing: -1px; }
.brand span { font-size: 11px; color: var(--muted); }
.nav { display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: 13px; font-weight: 600; letter-spacing: 1px; }
.nav a { text-decoration: none; }
.top-right { display: flex; align-items: center; gap: 16px; font-size: 12px; font-weight: 600; letter-spacing: 1px; }
.lang { display: flex; border: 1px solid var(--line); }
.lang button { background: none; border: 0; padding: 4px 8px; cursor: pointer; font-size: 12px; min-height: 28px; }
.lang button.on { background: var(--ink); color: var(--paper); }

/* ── barra linguette + ticker posizioni ── */
.bar { display: flex; flex-wrap: wrap; border-bottom: 2px solid var(--line); }
.tabs { display: flex; flex-wrap: wrap; flex: 1 1 520px; }
.tab {
  border: 0; border-right: 1px solid var(--line); padding: 12px 18px; font-size: 12px;
  cursor: pointer; background: var(--paper); min-height: 44px;
}
.tab[data-group="energy"] { background: var(--tab-energy); }
.tab[data-group="metal"] { background: var(--tab-metal); }
.tab[data-group="index"] { background: var(--tab-index); }
.tab.on { font-weight: 700; box-shadow: inset 0 -3px 0 var(--ink); }
.ticker { display: flex; flex-wrap: wrap; flex: 1 1 640px; }
.tick { flex: 1 1 110px; padding: 6px 14px; border-left: 1px solid var(--line); cursor: pointer; background: none; border-top: 0; border-right: 0; border-bottom: 0; text-align: left; }
.tick:hover { background: #f5f5f5; }
.tick small { display: block; font-size: 10px; letter-spacing: .5px; }
.tick b { font-size: 15px; font-weight: 600; }

/* ── layout ── */
.layout { display: flex; flex-wrap: wrap; }
.main { flex: 999 1 640px; min-width: 0; border-right: 2px solid var(--line); }
.side { flex: 1 1 360px; min-width: 0; }
.caption { padding: 10px 32px; font-size: 12px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.fresh { display: inline-flex; align-items: center; gap: 6px; }
.fresh i { width: 8px; height: 8px; border-radius: 50%; background: #999; display: inline-block; }
.fresh.ok i { background: var(--up); }
.fresh.warn i { background: #b7791f; }
.fresh.bad i { background: var(--down); }

/* ── hero ── */
.hero { padding: 32px 32px 12px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 40px; }
.hero .label { font-size: 12px; letter-spacing: 1px; }
.hero .big { font-size: 88px; font-weight: 700; letter-spacing: -4px; line-height: 1; }
.hero .facts { font-size: 13px; line-height: 1.8; }

/* ── grafico equity ── */
.chart-box { margin: 0 32px 24px; border: 1px solid var(--line); position: relative; height: 380px; }
.chart-box svg { position: absolute; left: 24px; top: 24px; width: calc(100% - 150px); height: calc(100% - 60px); overflow: visible; }
.chart-tags { position: absolute; right: 8px; top: 24px; bottom: 36px; width: 118px; }
.chart-tag { position: absolute; right: 0; font-size: 11px; font-weight: 700; color: #fff; padding: 2px 6px; white-space: nowrap; transform: translateY(-50%); }
.chart-axis { position: absolute; left: 24px; right: 126px; bottom: 8px; display: flex; justify-content: space-between; font-size: 11px; }
.chart-empty { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--muted); }

/* ── KPI ── */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); }
.kpi { padding: 18px 24px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi small { display: block; font-size: 11px; letter-spacing: 1px; }
.kpi b { display: block; font-size: 30px; }
.kpi span { font-size: 11px; color: var(--muted); }

/* ── classifica ── */
.section { padding: 24px 32px; }
.section h2 { font-size: 13px; letter-spacing: 1px; margin: 0 0 12px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px; border-bottom: 2px solid var(--line); font-size: 11px; letter-spacing: 1px; white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr.row { cursor: pointer; }
tr.row:hover td { background: #f7f7f7; }
tr.row.on td { background: #f0f0f0; }
.dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; vertical-align: middle; }

/* ── dettaglio strategia ── */
.detail { border-top: 2px solid var(--line); }
.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 32px; border-bottom: 1px solid var(--line); }
.detail-head h3 { margin: 0; font-size: 18px; }
.ranges { display: flex; }
.ranges button { border: 1px solid var(--line); background: none; padding: 6px 12px; cursor: pointer; font-size: 12px; margin-left: -1px; min-height: 32px; }
.ranges button.on { background: var(--ink); color: var(--paper); }
#priceChart { height: 360px; margin: 16px 32px; border: 1px solid var(--line); }
.metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metrics div { padding: 12px 16px; border-right: 1px solid var(--line); }
.metrics div:last-child { border-right: 0; }
.metrics small { display: block; font-size: 10px; letter-spacing: 1px; }
.metrics b { font-size: 18px; }

/* ── pannello laterale ── */
.side-tabs { display: flex; border-bottom: 2px solid var(--line); }
.side-tabs button { flex: 1; border: 0; background: var(--paper); padding: 12px; font-size: 12px; cursor: pointer; min-height: 44px; }
.side-tabs button.on { background: var(--ink); color: var(--paper); font-weight: 700; }
.feed { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.card { border: 1px solid var(--line); padding: 12px 14px; }
.card header { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.card p { margin: 8px 0 0; font-size: 13px; line-height: 1.6; }
.log { font-size: 12px; }
.log td { padding: 6px 8px; }
.empty { padding: 24px 16px; color: var(--muted); font-size: 13px; }

/* ── metodo + footer ── */
.method { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 2px solid var(--line); }
.method div { padding: 20px 32px; border-right: 1px solid var(--line); }
.method div:last-child { border-right: 0; }
.method h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: 1px; }
.method p { margin: 0; font-size: 12px; line-height: 1.7; color: #333; }
.foot { border-top: 2px solid var(--line); padding: 20px 32px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 12px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 20px; }

/* ── pagina testo (tos) ── */
.doc { max-width: 860px; margin: 0 auto; padding: 48px 24px 72px; }
.doc h1 { font-size: 26px; letter-spacing: -0.5px; }
.doc h2 { font-size: 14px; letter-spacing: 1px; margin-top: 32px; }
.doc p, .doc li { font-size: 13px; line-height: 1.8; color: #333; }

/* ── responsive ── */
@media (max-width: 1100px) {
  .main { border-right: 0; border-bottom: 2px solid var(--line); }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metrics div:nth-child(3) { border-right: 0; }
}
@media (max-width: 640px) {
  .top, .caption, .hero, .section, .detail-head, .foot { padding-left: 16px; padding-right: 16px; }
  .nav { display: none; }
  .hero .big { font-size: 56px; letter-spacing: -2px; }
  .chart-box, #priceChart { margin-left: 16px; margin-right: 16px; }
  .chart-box { height: 300px; }
  .chart-box svg { width: calc(100% - 110px); }
  .chart-tags { width: 86px; }
  .chart-axis { right: 94px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .kpi b { font-size: 24px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics div { border-bottom: 1px solid var(--line); }
  .method { grid-template-columns: minmax(0, 1fr); }
  .method div { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; }
  .tab { padding: 10px 12px; }
}
