/* Portfolio page */
.pf-hero .wrap { padding-block: 56px 44px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px 48px; align-items: end; }
.pf-hero h1 { font-size: clamp(34px, 5vw, 52px); }
.sync { display: flex; align-items: center; gap: 8px; margin: 18px 0 0; font-size: 14px; color: var(--on-navy-muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.18); flex: none; }
.pf-stats { display: grid; grid-template-columns: repeat(2, minmax(0, auto)); gap: 18px 40px; text-align: right; }
.stat .k { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--on-navy-muted); }
.stat .v { font-family: var(--f-mono); font-weight: 700; font-size: clamp(24px, 3.6vw, 34px); line-height: 1.15; }
.stat .v.lead { font-size: clamp(34px, 5.4vw, 50px); }
.stat.span2 { grid-column: span 2; }
@media (max-width: 820px) {
  .pf-hero .wrap { grid-template-columns: 1fr; padding-block: 40px 32px; }
  .pf-stats { text-align: left; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.pf { padding-top: 28px; }
.pf-grid { display: grid; gap: 22px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.card h2 { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); margin: 0; }
.card-note { font-size: 14px; color: var(--muted); margin: 4px 0 0; }

.seg { display: inline-flex; background: var(--chip); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { font: 600 13px var(--f-mono); color: var(--fg-2); background: transparent; border: 0; border-radius: 7px; padding: 8px 12px; min-height: 36px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(15,25,45,.14); }

.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--fg-2); margin-bottom: 8px; }
.legend > span { display: inline-flex; align-items: center; gap: 7px; }
.legend .num { color: var(--fg); font-weight: 600; }
.swatch-line { width: 18px; height: 0; border-top: 2px solid var(--s-port); display: inline-block; }
.swatch-line.bench { border-top: 2px dashed var(--s-bench); }
.chart-box { position: relative; }
#chart { display: block; width: 100%; height: 320px; touch-action: pan-y; }
#chart text { font-family: var(--f-mono); font-size: 11px; fill: var(--muted); }
#chart .grid { stroke: var(--line); stroke-width: 1; }
#chart .zero { stroke: var(--line-strong); stroke-width: 1; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 18px rgba(15,25,45,.16); min-width: 160px; }
.tip .d { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; }
.tip .r span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-2); }

.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--fg-2); cursor: pointer; user-select: none; min-height: 40px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 36px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform .15s; }
.switch input:checked + span { background: #3b82f6; }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }

.table-scroll { overflow-x: auto; margin-inline: -4px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: right; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th button { all: unset; cursor: pointer; }
th button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
th button::after { content: ""; display: inline-block; width: 10px; }
th button[data-dir="desc"]::after { content: "↓"; margin-left: 3px; }
th button[data-dir="asc"]::after { content: "↑"; margin-left: 3px; }
td { padding: 12px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.tk { font-family: var(--f-mono); font-weight: 700; font-size: 15px; }
.nm { display: block; font-size: 13px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.new { font: 700 10px var(--f-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); background: var(--chip); border-radius: 4px; padding: 2px 5px; margin-left: 6px; vertical-align: 2px; }
.wbar { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.wbar i { display: block; height: 6px; border-radius: 3px; background: var(--s-port); }
.up { color: var(--up); } .down { color: var(--down); }
tfoot td { color: var(--muted); font-size: 14px; border-top: 1px solid var(--line-strong); border-bottom: 0; }

.pf-split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.trades { list-style: none; margin: 0; padding: 0; }
.trade { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding-block: 14px; border-bottom: 1px solid var(--line); }
.trade:first-child { padding-top: 2px; }
.trade:last-child { border-bottom: 0; padding-bottom: 0; }
.tdate { font-family: var(--f-mono); font-size: 12px; color: var(--muted); line-height: 1.35; padding-top: 3px; }
.tdate b { display: block; font-size: 17px; color: var(--fg); font-weight: 600; }
.tline { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.act { font: 700 10.5px var(--f-sans); letter-spacing: .08em; text-transform: uppercase; border-radius: 5px; padding: 3px 7px; }
.act.buy, .act.add { color: var(--up); background: var(--up-bg); }
.act.trim, .act.sell { color: var(--down); background: var(--down-bg); }
.tmeta { font-size: 14px; color: var(--fg-2); }
.tnote { margin: 6px 0 0; font-size: 15px; color: var(--fg-2); max-width: 60ch; }

.stack { display: flex; height: 18px; gap: 2px; border-radius: 4px; overflow: hidden; margin-bottom: 18px; }
.stack div { min-width: 2px; }
.alloc-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.alloc-list li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 15px; padding-block: 8px; border-bottom: 1px solid var(--line); }
.alloc-list li:last-child { border-bottom: 0; }
.alloc-list .sw { width: 12px; height: 12px; border-radius: 3px; }
.alloc-list .tks { display: block; font-size: 12px; color: var(--muted); font-family: var(--f-mono); }
.cash-fill { background-image: repeating-linear-gradient(135deg, var(--cash) 0 4px, transparent 4px 7px); background-color: var(--chip); }

.load-error { padding: 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--fg-2); }

@media (max-width: 860px) {
  .pf-split { grid-template-columns: 1fr; }
  .card { padding: 20px 14px; }
  #chart { height: 250px; }
  .nm { max-width: 110px; }
  th, td { padding-inline: 4px; }
  th { font-size: 10.5px; letter-spacing: .04em; }
  table { font-size: 13.5px; }
  .tk { font-size: 14px; }
  .table-scroll { margin-inline: 0; }
  .wbar i { display: none; }
}
