:root {
  color-scheme: dark;
  --bg: #0d1110;
  --bg-2: #141917;
  --panel: #181f1d;
  --panel-2: #111715;
  --text: #eef4ef;
  --muted: #9dac9f;
  --line: #2d3933;
  --line-strong: #46554c;
  --accent: #8ff36a;
  --accent-2: #53d3c6;
  --warn: #f4bf5f;
  --danger: #f07070;
  --shadow: 0 20px 80px rgba(0, 0, 0, 0.34);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 36px 36px,
    linear-gradient(180deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px) 0 0 / 36px 36px,
    linear-gradient(135deg, rgba(143, 243, 106, 0.14), transparent 34rem),
    linear-gradient(315deg, rgba(83, 211, 198, 0.08), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.appShell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  max-width: 980px;
  font: 760 clamp(30px, 4vw, 58px)/0.98 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

.deck {
  max-width: 780px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.1;
  letter-spacing: 0;
}

.sourceBadge {
  min-width: 280px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 31, 29, 0.88);
  padding: 12px 14px;
  text-align: right;
  box-shadow: var(--shadow);
}

.sourceBadge span,
.sourceBadge strong {
  display: block;
}

.sourceBadge span {
  color: var(--muted);
  font-size: 12px;
}

.sourceBadge strong {
  margin-top: 5px;
  font-size: 13px;
  font-weight: 700;
}

.freshnessBadges {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 6px;
  margin-top: 10px;
}

.freshnessBadges span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--muted);
  font-size: 11px;
}

.freshnessBadges b {
  color: var(--accent);
  font-weight: 800;
}

.filters,
.kpis,
.grid {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.filters {
  grid-template-columns: minmax(180px, 1.05fr) minmax(128px, 0.68fr) minmax(158px, 0.8fr) minmax(140px, 0.72fr) minmax(140px, 0.72fr) minmax(220px, 1.15fr) 76px;
  align-items: end;
  margin-bottom: 10px;
}

label {
  display: grid;
  gap: 7px;
}

label span,
.filterGroup > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

select,
input,
button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 23, 21, 0.94);
  color: var(--text);
  padding: 0 12px;
}

input:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

select[multiple] {
  min-height: 84px;
  padding: 8px 10px;
}

.filterGroup {
  display: grid;
  gap: 7px;
}

.aggregatorFilter select {
  display: none;
}

.presetRow,
.chipGrid,
.tabBar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.presetRow button,
.chip,
.tabBar button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.presetRow button.isActive,
.chip.isActive,
.tabBar button.isActive {
  border-color: var(--accent);
  background: rgba(143, 243, 106, 0.12);
  color: var(--accent);
}

.chipGrid {
  max-height: 84px;
  overflow: auto;
  padding-right: 2px;
}

button {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
}

button:hover {
  border-color: var(--accent);
}

.kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 10px;
}

.kpis article,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 31, 29, 0.9);
  box-shadow: var(--shadow);
}

.kpis article {
  min-height: 106px;
  padding: 15px;
}

.kpis span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.kpis strong {
  display: block;
  margin-top: 15px;
  overflow-wrap: anywhere;
  font-size: clamp(23px, 2.3vw, 34px);
  line-height: 1.02;
  letter-spacing: 0;
}

#kpiVolume,
#kpiLiveVolume,
#kpiLiveDelta,
#kpiTxCount,
#kpiActiveAggregators {
  overflow-wrap: normal;
  white-space: nowrap;
  font-size: clamp(22px, 1.85vw, 31px);
}

.grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.9fr);
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panelHead {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  min-height: 48px;
  margin-bottom: 14px;
}

.panelHint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 7px 10px;
  max-width: 620px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.chart {
  min-height: 340px;
}

.scrollChart {
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: end;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 4px 2px;
}

.dayColumn {
  position: relative;
  flex: 0 0 48px;
  min-height: 318px;
  display: grid;
  grid-template-rows: 260px 58px;
  gap: 8px;
  align-items: end;
  cursor: pointer;
  outline: none;
}

.stackedBar {
  align-self: end;
  width: 100%;
  min-height: 6px;
  display: flex;
  flex-direction: column-reverse;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px 6px 4px 4px;
  overflow: hidden;
  background: var(--panel-2);
}

.barSegment {
  min-height: 1px;
}

.hasDayTooltip:focus-visible .stackedBar,
.hasDayTooltip:focus-visible .shareBar,
.hasDayTooltip.isTooltipActive .stackedBar,
.hasDayTooltip.isTooltipActive .shareBar {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(143, 243, 106, 0.18);
}

.dayTooltip {
  display: none;
}

.floatingDayTooltip {
  position: fixed;
  z-index: 1000;
  display: none;
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(13, 17, 16, 0.98);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.46);
  padding: 10px;
  pointer-events: none;
}

.floatingDayTooltip.isVisible {
  display: block;
}

.tooltipHead,
.tooltipRow,
.tooltipMeta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.tooltipHead {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.tooltipHead b {
  font-size: 13px;
}

.tooltipHead strong {
  color: var(--accent);
  font-size: 13px;
}

.tooltipRow {
  margin-top: 8px;
  font-size: 12px;
}

.tooltipRow span {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow-wrap: anywhere;
}

.tooltipRow i {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.tooltipRow strong {
  flex: 0 0 auto;
  text-align: right;
  font-size: 12px;
}

.tooltipRow em {
  color: var(--muted);
  font-style: normal;
}

.tooltipMore,
.tooltipMeta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.tooltipMeta {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.axisLabel {
  min-height: 58px;
}

.axisLabel b,
.axisLabel span {
  display: block;
}

.axisLabel b {
  font-size: 11px;
  font-weight: 800;
}

.axisLabel span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.shareChart {
  display: grid;
  align-content: start;
  gap: 7px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}

.shareRow {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(150px, 1fr) 82px;
  gap: 9px;
  align-items: center;
  min-height: 22px;
  cursor: pointer;
  outline: none;
}

.shareRow span,
.shareRow strong {
  font-size: 11px;
}

.shareRow span {
  color: var(--muted);
}

.shareRow strong {
  text-align: right;
  font-weight: 700;
}

.shareBar {
  display: flex;
  height: 14px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 5px;
  background: var(--panel-2);
}

.shareSegment {
  min-width: 1px;
}

.tablePanel,
.notesPanel,
.topPairsPanel,
.tabBar {
  margin-top: 10px;
}

.topPairsList {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.topPairItem {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "rank pair"
    "rank volume"
    "rank txs";
  gap: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 23, 21, 0.62);
  padding: 10px;
}

.topPairItem > span {
  grid-area: rank;
  align-self: start;
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.topPairItem div {
  grid-area: pair;
  min-width: 0;
}

.topPairItem strong,
.topPairItem small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topPairItem strong {
  font-size: 14px;
}

.topPairItem small,
.topPairItem em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.topPairItem b {
  grid-area: volume;
  font-size: 15px;
}

.topPairItem em {
  grid-area: txs;
}

.tabBar {
  padding: 10px;
}

.tabPanel {
  display: none;
}

.tabPanel.isActive {
  display: block;
}

.notesPanel.tabPanel.isActive {
  display: grid;
}

.tableWrap {
  overflow-x: auto;
  max-height: 520px;
  max-width: 100%;
}

table {
  width: 100%;
  min-width: 850px;
  border-collapse: collapse;
}

.pairTable {
  min-width: 1020px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

th:nth-child(-n+3),
td:nth-child(-n+3) {
  text-align: left;
}

tbody tr:hover {
  background: rgba(143, 243, 106, 0.045);
}

.addressLink {
  color: var(--accent-2);
  font-family: "Courier New", monospace;
  font-size: 12px;
  text-decoration: none;
}

.addressLink:hover {
  color: var(--accent);
  text-decoration: underline;
}

.protocolBadge {
  display: inline-flex;
  align-items: center;
  min-width: 54px;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
  justify-content: center;
  vertical-align: middle;
}

.protocolBadge.isCompact {
  min-width: 38px;
  min-height: 18px;
  margin-left: 8px;
  padding: 0 6px;
  font-size: 9px;
}

.protocol-v2 {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.protocol-cl {
  color: var(--accent-2);
  background: rgba(83, 211, 198, 0.1);
}

.protocol-dlmm {
  color: var(--accent);
  background: rgba(143, 243, 106, 0.12);
}

.protocol-other {
  color: var(--warn);
  background: rgba(244, 191, 95, 0.1);
}

.notesPanel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.notesPanel.tabPanel:not(.isActive) {
  display: none;
}

.notesPanel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.notesPanel a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.siteFooter {
  margin-top: 18px;
  padding: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.siteFooter a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.siteFooter a:hover {
  text-decoration: underline;
}

.empty {
  margin: 18px 0;
  color: var(--muted);
}

@media (max-width: 1280px) {
  .kpis,
  body.layout-brief .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .topbar,
  .grid,
  .notesPanel {
    grid-template-columns: 1fr;
  }

  .sourceBadge {
    text-align: left;
  }

  .freshnessBadges {
    justify-content: start;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters .wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .appShell {
    width: min(100% - 20px, 1440px);
    padding-top: 20px;
  }

  .filters,
  .kpis {
    grid-template-columns: 1fr;
  }

  .panelHead {
    display: grid;
  }

  .legend {
    justify-content: start;
  }

  .dayColumn {
    flex-basis: 44px;
  }

  .topPairsList {
    grid-template-columns: 1fr;
  }

  .topPairItem {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "rank pair volume"
      "rank pair txs";
    align-items: center;
  }
}

/* Layout 1: Dense minimal. Default, quiet, and exact. */
body.layout-minimal {
  --bg: #080a09;
  --bg-2: #0b0e0d;
  --panel: #0f1311;
  --panel-2: #090c0b;
  --text: #f5f7f3;
  --muted: #9aa39b;
  --line: #2b322d;
  --line-strong: #586359;
  --accent: #a9ff78;
  --accent-2: #70e2d1;
  --shadow: none;
  background: var(--bg);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

body.layout-minimal .appShell {
  width: min(1500px, calc(100% - 28px));
  padding-top: 18px;
}

body.layout-minimal .topbar,
body.layout-minimal .filters,
body.layout-minimal .kpis,
body.layout-minimal .grid,
body.layout-minimal .tablePanel,
body.layout-minimal .topPairsPanel,
body.layout-minimal .tabBar,
body.layout-minimal .notesPanel {
  border-left: 2px solid var(--line-strong);
  padding-left: 10px;
}

body.layout-minimal .kpis article,
body.layout-minimal .panel,
body.layout-minimal .sourceBadge,
body.layout-minimal select,
body.layout-minimal input,
body.layout-minimal button {
  background: #0d100f;
  border-radius: 2px;
}

body.layout-minimal h1 {
  font-family: "Courier New", monospace;
  font-size: clamp(25px, 3vw, 42px);
  line-height: 1.05;
}

body.layout-minimal h2,
body.layout-minimal label span,
body.layout-minimal .eyebrow,
body.layout-minimal th {
  font-family: "Courier New", monospace;
}

body.layout-minimal .kpis article {
  min-height: 84px;
  padding: 12px;
}

body.layout-minimal .kpis strong {
  margin-top: 10px;
}

/* Layout 2: Command center. A wall-board view for scanning live routing flow. */
body.layout-command {
  --bg: #10130f;
  --bg-2: #171b15;
  --panel: #151a13;
  --panel-2: #0b0f0a;
  --text: #f0f3de;
  --muted: #a7af8f;
  --line: #35412a;
  --line-strong: #6d7f46;
  --accent: #d8ff5f;
  --accent-2: #4cc7ff;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  background:
    radial-gradient(circle at 20% 5%, rgba(216, 255, 95, 0.12), transparent 30rem),
    linear-gradient(90deg, rgba(216, 255, 95, 0.075) 1px, transparent 1px) 0 0 / 72px 72px,
    linear-gradient(180deg, rgba(216, 255, 95, 0.055) 1px, transparent 1px) 0 0 / 72px 72px,
    #10130f;
  font-family: "Bahnschrift", "Segoe UI", sans-serif;
}

body.layout-command .appShell {
  width: min(1620px, calc(100% - 34px));
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 2.1fr);
  grid-template-areas:
    "top top"
    "filters kpis"
    "filters charts"
    "topPairs charts"
    "tabBar charts"
    "table charts"
    "notes notes";
  gap: 12px;
}

body.layout-command .topbar { grid-area: top; margin-bottom: 0; }
body.layout-command .filters { grid-area: filters; grid-template-columns: 1fr; margin-bottom: 0; align-self: start; }
body.layout-command .kpis { grid-area: kpis; margin-bottom: 0; }
body.layout-command .grid { grid-area: charts; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr); }
body.layout-command .topPairsPanel { grid-area: topPairs; margin-top: 0; }
body.layout-command .tabBar { grid-area: tabBar; margin-top: 0; }
body.layout-command .tablePanel { grid-area: table; margin-top: 0; }
body.layout-command .notesPanel { grid-area: notes; margin-top: 0; }

body.layout-command .topbar,
body.layout-command .panel,
body.layout-command .kpis article,
body.layout-command .sourceBadge,
body.layout-command .tabBar {
  border-color: rgba(216, 255, 95, 0.32);
}

body.layout-command .filters {
  border: 1px solid rgba(216, 255, 95, 0.32);
  border-radius: var(--radius);
  background: rgba(15, 19, 13, 0.88);
  padding: 14px;
}

body.layout-command h1 {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(34px, 4.8vw, 72px);
  line-height: 0.92;
  text-transform: uppercase;
}

body.layout-command .kpis strong {
  color: var(--accent);
  font-size: clamp(22px, 1.9vw, 29px);
  overflow-wrap: normal;
}

body.layout-command #kpiVolume {
  font-size: clamp(20px, 1.75vw, 27px);
}

/* Layout 3: Tape ledger. Table-forward analyst mode with charts as supporting evidence. */
body.layout-ledger {
  --bg: #15130f;
  --bg-2: #f2eadc;
  --panel: #f5efe4;
  --panel-2: #ebe1d2;
  --text: #191812;
  --muted: #625b4e;
  --line: #d4c7b5;
  --line-strong: #7e735f;
  --accent: #064f8f;
  --accent-2: #0f8375;
  --shadow: 0 14px 30px rgba(54, 40, 15, 0.14);
  color-scheme: light;
  background:
    linear-gradient(180deg, rgba(6, 79, 143, 0.08), transparent 220px),
    #eee5d5;
  color: var(--text);
  font-family: "Iowan Old Style", Georgia, serif;
}

body.layout-ledger .appShell {
  width: min(1480px, calc(100% - 32px));
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
  grid-template-areas:
    "top top"
    "filters filters"
    "table kpis"
    "table charts"
    "topPairs charts"
    "tabBar charts"
    "notes notes";
  gap: 12px;
}

body.layout-ledger .topbar { grid-area: top; margin-bottom: 0; }
body.layout-ledger .filters { grid-area: filters; margin-bottom: 0; }
body.layout-ledger .kpis { grid-area: kpis; grid-template-columns: 1fr 1fr; margin-bottom: 0; }
body.layout-ledger .grid { grid-area: charts; grid-template-columns: 1fr; }
body.layout-ledger .topPairsPanel { grid-area: topPairs; margin-top: 0; }
body.layout-ledger .tabBar { grid-area: tabBar; margin-top: 0; }
body.layout-ledger .tablePanel { grid-area: table; margin-top: 0; }
body.layout-ledger .notesPanel { grid-area: notes; margin-top: 0; }

body.layout-ledger h1 {
  font-family: "Iowan Old Style", Georgia, serif;
  font-size: clamp(31px, 4vw, 56px);
  line-height: 1;
}

body.layout-ledger .eyebrow,
body.layout-ledger label span,
body.layout-ledger th {
  color: var(--accent);
}

body.layout-ledger .kpis article,
body.layout-ledger .panel,
body.layout-ledger .sourceBadge,
body.layout-ledger select,
body.layout-ledger input,
body.layout-ledger button {
  background: rgba(245, 239, 228, 0.95);
  color: var(--text);
}

body.layout-ledger .tableWrap {
  max-height: 760px;
}

body.layout-ledger tbody tr:hover {
  background: rgba(6, 79, 143, 0.07);
}

/* Layout 4: Heatmap lab. Compressed research-bench view with bright plots first. */
body.layout-heatmap {
  --bg: #080706;
  --bg-2: #15110d;
  --panel: #18130e;
  --panel-2: #0d0a08;
  --text: #fff8e8;
  --muted: #c1aa86;
  --line: #3a2d20;
  --line-strong: #735a35;
  --accent: #ffcc4d;
  --accent-2: #ff6f3c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  background:
    linear-gradient(135deg, rgba(255, 111, 60, 0.13), transparent 34rem),
    repeating-linear-gradient(90deg, rgba(255, 204, 77, 0.045) 0 1px, transparent 1px 18px),
    #080706;
  font-family: "Trebuchet MS", Verdana, sans-serif;
}

body.layout-heatmap .appShell {
  width: min(1560px, calc(100% - 30px));
}

body.layout-heatmap .grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

body.layout-heatmap .kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.layout-heatmap h1 {
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: clamp(32px, 4.2vw, 62px);
  line-height: 0.96;
  text-transform: uppercase;
}

body.layout-heatmap .panel,
body.layout-heatmap .kpis article,
body.layout-heatmap .sourceBadge {
  background: linear-gradient(180deg, rgba(35, 25, 15, 0.96), rgba(19, 14, 10, 0.96));
  border-color: rgba(255, 204, 77, 0.25);
}

body.layout-heatmap .stackedBar,
body.layout-heatmap .shareBar {
  box-shadow: 0 0 18px rgba(255, 111, 60, 0.12);
}

/* Layout 5: Executive brief. Snapshot-first presentation mode. */
body.layout-brief {
  --bg: #f7f8f4;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #eef2ed;
  --text: #17201c;
  --muted: #66726b;
  --line: #dce4dd;
  --line-strong: #9cab9f;
  --accent: #0d6b55;
  --accent-2: #3267c8;
  --shadow: 0 18px 42px rgba(29, 47, 37, 0.1);
  color-scheme: light;
  background: #f7f8f4;
  color: var(--text);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

body.layout-brief .appShell {
  width: min(1360px, calc(100% - 40px));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

body.layout-brief .topbar,
body.layout-brief .filters,
body.layout-brief .kpis,
body.layout-brief .grid,
body.layout-brief .tablePanel,
body.layout-brief .topPairsPanel,
body.layout-brief .tabBar,
body.layout-brief .notesPanel {
  margin: 0;
}

body.layout-brief .topbar {
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

body.layout-brief h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(35px, 4.2vw, 64px);
  line-height: 1;
}

body.layout-brief .kpis {
  grid-template-columns: 1.3fr repeat(5, 1fr);
}

body.layout-brief .kpis article,
body.layout-brief .panel,
body.layout-brief .sourceBadge,
body.layout-brief select,
body.layout-brief input,
body.layout-brief button {
  background: #ffffff;
  color: var(--text);
}

body.layout-brief .grid {
  grid-template-columns: minmax(0, 1fr);
}

body.layout-brief .shareChart {
  max-height: 260px;
}

@media (max-width: 1180px) {
  body.layout-command .appShell,
  body.layout-ledger .appShell {
    display: block;
  }

  body.layout-command .filters,
  body.layout-ledger .filters {
    margin-bottom: 10px;
  }

  body.layout-command .tablePanel,
  body.layout-ledger .tablePanel {
    margin-top: 10px;
  }
}

@media (max-width: 720px) {
  body.layout-command .appShell,
  body.layout-ledger .appShell,
  body.layout-brief .appShell {
    width: min(100% - 20px, 1440px);
  }

  body.layout-command .kpis,
  body.layout-ledger .kpis,
  body.layout-heatmap .kpis,
  body.layout-brief .kpis {
    grid-template-columns: 1fr;
  }

  body.layout-heatmap .grid {
    grid-template-columns: 1fr;
  }
}
