:root {
  /* the site is white-only; opts out of chrome's auto dark theme and highcharts dark theming */
  color-scheme: only light;
  --green:#00c805;
  --red:#ff4444;
  --gold:#ffd700;
  --font:"Trebuchet MS",sans-serif;
  --site-ink:#18221f;
  --site-line:#dfe3dc;
  --site-blue:#2f6fed;
  --site-header-height:58px;
}
html,body{height:100%;margin:0}
body{
  display:flex;flex-direction:column;align-items:center;
  font-family:var(--font);text-align:center;background:#fff;
}

.site-header,
.site-header *{
  box-sizing:border-box;
}
.site-header{
  position:sticky;
  z-index:30;
  top:0;
  display:flex;
  flex:0 0 var(--site-header-height);
  width:100%;
  height:var(--site-header-height);
  padding:0 16px;
  border-bottom:1px solid var(--site-line);
  background:rgba(253,253,250,.95);
  align-items:center;
  gap:16px;
  font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  text-align:left;
  backdrop-filter:blur(14px);
}
.brand{
  display:inline-flex;
  flex:0 0 auto;
  align-items:center;
  gap:8px;
  color:var(--site-ink);
  font-size:15px;
  font-weight:800;
  letter-spacing:-.02em;
  text-decoration:none;
}
.brand-mark{
  width:25px;
  height:25px;
  border-radius:7px;
}
.site-nav{
  display:flex;
  flex:1;
  min-width:0;
  align-items:center;
  justify-content:space-between;
  gap:2px;
  overflow-x:auto;
  scrollbar-width:none;
}
.site-nav::-webkit-scrollbar{display:none}
.site-nav-link{
  flex:1 1 0;
  min-width:max-content;
  padding:7px 9px;
  border-radius:6px;
  color:#66736d;
  font-size:12px;
  font-weight:700;
  text-align:center;
  text-decoration:none;
  white-space:nowrap;
  transition:color 150ms ease,background 150ms ease;
}
.site-nav-link:hover,
.site-nav-link.is-current{
  background:#f1f3ef;
  color:var(--site-ink);
}
.site-account{
  display:flex;
  flex:0 0 auto;
  align-items:center;
  gap:8px;
}
.site-account-login,
.site-account-signup{
  min-height:32px;
  padding:0 11px;
  border-radius:6px;
  cursor:pointer;
  font-family:inherit;
  font-size:12px;
  font-weight:700;
  white-space:nowrap;
  transition:background 150ms ease,border-color 150ms ease,color 150ms ease;
}
.site-account-login{
  border:1px solid transparent;
  background:transparent;
  color:#66736d;
}
.site-account-login:hover{
  background:#f1f3ef;
  color:var(--site-ink);
}
.site-account-signup{
  border:1px solid var(--site-blue);
  background:var(--site-blue);
  color:#fff;
}
.site-account-signup:hover{
  border-color:#1f5ad4;
  background:#1f5ad4;
}
.site-header button:focus-visible,
.site-header a:focus-visible{
  outline:3px solid rgba(47,111,237,.24);
  outline-offset:2px;
}

#headlineWrap{
  display:flex;flex-direction:column;align-items:center;gap:4px;
  margin:32px 0 12px;line-height:1;user-select:none;
  color: var(--green);
}
#netWorthDisplay{font-size:32px;font-weight:900;font-variant-numeric:tabular-nums}
/* benchmark (TWRR) view shows % returns instead of $ figures; drop the big $ header
   down to the subheader's size so the two read as one matched label:value stack */
body.benchmark-mode #netWorthDisplay{font-size:22.24px}
/* the "Your portfolio:" label stays green; only the % value takes the red/green color */
.benchmark-label{color:var(--green)}

.digit-slot {
  display: inline-flex;
  overflow: hidden;
  height: 1em;
  vertical-align: baseline;
}
.digit-stack {
  display: flex;
  flex-direction: column;
  transition: transform 0.26s ease-out;
}
.digit-stack span {
  height: 1em;
  line-height: 1;
}
.digit-stack.slide-up {
  transform: translateY(-1em);
}
.digit-stack[data-dir="down"] {
  transform: translateY(-1em);
}
.digit-stack.slide-down {
  transform: translateY(0);
}
#gainHeadline{font-size:16px;font-weight:600; min-height: 1.2em;}

#mainContent{
  --chart-width:900px;
  display:grid;
  grid-template-columns: var(--chart-width) 200px;
  grid-template-rows: auto auto;
  justify-content:center;
  align-items:start;
  column-gap:32px;
  width:100%;
  max-width:1470px;
  margin:0 auto;
  padding:0 32px;
  box-sizing:border-box;
}
#mainContent #headlineWrap{
  grid-column:1;
  grid-row:1;
}
#chartArea{
  grid-column:1;
  grid-row:2;
  display:flex;
  flex-direction:column;
  align-items:center;
  width:var(--chart-width);
}
#container{width:100%;max-width:var(--chart-width);height:59.5vh}

/* Back to Portfolio button */
#backToPortfolio{
  align-self:flex-end;
  appearance:none;
  border:none;
  background:transparent;
  color:#555;
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  padding:4px 0;
  margin-bottom:0;
  position:relative;
  top:10px;
  z-index:2;
}
#backToPortfolio:hover{color:#000}

/* Holdings Panel */
#holdingsPanel{
  grid-column:2;
  grid-row:2;
  border:1px solid #ccc;
  border-radius:12px;
  width:248px;
  margin-top:0;
  height:59.5vh;
  box-sizing:border-box;
  overflow-y:auto;
  padding:12px;
}
.holdings-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin:4px 0 8px;
  padding:0 12px 8px;
  border-bottom:1px solid #d9d9d9;
}
.holdings-title{
  text-align:left;
  font-size:16px;
  font-weight:800;
  color:#444444;
  margin:0;
  padding:0;
}
.holdings-settings-button{
  appearance:none;
  border:none;
  background:transparent;
  padding:2px;
  margin:0;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  color:#6f6f6f;
  flex:0 0 auto;
}
.holdings-settings-button:hover{color:#2f2f2f}
.holdings-settings-button:focus-visible{outline:2px solid var(--green);outline-offset:2px;border-radius:8px}
.holdings-settings-button svg{
  width:18px;
  height:18px;
  fill:currentColor;
}
.holdings-settings-panel{
  margin:0 0 10px;
  padding:10px 12px 12px;
  border-bottom:1px solid #d9d9d9;
  text-align:left;
  display:flex;
  flex-wrap:wrap;
  gap:14px;
}
.holdings-settings-panel[hidden]{
  display:none;
}
.holdings-settings-label{
  font-size:11px;
  font-weight:800;
  color:#7d7d7d;
  margin-bottom:8px;
}
.holdings-settings-group--wide{
  flex-basis:100%;
}
.holdings-settings-toggle-row{
  display:flex;
  flex-wrap:wrap;
  gap:11px;
}
.holdings-settings-toggle-row .holdings-settings-option + .holdings-settings-option{
  margin-top:0;
}
.holdings-settings-option{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  color:#444;
}
.holdings-settings-option + .holdings-settings-option{
  margin-top:6px;
}
.holdings-settings-option input{
  margin:0;
}
.holding-item{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:11px 12px;
  border-bottom:1px solid #d9d9d9;
  border-radius:0;
  margin-bottom:0;
  cursor:pointer;
  font-weight:600;
  text-align:left;
  transition:background-color .16s ease;
}
.holding-item:last-child{
  border-bottom:none;
}
.holding-item.is-below-value-threshold{
  display:none;
}
.holding-logo{
  width:22px;
  height:22px;
  object-fit:contain;
  flex:0 0 auto;
}
.holding-logo-box{
  width:22px;
  height:22px;
  border-radius:6px;
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  flex:0 0 auto;
}
.holding-logo-box.is-black{
  background:#000;
}
.holding-logo-fallback{
  width:22px;
  height:22px;
  border-radius:6px;
  background:#000;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  flex:0 0 auto;
}
.holding-label{
  flex:1 1 auto;
  color:#555;
  font-size:13px;
  font-weight:600;
}
.holding-label-wrap{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  min-width:0;
  flex:1 1 auto;
}
.holding-weight{
  margin-top:2px;
  color:#8a8a8a;
  font-size:11px;
  font-weight:500;
}
.holding-metrics{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:2px;
  flex:0 0 auto;
}
.holding-value{
  color:#333;
  font-size:12px;
  font-weight:600;
}
.holding-return{
  font-size:11px;
  font-weight:600;
  min-height:1.2em;
  white-space:nowrap;
}
.holding-return.is-positive{color:var(--green)}
.holding-return.is-negative{color:var(--red)}
.holding-item:hover{background:#f5f5f5}
.holding-item.active{
  background:#efefef;
}

#rangeSelector{
  display:flex;
  gap:0;
  margin:4px 0 0;
  justify-content:center;
}
.range-btn{
  appearance:none;
  border:none;
  background:transparent;
  color:#888;
  padding:6px 14px;
  font-weight:600;
  cursor:pointer;
  border-right:1px solid #ccc;
}
.range-btn:last-child{
  border-right:none;
}
.range-btn:hover{color:#555}
.range-btn:focus-visible{outline:2px solid var(--green);outline-offset:2px}
.range-btn.is-active{
  color:#00a004;
  text-decoration:underline;
  text-decoration-thickness:2.5px;
  text-underline-offset:3px;
}

#performanceRatios{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  margin:16px auto 0;
  max-width:var(--chart-width);
  font-family:var(--font);
}
#performanceRatios[hidden]{display:none}
.perf-ratio-row{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:10px 22px;
}
.perf-benchmark-label{
  margin-top:2px;
  font-size:13.2px;
  font-weight:800;
  color:#1e90ff;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.perf-ratio{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:2px;
  min-width:60px;
}
.perf-ratio-label{
  font-size:11px;
  font-weight:700;
  color:#7d7d7d;
  text-transform:uppercase;
  letter-spacing:.03em;
}
.perf-ratio-value{
  font-size:15px;
  font-weight:800;
  color:#222;
  font-variant-numeric:tabular-nums;
}
.perf-ratio--empty{
  flex-direction:row;
  color:#999;
  font-size:13px;
  font-weight:600;
}

.highcharts-legend-item-hidden > text {
  text-decoration: none !important;
  fill: #a0a0a0 !important;
}
.highcharts-legend-item-hidden > path {
  stroke: #a0a0a0 !important;
  fill: #a0a0a0 !important;
}
.highcharts-legend-item.highcharts-series-inactive > text {
  text-decoration: none !important;
}

@media (min-width: 1700px) {
  #mainContent {
    --chart-width: clamp(900px, 53vw, 1170px);
  }
  #container .highcharts-series-0 .highcharts-graph {
    stroke-width: clamp(2px, 0.118vw, 2.6px) !important;
  }
  #container .highcharts-series-1 .highcharts-graph {
    stroke-width: clamp(1.5px, 0.088vw, 1.95px) !important;
  }
  /* Benchmark mode uses a thin "Your portfolio" line alongside its comparison
     line; individual holding charts retain the normal net-worth thickness. */
  body.thin-main-line #container .highcharts-series-0 .highcharts-graph {
    stroke-width: clamp(1.5px, 0.088vw, 1.95px) !important;
  }
}
