:root {
  --bg: #080d15;
  --bg-raised: #0e1520;
  --panel: #111a26;
  --panel-2: #151f2d;
  --line: #253246;
  --line-soft: #1c2838;
  --text: #edf4ff;
  --muted: #8da2be;
  --faint: #61758f;
  --blue: #3c82ff;
  --blue-soft: rgba(60, 130, 255, 0.14);
  --green: #36e58a;
  --green-soft: rgba(54, 229, 138, 0.12);
  --red: #ff5f69;
  --red-soft: rgba(255, 95, 105, 0.12);
  --amber: #f5bd45;
  --amber-soft: rgba(245, 189, 69, 0.13);
  --violet: #a88bff;
  --violet-soft: rgba(168, 139, 255, 0.13);
  --cyan: #4ed7e8;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
  --radius: 14px;
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 78% 0%, rgba(48, 94, 170, 0.11), transparent 31rem),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  color: var(--text);
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.65rem 0.85rem;
  border-radius: 7px;
  background: #fff;
  color: #000;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto auto minmax(10rem, 1fr) auto;
  align-items: center;
  min-height: 70px;
  padding: 0.75rem clamp(1rem, 2vw, 2rem);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(10, 15, 24, 0.94);
  backdrop-filter: blur(16px);
}

.dashboard-nav {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: clamp(0.75rem, 1.5vw, 1.5rem);
  padding-left: clamp(0.75rem, 1.5vw, 1.5rem);
  border-left: 1px solid var(--line-soft);
  white-space: nowrap;
}

.dashboard-nav-label {
  margin-right: 0.25rem;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-nav a {
  padding: 0.42rem 0.58rem;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #b9c8dc;
  font-size: 0.74rem;
  font-weight: 700;
  text-decoration: none;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.dashboard-nav a:hover {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.dashboard-nav a[aria-current="page"] {
  border-color: rgba(60, 130, 255, 0.45);
  background: var(--blue-soft);
  color: #bcd2ff;
}

.dashboard-nav a:focus-visible {
  outline: 2px solid #74a5ff;
  outline-offset: 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  display: block;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 9px;
  object-fit: cover;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: 0.01em;
}

.brand small {
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.69rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 0;
  color: #c5d2e5;
  font-size: 0.78rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 4px rgba(97, 117, 143, 0.12);
}

.status-live {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft), 0 0 13px rgba(54, 229, 138, 0.45);
}

.status-stale {
  background: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-soft);
}

.status-error {
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}

.status-loading {
  background: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.38;
  }
}

.button {
  min-height: 38px;
  padding: 0.55rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:focus-visible,
select:focus-visible,
input:focus-visible,
.strategy-table tbody tr:focus-visible {
  outline: 2px solid #74a5ff;
  outline-offset: 2px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

.button-primary {
  border-color: #4a8dff;
  background: #286ee8;
  box-shadow: 0 7px 20px rgba(40, 110, 232, 0.22);
}

.button-primary:hover {
  background: #347cf5;
}

.page-shell {
  width: min(1880px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 2vw, 2rem);
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin: 0.55rem 0 1.25rem;
}

.page-heading h1 {
  max-width: 900px;
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(1.55rem, 2.6vw, 2.5rem);
  letter-spacing: -0.035em;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: #78a8ff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.heading-copy,
.panel-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.heading-copy {
  max-width: 760px;
  font-size: 0.9rem;
}

.heading-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.meta-pill {
  padding: 0.42rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(17, 26, 38, 0.8);
  color: var(--muted);
  font-size: 0.71rem;
  white-space: nowrap;
}

.alert-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 0.78rem 1rem;
  border: 1px solid rgba(245, 189, 69, 0.4);
  border-radius: 10px;
  background: var(--amber-soft);
  color: #ffe2a1;
  font-size: 0.82rem;
}

.alert-banner.is-error {
  border-color: rgba(255, 95, 105, 0.42);
  background: var(--red-soft);
  color: #ffc0c4;
}

.is-hidden {
  display: none !important;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(165px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.metric-card,
.panel {
  border: 1px solid var(--line-soft);
  background: linear-gradient(145deg, rgba(20, 30, 44, 0.98), rgba(14, 22, 33, 0.98));
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 126px;
  padding: 1rem;
  border-radius: 12px;
}

.metric-label,
.metric-note {
  display: block;
  color: var(--muted);
}

.metric-label {
  min-height: 2.2em;
  font-size: 0.72rem;
}

.metric-value {
  display: block;
  margin: 0.34rem 0;
  font-size: clamp(1.25rem, 2vw, 1.85rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.drawdown-value {
  font-variant-numeric: tabular-nums;
}

.metric-value.drawdown-value {
  font-size: 0.82rem;
}

.drawdown-profile {
  display: grid !important;
  grid-template-columns: max-content minmax(max-content, 1fr) minmax(4.8rem, max-content);
  align-items: center;
  column-gap: 0.42rem;
  gap: 0.2rem;
  white-space: normal;
}

.drawdown-line {
  display: contents !important;
}

.drawdown-line-label {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 650;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.drawdown-line-value {
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  text-align: left;
  white-space: nowrap;
}

.metric-value.drawdown-profile .drawdown-line-value {
  font-size: clamp(0.84rem, 1.2vw, 1.08rem);
}

.drawdown-tail-flag {
  min-width: 4.8rem;
  padding: 0.2rem 0.32rem;
  border: 1px solid rgba(255, 95, 105, 0.36);
  border-radius: 4px;
  background: rgba(255, 95, 105, 0.1);
  color: #ff9299;
  font-size: 0.48rem;
  font-weight: 850;
  letter-spacing: 0.055em;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.drawdown-tail-flag-placeholder {
  visibility: hidden;
}

.metric-note {
  font-size: 0.67rem;
  line-height: 1.35;
}

.positive {
  color: var(--green) !important;
}

.negative {
  color: var(--red) !important;
}

.neutral-value {
  color: #dbe7f9 !important;
}

.muted {
  color: var(--muted);
}

.panel {
  margin-bottom: 0.85rem;
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.85rem;
}

.panel-heading h2 {
  margin: 0.18rem 0 0;
  font-size: 1.02rem;
  letter-spacing: -0.015em;
}

.panel-note {
  max-width: 760px;
  margin-top: 0.38rem;
  font-size: 0.74rem;
}

.select-control,
.filter-bar label {
  display: grid;
  gap: 0.32rem;
  color: var(--muted);
  font-size: 0.66rem;
}

select,
input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0c1420;
}

select {
  min-width: 210px;
  padding: 0.45rem 2.1rem 0.45rem 0.65rem;
}

input {
  min-width: 190px;
  padding: 0.45rem 0.65rem;
}

input::placeholder {
  color: #687d98;
}

.selected-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 55px;
  margin: 0 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line-soft);
}

.selected-context strong,
.selected-context span {
  display: block;
}

.selected-context strong {
  font-size: 0.92rem;
}

.selected-context .muted {
  margin-top: 0.16rem;
  font-size: 0.7rem;
}

.selected-context .selected-forward-shadow {
  max-width: 780px;
  margin-top: 0.32rem;
  color: #bdaaff;
  line-height: 1.45;
}

.selected-context .selected-continuity {
  max-width: 850px;
  margin-top: 0.32rem;
  color: #d3c8ff;
  font-weight: 650;
  line-height: 1.45;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.evidence-stack {
  max-width: 155px;
  justify-content: flex-start;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0.25rem 0.48rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  line-height: 1;
  white-space: nowrap;
}

.badge-run {
  border-color: rgba(54, 229, 138, 0.35);
  background: var(--green-soft);
  color: var(--green);
}

.badge-watch {
  border-color: rgba(245, 189, 69, 0.35);
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-operator {
  border-style: solid;
  border-width: 1.5px;
  box-shadow: 0 0 0 1px rgba(159, 177, 200, 0.22);
  font-size: 0.68rem;
  min-height: 25px;
}

.badge-model-secondary {
  font-size: 0.53rem;
  min-height: 18px;
  opacity: 0.62;
  border-style: dotted;
}

.badge-pause {
  border-color: rgba(255, 95, 105, 0.36);
  background: var(--red-soft);
  color: var(--red);
}

.badge-insufficient,
.badge-neutral {
  background: rgba(97, 117, 143, 0.1);
  color: #9fb1c8;
}

.badge-actual {
  border-color: rgba(78, 215, 232, 0.36);
  background: rgba(78, 215, 232, 0.1);
  color: var(--cyan);
}

.badge-shadow {
  border-color: rgba(168, 139, 255, 0.36);
  background: var(--violet-soft);
  color: #bdaaff;
}

.badge-simulated {
  border-color: rgba(60, 130, 255, 0.36);
  background: var(--blue-soft);
  color: #79a9ff;
}

.badge-research {
  border-color: rgba(245, 189, 69, 0.3);
  background: rgba(245, 189, 69, 0.08);
  color: #e8c77c;
}

.badge-unavailable,
.badge-unknown,
.badge-awaiting {
  border-color: rgba(97, 117, 143, 0.3);
  background: rgba(97, 117, 143, 0.08);
  color: #8397b1;
}

.badge-error,
.badge-stale_after_error {
  border-color: rgba(255, 95, 105, 0.32);
  background: var(--red-soft);
  color: #ff8b93;
}

.badge-ready {
  border-color: rgba(54, 229, 138, 0.27);
  background: rgba(54, 229, 138, 0.07);
  color: #75dca6;
}

.state-stack {
  display: flex;
  min-width: 112px;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.28rem;
}

.badge-gated {
  min-height: 17px;
  border-color: rgba(97, 117, 143, 0.28);
  background: rgba(97, 117, 143, 0.07);
  color: #7d8ea3;
  font-size: 0.5rem;
  letter-spacing: 0.045em;
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin: 0 1rem 0.4rem;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(8, 13, 21, 0.36);
}

.chart-stats > div {
  padding: 0.65rem 0.8rem;
  border-right: 1px solid var(--line-soft);
}

.chart-stats > div:last-child {
  border-right: 0;
}

.chart-stats span,
.chart-stats strong {
  display: block;
}

.chart-stats span {
  margin-bottom: 0.16rem;
  color: var(--muted);
  font-size: 0.62rem;
}

.chart-stats strong {
  font-size: 0.86rem;
}

.chart-stats .drawdown-line-label,
.chart-stats .drawdown-line-value,
.chart-stats .drawdown-tail-flag {
  margin-bottom: 0;
}

.chart-stats .drawdown-line-label {
  color: var(--muted);
  font-size: 0.52rem;
}

.chart-stats .drawdown-line-value {
  color: var(--red);
  font-size: 0.76rem;
}

.chart-stats .drawdown-tail-flag {
  color: #ff9299;
  font-size: 0.44rem;
}

.chart-wrap {
  position: relative;
  height: clamp(280px, 35vw, 480px);
  margin: 0 1rem 1rem;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background:
    linear-gradient(rgba(37, 50, 70, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 50, 70, 0.14) 1px, transparent 1px),
    #0b121d;
  background-size: 100% 25%, 12.5% 100%;
}

.chart-range-controls {
  display: grid;
  grid-template-columns: max-content minmax(120px, 1fr) max-content;
  align-items: center;
  gap: 0.65rem;
  margin: -0.35rem 1rem 1rem;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
}

.chart-range-controls input[type="range"] {
  width: 100%;
  min-height: 32px;
  margin: 0;
  accent-color: var(--blue);
}

.chart-range-controls output {
  min-width: 9rem;
  color: #b9c8dc;
  text-align: right;
}

#pnl-chart {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}

#pnl-chart:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -3px;
}

.chart-continuity-legend {
  position: absolute;
  z-index: 2;
  top: 0.65rem;
  right: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem 0.8rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid rgba(97, 117, 143, 0.3);
  border-radius: 6px;
  background: rgba(7, 12, 20, 0.82);
  color: #aebfd5;
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  pointer-events: none;
}

.chart-continuity-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
}

.chart-legend-line {
  display: inline-block;
  width: 22px;
  height: 0;
  border-top: 2px solid #c6d5e8;
}

.chart-legend-forward {
  border-top-color: #a88bff;
  border-top-style: dashed;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.3rem;
  padding: 1rem;
  color: var(--muted);
  text-align: center;
}

.chart-empty strong {
  color: #c8d5e8;
  font-size: 0.9rem;
}

.chart-empty span {
  font-size: 0.72rem;
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 150px;
  padding: 0.5rem 0.65rem;
  border: 1px solid #3b4d67;
  border-radius: 7px;
  background: rgba(7, 12, 20, 0.95);
  box-shadow: 0 9px 30px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.chart-tooltip strong,
.chart-tooltip span {
  display: block;
}

.chart-tooltip strong {
  font-size: 0.75rem;
}

.chart-tooltip span {
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.65rem;
}

.chart-tooltip .curve-segment-forward {
  color: #bdaaff;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.045em;
}

.chart-tooltip .curve-segment-history {
  color: #91dcb5;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.045em;
}

.table-heading {
  align-items: flex-end;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.filter-bar select {
  min-width: 130px;
}

.table-scroll {
  overflow-x: auto;
  border-top: 1px solid var(--line-soft);
  scrollbar-color: #33445c #101823;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  white-space: nowrap;
}

.data-table th,
.data-table td {
  padding: 0.72rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #111a26;
  color: #8fa4c0;
  font-size: 0.63rem;
  font-weight: 750;
  letter-spacing: 0.015em;
}

.data-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.drawdown-profile-cell {
  min-width: 264px;
}

.drawdown-profile-cell .drawdown-profile {
  grid-template-columns: 46px minmax(112px, max-content) minmax(4.8rem, max-content);
  justify-content: end;
}

.drawdown-profile-cell .drawdown-line-label {
  min-width: 46px;
  text-align: left;
}

.strategy-table tbody tr {
  cursor: pointer;
  transition: background 120ms ease;
}

.strategy-table tbody tr:hover,
.strategy-table tbody tr.is-selected {
  background: rgba(60, 130, 255, 0.075);
}

.strategy-table tbody tr.is-selected {
  box-shadow: inset 3px 0 var(--blue);
}

.strategy-name {
  display: block;
  color: #f3f7ff;
  font-weight: 720;
}

.strategy-subtext {
  display: block;
  max-width: 260px;
  margin-top: 0.15rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.62rem;
  text-overflow: ellipsis;
}

.trend-cell {
  min-width: 110px;
}

.trend-label {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-weight: 700;
}

.trend-label::before {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  content: "";
}

.trend-up {
  color: var(--green);
}

.trend-up::before {
  background: var(--green);
}

.trend-down {
  color: var(--red);
}

.trend-down::before {
  background: var(--red);
}

.trend-flat {
  color: var(--amber);
}

.trend-flat::before {
  background: var(--amber);
}

.empty-cell {
  height: 110px;
  color: var(--muted);
  text-align: center !important;
}

.table-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.64rem 0.85rem;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.64rem;
}

.freshness-table {
  min-width: 820px;
}

.freshness-root {
  color: #f4f8ff;
  font-weight: 800;
}

.methodology-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.disclosure-card {
  min-height: 100%;
  margin-bottom: 0;
  padding: 1rem;
}

.disclosure-card h2 {
  margin: 0.18rem 0 0.95rem;
  font-size: 1rem;
}

.legend-list {
  margin: 0;
}

.legend-list > div {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: start;
  gap: 0.6rem;
  padding: 0.56rem 0;
  border-top: 1px solid var(--line-soft);
}

.legend-list dt,
.legend-list dd {
  margin: 0;
}

.legend-list dd,
.guardrail-list {
  color: var(--muted);
  font-size: 0.71rem;
  line-height: 1.45;
}

.guardrail-list {
  margin: 0;
  padding-left: 1.1rem;
}

.guardrail-list li + li {
  margin-top: 0.48rem;
}

.methodology-version {
  margin: 1rem 0 0;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 0.65rem;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(1880px, 100%);
  margin: 0 auto;
  padding: 1rem clamp(1rem, 2vw, 2rem) 2rem;
  color: var(--faint);
  font-size: 0.65rem;
}

@media (max-width: 1280px) {
  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .chart-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .chart-stats > div:nth-child(3) {
    border-right: 0;
  }

  .chart-stats > div:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line-soft);
  }

  .table-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-bar {
    justify-content: flex-start;
    width: 100%;
  }
}

@media (max-width: 900px) {
  .app-header {
    grid-template-columns: 1fr auto;
  }

  .dashboard-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    margin: 0.55rem 0 0;
    padding: 0.5rem 0 0;
    border-top: 1px solid var(--line-soft);
    border-left: 0;
  }

  .header-status {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: flex-start;
    margin-top: 0.55rem;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.8rem;
  }

  .heading-meta {
    justify-content: flex-start;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .methodology-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 0.7rem;
  }

  .app-header {
    padding: 0.65rem 0.75rem;
  }

  .brand small,
  #last-updated {
    display: none;
  }

  .dashboard-nav {
    gap: 0.2rem;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .dashboard-nav-label {
    display: none;
  }

  .dashboard-nav a {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0.72rem 0.65rem;
  }

  .button {
    padding-inline: 0.7rem;
    font-size: 0.75rem;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }

  .metric-card {
    min-height: 112px;
    padding: 0.82rem;
  }

  .summary-grid .drawdown-profile {
    grid-template-columns: max-content minmax(max-content, 1fr) minmax(4.8rem, max-content);
    column-gap: 0.28rem;
  }

  .summary-grid .metric-card:first-child {
    grid-column: 1 / -1;
  }

  .panel-heading,
  .selected-context {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-heading {
    padding: 0.85rem;
  }

  .select-control,
  .select-control select,
  .filter-bar,
  .filter-bar label,
  .filter-bar select,
  .filter-bar input {
    width: 100%;
  }

  .selected-context {
    margin-inline: 0.85rem;
  }

  .badge-row {
    justify-content: flex-start;
  }

  .chart-stats {
    grid-template-columns: repeat(2, 1fr);
    margin-inline: 0.85rem;
  }

  .chart-stats > div,
  .chart-stats > div:nth-child(3) {
    border-right: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
  }

  .chart-stats > div:nth-child(even) {
    border-right: 0;
  }

  .chart-stats > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .chart-wrap {
    height: 300px;
    margin: 0 0.85rem 0.85rem;
  }

  .chart-range-controls {
    grid-template-columns: 1fr;
    gap: 0.15rem;
    margin: -0.35rem 0.85rem 0.85rem;
  }

  .chart-range-controls label {
    display: none;
  }

  .chart-range-controls output {
    min-width: 0;
    text-align: center;
  }

  .table-footer,
  .app-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-footer {
    padding-inline: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
