/*
 * TEMPO editorial interface
 * Visual language adapted from the supplied Optimus reference: restrained
 * monochrome surfaces, serif display type, fine grid lines, and deliberate
 * motion. Runtime values continue to come exclusively from app.js.
 */

:root {
  --bg: #f2f1ec;
  --bg-elevated: #f8f7f2;
  --surface: rgba(250, 249, 245, .96);
  --surface-solid: #faf9f5;
  --surface-raised: #ebeae4;
  --surface-hover: #e4e3dc;
  --line: rgba(18, 18, 17, .16);
  --line-bright: rgba(18, 18, 17, .42);
  --text: #11110f;
  --text-soft: #393936;
  --muted: #72716b;
  --accent: #11110f;
  --accent-soft: rgba(17, 17, 15, .065);
  --accent-line: rgba(17, 17, 15, .45);
  --up: #176b51;
  --down: #a13e3e;
  --warning: #9b5e09;
  --info: #315f92;
  --model: #75508d;
  --llm: #665087;
  --radius: 2px;
  --radius-sm: 2px;
  --header-height: 86px;
  --footer-height: 34px;
  --page-gap: 14px;
  --panel-pad: 18px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  font-family: "Helvetica Neue", Helvetica, Arial, ui-sans-serif, system-ui, sans-serif;
}

body.theme-light {
  color-scheme: light;
  --bg: #f2f1ec;
  --bg-elevated: #f8f7f2;
  --surface: rgba(250, 249, 245, .96);
  --surface-solid: #faf9f5;
  --surface-raised: #ebeae4;
  --surface-hover: #e4e3dc;
  --line: rgba(18, 18, 17, .16);
  --line-bright: rgba(18, 18, 17, .42);
  --text: #11110f;
  --text-soft: #393936;
  --muted: #72716b;
  --accent: #11110f;
  --accent-soft: rgba(17, 17, 15, .065);
  --accent-line: rgba(17, 17, 15, .45);
  --up: #176b51;
  --down: #a13e3e;
  --warning: #9b5e09;
  --info: #315f92;
  --model: #75508d;
  --llm: #665087;
  background: var(--bg);
}

body.theme-dark {
  color-scheme: dark;
  --bg: #10100f;
  --bg-elevated: #151514;
  --surface: rgba(22, 22, 20, .97);
  --surface-solid: #181816;
  --surface-raised: #222220;
  --surface-hover: #292927;
  --line: rgba(247, 246, 239, .16);
  --line-bright: rgba(247, 246, 239, .42);
  --text: #f4f3ed;
  --text-soft: #d0cfc8;
  --muted: #8f8e87;
  --accent: #f4f3ed;
  --accent-soft: rgba(244, 243, 237, .07);
  --accent-line: rgba(244, 243, 237, .45);
  --up: #79c6a8;
  --down: #e08a8a;
  --warning: #dbad6a;
  --info: #91b8e3;
  --model: #c9a5dd;
  --llm: #bca7d5;
  background: var(--bg);
}

html,
body { background: var(--bg); }

body {
  background-image: none;
  letter-spacing: -.005em;
}

::selection { color: var(--bg); background: var(--text); }

.ambient {
  opacity: 1;
  background-image:
    linear-gradient(90deg, transparent calc(50% - .5px), var(--line) 50%, transparent calc(50% + .5px));
}

.ambient::before {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: min(25vw, 360px) min(25vw, 360px);
  opacity: .24;
  mask-image: linear-gradient(to bottom, #000, transparent 72%);
}

.ambient span { display: none; }

.app-shell { grid-template-rows: var(--header-height) minmax(0, 1fr) var(--footer-height); }

.topbar,
body.theme-light .topbar,
body.theme-dark .topbar {
  --nav-bg: var(--bg);
  --nav-surface: var(--surface-raised);
  --nav-surface-strong: var(--text);
  --nav-line: var(--line);
  --nav-text: var(--text);
  --nav-muted: var(--muted);
  --nav-inverse: var(--bg);
  position: relative;
  isolation: isolate;
  align-self: center;
  justify-self: center;
  width: min(1240px, calc(100% - 32px));
  min-height: 60px;
  grid-template-columns: minmax(190px, 1fr) auto minmax(330px, 1fr);
  gap: clamp(22px, 3vw, 48px);
  padding: 7px 9px 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
  box-shadow: 0 10px 30px rgba(17, 17, 15, .08), 0 2px 8px rgba(17, 17, 15, .05);
  backdrop-filter: blur(18px) saturate(1.12);
  transition: border-color .28s var(--ease), box-shadow .28s var(--ease), transform .28s var(--ease);
}

.topbar::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(110deg, color-mix(in srgb, var(--text) 5%, transparent), transparent 32%, transparent 68%, color-mix(in srgb, var(--text) 4%, transparent));
  opacity: 0;
  transition: opacity .28s var(--ease);
  pointer-events: none;
}

.topbar:hover {
  border-color: color-mix(in srgb, var(--text) 24%, var(--line));
  box-shadow: 0 14px 36px rgba(17, 17, 15, .1), 0 3px 10px rgba(17, 17, 15, .06);
  transform: translateY(-1px);
}

.topbar:hover::before { opacity: 1; }

.topbar .brand {
  gap: 11px;
  min-width: 0;
  padding-right: 10px;
  border-radius: 999px;
  transition: color .2s var(--ease), transform .2s var(--ease);
}

.topbar .brand:hover { transform: translateX(2px); }

.topbar .brand-logo {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border: 0;
  border-radius: 13px;
  background: var(--text);
  transition: border-radius .28s var(--ease), transform .28s var(--ease);
}

.topbar .brand:hover .brand-logo { border-radius: 50%; transform: rotate(-4deg) scale(1.03); }

.topbar .brand-logo img {
  width: 100%;
  height: 100%;
  filter: grayscale(1) contrast(1.5);
  mix-blend-mode: luminosity;
}

.topbar .brand-copy strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 400;
  letter-spacing: -.035em;
}

.topbar .brand-copy small { font-size: 7px; letter-spacing: .2em; }

.topbar .primary-nav {
  align-self: stretch;
  gap: clamp(6px, .65vw, 10px);
}

.topbar .primary-nav a {
  z-index: 0;
  padding: 0 clamp(9px, .75vw, 13px);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 520;
  letter-spacing: .01em;
  transition: color .2s var(--ease), transform .2s var(--ease);
}

.topbar .primary-nav a::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 7px 2px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent-soft);
  opacity: 0;
  transform: scale(.82);
  transition: opacity .2s var(--ease), transform .3s var(--ease), border-color .2s var(--ease);
}

.topbar .primary-nav a:hover,
.topbar .primary-nav a:focus-visible { color: var(--text); transform: translateY(-1px); }
.topbar .primary-nav a:hover::before,
.topbar .primary-nav a:focus-visible::before { opacity: 1; transform: scale(1); }
.topbar .primary-nav a.active { color: var(--text); font-weight: 680; }
.topbar .primary-nav a.active::before { border-color: var(--line); opacity: 1; transform: scale(1); }
.topbar .primary-nav a.active::after {
  left: 50%;
  right: auto;
  bottom: 5px;
  width: 12px;
  height: 1px;
  border-radius: 1px;
  background: var(--text);
  transform: translateX(-50%);
}

.topbar .system-cluster { justify-self: end; gap: 6px; }

.topbar .status-pill {
  height: 38px;
  min-height: 38px;
  border-radius: 999px;
  background: transparent;
  font-size: 8px;
  box-shadow: none;
  transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}

.topbar .status-pill-filled.status-pill-network { background: var(--surface-raised); }
.topbar .status-pill-primary { color: var(--bg); background: var(--text); }
.topbar .status-pill-control:hover,
.topbar .status-pill-control:focus-visible { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(17, 17, 15, .11); }
.topbar .status-pill-primary:hover { color: var(--bg); background: var(--text-soft); }

.topbar .wallet-trigger {
  min-width: 132px;
  height: 44px;
  min-height: 44px;
  padding-inline: 18px;
  font-size: 9px;
}
.topbar .wallet-trigger::after {
  content: "\2197";
  display: inline-block;
  margin-left: 1px;
  font-size: 11px;
  transition: transform .2s var(--ease);
}
.topbar .wallet-trigger:hover::after { transform: translate(2px, -2px); }

.menu-trigger {
  display: none;
  width: 34px;
  height: 34px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
}

.menu-trigger span { display: block; height: 1px; margin: 4px 0; background: var(--text); }

.page-host { background: transparent; }

.page { padding: var(--page-gap) clamp(14px, 2vw, 30px); }

.page-header { margin-bottom: 20px; }

.page-header h1,
.hero h1,
.section-intro h2,
.landing-cta h2,
.protocol-truth h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -.045em;
}

.page-header h1 { font-size: clamp(38px, 4vw, 58px); line-height: .95; }
.page-header p { max-width: 650px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.eyebrow { color: var(--muted); font-size: 9px; letter-spacing: .18em; }

.panel,
.proof-card,
.agent-card,
.fact,
.price-card,
.briefing,
.filter-bar,
.fair-value,
.empty-book-box,
.market-core > .book {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
  animation: none;
}

.panel::before,
.panel::after,
.proof-card::before,
.agent-card::before,
.fact::before,
.pulse-stat::before,
.price-card::before,
.settlement-row::before,
.fair-value::before,
.empty-book-box::before,
.market-core > .book::before,
.button::after { display: none; }

.panel:hover,
.proof-card:hover,
.agent-card:hover,
.fact:hover,
.briefing:hover,
.filter-bar:focus-within,
.fair-value:hover,
.empty-book-box:hover,
.market-core > .book:hover {
  border-color: var(--line-bright);
  box-shadow: none;
}

.panel-head { min-height: 54px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { font-size: 13px; font-weight: 640; }
.panel-head small { font-size: 9px; letter-spacing: .06em; }

.button {
  min-height: 42px;
  padding-inline: 17px;
  border: 1px solid var(--line-bright);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  transition: transform .25s var(--ease), color .25s ease, background .25s ease;
}

.button-primary,
body.theme-light .button-primary {
  border-color: var(--text);
  color: var(--bg);
  background: var(--text);
}

.button-primary:hover { color: var(--bg); background: var(--text-soft); transform: translateY(-2px); }
.button-ghost { color: var(--text); background: transparent; }
.button-ghost:hover { background: var(--accent-soft); }
.button-small { min-height: 31px; padding-inline: 11px; font-size: 9px; }

.prov { border-radius: 999px; font-size: 7px; }
.prov.chain { color: var(--up); }
.prov.derived { color: var(--muted); }

input,
select,
body.theme-light input,
body.theme-light select {
  min-height: 40px;
  border-color: var(--line);
  border-radius: 1px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: none;
}

.filter-bar { padding: 10px; }
.data-table th { background: var(--surface-raised); }
.data-table tbody tr:hover { background: var(--accent-soft); }

/* Editorial landing */
.landing { padding: 0; overflow-y: auto; }
.landing-inner { display: block; min-height: 100%; padding: 0 clamp(18px, 5vw, 78px) 70px; }

.editorial-hero {
  min-height: min(780px, calc(100dvh - var(--header-height) - var(--footer-height)));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, .78fr);
  align-items: stretch;
  border-inline: 1px solid var(--line);
}

.editorial-hero .hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(54px, 7vw, 110px) clamp(26px, 5vw, 78px);
  border-right: 1px solid var(--line);
}

.editorial-hero h1 {
  max-width: 820px;
  margin: 25px 0 0;
  font-size: clamp(60px, 7vw, 112px);
  line-height: .86;
}

.editorial-hero h1 em,
.section-intro h2 em,
.protocol-truth h2 em { color: var(--muted); font-weight: 400; }

.editorial-hero .hero-lede {
  max-width: 620px;
  margin-top: 30px;
  color: var(--text-soft);
  font-size: clamp(15px, 1.3vw, 19px);
  line-height: 1.55;
}

.hero-actions { margin-top: 28px; }
.hero-network { margin-top: 22px; font-size: 8px; letter-spacing: .08em; }

.auction-visual {
  position: relative;
  min-height: 620px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 42px;
  background: var(--surface-solid);
}

.auction-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle, #000, transparent 72%);
}

.auction-orbit { position: absolute; width: min(82%, 520px); aspect-ratio: 1; }
.auction-orbit span { position: absolute; inset: 0; border: 1px solid var(--line); border-radius: 50%; animation: tempo-spin 24s linear infinite; }
.auction-orbit span:nth-child(2) { inset: 12%; border-style: dashed; animation-direction: reverse; animation-duration: 18s; }
.auction-orbit span::before { content: ""; position: absolute; top: 9%; left: 14%; width: 7px; height: 7px; border-radius: 50%; background: var(--text); }
.auction-orbit i { position: absolute; inset: 26%; border: 1px solid var(--line-bright); border-radius: 50%; }

.auction-window {
  position: relative;
  z-index: 2;
  width: min(100%, 430px);
  border: 1px solid var(--line-bright);
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
  backdrop-filter: blur(14px);
}

.auction-window-head { display: flex; justify-content: space-between; gap: 20px; padding: 18px; border-bottom: 1px solid var(--line); }
.auction-window-head div { display: grid; gap: 8px; }
.auction-window-head span:first-child { color: var(--muted); font: 650 8px ui-monospace, monospace; letter-spacing: .1em; }
.auction-window-head b { font-family: Georgia, serif; font-size: 23px; font-weight: 400; }
.auction-window-head .countdown { font: 500 14px ui-monospace, monospace; }
.auction-window-main { display: grid; grid-template-columns: 1fr 1fr; }
.auction-window-main > div { min-height: 96px; padding: 17px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.auction-window-main > div:nth-child(2n) { border-right: 0; }
.auction-window-main span { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.auction-window-main strong { display: block; margin-top: 13px; font: 400 24px ui-monospace, monospace; }
.auction-window-id { padding: 12px 17px; color: var(--muted); font: 9px ui-monospace, monospace; }
.auction-caption { position: absolute; right: 26px; bottom: 22px; left: 26px; display: flex; justify-content: space-between; color: var(--muted); font: 7px ui-monospace, monospace; letter-spacing: .14em; }

.live-ledger { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-top: 0; }
.live-ledger > div { min-height: 126px; padding: 24px; border-right: 1px solid var(--line); background: var(--surface); }
.live-ledger > div:last-child { border-right: 0; }
.live-ledger strong { display: block; font-family: Georgia, serif; font-size: clamp(32px, 4vw, 54px); font-weight: 400; }
.live-ledger span { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 18px; color: var(--muted); font: 8px ui-monospace, monospace; letter-spacing: .08em; }

.operating-model { display: grid; grid-template-columns: .8fr 1.4fr; gap: clamp(40px, 7vw, 110px); padding: clamp(90px, 12vw, 170px) clamp(12px, 5vw, 70px); }
.section-intro h2 { margin: 22px 0 0; font-size: clamp(48px, 5.5vw, 82px); line-height: .92; }
.section-intro p { max-width: 510px; margin: 28px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.operating-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.operating-grid article { min-height: 245px; padding: 28px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.operating-grid article > span { color: var(--muted); font: 8px ui-monospace, monospace; letter-spacing: .12em; }
.operating-grid h3 { max-width: 280px; margin: 55px 0 0; font-family: Georgia, serif; font-size: 27px; font-weight: 400; line-height: 1.05; }
.operating-grid p { max-width: 350px; margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.lifecycle-section { padding: 65px 0 95px; border-top: 1px solid var(--line); }
.compact-intro { display: flex; align-items: end; justify-content: space-between; margin-bottom: 45px; }
.compact-intro h2 { font-size: clamp(46px, 5vw, 72px); }
.lifecycle { grid-template-columns: repeat(8, minmax(130px, 1fr)); border-radius: 0; background: var(--line); }
.lifecycle-step { min-height: 120px; padding: 18px; background: var(--surface); }
.lifecycle-step.active { color: var(--bg); background: var(--text); box-shadow: none; }
.lifecycle-step.active b, .lifecycle-step.active small { color: var(--bg); }
.lifecycle-step:not(:last-child)::after { display: none; }

.landing-cta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  padding: clamp(65px, 9vw, 120px);
  color: var(--bg);
  background: var(--text);
}
.landing-cta .eyebrow { color: color-mix(in srgb, var(--bg) 60%, transparent); }
.landing-cta h2 { margin: 20px 0 0; font-size: clamp(48px, 6vw, 90px); line-height: .9; }
.landing-cta p { max-width: 510px; margin: 0; color: color-mix(in srgb, var(--bg) 70%, transparent); font-size: 14px; line-height: 1.7; }
.landing-cta .button-primary { border-color: var(--bg); color: var(--text); background: var(--bg); }
.landing-cta .button-ghost { border-color: color-mix(in srgb, var(--bg) 45%, transparent); color: var(--bg); }

/* Protocol */
.protocol-page { overflow-y: auto; }
.protocol-inner { max-width: 1540px; margin: 0 auto; padding: 35px 0 90px; }
.protocol-facts { display: grid; grid-template-columns: repeat(6, 1fr); margin-top: 42px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.protocol-facts .fact { min-height: 125px; border-width: 0 1px 1px 0; }
.protocol-flow { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 80px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.protocol-flow article { min-height: 285px; padding: 25px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.protocol-flow article > span { color: var(--muted); font: 9px ui-monospace, monospace; }
.protocol-flow h2 { margin: 78px 0 0; font-family: Georgia, serif; font-size: 34px; font-weight: 400; }
.protocol-flow p { color: var(--muted); font-size: 12px; line-height: 1.65; }
.protocol-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.protocol-rows { padding: 0; }
.protocol-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.protocol-row:last-child { border-bottom: 0; }
.protocol-row span { color: var(--muted); font-size: 11px; text-transform: capitalize; }
.protocol-row b { font: 500 12px ui-monospace, monospace; }
.protocol-agents { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.protocol-agent { min-height: 100%; padding: 24px; border: 1px solid var(--line); background: var(--surface); }
.protocol-agent > div { display: flex; align-items: baseline; justify-content: space-between; }
.protocol-agent h3 { margin: 9px 0 0; font-family: Georgia, serif; font-size: 30px; font-weight: 400; }
.protocol-agent p { min-height: 64px; margin: 28px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.protocol-truth { max-width: 900px; padding: 130px 0 60px; }
.protocol-truth h2 { margin: 24px 0 0; font-size: clamp(54px, 7vw, 100px); line-height: .88; }
.protocol-truth p { max-width: 620px; margin: 30px 0 0; color: var(--muted); font-size: 14px; line-height: 1.75; }

/* Existing observatory surfaces, made calmer and more spacious. */
.dashboard,
.markets-page,
.history-page,
.market-detail-page { padding-top: 22px; }
.dashboard-grid { gap: 10px; }
.pulse-grid { background: var(--line); }
.pulse-stat { background: var(--surface-solid); }
.market-item:hover, .market-item.active { box-shadow: inset 2px 0 var(--text); }
.risk-track { display: block; background: var(--surface-raised); }
.risk-track i { background: var(--text); }
.fair-value-number { font-family: Georgia, serif; }
.book-level.bid::before { background: color-mix(in srgb, var(--up) 15%, transparent); }
.book-level.ask::before { background: color-mix(in srgb, var(--down) 15%, transparent); }
.right-tab { font-size: 10px; }

.status-rail,
body.theme-light .status-rail,
body.theme-dark .status-rail {
  padding-inline: clamp(16px, 3vw, 46px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: var(--bg);
  font-size: 7px;
  letter-spacing: .08em;
}

.zero-mock { color: var(--text); }

.overlay,
.drawer-backdrop { backdrop-filter: blur(7px); }
.command-dialog,
.settings-dialog,
.side-drawer,
body.theme-light .command-dialog,
body.theme-light .settings-dialog,
body.theme-light .side-drawer { border-radius: 2px; background: var(--surface-solid); }

.wallet-modal-backdrop {
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--text) 30%, transparent);
}

.wallet-modal,
body.theme-light .wallet-modal,
body.theme-dark .wallet-modal {
  width: min(620px, calc(100vw - 32px));
  height: auto;
  max-height: min(780px, calc(100dvh - 48px));
  padding-bottom: 18px;
  border: 1px solid var(--line-bright);
  border-radius: 18px;
  background: var(--surface-solid);
  box-shadow: 0 30px 90px rgba(17, 17, 15, .24), 0 8px 24px rgba(17, 17, 15, .12);
  animation: wallet-pop .3s var(--ease) both;
  overflow-y: auto;
}

.wallet-modal .dialog-head { min-height: 78px; padding-inline: 22px; }
.wallet-modal .dialog-head h2 { font-family: Georgia, "Times New Roman", serif; font-size: 27px; font-weight: 400; }
.wallet-modal .trust-callout { margin: 18px 22px; }
.wallet-modal .wallet-panel { padding-inline: 22px; }

@keyframes wallet-pop {
  from { opacity: 0; transform: translateY(18px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.mobile-menu {
  position: fixed;
  z-index: 180;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 24px;
  color: var(--text);
  background: var(--bg);
  animation: menu-in .45s var(--ease) both;
}
.mobile-menu-head, .mobile-menu-foot { display: flex; justify-content: space-between; align-items: center; }
.mobile-menu nav { display: grid; align-content: center; }
.mobile-menu nav a { display: flex; align-items: baseline; gap: 22px; padding: 13px 0; border-bottom: 1px solid var(--line); font-family: Georgia, serif; font-size: clamp(38px, 11vw, 62px); text-decoration: none; }
.mobile-menu nav a span { color: var(--muted); font: 8px ui-monospace, monospace; }
.mobile-menu nav a.active { padding-left: 18px; color: var(--muted); }
.mobile-menu-foot { color: var(--muted); font: 7px ui-monospace, monospace; letter-spacing: .1em; }

@keyframes tempo-spin { to { transform: rotate(360deg); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-12px); } }

@media (max-width: 1180px) {
  .topbar { width: calc(100% - 28px); grid-template-columns: auto 1fr auto; gap: 14px; }
  .topbar .command-trigger b { display: none; }
  .topbar .primary-nav { gap: 2px; }
  .topbar .primary-nav a { padding-inline: 9px; }
  .editorial-hero { grid-template-columns: 1.05fr .95fr; }
  .protocol-facts { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 940px) {
  :root { --header-height: 76px; }
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100dvh; grid-template-rows: var(--header-height) minmax(calc(100dvh - var(--header-height) - var(--footer-height)), auto) var(--footer-height); }
  .topbar {
    position: sticky;
    top: 8px;
    width: calc(100% - 20px);
    min-height: 58px;
    grid-template-columns: 1fr auto;
    padding: 7px 8px 7px 12px;
  }
  .topbar > .brand { position: relative; z-index: 1; }
  .topbar > .system-cluster {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
  }
  .topbar .primary-nav, .topbar .desktop-status, .topbar .command-trigger, .topbar #theme-toggle { display: none; }
  .menu-trigger { display: block; }
  .page-host { overflow: visible; }
  .editorial-hero { min-height: auto; grid-template-columns: 1fr; }
  .editorial-hero .hero-copy { min-height: 650px; border-right: 0; border-bottom: 1px solid var(--line); }
  .auction-visual { min-height: 580px; }
  .live-ledger { grid-template-columns: 1fr 1fr; }
  .live-ledger > div:nth-child(2) { border-right: 0; }
  .live-ledger > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .operating-model { grid-template-columns: 1fr; }
  .landing-cta { grid-template-columns: 1fr; }
  .protocol-flow { grid-template-columns: 1fr 1fr; }
  .protocol-columns { grid-template-columns: 1fr; }
  .status-rail nav a { display: none; }
}

@media (max-width: 620px) {
  :root { --header-height: 70px; --footer-height: 30px; --panel-pad: 13px; }
  .topbar { top: 6px; width: calc(100% - 12px); min-height: 56px; padding: 6px 7px 6px 10px; }
  .topbar > .system-cluster { right: 7px; }
  .topbar .brand-copy { display: grid; }
  .topbar .brand-copy strong { font-size: 18px; }
  .topbar .brand-copy small { display: none; }
  .topbar .status-pill-network { display: none; }
  .topbar .wallet-trigger { width: auto; min-width: 116px; height: 40px; min-height: 40px; padding-inline: 13px; }
  .topbar .wallet-trigger span:last-child { display: inline; max-width: none; overflow: visible; text-overflow: clip; }
  .topbar .wallet-trigger::after { display: inline-block; }
  .wallet-modal-backdrop { padding: 10px; }
  .wallet-modal,
  body.theme-light .wallet-modal,
  body.theme-dark .wallet-modal { width: min(620px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); border-radius: 14px; }
  .landing-inner { padding-inline: 10px; padding-bottom: 10px; }
  .editorial-hero .hero-copy { min-height: 590px; padding: 70px 22px 48px; }
  .editorial-hero h1 { font-size: clamp(56px, 17vw, 78px); }
  .editorial-hero .hero-lede { font-size: 15px; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions .button { width: 100%; }
  .auction-visual { min-height: 500px; padding: 18px; }
  .auction-window-main > div { min-height: 82px; padding: 13px; }
  .auction-window-main strong { font-size: 18px; }
  .auction-orbit { width: 115%; }
  .live-ledger { grid-template-columns: 1fr; }
  .live-ledger > div { min-height: 100px; border-right: 0; border-bottom: 1px solid var(--line); }
  .live-ledger > div:last-child { border-bottom: 0; }
  .operating-model { padding: 85px 10px; }
  .section-intro h2 { font-size: 52px; }
  .operating-grid { grid-template-columns: 1fr; }
  .operating-grid article { min-height: 215px; }
  .lifecycle-section { padding: 60px 0; }
  .compact-intro { display: block; padding-inline: 10px; }
  .compact-intro h2 { margin-top: 20px; }
  .landing-cta { padding: 70px 24px; gap: 38px; }
  .landing-cta h2 { font-size: 55px; }
  .page { padding-inline: 10px; }
  .page-header { display: grid; align-items: start; }
  .page-header h1 { font-size: 43px; }
  .page-actions { justify-content: flex-start; flex-wrap: wrap; }
  .protocol-inner { padding-top: 20px; }
  .protocol-facts { grid-template-columns: 1fr 1fr; }
  .protocol-flow { grid-template-columns: 1fr; margin-top: 50px; }
  .protocol-flow article { min-height: 230px; }
  .protocol-flow h2 { margin-top: 50px; }
  .protocol-agents { grid-template-columns: 1fr; }
  .protocol-truth { padding: 90px 10px 40px; }
  .protocol-truth h2 { font-size: 58px; }
  .status-rail nav { display: none; }
  .status-rail { justify-content: center; }
}

@media (max-width: 350px) {
  .topbar .brand-copy { display: none; }
  .topbar .wallet-trigger { min-width: 108px; padding-inline: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .auction-orbit span,
  .mobile-menu { animation: none !important; }
  .topbar,
  .topbar *,
  .topbar *::before,
  .topbar *::after { transition: none !important; }
  .topbar:hover,
  .topbar .brand:hover,
  .topbar .brand:hover .brand-logo,
  .topbar .primary-nav a:hover,
  .topbar .status-pill-control:hover { transform: none; }
  .wallet-modal { animation: none !important; }
}

/* Reliable nested scrolling for live panels and full-page data surfaces. */
.venue-panel,
.market-preview,
.agents-risk-panel,
.evidence-panel,
.detail-book,
.detail-fair,
.detail-agents,
.detail-proof {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.venue-panel-body {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.market-list {
  height: auto;
  min-height: 0;
  overflow-y: auto;
}

.markets-page {
  grid-template-rows: auto auto minmax(320px, 1fr) auto;
  overflow-y: auto;
}

.recent-finalized {
  min-height: 240px;
  max-height: min(34vh, 320px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.recent-finalized > .panel-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.agents-risk-body,
.evidence-body,
.evidence-body > .scroll-region,
.detail-book > .scroll-region,
.detail-proof > .scroll-region {
  min-height: 0;
}

.evidence-body {
  overflow: hidden;
}

.evidence-body > .scroll-region {
  height: 100%;
  overflow-y: auto;
}

.evidence-events {
  min-height: 0;
}

.scroll-region,
.data-table-wrap,
.docs-sidebar-spa,
.docs-content-spa,
.page-scroll,
.pricing-page,
.protocol-page,
.landing,
.dashboard,
.lifecycle,
.lifecycle-detail,
.dashboard-lifecycle-track {
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) {
  .recent-finalized {
    min-height: 280px;
    max-height: 360px;
  }
}

/* Judge-facing intelligence: live aggregates, never hard-coded performance. */
.dashboard-intro {
  min-width: 0;
}

.dashboard-intro .page-header {
  margin-bottom: 10px;
}

.firm-intelligence {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  background: var(--surface-solid);
}

.firm-intelligence::before {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid transparent;
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 8%, var(--flow-a), var(--flow-b), transparent 75%) border-box;
  background-size: 280% 100%;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  animation: edge-flow 8s linear infinite;
}

.intelligence-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
}

.intelligence-head > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.intelligence-head h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 16px;
  font-weight: 400;
}

.intelligence-head small {
  color: var(--muted);
  font: 9px ui-monospace, monospace;
  white-space: nowrap;
}

.intelligence-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.intelligence-actions .panel-toggle {
  flex: 0 0 auto;
}

.intelligence-grid-shell {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr;
  overflow: hidden;
  opacity: 1;
  transform-origin: top;
  transform: translateY(0);
  visibility: visible;
  transition: grid-template-rows .24s var(--ease), opacity .2s ease, transform .24s var(--ease), visibility 0s;
}

.firm-intelligence.intelligence-minimized .intelligence-head {
  border-bottom-color: transparent;
}

.firm-intelligence.intelligence-minimized .intelligence-grid-shell {
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(-6px);
  visibility: hidden;
  pointer-events: none;
  transition: grid-template-rows .2s var(--ease), opacity .16s ease, transform .2s var(--ease), visibility 0s .2s;
}

.intelligence-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(9, minmax(112px, 1fr));
  overflow-x: auto;
}

.intelligence-stat {
  min-width: 0;
  min-height: 60px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 9px 11px;
  border-right: 1px solid var(--line);
}

.intelligence-stat:last-child {
  border-right: 0;
}

.intelligence-stat > span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font: 700 9px/1.3 ui-monospace, monospace;
  white-space: nowrap;
}

.intelligence-stat > b {
  overflow: hidden;
  color: var(--text);
  font: 560 17px/1 ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* First-visit guide: product framing plus an immediate path to participation. */
.overlay.onboarding-overlay {
  place-items: center;
  padding: 18px;
  overflow-y: auto;
}

.onboarding-dialog {
  position: relative;
  width: min(940px, calc(100vw - 36px));
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  border: 1px solid var(--line-bright);
  border-radius: 16px;
  background: var(--surface-solid);
  box-shadow: 0 35px 120px rgba(0,0,0,.48);
  animation: dialog-in .35s var(--ease);
}

.onboarding-dialog::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 85% 0%, var(--accent-soft), transparent 38%);
}

.onboarding-copy {
  position: relative;
  padding: clamp(24px, 5vw, 52px);
  border-bottom: 1px solid var(--line);
}

.onboarding-copy h2 {
  max-width: 780px;
  margin: 18px 0 0;
  font-family: Georgia, serif;
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 400;
  line-height: .95;
  letter-spacing: -.035em;
}

.onboarding-copy h2 em {
  color: var(--accent);
  font-style: normal;
}

.onboarding-copy p {
  max-width: 760px;
  margin: 22px 0 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.65;
}

.onboarding-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}

.onboarding-map li {
  min-height: 180px;
  display: grid;
  align-content: space-between;
  gap: 24px;
  padding: 22px;
  border-right: 1px solid var(--line);
}

.onboarding-map li:last-child {
  border-right: 0;
}

.onboarding-map li > span {
  color: var(--accent);
  font: 700 12px ui-monospace, monospace;
}

.onboarding-map b {
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 400;
}

.onboarding-map p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.onboarding-truth,
.onboarding-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
}

.onboarding-truth {
  justify-content: space-between;
  color: var(--muted);
  font: 700 9px ui-monospace, monospace;
  letter-spacing: .06em;
}

.onboarding-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

body.theme-light .onboarding-dialog,
body.theme-dark .onboarding-dialog {
  background: var(--surface-solid);
}

body.reduced-motion .intelligence-grid-shell {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .intelligence-grid-shell { transition: none !important; }
}

@media (max-width: 940px) {
  .intelligence-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .onboarding-map { grid-template-columns: 1fr 1fr; }
  .onboarding-map li:nth-child(2) { border-right: 0; }
  .onboarding-map li:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 620px) {
  .intelligence-head { align-items: flex-start; flex-direction: column; gap: 4px; padding-block: 10px; }
  .intelligence-head > div { align-items: flex-start; flex-direction: column; gap: 3px; }
  .intelligence-actions { width: 100%; justify-content: space-between; }
  .intelligence-actions small { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .intelligence-grid { grid-template-columns: repeat(2, minmax(145px, 1fr)); }
  .intelligence-stat:nth-child(2n) { border-right: 0; }
  .onboarding-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .onboarding-copy { padding: 28px 20px; }
  .onboarding-copy h2 { font-size: 39px; }
  .onboarding-map { grid-template-columns: 1fr; }
  .onboarding-map li { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .onboarding-map li:last-child { border-bottom: 0; }
  .onboarding-truth { align-items: flex-start; flex-direction: column; }
  .onboarding-actions { align-items: stretch; flex-direction: column; }
  .onboarding-actions .button { width: 100%; }
}

/* Keep the expanded agent window self-contained without shrinking status badges. */
@media (min-width: 901px) {
  .dashboard-grid.right-expanded:not(.agents-minimized) .agents-risk-panel,
  .dashboard-grid.right-expanded:not(.evidence-minimized) .evidence-panel {
    grid-column: 3;
    grid-row: 1 / 3;
    width: auto;
    justify-self: stretch;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .agents-risk-panel > .panel-head {
    min-height: 48px;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .agents-risk-body {
    display: grid;
    grid-template-rows: auto 1px auto;
    align-content: start;
    gap: 6px;
    padding: 6px 10px;
    overflow: hidden;
    scrollbar-gutter: auto;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .agent-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .agent-card {
    padding: 4px 10px;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .agent-meta {
    gap: 2px 8px;
    margin-top: 3px;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .agent-meta div span {
    min-height: 22px;
    font-size: 10px;
    line-height: 1.2;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .agent-meta div b {
    margin-top: 2px;
    font-size: 14px;
    line-height: 1.2;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .agents-risk-body > .drawer-divider {
    margin: 0;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .risk-bars {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .risk-row-head {
    display: grid;
    align-items: flex-start;
    align-content: start;
    gap: 3px;
    font-size: 10px;
    line-height: 1.2;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .risk-row-head b {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    font-size: 10px;
    line-height: 1.2;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .risk-track {
    height: 4px;
    margin-top: 4px;
  }

  .dashboard-grid.right-expanded .panel-switch {
    min-width: 116px;
  }
}

@media (max-width: 900px) {
  .dashboard-grid.right-expanded:not(.agents-minimized) .agents-risk-panel {
    height: auto;
    display: block;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .agents-risk-body {
    max-height: none;
    overflow: visible;
    scrollbar-gutter: auto;
  }

  .dashboard-grid.right-expanded:not(.agents-minimized) .risk-row-head b {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
  }
}
