/* Piootoo — dashboard Hyperliquid. Sito statico, nessuna dipendenza esterna. Stessa tavolozza del sito di documentazione. */

:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #f6f9fa;
  --ink: #0f1b24;
  --ink-2: #42525e;
  --ink-3: #6f7f8b;
  --line: #e0e7ec;
  --line-strong: #c8d3da;
  --accent: #0b7a75;
  --accent-ink: #ffffff;
  --accent-soft: #def3f0;
  --gain: #17693f;
  --loss: #a8261d;
  --ok: #17693f;      --ok-bg: #e0f2e7;
  --warn: #8a5a00;    --warn-bg: #fcefcf;
  --bad: #a8261d;     --bad-bg: #fbe4e1;
  --mute: #56636e;    --mute-bg: #e9eef1;
  --line-equity: #1f77b4;
  --line-balance: #e0730e;
  --line-pnl: #2c9a2c;
  --line-benchmark: #7b4fb5;
  --line-return: #0f8a8a;
  --side-buy: #1d64c8;
  --side-sell: #c2410c;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  --radius: 10px;
  --radius-lg: 14px;
  --brand-gradient: linear-gradient(135deg, #2ad0bb 0%, #0e8a8f 55%, #0b4f74 100%);
  --shadow: 0 1px 2px rgba(15, 27, 36, .05), 0 8px 24px -8px rgba(15, 27, 36, .12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1217;
    --surface: #121b22;
    --surface-2: #17222b;
    --ink: #e6edf1;
    --ink-2: #aebbc5;
    --ink-3: #7f8f9b;
    --line: #22303a;
    --line-strong: #33444f;
    --accent: #4fd1c5;
    --accent-ink: #06211f;
    --accent-soft: #11333a;
    --gain: #6fd49b;
    --loss: #ff9186;
    --ok: #6fd49b;    --ok-bg: #133324;
    --warn: #f0c060;  --warn-bg: #3a2c0c;
    --bad: #ff9186;   --bad-bg: #3d1a17;
    --mute: #a9b5be;  --mute-bg: #222d36;
    --line-equity: #6cb4ee;
    --line-balance: #ffa94d;
    --line-pnl: #6fd49b;
    --line-benchmark: #c3a6f5;
    --line-return: #5fd3d3;
    --side-buy: #74b3ff;
    --side-sell: #ff9f5a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1217;
  --surface: #121b22;
  --surface-2: #17222b;
  --ink: #e6edf1;
  --ink-2: #aebbc5;
  --ink-3: #7f8f9b;
  --line: #22303a;
  --line-strong: #33444f;
  --accent: #4fd1c5;
  --accent-ink: #06211f;
  --accent-soft: #11333a;
  --gain: #6fd49b;
  --loss: #ff9186;
  --ok: #6fd49b;    --ok-bg: #133324;
  --warn: #f0c060;  --warn-bg: #3a2c0c;
  --bad: #ff9186;   --bad-bg: #3d1a17;
  --mute: #a9b5be;  --mute-bg: #222d36;
  --line-equity: #6cb4ee;
  --line-balance: #ffa94d;
  --line-pnl: #6fd49b;
  --line-benchmark: #c3a6f5;
  --line-return: #5fd3d3;
  --side-buy: #74b3ff;
  --side-sell: #ff9f5a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--sans);
  -webkit-text-size-adjust: 100%;
}
button, input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.muted { color: var(--ink-3); }
.side-buy { color: var(--side-buy); font-weight: 600; }
.side-sell { color: var(--side-sell); font-weight: 600; }

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

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px 24px 24px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand img { width: 44px; height: 44px; }
.login-brand h1 { font: 600 20px/1.2 var(--display); margin: 0; }
.login-brand p { margin: 2px 0 0; color: var(--ink-3); font-size: 13px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.field > label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
/* Campo password con l'occhio per mostrarla: il bottone sta dentro il bordo del campo, a destra. */
.password-box { position: relative; }
.password-box input { padding-right: 44px; }
.reveal {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.reveal:hover { color: var(--ink); }
.reveal:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.reveal svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.reveal .eye-closed { display: none; }
.reveal[aria-pressed="true"] .eye-open { display: none; }
.reveal[aria-pressed="true"] .eye-closed { display: block; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); margin: 4px 0 18px; }
.primary {
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  cursor: pointer;
}
.primary:disabled { opacity: .6; cursor: progress; }
.message { margin: 14px 0 0; font-size: 13px; min-height: 1.2em; }
.message.error { color: var(--bad); }

/* ------------------------------------------------------------------ dashboard */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font: 600 16px/1 var(--display); white-space: nowrap; }
.topbar .brand img { width: 30px; height: 30px; }
.topbar .spacer { flex: 1; }
.topbar select, .topbar button, .toolbar select {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  max-width: 100%;
}
/* ------------------------------------------------------------------ scelta del conto: pulsante e card
   Ogni conto ha due colori (--acc-from, --acc-to) messi dal JavaScript: la sfumatura dell'avatar e della testata
   della card. Il testo sopra e' bianco, quindi la stessa sfumatura vale nel tema chiaro e in quello scuro. */

.account-picker { position: relative; min-width: 0; }
.topbar .account-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  max-width: 360px;
  text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.topbar .account-button:hover, .topbar .account-button[aria-expanded="true"] { border-color: var(--accent); }
.topbar .account-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.acc-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--acc-from, #2ad0bb), var(--acc-to, #0b4f74));
  color: #fff;
  font: 700 12.5px/1 var(--display);
  letter-spacing: .02em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .25);
}
.acc-button-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.acc-button-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-button-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-count {
  flex: none;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.acc-chevron { flex: none; width: 16px; height: 16px; color: var(--ink-3); transition: transform .15s; }
.account-button[aria-expanded="true"] .acc-chevron { transform: rotate(180deg); }

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  /* --acc-cols lo mette il JavaScript (conti, al massimo 3): la tendina non lascia colonne vuote. */
  width: min(calc(var(--acc-cols, 2) * 270px + (var(--acc-cols, 2) - 1) * 10px + 26px), calc(100vw - 32px));
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 4px rgba(15, 27, 36, .06), 0 24px 48px -12px rgba(15, 27, 36, .28);
  animation: acc-menu-in .14s ease-out;
}
@keyframes acc-menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .account-menu { animation: none; } }
.acc-menu-head { font: 600 13px/1.2 var(--display); color: var(--ink-2); margin: 2px 4px 10px; text-transform: uppercase; letter-spacing: .04em; }
.acc-grid { display: grid; grid-template-columns: repeat(var(--acc-cols, 2), minmax(0, 1fr)); gap: 10px; }
.acc-menu-user { margin: 12px 4px 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.acc-menu-user b { color: var(--ink-2); font-weight: 600; }

/* Chi e' collegato: email accanto a «Esci»; sul telefono resta l'icona, l'email sta in fondo alla tendina dei conti. */
.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 260px;
  font-size: 13px;
  color: var(--ink-2);
}
.user-chip svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.user-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar .acc-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  text-align: left;
  max-width: none;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.topbar .acc-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.topbar .acc-card:focus-visible { outline: 2px solid var(--acc-from); outline-offset: 2px; }
.topbar .acc-card.selected { border-color: var(--acc-to); box-shadow: 0 0 0 2px var(--acc-from), var(--shadow); }
.acc-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 14px;
  background: linear-gradient(135deg, var(--acc-from), var(--acc-to));
  color: #fff;
}
.acc-card-head .acc-avatar { background: rgba(255, 255, 255, .22); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35); }
.acc-card-title { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.acc-card-name {
  font: 600 15px/1.25 var(--display);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .2);
}
.acc-card-meta { font-size: 12px; opacity: .85; }
.acc-check {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 3px;
  border-radius: 50%;
  background: #fff;
  color: var(--acc-to);
}
.acc-card-body { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px 12px; }
.acc-equity { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.acc-equity span { font-size: 12px; color: var(--ink-3); }
.acc-equity b { font: 600 22px/1.1 var(--display); }
.acc-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.acc-figure {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface-2);
  min-width: 0;
}
.acc-figure span { font-size: 11px; color: var(--ink-3); }
.acc-figure b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-card-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.acc-card-foot .muted { margin-left: auto; }
.acc-warn { color: var(--warn); font-weight: 600; }

.tabs { display: flex; gap: 4px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs button {
  padding: 10px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
  font-weight: 600;
}
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

.page { max-width: 1280px; margin: 0 auto; padding: 16px 16px 48px; }
.band {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-weight: 600;
  margin-bottom: 8px;
}
.band.running { background: var(--ok-bg); color: var(--ok); }
.band.warning { background: var(--warn-bg); color: var(--warn); }
.band.idle { background: var(--mute-bg); color: var(--mute); }
.band.off { background: var(--bad-bg); color: var(--bad); }
.band small { font-weight: 400; }
.active-plans { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin: 0 0 10px; }
.active-plans-label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); margin-right: 2px; }
.plan-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 3px 10px; border-radius: 999px; font-size: 13px; background: var(--mute-bg); color: var(--mute); }
.plan-chip strong { font-family: var(--mono); font-size: 12.5px; }
.plan-chip.running { background: var(--ok-bg); color: var(--ok); }
.plan-chip.warning { background: var(--warn-bg); color: var(--warn); }
.plan-chip.off { background: var(--bad-bg); color: var(--bad); }
.freshness { font-size: 13px; color: var(--ink-3); margin: 0 0 14px; }
.freshness.stale { color: var(--warn); font-weight: 600; }
.notice { padding: 10px 14px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); margin-bottom: 12px; font-size: 14px; }
.notice.bad { background: var(--bad-bg); color: var(--bad); }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-width: 0;
}
.tile .caption { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .value { font: 600 21px/1.25 var(--display); font-variant-numeric: tabular-nums; margin-top: 2px; overflow-wrap: anywhere; }
.tile .detail { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.tile .value.none { color: var(--ink-3); }
.tile.dual .value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.tile.dual .second { font-size: 17px; }
.tile .value .none { color: var(--ink-3); }
/* In testa alla dashboard: i quattro PnL, piu' grandi del resto. */
.tiles.headline { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tiles.headline .tile { padding: 14px 16px; border-color: var(--line-strong); }
.tiles.headline .caption { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.tiles.headline .value { font-size: 32px; margin-top: 4px; }
.tiles.headline .tile.dual .value { flex-direction: column; align-items: flex-start; }
.tiles.headline .tile.dual .second { font-size: 19px; }
.tiles.headline .detail { font-size: 12.5px; }.capital-line {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
}
.capital-line b { font: 600 17px/1.2 var(--display); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 18px;
  min-width: 0;
}
.panel h2 { font: 600 15px/1.3 var(--display); margin: 0 0 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.panel h2 .count { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-left: auto; font-weight: 400; font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-bottom: 10px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-3); min-width: 0; }
.filters .search { flex: 1; min-width: 200px; }
.filters select, .filters input, .filters button {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 14px;
  color: var(--ink);
  min-width: 0;
}
.filters select, .filters button { cursor: pointer; }
.filters input:focus, .filters select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.note { font-size: 13px; color: var(--ink-3); margin: 0 0 10px; }
.note.error { color: var(--bad); }

/* I due grafici al netto dei versamenti, affiancati; sotto i 900 px uno sopra l'altro. */
.chart-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.chart-pair .chart { height: 240px; }
@media (max-width: 900px) { .chart-pair { grid-template-columns: 1fr; } }

/* Account info: i dati del conto in due colonne, etichetta e valore; su telefono una sotto l'altra. */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; font-size: 14px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts a { color: var(--accent); font-size: 13px; }
.facts code, code.address { font-family: var(--mono); font-size: 13px; }
code.address { user-select: all; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; overflow-wrap: anywhere; }
.account-notes { margin: 0; font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
}

.chart { position: relative; width: 100%; height: 300px; }
.chart svg { display: block; width: 100%; height: 100%; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 4 4; }
.chart text { fill: var(--ink-3); font: 11px var(--sans); }
.chart .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 14px; text-align: center; padding: 16px; }
.chart .tip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 12px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.legend i.dash { border-radius: 0; -webkit-mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 8px); mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 8px); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-height: 520px; overflow-y: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 6px 9px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--ink-2);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
th.num, td.num { text-align: right; }
th[aria-sort="ascending"]::after { content: " ▲"; font-size: 10px; }
th[aria-sort="descending"]::after { content: " ▼"; font-size: 10px; }
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 600; border-bottom: none; }
tfoot tr:first-child td { border-top: 1px solid var(--line); }
.empty-row { color: var(--ink-3); padding: 10px 9px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.running { background: var(--ok-bg); color: var(--ok); }
.pill.warning { background: var(--warn-bg); color: var(--warn); }
.pill.idle { background: var(--mute-bg); color: var(--mute); }
.pill.off { background: var(--bad-bg); color: var(--bad); }

/* Ciambelle: gli slot categoriali della tavolozza di riferimento, in ordine fisso (gli stessi di DonutChart.cs
   nella console), un passo proprio per il tema scuro. «Altro» e' grigio: non e' un simbolo. */
:root {
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --slice-other: #898781;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --slice-other: #898781;
  }
}
:root[data-theme="dark"] {
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --slice-other: #898781;
}
.donuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 16px 24px; }
.donut { min-width: 0; }
.donut-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.donut-title .muted { font-weight: 400; }
.donut-body { display: flex; align-items: center; gap: 16px; }
.donut-body svg { width: 150px; height: 150px; flex: none; }
.donut-body circle { transition: stroke-width .12s; }
.donut-body circle:hover { stroke-width: 22; }
.donut-total { fill: var(--ink); font: 600 15px var(--display); }
.donut-unit { fill: var(--ink-3); font: 10px var(--sans); }
.donut-legend { list-style: none; margin: 0; padding: 0; font-size: 13px; min-width: 0; flex: 1; }
.donut-body { flex-wrap: wrap; }
.donut-legend li {
  display: grid;
  grid-template-columns: 12px minmax(44px, 1fr) 54px 72px 64px 62px;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}
.donut-legend li > :nth-child(n+3) { text-align: right; }
.donut-legend li.head { color: var(--ink-3); font-size: 11px; padding-bottom: 1px; }
.donut-legend li.total { border-top: 1px solid var(--line); margin-top: 2px; padding-top: 5px; font-weight: 600; }
.donut-legend i { width: 10px; height: 10px; border-radius: 2px; }
.donut-legend span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) {
  .donuts { grid-template-columns: 1fr; }
  .donut-body { flex-direction: column; align-items: stretch; }
  .donut-body svg { width: 130px; height: 130px; align-self: center; }
  .donut-legend { width: 100%; flex: none; font-size: 12px; }
  .donut-legend li { grid-template-columns: 10px minmax(30px, 1fr) 44px 58px 54px 56px; gap: 4px; }
}

[hidden] { display: none !important; }

@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .topbar .brand span, .topbar .spacer { display: none; }
  .topbar select { flex: 1; min-width: 0; }
  .topbar > button { margin-left: auto; }
  .account-picker { flex: 1; position: static; }
  .topbar .account-button { max-width: 100%; width: 100%; }
  .account-menu { left: 16px; right: 16px; width: auto; top: calc(100% + 4px); }
  .acc-grid { grid-template-columns: 1fr; }
  .user-chip span { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile .value { font-size: 18px; }
  .chart { height: 240px; }
  .tiles.headline { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tiles.headline .tile { padding: 10px 12px; }
  /* «PnL da inizio · N giorni» non sta su una riga in mezza larghezza di telefono: va a capo invece di troncarsi. */
  .tiles.headline .caption { white-space: normal; }  .tiles.headline .value { font-size: 23px; }
  .tiles.headline .tile.dual .second { font-size: 15px; }
  .filters label { flex: 1 1 140px; }
  .filters .search { flex-basis: 100%; }
}
