:root {
  --bg: #f4f5f7; --panel: #fff; --ink: #1d2433; --muted: #6b7385; --line: #e4e7ec;
  --accent: #2f5bea; --accent-soft: #e8eeff; --pos: #15803d; --neg: #c62828;
  --warn: #b45309; --warn-soft: #fff4e0; --pos-soft: #e7f6ec; --neg-soft: #fdeaea;
  --side: #161b28; --side-ink: #c9cfdb; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); display: flex; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .muted { color: var(--muted); }

.side { width: 230px; flex-shrink: 0; background: var(--side); color: var(--side-ink); padding: 12px 12px 8px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { font-size: 18px; font-weight: 700; color: #fff; padding: 4px 10px 10px; display: flex; align-items: center; gap: 8px; }
.brand span { color: #7ea0ff; font-weight: 400; }
.side nav { display: flex; flex-direction: column; gap: 1px; scrollbar-width: thin; scrollbar-color: #3a4256 transparent; flex: 1; overflow-y: auto; min-height: 0; }
.side nav a { color: var(--side-ink); padding: 5px 10px; font-size: 14px; border-radius: 8px; display: flex; gap: 10px; align-items: center; }
.side nav a:hover { background: #222a3b; text-decoration: none; }
.side nav a.on { background: #2a3550; color: #fff; }
.side .nav-group { margin-top: 6px; border-top: 1px solid #2a3142; padding: 8px 10px 2px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #6f7a91; }
.side .nav-group.first { border-top: 0; margin-top: 2px; padding-top: 2px; }
.side .ic { width: 18px; text-align: center; opacity: .8; }
.side-prices { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px 0; }
.side-prices small { color: #8a93a6; font-size: 12px; }

main { flex: 1; min-width: 0; padding: 22px 28px 40px; }
.top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.top h1 { margin: 0; font-size: 22px; }
.today { color: var(--muted); }
.foot { margin-top: 30px; color: var(--muted); font-size: 12px; }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1100px) { .g2, .g3, .g4, .g21 { grid-template-columns: 1fr; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card h2 small { font-weight: 400; }
.card + .card { margin-top: 0; }
section.card { margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.kpi .v { font-size: 20px; font-weight: 650; margin-top: 2px; white-space: nowrap; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }

.compose { margin-bottom: 16px; }
.compose .parts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.compose .parts[hidden] { display: none; }
@media (max-width: 1100px) { .compose .parts { grid-template-columns: 1fr 1fr; } }
.compose label.part { cursor: pointer; background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: block; }
.compose label.part:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.compose .part input { margin-right: 6px; }
.compose .part .v { font-size: 19px; font-weight: 650; margin-top: 4px; white-space: nowrap; }
.compose .part .q { color: var(--muted); }
.compose .total { background: var(--side); color: #fff; border-radius: var(--radius); padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.compose .total .v { font-size: 28px; font-weight: 700; white-space: nowrap; }
.compose .total small { color: #a9b3c7; display: block; }
.compose .total-side { display: flex; align-items: center; gap: 14px; }
.compose .total .btn { color: #fff; border-color: #4b5670; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
td.n, th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.sub td { background: #fafbfc; font-weight: 600; }
tr.group td { background: #f1f3f7; font-weight: 650; }
tr.year td { background: #eef2ff; font-weight: 600; }
tr.dim td { color: var(--muted); }
tr.hl td { background: #fffbea; }
tfoot td { font-weight: 650; border-top: 2px solid var(--line); }
.scroll { overflow-x: auto; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #eef0f4; color: var(--muted); white-space: nowrap; font-weight: 600; }
.badge.ok { background: var(--pos-soft); color: var(--pos); }
.badge.ko { background: var(--neg-soft); color: var(--neg); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot.ok { background: var(--pos); } .dot.ko { background: var(--neg); } .dot.warn { background: var(--warn); } .dot.info { background: var(--accent); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: var(--pos-soft); border-color: #b9e3c6; color: #14532d; }
.flash.error { background: var(--neg-soft); border-color: #f3c0c0; color: #7f1d1d; }
.flash.warn { background: var(--warn-soft); border-color: #f5d9a8; color: #7c3d05; }
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { padding: 8px 12px; border-radius: 8px; background: #f7f8fa; border-left: 3px solid var(--line); }
.alert.warn { border-color: var(--warn); background: var(--warn-soft); }
.alert.ko { border-color: var(--neg); background: var(--neg-soft); }
.alert.ok { border-color: var(--pos); background: var(--pos-soft); }

form.inline { display: inline; margin: 0; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
input[type=text], input[type=number], input[type=date], input[type=month], input[type=time], input[type=password], input[type=email], input[type=search], input:not([type]), select, textarea {
  font: inherit; font-size: 15px; padding: 9px 11px; min-height: 40px; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; }
.btn { font: inherit; font-weight: 600; border: 1px solid var(--accent); background: var(--accent); color: #fff; padding: 9px 16px; border-radius: 7px; cursor: pointer; display: inline-block; }
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); }
.side .btn.ghost { color: #c9d6ff; border-color: #3a4a74; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger { background: var(--neg); border-color: var(--neg); }
.icon { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 14px; padding: 2px 5px; border-radius: 5px; }
.icon:hover { background: #eef0f4; color: var(--ink); text-decoration: none; }
.icon.danger:hover { background: var(--neg-soft); color: var(--neg); }
.actions { white-space: nowrap; display: inline-flex; gap: 2px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a { padding: 5px 12px; border-radius: 99px; background: #eef0f4; color: var(--ink); font-size: 13px; }
.tabs a.on { background: var(--accent); color: #fff; }
.tabs a:hover { text-decoration: none; filter: brightness(.97); }

.bar { height: 10px; background: #eef0f4; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.stack { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin: 6px 0 10px; }
.stack span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

.heat td { text-align: center; font-size: 12.5px; font-variant-numeric: tabular-nums; border: 2px solid #fff; border-radius: 6px; }
.heat th { text-align: center; }
.chart { position: relative; }
.empty { color: var(--muted); padding: 18px; text-align: center; background: #fafbfc; border-radius: 8px; border: 1px dashed var(--line); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.checks fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0; }
.checks legend { font-weight: 650; font-size: 13px; padding: 0 4px; }
.checks label { display: block; padding: 2px 0; }
.checks label.all { font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: 4px; padding-bottom: 4px; }
details.add > summary { cursor: pointer; font-weight: 600; color: var(--accent); margin-bottom: 10px; }
.goal-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 10px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.kv div small { display: block; }
.kv div b { font-size: 15px; white-space: nowrap; }

.year-block { margin-bottom: 10px; }
.year-block > summary { cursor: pointer; font-size: 15px; padding: 6px 0; }
.ytable td, .ytable th { padding: 4px 6px; font-size: 12.5px; }
.ytable td:first-child { white-space: nowrap; min-width: 190px; }
.ytable tr.total td { background: #e8eeff; font-size: 13.5px; }
.ytable tr.group td { background: #e7f6ec; }
.ytable tr.acc td { border-top: 1px solid #d5d9e0; }
.ytable tr.var td { font-size: 11.5px; color: var(--muted); font-style: italic; border-bottom: 1px dashed var(--line); }
.ytable tr.var td.pos { color: var(--pos); } .ytable tr.var td.neg { color: var(--neg); }
.ytable .yc { border-left: 2px solid #9333ea; background: #faf5ff; }
.ytable .tg { border: 0; background: none; cursor: pointer; color: var(--muted); width: 18px; padding: 0; margin-right: 4px; font-size: 12px; }
.ytable .tg:hover { color: var(--ink); }
.ytable tr.var .tg, .ytable tr.var td:first-child { padding-left: inherit; }
.ytable tr.total td { background: #dfe7ff; font-size: 14px; }
.ytable tr.comp td { background: #eef2ff; }
.ticker-box:empty { display: none; }
.ticker-box table.pick { margin-top: 6px; }
.ticker-box table.pick td { padding: 4px 6px; font-size: 13px; }
.ytable .tg-sp { display: inline-block; width: 22px; }
.ytable .tv { border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--accent); font-size: 10.5px; border-radius: 4px; padding: 0 4px; margin-left: 6px; line-height: 15px; }
.ytable .tv.off { color: var(--muted); background: transparent; border-style: dashed; }
.range-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: -4px 0 10px; font-size: 13px; }
.range-form label { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.range-form input[type=month] { width: auto; padding: 4px 6px; }
a.kpi.platform { color: inherit; display: block; cursor: pointer; transition: border-color .15s; }
a.kpi.platform:hover { border-color: var(--accent); text-decoration: none; }
a.kpi.platform.on { border: 2px solid var(--accent); background: var(--accent-soft); }
.breakdown .bd-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.breakdown .stack span { color: #fff; font-size: 11px; font-weight: 600; line-height: 26px; padding-left: 8px; white-space: nowrap; overflow: hidden; }
.bd-item { border-bottom: 1px solid var(--line); }
.bd-item > summary { display: grid; grid-template-columns: 1fr 80px 130px; align-items: center; gap: 8px; padding: 9px 4px; cursor: pointer; list-style: none; }
.bd-item > summary::-webkit-details-marker { display: none; }
.bd-item > summary .bd-name::before { content: '›'; display: inline-block; width: 14px; color: var(--muted); transition: transform .15s; }
.bd-item[open] > summary .bd-name::before { transform: rotate(90deg); }
.bd-item > summary b, .bd-item > summary .muted, .bd-sub span:nth-child(2), .bd-sub span:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }
.bd-sub { display: grid; grid-template-columns: 1fr 80px 130px; gap: 8px; padding: 5px 4px 5px 40px; font-size: 13px; border-top: 1px dashed var(--line); }
.chart-title { font-size: 13px; margin: 0 0 6px; display: flex; justify-content: space-between; color: var(--muted); font-weight: 600; }
section.card > h2 { cursor: pointer; user-select: none; }
section.card > h2 .fold { border: 0; background: none; color: var(--muted); font-size: 13px; width: 20px; padding: 0; margin-right: 4px; cursor: pointer; }
section.card.folded > *:not(h2) { display: none !important; }
section.card.folded > h2 { margin-bottom: 0; }
/* summary shown in the title only while the card is folded (Panoramica: goals, budgets) */
section.card > h2 .fold-sum { display: none; margin-left: auto; font-size: 13px; font-weight: 400; color: var(--muted); }
section.card.folded > h2 .fold-sum { display: inline-flex; align-items: center; gap: 4px; }
section.card > h2 { justify-content: flex-start; }
section.card > h2 > small, section.card > h2 > span:last-child, section.card > h2 > .tabs, section.card > h2 > .actions, section.card > h2 > form, section.card > h2 > a { margin-left: auto; }
/* A folded card shrinks to its title bar, also inside grids (no stretching to the neighbour's height). */
section.card.folded { align-self: start; padding-top: 10px; padding-bottom: 10px; }
.grid > section.card.folded, .grid > div > section.card.folded { height: auto; }

/* Saldi per anno: % of the change on its own line (narrower columns), label column fixed while scrolling. */
.ytable tr.var td.n small { display: block; line-height: 1.1; }
.ytable td:first-child, .ytable th:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); }
.ytable tr.total td:first-child { background: #e8eeff; }
.ytable tr.group td:first-child { background: #e7f6ec; }
.ytable td:first-child { white-space: normal; min-width: 170px; max-width: 230px; }

/* Panoramica: classes bar, class doughnuts, platforms. */
.stack.big { height: 22px; gap: 2px; }
.cls-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.cls-legend .n { font-size: 13px; }
.cls-legend .n i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.cls-legend .p { font-size: 22px; font-weight: 700; }
table.mini { margin-top: 8px; }
table.mini td { padding: 3px 4px; font-size: 13px; border: 0; }
table.mini .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.plat-row { margin: 8px 0 12px; }
.plat-row > div:first-child { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
/* Heatmap: the current month is provisional. */
td.prov { outline: 2px dashed #64748b; outline-offset: -3px; }
/* Panoramica: the composition doughnut fills the height of the card next to it. */
.grid > section[data-compose-chart] { display: flex; flex-direction: column; }
.grid > section[data-compose-chart] .chart { flex: 1; min-height: 300px; height: auto !important; }
/* Open positions on several platforms: total row and split rows. */
tr.pos-total td { background: #f6f8ff; }
tr.pos-child td { background: #fbfcfe; font-size: 13px; }
/* Open positions: the ▸ sits in its own gutter left of the name, so all names line up. */
table.postable td:first-child, table.postable th:first-child { padding-left: 38px; position: relative; }
table.postable tr.pos-child td:first-child { padding-left: 52px; }
table.postable .tg { position: absolute; left: 8px; top: 12px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); font-size: 12px; line-height: 20px; padding: 0; cursor: pointer; text-align: center; }
table.postable td:first-child { white-space: nowrap; }
table.postable .tg:hover { color: var(--ink); border-color: var(--accent); }
table.postable tr.pos-total td:nth-child(2) { white-space: nowrap; }
/* Saldi per anno: the ± (variations) toggle sits at the right edge of the name cell, never on its own line. */
.ytable tr:not(.var) td:first-child { padding-right: 34px; }
.ytable .tv { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); margin: 0; width: 20px; height: 18px; padding: 0; font-size: 13px; font-weight: 700; line-height: 16px; text-align: center; }
.ytable td:first-child { min-width: 210px; max-width: 260px; }
.ytable tr.var td.n small { color: #475569; }
/* Saldi per anno: blue rows (total and components) in bold like the groups. */
.ytable tr.total td, .ytable tr.comp td { font-weight: 650; }
/* Open positions: detail drawer with the total gain. */
tr.has-det { cursor: pointer; }
tr.has-det:hover td { background: #f3f6ff; }
tr.has-det.det-on td { background: #eaf0ff; }
tr.pos-det > td { background: #f8fafc; padding: 12px 16px 16px 38px; border-bottom: 2px solid #c7d2fe; white-space: normal; }
.det-title { font-weight: 650; margin-bottom: 8px; }
.det-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; max-width: 900px; }
.det-kpis > div { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.det-kpis small { display: block; font-size: 11.5px; color: var(--muted); }
.det-kpis b { font-size: 16px; }
.det-kpis .det-tot { border: 2px solid var(--accent); }
.det-sub { font-weight: 600; font-size: 13px; margin: 12px 0 2px; }
table.det-plat { max-width: 900px; margin-top: 10px; }
table.det-plat th { font-size: 11.5px; padding: 3px 4px; }
.pos-det table.mini { width: auto; min-width: 420px; }
/* Open positions: long names wrap so the whole table fits; small sub-labels in headers. */
table.postable td:first-child { white-space: normal; min-width: 220px; max-width: 300px; }
table.postable th small { display: block; font-size: 10px; text-transform: none; }
table.postable td.n { white-space: nowrap; }
.ytable tr.eur-row td { border-top: 0; color: var(--muted); font-size: 12px; }

/* Movements and categories */
.cicon { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; line-height: 1; flex-shrink: 0; }
table.moves tr.day td { background: #f4f5f8; font-weight: 600; border-bottom: 0; }
table.moves tr.day td small { font-weight: 500; }
.filters select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }

/* Categories: collapsible groups */
table.cats tr.group { cursor: pointer; }
table.cats tr.group .ctg { display: inline-block; width: 14px; color: var(--muted, #8a93a6); }

/* Credit card plafond */
.plafond { margin-bottom: 14px; }
.plafond-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.plafond-head b { color: var(--ink, #1f2937); }
.plafond-bar { height: 10px; background: #e8ebf0; border-radius: 99px; overflow: hidden; }
.plafond-bar > div { height: 100%; border-radius: 99px; background: var(--pos); }
.plafond-bar > div.warn { background: var(--warn); }
.plafond-bar > div.ko { background: var(--neg); }

/* Account chart (Andamento dei conti) */
.radios { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; min-height: 36px; }
.radios label { white-space: nowrap; }
.acc-pick { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.acc-pick summary { padding: 8px 10px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-pick .acc-list { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--line); max-height: 260px; overflow: auto; }

/* How an account is managed: balances or movements */
.trk { display: inline-block; width: 18px; text-align: center; color: var(--muted); font-size: 13px; margin-right: 4px; cursor: help; }
.trk.mov { color: var(--accent); font-weight: 700; }

/* Tables by year: keep the first column on one line */
table[data-years] td:first-child { white-space: nowrap; }

/* Institution logos */
.ilogo { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; border-radius: 50%; object-fit: cover; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.ilogo.ini { border-radius: 50%; color: #fff; font-weight: 700; line-height: 1; }
.logo-up label { cursor: pointer; }

/* Logged-in user and logout, at the bottom of the menu */
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 0; font-size: 13px; }
.side-user a { color: var(--side-ink); }

/* Budget: one row per budget, bar with the share spent and a tick for today. */
.budgets { display: flex; flex-direction: column; gap: 18px; }
.budget { display: flex; gap: 14px; align-items: flex-start; }
.budget .cicon { margin-top: 2px; }
.budget-body { flex: 1; min-width: 0; }
.budget-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.budget-head .actions { margin-left: auto; }
.budget-dates { display: flex; justify-content: space-between; gap: 10px; margin: 2px 0; }
.bbar { position: relative; height: 10px; background: #eef0f4; border-radius: 99px; margin: 4px 0; }
.bbar > span { display: block; height: 100%; border-radius: 99px; background: #16a34a; }
.bbar.warn > span { background: #f59e0b; }
.bbar.ko > span { background: #e11d48; }
.bbar > i { position: absolute; top: -3px; width: 2px; height: 16px; background: #1f2937; border-radius: 1px; }
.budget-mini td { vertical-align: middle; }

/* Icon picker under the icon fields. */
.icon-pick { margin-top: 4px; position: relative; }
.icon-pick summary { cursor: pointer; font-size: 12px; color: var(--accent); }
.icon-grid { position: absolute; z-index: 20; margin-top: 4px; padding: 10px; width: min(380px, 90vw); max-height: 300px; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 23, 42, .15); }
.icon-grid > small { display: block; margin: 2px 0 4px; }
.icon-grid > div { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.icon-grid button:not(.btn) { width: 36px; height: 36px; font-size: 20px; line-height: 1; border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer; padding: 0; }
.icon-grid button:not(.btn):hover { background: #eef0f4; }
.icon-grid button.on { border-color: var(--accent); background: #eef2ff; }

/* Records (Performance): ranked rows with a bar. */
.rank-h { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.rank { display: grid; grid-template-columns: 18px minmax(64px, auto) minmax(40px, 1fr) auto minmax(44px, auto); align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.rank .n { color: var(--muted); font-size: 12px; }
.rank .b { height: 8px; background: #eef0f4; border-radius: 99px; overflow: hidden; }
.rank .b > span { display: block; height: 100%; border-radius: 99px; }
.rank .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank .muted { font-size: 12px; }

/* Target allocation (Allocazioni). */
.tgt-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.tgt-stack { display: flex; height: 14px; border-radius: 99px; overflow: hidden; margin: 4px 0 10px; }
.tgt-stack > span { display: block; height: 100%; }
.seg { display: inline-flex; gap: 4px; margin-left: auto; }
.seg a { padding: 4px 10px; border-radius: 8px; background: #eef0f4; font-size: 12px; color: var(--ink); }
.seg a.on { background: var(--accent); color: #fff; }
.seg a:hover { text-decoration: none; }
.op { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.op-v { font-size: 18px; white-space: nowrap; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; margin-right: 8px; }
.tag.sell { background: var(--neg-soft); color: var(--neg); }
.tag.buy { background: var(--pos-soft); color: var(--pos); }

.plan-h { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 8px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* «Dove vanno i soldi» (Sankey). */
.sankey { width: 100%; overflow-x: auto; }
.sankey svg { display: block; font-size: 13px; fill: var(--ink); }
.sankey path { fill-opacity: .3; transition: fill-opacity .15s; }
.sankey path:hover { fill-opacity: .6; }
.sankey text { fill: var(--ink); }
.sankey .sk-pct { fill: var(--muted); }
.sk-lead { margin: 0 0 8px; }

/* FIRE e simulazioni. */
.lead { margin-bottom: 16px; }
.lead-h { font-size: 26px; margin: 0 0 6px; letter-spacing: -.3px; }
.lead p { color: var(--muted); margin: 0; max-width: 1000px; }
.lead p b { color: var(--ink); }
.fire-sc { display: flex; flex-direction: column; margin-top: 10px; }
.fire-sc > div { display: flex; align-items: baseline; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fire-sc > div > span { margin-left: auto; }
.fire-sc i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.ro { padding: 6px 0; }
/* Page tabs (Allocazioni): plain labels on a line, the active one underlined in blue. */
.page-tabs { display: flex; gap: 28px; border-bottom: 1px solid #d5d9e0; margin-bottom: 16px; }
.page-tabs a { padding: 4px 0 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 15px; font-weight: 500; }
.page-tabs a:hover { color: var(--ink); text-decoration: none; }
.page-tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.page-tabs a i { font-style: normal; margin-right: 6px; }
/* Category picker with a search box (forms of movements, subscriptions, budgets). */
.cpick { position: relative; }
.cpick-btn { width: 100%; height: 40px; text-align: left; padding: 0 30px 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cpick-btn::after { content: '▾'; position: absolute; right: 11px; top: 11px; color: var(--muted); }
.cpick-btn.empty { color: var(--muted); }
.cpick-pop { position: absolute; z-index: 30; left: 0; right: 0; min-width: 260px; top: 44px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 24, 40, .12); padding: 8px; }
.cpick-pop input { width: 100%; margin-bottom: 6px; }
.cpick-list { max-height: 300px; overflow-y: auto; }
.cpick-item { padding: 7px 9px; border-radius: 6px; cursor: pointer; }
.cpick-item small { color: var(--muted); }
.cpick-item.on { background: var(--accent-soft); }
.cpick-item.sel span { font-weight: 600; }
.cpick-item.none { color: var(--muted); }
.cpick-empty { padding: 8px; color: var(--muted); }
/* Panoramica, monthly trend: «Escludi» boxes above the chart */
.trend-excl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 4px 0 8px; font-size: 13px; }
/* Saldi per anno: account name and institution on one line, smaller indent (the column widens instead of wrapping) */
.ytable td:first-child { white-space: nowrap; max-width: none; }
