:root {
  --ground: #0B1A21;
  --surface: #0F2129;
  --raised: #142A33;
  --border: #1E3A44;
  --ink: #EDF3F2;
  --muted: #7C9199;
  --subtle: #4E656D;
  --amber: #E9922B;
  --green: #35D07F;
  --red: #D9534F;
  --blue: #3AA0FF;
  --display: "Chakra Petch", "JetBrains Mono", sans-serif;
  --body: "Inter Tight", Inter, sans-serif;
  --mono: "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }
html { background: var(--ground); color: var(--ink); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
::selection { background: rgba(233,146,43,.24); color: var(--ink); }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--ground); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.topbar { min-height: 56px; display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 18px; padding: 0 24px; border-bottom: 1px solid var(--border); position: relative; z-index: 2; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 15px/1 var(--display); letter-spacing: .12em; }
.brand img { width: 29px; height: 29px; image-rendering: auto; }
.chain-chip, .pill, #read-stamp, .status-rail { font: 500 12px/1 var(--mono); letter-spacing: .04em; }
.chain-chip { display: flex; gap: 7px; align-items: center; color: var(--muted); border: 1px solid var(--border); background: var(--surface); padding: 7px 9px; border-radius: 4px; }
.chain-chip b { color: var(--blue); }
.chain-chip span { color: var(--subtle); }
nav { justify-self: center; display: flex; height: 56px; gap: clamp(14px,2vw,28px); }
nav a { position: relative; display: grid; place-items: center; color: var(--muted); font: 600 12px/1 var(--mono); letter-spacing: .08em; }
nav a:hover, nav a.active { color: var(--ink); }
nav a.active::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--amber); }
.live-read { display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); }
.pill, #read-stamp { border: 1px solid var(--border); background: var(--surface); padding: 7px 9px; border-radius: 4px; white-space: nowrap; }
.pill { display: flex; gap: 7px; align-items: center; color: var(--ink); }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.pill.error i { background: var(--red); }
.pill.reading i { background: var(--amber); animation: blink 1s steps(2,end) infinite; }
@keyframes blink { 50% { opacity: .32; } }
.mobile-nav { display: none; }

.status-rail { min-height: 42px; display: flex; align-items: center; gap: 12px; padding: 6px 24px; border-bottom: 1px solid var(--border); color: var(--muted); overflow-x: auto; white-space: nowrap; }
.status-label { color: var(--blue); font-weight: 700; }
.status-rail strong { color: var(--ink); }
.copy-button, .buy-button { min-height: 28px; border: 1px solid var(--border); border-radius: 2px; padding: 6px 10px; background: var(--raised); color: var(--muted); font: 600 12px/1 var(--mono); }
.copy-button:disabled { opacity: .55; cursor: not-allowed; }
.buy-button { border-color: rgba(233,146,43,.55); color: var(--amber); }
.rail-spacer { flex: 1; }
.status-rail > a { color: var(--amber); text-decoration: none; }
.status-rail > a:hover { text-decoration: underline; }

main { width: min(100%,1440px); min-height: calc(100vh - 142px); margin: 0 auto; padding: 20px 24px 28px; }
.route-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.route-head h1 { margin: 0; font: 700 clamp(30px,4vw,40px)/1.06 var(--display); letter-spacing: -.01em; }
.route-head p { max-width: 720px; margin: 6px 0 0; color: var(--muted); font-size: 16px; }
.stamp { flex: 0 0 auto; color: var(--muted); font: 500 12px/1.45 var(--mono); text-align: right; }
.eyebrow, .panel-title, th, .label { color: var(--muted); font: 600 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.read-note { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font: 500 12px/1.5 var(--mono); }
.read-note::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.panel { border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.panel-pad { padding: 18px; }
.panel-header { min-height: 43px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.loading { min-height: 65vh; display: grid; place-content: center; text-align: center; }
.loading h1 { font: 700 38px/1 var(--display); margin: 12px 0; }
.loading p { color: var(--muted); }
.route-read-state { display: block; margin-top: 5px; color: var(--muted); font: 500 11px/1.35 var(--mono); text-transform: none; }
.route-read-state.red { color: var(--red); }
.shell-value { display: block; min-height: 34px; margin-top: 12px; color: var(--muted); font: 600 13px/1.2 var(--mono); }
.shell-value.failed { color: var(--red); }
.shell-panel { min-height: 278px; }
.shell-panel.ring-panel, .shell-panel.strip-panel { min-height: 440px; }
.shell-chart { min-height: 230px; display: grid; align-content: center; gap: 18px; padding: 24px 18px; }
.skeleton-line { display: block; width: min(100%,520px); height: 12px; border-radius: 2px; background: linear-gradient(90deg,var(--raised) 20%,var(--border) 45%,var(--raised) 70%); background-size: 220% 100%; animation: skeleton-pulse 1.35s ease-in-out infinite; }
.skeleton-line:nth-child(2) { width: 72%; }
.skeleton-line:nth-child(3) { width: 88%; }
.skeleton-line.failed { width: 84px; background: var(--raised); animation: none; }
.route-shell-table .table-wrap { min-height: 270px; }
.route-shell-table td { height: 39px; }
.route-shell-table td .skeleton-line { width: 74%; height: 9px; }
.shell-flow { min-height: 148px; display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: center; gap: 12px; padding: 18px; color: var(--muted); font: 600 11px/1.3 var(--mono); }
.shell-flow span { min-height: 82px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--ground); }
.shell-flow i { color: var(--amber); font-style: normal; }
.shell-api { min-height: 214px; display: grid; align-content: start; gap: 12px; }
.shell-api code { color: var(--muted); font: 500 11px/1.4 var(--mono); }
@keyframes skeleton-pulse { 0% { background-position: 100% 0; opacity: .58; } 50% { opacity: 1; } 100% { background-position: -120% 0; opacity: .58; } }

.kpi-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.kpi { min-height: 145px; padding: 17px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; }
.kpi.active::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg,var(--amber),var(--green)); }
.kpi-value { display: flex; align-items: baseline; gap: 8px; margin: 12px 0; color: var(--ink); font: 700 clamp(29px,4vw,52px)/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
.kpi-value small { color: var(--muted); font-size: 18px; font-weight: 400; letter-spacing: 0; }
.kpi-foot { color: var(--muted); font: 500 12px/1.4 var(--mono); }
.amber { color: var(--amber); }
.green { color: var(--green); }
.red { color: var(--red); }

.board-visuals { display: grid; grid-template-columns: 400px 1fr; gap: 14px; margin-top: 14px; }
.ring-panel, .strip-panel { min-height: 440px; }
.ring-wrap { position: relative; min-height: 340px; display: grid; place-items: center; }
.ring { width: min(310px,90%); transform: rotate(-90deg); }
.ring circle { fill: none; stroke: var(--border); stroke-width: 15; stroke-dasharray: 41 14; }
.ring .pulse { stroke: url(#ringGradient); stroke-width: 16; stroke-dasharray: 41 618; stroke-dashoffset: var(--ring-offset,0); transition: stroke-dashoffset .45s ease; filter: drop-shadow(0 0 5px rgba(233,146,43,.25)); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.ring-center strong { margin: 5px 0; font: 700 21px/1.2 var(--mono); }
.ring-center span { color: var(--muted); font: 500 12px/1.5 var(--mono); }
.ring-center .current-address { color: var(--amber); }
.ring-meta { display: grid; grid-template-columns: repeat(3,1fr); border-top: 1px solid var(--border); }
.ring-meta div { padding: 12px 8px; text-align: center; border-right: 1px solid var(--border); }
.ring-meta div:last-child { border: 0; }
.ring-meta strong { display: block; margin-top: 4px; font: 600 12px/1.3 var(--mono); }
.strip-wrap { position: relative; height: 310px; margin: 16px; padding-top: 42px; border-bottom: 1px solid var(--border); }
.median-line { position: absolute; z-index: 2; left: 0; right: 0; bottom: 48%; border-top: 1px dashed var(--muted); }
.median-line span { position: absolute; right: 0; top: -20px; color: var(--muted); background: var(--surface); font: 500 12px/1 var(--mono); }
.bars { height: 100%; display: flex; align-items: end; gap: 4px; }
.bar { flex: 1 1 0; min-width: 3px; height: var(--h); background: linear-gradient(180deg,var(--green),var(--amber)); transform-origin: bottom; animation: grow .4s ease both; }
.bar.miss { background: var(--red); }
@keyframes grow { from { transform: scaleY(.12); opacity: .35; } }
.strip-axis { display: flex; justify-content: space-between; padding: 0 16px 14px; color: var(--muted); font: 500 12px/1 var(--mono); }
.source-note { margin-top: 14px; padding: 11px 14px; border-left: 2px solid var(--amber); background: var(--surface); color: var(--muted); font: 500 12px/1.6 var(--mono); }

.table-panel { margin-top: 14px; overflow: hidden; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font: 500 12px/1.4 var(--mono); font-variant-numeric: tabular-nums; }
th, td { min-height: 38px; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; }
th.num, td.num { text-align: right; }
tbody tr:hover { background: var(--raised); }
tbody tr:first-child { background: rgba(233,146,43,.04); }
.table-panel td a { color: var(--amber); }
.table-panel td a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.address { color: var(--ink); font-family: var(--mono); }
.tag { display: inline-flex; align-items: center; padding: 3px 7px; border: 1px solid var(--border); border-radius: 2px; color: var(--muted); font: 600 12px/1 var(--mono); }
.tag.blue { border-color: rgba(58,160,255,.35); color: var(--blue); }
.share { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; }
.share i { width: 64px; height: 3px; background: var(--border); }
.share i::after { content: ""; display: block; width: var(--share); height: 100%; background: var(--amber); }
.table-summary { display: flex; justify-content: space-between; gap: 20px; padding: 11px 14px; color: var(--muted); font: 500 12px/1.4 var(--mono); }

.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 14px; }
.stat { padding: 16px; }
.stat strong { display: block; margin-top: 10px; font: 700 28px/1 var(--mono); }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.split-grid > *, .cards > * { min-width: 0; }
.distribution { display: grid; gap: 12px; padding: 18px; }
.bucket { display: grid; grid-template-columns: 110px 1fr 58px; align-items: center; gap: 12px; color: var(--muted); font: 500 12px/1 var(--mono); }
.bucket-track { height: 7px; border: 1px solid var(--border); }
.bucket-fill { height: 100%; width: var(--w); background: var(--amber); }
.cards { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.rule-card, .method-card, .api-card { padding: 18px; }
.rule-card h2, .method-card h2, .api-card h2 { margin: 6px 0 8px; font: 700 21px/1.15 var(--display); }
.rule-card p, .method-card p, .api-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.recipe { display: grid; grid-template-columns: 92px 1fr; gap: 8px 14px; margin: 15px 0 0; }
.recipe dt { color: var(--subtle); font: 600 12px/1.45 var(--mono); text-transform: uppercase; }
.recipe dd { margin: 0; color: var(--muted); font: 500 12px/1.45 var(--mono); }
pre { max-width: 100%; margin: 12px 0 0; padding: 14px; overflow: auto; border: 1px solid var(--border); border-radius: 2px; background: var(--ground); color: var(--ink); font: 500 12px/1.55 var(--mono); }
.endpoint { color: var(--green); }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.links a { color: var(--amber); font: 600 12px/1.2 var(--mono); border-bottom: 1px solid var(--amber); }

footer { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 24px; border-top: 1px solid var(--border); color: var(--muted); font: 500 12px/1.4 var(--mono); }
footer div { display: flex; align-items: center; gap: 14px; }
footer a:hover { color: var(--ink); }
footer p { margin: 0; color: var(--subtle); }
.arc-badge { color: var(--blue); border: 1px solid rgba(58,160,255,.35); padding: 3px 6px; border-radius: 2px; }

@media (max-width: 1160px) {
  .topbar { grid-template-columns: auto auto 1fr; }
  .topbar nav { display: none; }
  .mobile-nav { display: flex; gap: 22px; overflow-x: auto; padding: 11px 24px; border-bottom: 1px solid var(--border); color: var(--muted); font: 600 12px/1 var(--mono); }
  .board-visuals { grid-template-columns: 360px 1fr; }
}

@media (max-width: 820px) {
  .topbar { grid-template-columns: 1fr auto; padding: 0 14px; }
  .chain-chip { display: none; }
  #read-stamp { display: none; }
  .status-rail { padding-inline: 14px; }
  main { padding: 16px 14px 24px; min-height: calc(100vh - 190px); }
  .route-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .stamp { text-align: left; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .board-visuals, .split-grid, .cards { grid-template-columns: 1fr; }
  .ring-panel, .strip-panel { min-height: auto; }
  .stat-row { grid-template-columns: 1fr; }
  footer { align-items: flex-start; flex-direction: column; }
  .shell-flow { grid-template-columns: 1fr 1fr; }
  .shell-flow i { display: none; }
}

@media (max-width: 480px) {
  .topbar { min-height: 54px; }
  .brand img { width: 27px; height: 27px; }
  .mobile-nav { padding-inline: 14px; }
  .status-rail { min-height: 45px; }
  .rail-spacer, .status-rail > :nth-last-child(-n+2) { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { min-height: 130px; padding: 13px; }
  .kpi-value { font-size: 27px; }
  .kpi-value small { font-size: 14px; }
  .board-visuals { gap: 8px; margin-top: 8px; }
  .ring-wrap { min-height: 305px; }
  .strip-wrap { height: 270px; margin-inline: 12px; }
  .bars { gap: 2px; }
  .panel-header { padding-inline: 12px; }
  th, td { padding: 9px 11px; }
  footer { padding-inline: 14px; }
  footer div { flex-wrap: wrap; }
  .shell-flow { grid-template-columns: 1fr; }
}

/* FIX UI/UX v1 — dense dispatch-console modules */
.route-kicker { display: block; margin-bottom: 7px; color: var(--amber); font: 600 11px/1 var(--mono); letter-spacing: .14em; }
.mobile-nav a.active { color: var(--ink); }
.section-gap { margin-top: 14px; }

.metric-ribbon { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border: 1px solid var(--border); background: var(--surface); }
.metric-ribbon article { min-width: 0; min-height: 104px; padding: 15px 17px; border-right: 1px solid var(--border); display: flex; flex-direction: column; justify-content: space-between; }
.metric-ribbon article:last-child { border-right: 0; }
.metric-ribbon span { color: var(--muted); font: 600 11px/1.3 var(--mono); letter-spacing: .08em; }
.metric-ribbon strong { overflow-wrap: anywhere; font: 700 clamp(18px,2.6vw,31px)/1.1 var(--mono); }

.beat-topology { display: grid; grid-template-columns: minmax(340px,.72fr) minmax(0,1.28fr); gap: 14px; margin-top: 14px; }
.histogram, .signal-field { height: 235px; }
.histogram { display: flex; align-items: end; gap: 14px; padding: 30px 22px 18px; }
.hist-column { flex: 1 1 0; height: 100%; display: grid; grid-template-rows: 24px 1fr 30px; align-items: end; text-align: center; color: var(--muted); font: 500 10px/1.15 var(--mono); }
.hist-column b { color: var(--ink); font-size: 12px; }
.hist-column > i { width: 100%; height: var(--h); min-height: 3px; background: linear-gradient(180deg,var(--amber),rgba(233,146,43,.28)); border-top: 1px solid var(--amber); }
.hist-column span { align-self: center; }
.signal-field { padding: 22px 18px 18px; background-image: linear-gradient(var(--border) 1px,transparent 1px); background-size: 100% 25%; }
.signal-field .bars { height: 100%; }
.signal-legend { display: flex; gap: 18px; padding: 11px 16px; border-top: 1px solid var(--border); color: var(--muted); font: 500 10px/1 var(--mono); }
.key { display: inline-block; width: 7px; height: 7px; margin-right: 6px; }
.green-key { background: var(--green); }
.red-key { background: var(--red); }

.compare-lines { display: grid; grid-template-columns: 1fr 1fr; min-height: 158px; }
.compare-lines > div { display: flex; flex-direction: column; justify-content: space-between; padding: 19px; border-right: 1px solid var(--border); }
.compare-lines > div:last-child { border-right: 0; }
.compare-lines span, .compare-lines small { color: var(--muted); font: 500 11px/1.35 var(--mono); }
.compare-lines strong { margin-block: 20px; font: 700 22px/1.15 var(--display); }
.event-log { list-style: none; margin: 0; padding: 8px 16px 12px; }
.event-log li { display: grid; grid-template-columns: 100px 1fr auto; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font: 500 11px/1.3 var(--mono); }
.event-log li:last-child { border-bottom: 0; }
.event-log time, .event-log span { color: var(--muted); }
.event-log a { color: var(--amber); }

.parameter-band { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); margin-top: 14px; }
.parameter-band > div { min-width: 0; min-height: 96px; padding: 16px; border-right: 1px solid var(--border); }
.parameter-band > div:last-child { border-right: 0; }
.parameter-band strong { display: block; margin-top: 12px; overflow-wrap: anywhere; color: var(--ink); font: 600 12px/1.5 var(--mono); }

.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table-toolbar > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.table-source { max-width: 780px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--subtle); font: 500 10px/1.3 var(--mono); }
.table-search { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font: 600 10px/1 var(--mono); letter-spacing: .08em; }
.table-search input, .page-actions select { border: 1px solid var(--border); border-radius: 2px; background: var(--ground); color: var(--ink); font: 500 11px/1 var(--mono); }
.table-search input { width: 190px; padding: 8px 9px; }
.data-table .table-wrap { max-height: 520px; overflow: auto; }
.data-table thead { position: sticky; z-index: 2; top: 0; background: var(--raised); box-shadow: 0 1px var(--border); }
.data-table th { padding: 0; }
.data-table th button { width: 100%; min-height: 37px; padding: 9px 14px; border: 0; background: transparent; color: var(--muted); text-align: left; white-space: nowrap; cursor: pointer; font: inherit; }
.data-table th.num button { text-align: right; }
.data-table th button:hover, .data-table th button.sorted { color: var(--amber); }
.pagination { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 9px 14px; color: var(--muted); font: 500 10px/1 var(--mono); }
.page-actions { display: flex; align-items: center; gap: 9px; }
.page-actions label { display: flex; align-items: center; gap: 7px; }
.page-actions select { padding: 7px 24px 7px 7px; }
.page-actions button { width: 31px; height: 31px; border: 1px solid var(--border); border-radius: 2px; background: var(--raised); color: var(--ink); cursor: pointer; }
.page-actions button:disabled { opacity: .35; cursor: not-allowed; }

.heatmap-panel { margin-top: 14px; }
.heatmap-wrap { padding: 18px; }
.heatmap { display: grid; grid-template-columns: repeat(40,minmax(7px,1fr)); gap: 4px; }
.heatmap i { aspect-ratio: 1; min-width: 0; border-radius: 1px; background: hsl(calc(30 + var(--rank) * 27) 66% 54%); opacity: calc(.45 + (var(--rank) + 1) / (var(--sealers) + 1) * .55); }
.heatmap-axis { display: flex; justify-content: space-between; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--border); color: var(--muted); font: 500 10px/1 var(--mono); }
.mapping-flow { min-height: 158px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; }
.mapping-flow > div { display: flex; flex-direction: column; justify-content: center; padding: 20px; }
.mapping-flow > i { align-self: center; color: var(--red); font: 700 27px/1 var(--display); }
.mapping-flow span, .mapping-flow small { color: var(--muted); font: 500 11px/1.4 var(--mono); }
.mapping-flow b { margin: 9px 0; font: 700 18px/1.15 var(--display); }

.hour-timeline { display: grid; gap: 0; padding: 8px 16px; }
.hour-timeline article { display: grid; grid-template-columns: 72px minmax(140px,1fr) 90px 190px; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); font: 500 11px/1.3 var(--mono); }
.hour-timeline article:last-child { border-bottom: 0; }
.hour-timeline time, .hour-timeline span { color: var(--muted); }
.hour-track { height: 8px; border: 1px solid var(--border); }
.hour-track i { display: block; width: var(--w); height: 100%; background: linear-gradient(90deg,var(--amber),var(--green)); }
.day-bars { display: grid; gap: 12px; padding: 18px; }
.day-bars > div { display: grid; grid-template-columns: 90px 1fr 90px; align-items: center; gap: 12px; color: var(--muted); font: 500 11px/1 var(--mono); }
.day-bars > div > i { height: 8px; border: 1px solid var(--border); }
.day-bars > div > i i { display: block; width: var(--w); height: 100%; background: var(--blue); }
.day-bars b { text-align: right; color: var(--ink); }
.day-compare > p { margin: 0; padding: 0 18px 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.api-flow { margin-bottom: 14px; }
.flow-lane { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: center; padding: 18px; }
.flow-lane > div { min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; padding: 15px; border: 1px solid var(--border); background: var(--ground); }
.flow-lane > i { padding: 0 12px; color: var(--amber); font: 700 20px/1 var(--display); }
.flow-lane span, .flow-lane small { color: var(--muted); font: 500 10px/1.4 var(--mono); }
.flow-lane b { margin: 10px 0; font: 700 16px/1.15 var(--display); }
.api-stack { display: grid; gap: 14px; }
.api-tool { padding: 18px; }
.api-tool-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.api-tool h2 { margin: 6px 0 0; font: 700 24px/1 var(--display); }
.api-tool > p { color: var(--muted); }
.api-spec { display: grid; grid-template-columns: 110px 1fr; gap: 0; border: 1px solid var(--border); }
.api-spec dt, .api-spec dd { margin: 0; padding: 9px 12px; border-bottom: 1px solid var(--border); font: 500 11px/1.4 var(--mono); }
.api-spec dt { color: var(--subtle); background: var(--ground); text-transform: uppercase; }
.api-spec dd { min-width: 0; overflow-wrap: anywhere; color: var(--muted); }
.api-spec dt:nth-last-of-type(1), .api-spec dd:last-child { border-bottom: 0; }
details { margin-top: 14px; }
details summary { color: var(--amber); cursor: pointer; font: 600 11px/1.2 var(--mono); }
details pre { max-height: 420px; }
.plain-list { margin: 13px 0 0; padding-left: 20px; color: var(--muted); line-height: 1.7; }
.plain-list b { color: var(--ink); font-family: var(--mono); }

.method-diagram, .architecture-panel { margin-bottom: 14px; }
.workflow-grid { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr auto 1fr; align-items: center; padding: 18px; }
.workflow-grid article { min-height: 137px; display: flex; flex-direction: column; justify-content: space-between; padding: 15px; border: 1px solid var(--border); background: var(--ground); }
.workflow-grid > i { padding: 0 8px; color: var(--amber); font: 700 17px/1 var(--display); }
.workflow-grid span, .workflow-grid small, .architecture span, .architecture small { color: var(--muted); font: 500 10px/1.45 var(--mono); }
.workflow-grid b, .architecture b { margin: 12px 0; font: 700 16px/1.1 var(--display); }
.architecture { display: grid; grid-template-columns: 1fr .55fr 1.4fr .55fr 1.2fr; align-items: stretch; padding: 18px; }
.arch-client, .arch-server, .arch-rpc { display: flex; flex-direction: column; padding: 17px; border: 1px solid var(--border); background: var(--ground); }
.architecture em { margin-top: 14px; padding: 9px; border-left: 2px solid var(--amber); color: var(--muted); font: normal 500 10px/1.45 var(--mono); }
.arch-link { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.arch-link::before, .arch-link::after { content: ""; width: 100%; border-top: 1px dashed var(--amber); }
.arch-link b { margin: 0; color: var(--amber); font: 600 10px/1 var(--mono); }
.state-stack { display: grid; justify-items: center; gap: 6px; padding: 17px; }
.state-stack > div { width: min(100%,380px); display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; border: 1px solid var(--border); background: var(--ground); font: 500 11px/1.3 var(--mono); }
.state-stack span { color: var(--muted); }
.state-stack > i { color: var(--amber); font-style: normal; }

.gate-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: center; padding: 18px; }
.gate-flow > div { min-height: 90px; display: flex; flex-direction: column; justify-content: space-between; padding: 15px; border: 1px solid var(--border); background: var(--ground); }
.gate-flow > i { padding: 0 12px; color: var(--amber); font-style: normal; }
.gate-flow span { color: var(--muted); font: 500 10px/1 var(--mono); }
.gate-flow b { font: 700 15px/1.2 var(--display); }
.gate-flow .gate-stop { border-color: rgba(217,83,79,.45); }
.gate-flow .branch { color: var(--red); }

@media (max-width: 900px) {
  .beat-topology { grid-template-columns: 1fr; }
  .workflow-grid { grid-template-columns: 1fr; gap: 7px; }
  .workflow-grid > i { justify-self: center; transform: rotate(90deg); }
  .architecture { grid-template-columns: 1fr; gap: 8px; }
  .arch-link { width: 100%; padding: 5px 0; }
  .arch-link::before, .arch-link::after { width: 1px; height: 15px; border: 0; border-left: 1px dashed var(--amber); }
  .flow-lane { grid-template-columns: 1fr 1fr; gap: 8px; }
  .flow-lane > i { display: none; }
  .gate-flow { grid-template-columns: 1fr 1fr; gap: 8px; }
  .gate-flow > i { display: none; }
}

@media (max-width: 640px) {
  .metric-ribbon { grid-template-columns: 1fr 1fr; }
  .metric-ribbon article { min-height: 92px; border-bottom: 1px solid var(--border); }
  .metric-ribbon article:nth-child(2) { border-right: 0; }
  .metric-ribbon article:nth-last-child(-n+2) { border-bottom: 0; }
  .parameter-band { grid-template-columns: 1fr 1fr; }
  .parameter-band > div { border-bottom: 1px solid var(--border); }
  .parameter-band > div:nth-child(2) { border-right: 0; }
  .parameter-band > div:nth-last-child(-n+2) { border-bottom: 0; }
  .compare-lines { grid-template-columns: 1fr; }
  .compare-lines > div { border-right: 0; border-bottom: 1px solid var(--border); }
  .compare-lines > div:last-child { border-bottom: 0; }
  .event-log li { grid-template-columns: 86px 1fr; }
  .event-log li span, .event-log li a { grid-column: 2; }
  .heatmap { grid-template-columns: repeat(20,minmax(7px,1fr)); gap: 3px; }
  .heatmap-axis span:nth-child(2) { display: none; }
  .mapping-flow { grid-template-columns: 1fr; }
  .mapping-flow > i { padding: 0 0 8px; }
  .hour-timeline article { grid-template-columns: 66px 1fr; gap: 8px; }
  .hour-timeline article b { text-align: right; }
  .hour-timeline article span { grid-column: 2; text-align: right; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .table-search input { flex: 1; width: auto; min-width: 0; }
  .pagination { align-items: stretch; flex-direction: column; }
  .page-actions { justify-content: space-between; }
  .api-tool-head { flex-direction: column; }
  .api-spec { grid-template-columns: 86px 1fr; }
  .flow-lane, .gate-flow { grid-template-columns: 1fr; }
  .histogram { gap: 7px; padding-inline: 12px; }
}

@media (max-width: 390px) {
  main { width: 100%; overflow-x: clip; }
  .route-head h1 { font-size: 29px; }
  .metric-ribbon strong { font-size: 17px; }
  .hist-column span { font-size: 9px; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .read-note { white-space: normal; }
  .page-actions { flex-wrap: wrap; }
  .heatmap-wrap { padding: 12px; }
}
