/* The Account Journal · monthly portfolio */
.portfolio-view {
  --portfolio-wash: #f2ecd9;
  --portfolio-muted: #75665d;
  padding: 32px 0 27px;
  color: var(--wine);
}
.portfolio-view[hidden] { display: none !important; }
.portfolio-view > *,
.portfolio-view button,
.portfolio-view aside { min-width: 0; }

.portfolio-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 34px;
  margin-bottom: 26px;
}
.portfolio-heading h3 {
  font: 400 clamp(28px, 3vw, 39px)/1.13 var(--serif);
  letter-spacing: -.7px;
  max-width: 19ch;
}
.portfolio-heading h3 em { color: var(--red); }
.portfolio-heading > p {
  max-width: 46ch;
  font-size: 13px;
  line-height: 1.8;
}

.portfolio-modes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 27px;
}
.portfolio-mode {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  padding: 19px 20px 18px;
  min-height: 130px;
  text-align: left;
  background: var(--portfolio-wash);
  border: 1px solid var(--line);
  color: var(--wine);
  transition: background .18s ease, border-color .18s ease;
}
.portfolio-mode > small {
  font: 11px var(--serif);
  color: var(--portfolio-muted);
  margin-bottom: 3px;
}
.portfolio-mode > strong {
  font: 400 25px/1.2 var(--serif);
  letter-spacing: -.3px;
}
.portfolio-mode > span { font-size: 11px; line-height: 1.5; }
.portfolio-mode:hover { background: #f5e4bd; border-color: #a08a63; }
.portfolio-mode[aria-pressed="true"] {
  background: var(--mustard);
  border-color: var(--wine);
  box-shadow: inset 0 3px 0 var(--wine);
}

.portfolio-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 19px;
}
.portfolio-reading { min-width: 0; }
.portfolio-reading .eyebrow {
  font-size: 10px;
  letter-spacing: 1.2px;
  color: var(--teal);
  margin-bottom: 5px;
}
.portfolio-reading > strong {
  display: block;
  font: 400 clamp(34px, 4.1vw, 53px)/1.18 var(--serif);
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  color: var(--teal);
  overflow-wrap: anywhere;
}
.portfolio-reading #portfolio-context {
  max-width: 70ch;
  font-size: 12px;
  line-height: 1.75;
  margin-top: 8px;
}
.portfolio-unit-switch {
  display: flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
}
.portfolio-unit-switch button {
  min-height: 40px;
  padding: 7px 11px;
  background: none;
  border: 0;
  font-size: 11px;
  line-height: 1.45;
  white-space: nowrap;
}
.portfolio-unit-switch button:hover { background: var(--portfolio-wash); }
.portfolio-unit-switch button[aria-pressed="true"] {
  background: var(--teal);
  color: var(--paper);
}

.portfolio-components { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 15px 17px; margin: 0 0 14px; border: 1px solid var(--line); background: var(--portfolio-wash); font-size: 12px; }
.portfolio-components > span { display: inline-flex; gap: 9px; align-items: center; }
.portfolio-components strong { font-weight: 600; margin-left: 6px; white-space: nowrap; }
.portfolio-solid-key,.portfolio-hatch-key { display: inline-block; width: 17px; height: 17px; flex: none; background: var(--teal); }
.portfolio-hatch-key { background: repeating-linear-gradient(135deg,transparent 0 3px,#fffbef80 3px 4px),var(--teal); }
.portfolio-components .portfolio-components-note { margin-left: auto; color: var(--portfolio-muted); font-size: 10px; }
.portfolio-nav-reading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; margin: 0 0 16px; font-size: 12px; }
.portfolio-nav-reading > span { display: inline-flex; align-items: center; gap: 9px; }
.portfolio-nav-reading strong { font-variant-numeric: tabular-nums; }
.portfolio-nav-reading small { color: var(--portfolio-muted); font-size: 10px; }
.portfolio-nav-reading i { width: 25px; height: 3px; background: var(--wine); position: relative; }
.portfolio-nav-reading i::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--wine); position: absolute; top: -2px; left: 9px; }

.portfolio-chart {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-color: #ad9c7b var(--portfolio-wash);
  scrollbar-width: thin;
  padding: 6px 0 11px;
  margin-bottom: 8px;
}
.portfolio-chart svg { width: 100%; height: auto; min-width: 700px; display: block; }
.portfolio-chart > p { font-size: 12px; padding-block: 20px; }
.ph-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 6; }
.ph-axis { fill: var(--portfolio-muted); font: 11px var(--sans); }
.ph-nav-line { fill: none; stroke: var(--wine); stroke-width: 2; stroke-dasharray: 5 4; }
.ph-nav-dot { fill: var(--paper); stroke: var(--wine); stroke-width: 1.8; }
.ph-nav-key { fill: var(--wine); font: 11px var(--sans); }
.ph-axis-title { fill: var(--portfolio-muted); font: 600 10px var(--sans); letter-spacing: .5px; }
.ph-nav-axis { fill: var(--wine); }
.ph-nav-overlay { pointer-events: none; }
.ph-nav-halo { fill: none; stroke: var(--paper); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.ph-nav-trend { fill: none; stroke: var(--wine); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ph-nav-trend-dot { fill: var(--wine); stroke: var(--paper); stroke-width: 1.5; }
.ph-nav-trend-dot.selected { fill: var(--mustard); stroke: var(--wine); stroke-width: 2; }
.ph-selection { fill: #f2ce753b; stroke: #baa56a; stroke-width: 1; opacity: 1; }
.ph-column { cursor: pointer; }
.ph-column:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.ph-column:hover .ph-selection,
.ph-column:focus-visible .ph-selection { fill: #f2ce7570; stroke: var(--wine); stroke-width: 1.5; }
.ph-column[aria-pressed="true"] .ph-month { fill: var(--wine); font-weight: 700; }
.ph-month { fill: var(--portfolio-muted); font: 11px var(--sans); }
.ph-year { fill: var(--wine); font: 600 10px var(--sans); letter-spacing: 1.4px; }
.ph-bar-label { fill: var(--wine); font: 600 11px var(--sans); }
.portfolio-scroll-hint { display: none; font-size: 11px; line-height: 1.6; color: var(--portfolio-muted); text-align: right; margin: 2px 0 12px; }

.portfolio-legend {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  align-items: flex-start;
  gap: 12px 17px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}
.portfolio-legend > label,
.portfolio-legend > span,
.portfolio-legend > p:first-child {
  flex: none;
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 1px;
  padding-top: 13px;
}
.portfolio-legend > p:first-child > span {
  display: block;
  font-size: 11px;
  letter-spacing: 0;
  color: var(--portfolio-muted);
  line-height: 1.65;
  margin-top: 5px;
}
.portfolio-legend > .portfolio-focus-note { grid-column: 1/-1; margin: 0; max-width: none; }
.portfolio-focus-note:empty { display: none; }
.portfolio-tickers { display: flex; flex-wrap: wrap; gap: 4px; }
.portfolio-tickers button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 10px;
  background: none;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 600;
}
.portfolio-tickers button i,
.portfolio-ticker-row > i {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: none;
  border: 1px solid #49333120;
}
.portfolio-tickers button:hover { background: var(--portfolio-wash); }
.portfolio-tickers button[aria-pressed="true"],
.portfolio-tickers .ticker-active { background: #f7eccb; border-color: #b49a5e; }

.portfolio-picker {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0 21px;
  border-top: 1px solid var(--line);
}
.portfolio-picker > label { font-size: 12px; }
.portfolio-picker > span { margin-left: auto; font-size: 11px; color: var(--portfolio-muted); }
.portfolio-month-controls { display: flex; align-items: center; gap: 6px; }
.portfolio-month-controls button {
  min-width: 44px;
  min-height: 44px;
  background: var(--cream);
  border: 1px solid var(--line);
  font-size: 18px;
}
.portfolio-month-controls button:hover:not(:disabled) { background: var(--mustard); }
.portfolio-month-controls button:disabled { opacity: .4; cursor: default; }
.portfolio-month-controls select {
  min-width: 170px;
  max-width: 260px;
  min-height: 44px;
  padding: 8px 30px 8px 12px;
  border: 1px solid #b6aa91;
  border-radius: 0;
  background: var(--paper);
  font-size: 16px;
}

.portfolio-dossier {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: start;
  gap: 28px;
  border-top: 1px solid var(--line);
  padding-top: 28px;
  margin-bottom: 28px;
  scroll-margin-block-start: 12px;
}
.portfolio-breakdown h4,
.portfolio-snapshot h4 { font: 400 27px/1.2 var(--serif); letter-spacing: -.4px; margin: 0; }
.portfolio-breakdown > p { font-size: 12px; line-height: 1.75; margin: 9px 0 17px; }
.portfolio-ticker-rows { display: grid; gap: 3px; }
.portfolio-ticker-row {
  display: grid;
  grid-template-columns: 10px minmax(50px, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
  width: 100%;
  min-height: 62px;
  padding: 10px 12px;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-bottom-color: #49333116;
  font-size: 12px;
}
.portfolio-ticker-row:hover { background: var(--portfolio-wash); }
.portfolio-ticker-row[aria-pressed="true"],
.portfolio-ticker-row.ticker-active { background: #f7eccb; border-color: #b49a5e; }
.portfolio-ticker-row > strong { font-size: 12px; font-weight: 600; }
.portfolio-ticker-row > span:not(.portfolio-row-bar) { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.portfolio-ticker-row > small { grid-column: 2/-1; color: var(--portfolio-muted); font-size: 11px; line-height: 1.5; }
.portfolio-row-bar { display: block; grid-column: 2/-1; height: 6px; background: #e9e2ce; }
.portfolio-row-bar i { display: block; height: 100%; }

.portfolio-snapshot {
  background: var(--teal);
  color: var(--paper);
  border: 1px solid var(--wine);
  box-shadow: 5px 5px 0 #e4dbc2;
  padding: 22px;
  min-width: 0;
}
.portfolio-snapshot-head { padding-bottom: 21px; border-bottom: 1px solid #f8f2df42; margin-bottom: 20px; }
.portfolio-snapshot-head .eyebrow { font-size: 9px; letter-spacing: 1.4px; margin-bottom: 9px; color: var(--mustard); }
.portfolio-snapshot h4 { font-size: 29px; }
.portfolio-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 21px 16px; margin-bottom: 24px; }
.portfolio-stat > span { display: block; font-size: 11px; line-height: 1.5; color: #e4e8d5; margin-bottom: 7px; }
.portfolio-stat > strong { display: block; font: 400 clamp(23px, 2.25vw, 30px)/1.2 var(--serif); letter-spacing: -.3px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.portfolio-balance { border-top: 1px solid #f8f2df42; padding-top: 8px; }
.portfolio-balance > div,
.portfolio-balance > p { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 9px 0; font-size: 11px; line-height: 1.6; margin: 0; }
.portfolio-balance > p:last-child { border-top: 1px solid #f8f2df42; margin-top: 3px; padding-top: 13px; }
.portfolio-balance > p:last-child strong { font-weight: 700; }
.portfolio-balance strong { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.portfolio-snapshot > p { font-size: 11px; line-height: 1.75; color: #e4e8d5; margin-top: 16px; }
.portfolio-snapshot .portfolio-note { font-size: 11px; color: #e4e8d5; margin: 16px 0 0; }
.portfolio-snapshot a { text-decoration: underline; text-underline-offset: 3px; }

.portfolio-assignment,
.portfolio-method,
.portfolio-table { border-top: 1px solid var(--line); }
.portfolio-assignment > summary,
.portfolio-method > summary,
.portfolio-table > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  cursor: pointer;
  list-style: none;
  min-height: 56px;
  padding: 15px 0;
  font-size: 13px;
  line-height: 1.6;
}
.portfolio-assignment > summary::-webkit-details-marker,
.portfolio-method > summary::-webkit-details-marker,
.portfolio-table > summary::-webkit-details-marker { display: none; }
.portfolio-assignment > summary > span:not([aria-hidden]) { font: inherit; flex: 1; transform: none; }
.portfolio-assignment > summary > span[aria-hidden="true"],
.portfolio-method > summary > span[aria-hidden="true"],
.portfolio-table > summary > span[aria-hidden="true"] { font-size: 21px; flex: none; }
.portfolio-assignment[open] > summary > span[aria-hidden="true"],
.portfolio-method[open] > summary > span[aria-hidden="true"],
.portfolio-table[open] > summary > span[aria-hidden="true"] { transform: rotate(45deg); }
.portfolio-assignment p,
.portfolio-method p,
.portfolio-table p { font-size: 12px; line-height: 1.8; margin: 0 0 17px; max-width: 85ch; }
.portfolio-method ul { padding-left: 20px; font-size: 12px; line-height: 1.8; margin: 0 0 18px; }
.portfolio-method li + li { margin-top: 8px; }
.portfolio-view .table-scroll { max-width: 100%; max-height: 25rem; overflow: auto; margin-bottom: 17px; scrollbar-color: #ad9c7b var(--portfolio-wash); }
.portfolio-view table { min-width: 540px; font-size: 11px; font-variant-numeric: tabular-nums; }
.portfolio-view table caption { text-align: left; font-size: 12px; padding: 0 0 12px; }
.portfolio-view table th { background: #ece5d1; }
.portfolio-view table thead th { position: sticky; top: 0; z-index: 1; }
.portfolio-view table th,
.portfolio-view table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.portfolio-view table th { font-weight: 600; }
.portfolio-view table td.numeric,
.portfolio-view table th.numeric { text-align: right; white-space: nowrap; }
.portfolio-view table tbody tr:hover { background: var(--portfolio-wash); }
.portfolio-view table .portfolio-table-selected > th,
.portfolio-view table .portfolio-table-selected > td { background: #f7eccb; border-bottom-color: #b49a5e; }
#portfolio-history-table table { min-width: 1180px; }
#portfolio-history-table th:first-child { position: sticky; left: 0; z-index: 1; white-space: nowrap; }
#portfolio-history-table thead th:first-child { z-index: 2; }
#portfolio-contracts table { min-width: 700px; }
.portfolio-note { font-size: 12px; line-height: 1.75; color: var(--portfolio-muted); margin: 15px 0 19px; }
.portfolio-focus-note { font-size: 12px; line-height: 1.75; padding: 13px 16px; background: #f7eccb; border-left: 3px solid #b49a5e; margin: 12px 0 18px; }

/* Four journey views keep equal visual weight without crowding the reset action. */
.chart-controls > .segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-width: 0; }
.chart-controls > .segmented button { min-height: 44px; padding-inline: 12px; }
@media(max-width:1100px) {
  .chart-controls > .segmented { flex: 1; }
  .chart-controls > .segmented button { white-space: normal; line-height: 1.4; padding-inline: 8px; }
  .portfolio-mode { padding: 17px 15px; }
  .portfolio-mode > strong { font-size: 23px; }
  .portfolio-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portfolio-dossier { gap: 23px; }
}
@media(max-width:900px) {
  .portfolio-heading { display: block; }
  .portfolio-heading h3 { max-width: none; }
  .portfolio-heading > p { max-width: 75ch; margin-top: 16px; }
  .portfolio-toolbar { flex-wrap: wrap; gap: 16px; }
  .portfolio-dossier { grid-template-columns: minmax(0, 1fr); }
  .portfolio-stat > strong { font-size: 30px; }
  .portfolio-scroll-hint { display: block; }
  .portfolio-legend { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .portfolio-legend > label,
  .portfolio-legend > span,
  .portfolio-legend > p:first-child { display: block; padding-top: 0; margin-bottom: 3px; }
}
@media(max-width:780px) {
  .chart-controls > .segmented { width: 100%; flex-basis: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-controls > .segmented button { font-size: 12px; padding: 8px; }
  .portfolio-view { padding-top: 25px; }
  .portfolio-heading h3 { font-size: 30px; }
  .portfolio-heading > p { font-size: 13px; }
  .portfolio-picker { flex-wrap: wrap; gap: 9px; }
  .portfolio-picker > label { width: 100%; }
  .portfolio-month-controls { width: 100%; }
  .portfolio-month-controls select { min-width: 0; max-width: none; flex: 1; }
  .portfolio-picker > span { margin-left: 0; }
  .portfolio-tickers { gap: 3px; }
  .portfolio-tickers button { padding-inline: 8px; }
  .portfolio-chart { padding-bottom: 14px; }
  .portfolio-reading > strong { font-size: 39px; }
  .portfolio-snapshot { padding: 22px; }
}
@media(max-width:600px) {
  .portfolio-modes { grid-template-columns: minmax(0, 1fr); gap: 7px; margin-bottom: 23px; }
  .portfolio-mode { display: grid; grid-template-columns: 23px minmax(0, 1fr); gap: 4px 12px; min-height: 77px; padding: 14px 16px; }
  .portfolio-mode > small { grid-column: 1; grid-row: 1/3; align-self: center; margin: 0; }
  .portfolio-mode > strong { grid-column: 2; font-size: 22px; }
  .portfolio-mode > span { grid-column: 2; font-size: 11px; }
  .portfolio-mode[aria-pressed="true"] { box-shadow: inset 3px 0 0 var(--wine); }
  .portfolio-unit-switch { max-width: 100%; }
  .portfolio-unit-switch button { white-space: normal; min-height: 44px; }
  .portfolio-breakdown h4 { font-size: 26px; }
  .portfolio-ticker-row { padding-inline: 8px; }
  .portfolio-stat-grid { gap: 20px 14px; }
  .portfolio-stat > strong { font-size: 27px; }
}
@media(max-width:380px) {
  .portfolio-heading h3 { font-size: 28px; }
  .portfolio-reading > strong { font-size: 34px; }
  .portfolio-reading .eyebrow { font-size: 9px; letter-spacing: .8px; }
  .portfolio-mode { padding-inline: 12px; }
  .portfolio-tickers button { padding-inline: 7px; font-size: 10px; }
  .portfolio-snapshot { padding: 19px 17px; }
  .portfolio-stat-grid { grid-template-columns: minmax(0, 1fr); gap: 17px; }
  .portfolio-stat > strong { font-size: 30px; }
  .portfolio-balance > div,
  .portfolio-balance > p { gap: 10px; }
}
@media(prefers-reduced-motion:reduce) {
  .portfolio-view *, .portfolio-view *::before, .portfolio-view *::after { transition: none !important; animation: none !important; }
}
@media print {
  .portfolio-view { break-before: page; }
  .portfolio-modes, .portfolio-unit-switch, .portfolio-picker, .portfolio-scroll-hint { display: none; }
  .portfolio-chart { overflow: visible; }
  .portfolio-chart svg { min-width: 0; }
  .portfolio-snapshot { box-shadow: none; print-color-adjust: exact; }
  .portfolio-view .table-scroll { max-height: none; overflow: visible; }
}
