/* ==================== RESET & BASE ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:      var(--color-primary);               /* teal  #7dd4e8 */
  --blue-bg:   var(--color-surface-hi);            /* #003a50 */
  --red:       var(--color-negative);              /* coral #e07040 */
  --red-bg:    rgba(224, 112, 64, 0.12);
  --green:     var(--color-positive);              /* seafoam #4db8a0 */
  --green-bg:  rgba(77, 184, 160, 0.12);
  --orange:    var(--color-data-4);                /* #e07040 */
  --orange-bg: rgba(224, 112, 64, 0.12);
  --gray-50:   var(--color-bg);                    /* #001e2a */
  --gray-100:  var(--color-surface);               /* #002d3d */
  --gray-200:  var(--color-border);                /* rgba(100,210,230,0.14) */
  --gray-400:  var(--color-text-dim);              /* #5a9aaa */
  --gray-600:  var(--color-text-dim);              /* #5a9aaa */
  --gray-800:  var(--color-text);                  /* #d0eef5 */
  --sidebar-w: 300px;
  --font: var(--font-sans);
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
}

/* ==================== LAYOUT ==================== */
.layout {
  display: flex;
  min-height: 100vh;
  padding-top: 34px;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border-hi);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  position: sticky;
  top: 34px;
  height: calc(100vh - 34px);
  transition: width 0.25s ease, min-width 0.25s ease, padding 0.25s ease;
  position: sticky;
}

.sidebar--collapsed {
  width: 36px;
  min-width: 36px;
  padding: 24px 0;
  overflow-x: hidden;
  overflow-y: hidden;
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 1;
  transition: opacity 0.15s ease;
  min-width: calc(var(--sidebar-w) - 40px);
}

.sidebar--collapsed .sidebar-content {
  opacity: 0;
  pointer-events: none;
}

.sidebar-toggle {
  position: absolute;
  top: 20px;
  right: 8px;
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 13px;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
  z-index: 10;
}

.sidebar-toggle:hover {
  color: var(--gray-800);
  border-color: var(--gray-400);
}

.sidebar--collapsed .sidebar-toggle {
  right: 7px;
}

.sidebar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-800);
  line-height: 1.2;
}

.sidebar-subtitle {
  font-size: 12px;
  color: var(--gray-600);
  line-height: 1.5;
  margin-top: -8px;
  margin-bottom: 0;
}

.sidebar-see-also {
  font-size: 11px;
  color: var(--gray-400);
  line-height: 1.4;
  margin-top: 6px;
  margin-bottom: 0;
}
.sidebar-see-also a {
  color: var(--blue);
  text-decoration: none;
}
.sidebar-see-also a:hover {
  text-decoration: underline;
}

.section-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
  padding-top: 8px;
  border-top: 1px solid var(--gray-200);
}

/* ==================== COLLAPSIBLE GROUPS ==================== */
.sidebar-group {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border-hi);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(100, 210, 230, 0.04);
}

.sidebar-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: rgba(100, 210, 230, 0.07);
  border: none;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--color-primary);
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.sidebar-group-header:hover {
  background: rgba(100, 210, 230, 0.12);
  color: var(--color-primary-hi);
}

.sg-chevron {
  font-size: 14px;
  transition: transform 0.22s ease;
  flex-shrink: 0;
}
.sidebar-group.is-collapsed .sg-chevron { transform: rotate(-90deg); }

.sidebar-group-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.25s ease;
  opacity: 1;
  padding: 12px 12px 12px 12px;
}
.sidebar-group.is-collapsed .sidebar-group-content {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* ==================== CONTROLS ==================== */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 4px;
}

.pct-label {
  font-size: 11px;
  font-weight: 400;
  color: var(--gray-400);
}

.input-prefix-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-surface);
}

.prefix {
  padding: 0 8px;
  background: var(--gray-100);
  color: var(--gray-600);
  font-weight: 600;
  border-right: 1px solid var(--gray-200);
  height: 100%;
  display: flex;
  align-items: center;
  font-size: 13px;
}

.input-prefix-wrap input[type="number"] {
  border: none;
  padding: 7px 10px;
  flex: 1;
  font-size: 13px;
  outline: none;
  min-width: 0;
}

input[type="number"] {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  width: 100%;
  background: var(--color-surface);
}

input[type="number"]:focus,
.input-prefix-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(125, 212, 232, 0.12);
}

select {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  width: 100%;
  background: var(--color-surface);
  cursor: pointer;
}

select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(125, 212, 232, 0.12); }

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--gray-400);
  margin-top: -2px;
}

.checkbox-group label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}

.er-display {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
}

.guide-link {
  display: inline-block;
  font-size: 13px;
  color: var(--color-primary);
  text-decoration: none;
  border: 1px solid var(--color-border-hi);
  padding: 5px 14px;
  border-radius: 6px;
  background: var(--color-surface);
  margin-top: 2px;
  transition: background 0.15s, color 0.15s;
}
.guide-link:hover {
  background: var(--color-surface-hi);
  color: var(--color-primary-hi);
}

.data-note {
  font-size: 11px;
  color: var(--gray-400);
  line-height: 1.5;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--gray-200);
}

/* ==================== MAIN CHART AREA ==================== */
.chart-area {
  flex: 1;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.chart-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chart-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-800);
}

.chart-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.scale-lock-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-600);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 400;
}

.scale-lock-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
  cursor: pointer;
}

.rescale-btn {
  font-size: 12px;
  padding: 5px 12px;
  border: 1px solid var(--blue);
  border-radius: 5px;
  background: var(--color-surface);
  color: var(--blue);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.rescale-btn:hover {
  background: var(--blue-bg);
}

.chart-theme-btn {
  font-size: 15px;
  padding: 3px 7px;
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  background: var(--color-surface);
  color: var(--gray-400);
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s;
}
.chart-theme-btn:hover {
  color: var(--gray-800);
  border-color: var(--gray-400);
}

.error-banner {
  background: rgba(224, 112, 64, 0.12);
  border: 1px solid rgba(224, 112, 64, 0.4);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--color-negative);
  margin-top: 8px;
}

/* ==================== CHART CONTAINER ==================== */
.chart-container {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px;
  height: 400px;
}

.chart-container canvas {
  max-height: 100%;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 30, 42, 0.88);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 13px;
  color: var(--gray-600);
  z-index: 10;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== STATS GRID ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.stat-group {
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 12px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-group-diy    { background: rgba(125, 212, 232, 0.06); border-color: rgba(125, 212, 232, 0.25); }
.stat-group-active { background: rgba(77, 184, 160, 0.06);  border-color: rgba(77, 184, 160, 0.25);  }

.stat-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gray-400);
}

.stat-group-diy    .stat-group-label { color: var(--color-primary); }
.stat-group-active .stat-group-label { color: var(--color-positive); }
.stat-group-diy-momentum    .stat-group-label { color: var(--orange); }
.stat-group-active-momentum .stat-group-label { color: var(--orange); }

.stats-grid-momentum {
  grid-template-columns: repeat(4, 1fr);
}
.stats-grid-momentum .stat-group-diy-momentum    { grid-column: 2; }
.stats-grid-momentum .stat-group-active-momentum { grid-column: 4; }

.stat-group-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-card {
  background: var(--color-surface);
  border: 2px solid var(--gray-200);
  position: relative;
  border-radius: 10px;
  padding: 16px;
}

.stat-card.diy            { border-top: 4px solid var(--blue);   }
.stat-card.managed        { border-top: 4px solid var(--red);    }
.stat-card.active         { border-top: 4px solid var(--green);  }
.stat-card.active-managed { border-top: 4px solid var(--orange); }
.stat-card.diy-momentum    { border-top: 4px solid var(--orange); }
.stat-card.active-momentum { border-top: 4px solid var(--orange); }

.stat-card-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 14px;
  height: 14px;
  cursor: pointer;
  margin: 0;
}
.stat-card.diy            .stat-card-toggle { accent-color: var(--blue);   }
.stat-card.managed        .stat-card-toggle { accent-color: var(--red);    }
.stat-card.active         .stat-card-toggle { accent-color: var(--green);  }
.stat-card.active-managed .stat-card-toggle { accent-color: var(--orange); }

.stat-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 6px;
}

.graph-swatch {
  flex-shrink: 0;
  transition: opacity 0.2s, filter 0.2s;
}

.stat-card.line-hidden .graph-swatch {
  opacity: 0.15;
  filter: grayscale(1);
}

.stat-card.diy            .stat-card-title { color: var(--blue);   }
.stat-card.managed        .stat-card-title { color: var(--red);    }
.stat-card.active         .stat-card-title { color: var(--green);  }
.stat-card.active-managed .stat-card-title { color: var(--orange); }
.stat-card.diy-momentum    .stat-card-title { color: var(--orange); }
.stat-card.active-momentum .stat-card-title { color: var(--orange); }

.stat-card-sub {
  font-size: 11px;
  color: var(--gray-400);
  margin-bottom: 12px;
  margin-top: 2px;
}

.stat-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: baseline;
}

.stat-card dt {
  font-size: 12px;
  color: var(--gray-600);
  white-space: nowrap;
}

.stat-card dd {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  text-align: right;
}

/* ==================== FEE DRAG CALLOUT ==================== */
.fee-drag-callout {
  background: var(--color-surface);
  border: 1px solid var(--color-border-hi);
  border-left: 4px solid var(--color-primary);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 14px;
  color: var(--gray-800);
  line-height: 1.6;
}

/* ==================== DISCLAIMER ==================== */
.disclaimer {
  font-size: 11px;
  color: var(--gray-400);
  line-height: 1.6;
  padding: 12px 0;
  border-top: 1px solid var(--gray-200);
}

/* ==================== TOOLTIPS ==================== */
.tooltip-term {
  text-decoration: underline dotted var(--gray-400);
  cursor: help;
  position: relative;
}

.tooltip-term::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #001520;
  border: 1px solid var(--color-border-hi);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  padding: 8px 12px;
  border-radius: 6px;
  max-width: 440px;
  white-space: pre-line;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  text-decoration: none;
}

.tooltip-term:hover::after {
  opacity: 1;
}

.tooltip-term--wide::after {
  max-width: 620px;
}

.tooltip-term--below-right::after {
  bottom: auto;
  top: calc(100% + 6px);
  left: auto;
  right: 0;
  transform: none;
  width: 360px;
}

/* Sidebar tooltips: handled by JS (#sidebarTooltip) to escape overflow clipping */
.sidebar .tooltip-term::after { display: none; }

#sidebarTooltip {
  position: fixed;
  display: none;
  background: #001520;
  border: 1px solid var(--color-border-hi);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  padding: 8px 12px;
  border-radius: 6px;
  max-width: 440px;
  z-index: 10000;
  pointer-events: none;
}

/* Floating tooltip (chart legend + fund hover) — positioned via JS */
#legendTooltip {
  position: fixed;
  display: none;
  background: #001520;
  border: 1px solid var(--color-border-hi);
  color: var(--color-text);
  font-size: 11px;
  line-height: 1.6;
  padding: 10px 14px;
  border-radius: 6px;
  min-width: 320px;
  max-width: 480px;
  pointer-events: none;
  z-index: 1000;
}

/* Fund table inside the floating tooltip */
.fund-tbl {
  border-collapse: collapse;
  width: 100%;
  font-size: 11px;
}
.fund-tbl th {
  text-align: left;
  padding: 2px 8px 5px;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
  font-size: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
.fund-tbl td {
  padding: 2px 8px;
  vertical-align: top;
}
.fund-tbl-head {
  padding: 7px 8px 2px !important;
  color: rgba(255,255,255,0.45);
  font-style: italic;
  font-size: 10px;
  letter-spacing: 0.02em;
}
.fund-tbl-cat {
  color: #9ca3af;
}

/* ==================== ERA TOGGLE ==================== */
.era-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.era-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  background: var(--color-surface);
  transition: border-color 0.15s, background 0.15s;
}

.era-option--selected {
  border-color: var(--blue);
  background: var(--blue-bg);
}

.era-option input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--blue);
  flex-shrink: 0;
}

.era-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.era-option-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
}

.era-option-sub {
  font-size: 11px;
  color: var(--gray-400);
}

/* ==================== AGGRESSIVENESS TOGGLE ==================== */
.agg-toggle {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-surface);
}

.agg-option {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--color-surface);
  border-bottom: 1px solid var(--gray-200);
  transition: background 0.15s, color 0.15s;
  user-select: none;
  text-align: center;
}

.agg-option:last-child {
  border-bottom: none;
}

.agg-option input[type="radio"] {
  display: none;
}

.agg-option--selected {
  background: var(--blue-bg);
  color: var(--blue);
  font-weight: 600;
}

.agg-toggle--disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.agg-toggle--disabled .agg-option {
  pointer-events: none;
}

/* Momentum checkbox + aggressiveness grouped card */
.momentum-group {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.momentum-group .checkbox-group {
  margin: 0;
}
.agg-sub {
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.agg-sub-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==================== STRATEGY TOGGLE (Rebalancing page) ==================== */
.strategy-toggle {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strategy-group {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 10px 10px;
  background: var(--color-surface);
}

.strategy-group-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: 6px;
}

.strategy-group-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.strategy-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  cursor: pointer;
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-800);
}

.strategy-option--selected {
  border-color: var(--blue);
  background: var(--blue-bg);
}

.strategy-option input[type="radio"] {
  accent-color: var(--blue);
  flex-shrink: 0;
}

/* ==================== REBALANCING STATS GRID ==================== */
.stats-grid-rebal {
  grid-template-columns: 1fr;
}

.stat-group-rebal {
  background: rgba(125, 212, 232, 0.06);
  border-color: rgba(125, 212, 232, 0.25);
}

.stat-group-rebal .stat-group-label {
  color: var(--color-primary);
}

.stat-group-cards-rebal {
  grid-template-columns: repeat(3, 1fr);
}

.stat-card.rebal-card {
  border-top: 4px solid var(--blue);
}

.stat-card.momentum-rebal {
  border-top: 4px solid #7c3aed;
}
.stat-card.momentum-rebal .stat-card-title {
  color: #7c3aed;
}

.stats-grid-momentum-rebal {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}

.stat-group-momentum-rebal {
  background: rgba(124, 58, 237, 0.06);
  border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: 12px;
  padding: 12px;
  max-width: 360px;
}

.stat-group-momentum-rebal .stat-group-label {
  color: #7c3aed;
}

/* ==================== DATE PICKER ==================== */
.date-picker {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--color-surface);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 4px 6px;
}

.picker-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--blue);
  font-size: 16px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
  user-select: none;
}

.picker-btn:hover:not(:disabled) {
  background: var(--blue-bg);
}

.picker-btn:disabled {
  color: var(--gray-200);
  cursor: default;
}

.picker-reset {
  display: none;  /* shown via JS only when end date is not at max */
  font-size: 11px;
  color: var(--gray-400);
  margin-left: 4px;
  padding: 2px 6px;
  border: 1px solid var(--gray-200) !important;
  border-radius: 4px;
}
.picker-reset:hover:not(:disabled) {
  color: var(--gray-800);
  background: var(--gray-100) !important;
}

.picker-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  min-width: 36px;
  text-align: center;
}

#pickerYear {
  min-width: 44px;
}

.picker-sep {
  width: 1px;
  height: 18px;
  background: var(--gray-200);
  margin: 0 4px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
  }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-group-cards { grid-template-columns: repeat(2, 1fr); }
  .stat-group-cards-rebal { grid-template-columns: 1fr; }
  .chart-area { padding: 20px 16px; }
}
