:root {
  color-scheme: light;
  --bg: #f4f4f2; --surface: #fcfcfb; --surface-2: #f0efec; --line: #dedcd6;
  --ink: #0b0b0b; --ink-2: #52514e; --ink-3: #7a7873; --accent: #0f8b94;
  --rail: 208px; --rail-narrow: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --surface-2: #232321; --line: #33322f;
    --ink: #ffffff; --ink-2: #c3c2b7; --ink-3: #8f8e86; --accent: #39c5cf;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --surface-2: #232321; --line: #33322f;
  --ink: #ffffff; --ink-2: #c3c2b7; --ink-3: #8f8e86; --accent: #39c5cf;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }
body.home .shell { grid-template-columns: minmax(0, 1fr); }
body.home .rail { display: none; }

/* top bar: brand · Home + Toolbox (the product) · the reference systems by asset class; each has its own rail */
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 8px 14px;
  background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; }
.topbar .brand { padding: 0; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.topbar .brand .mark { display: inline; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.topbar .brand .tag { display: inline; font-size: 11px; color: var(--ink-3); }
.topbar .brand .home { font-size: 11px; color: var(--ink-3); text-decoration: none; margin-right: 2px; }
/* the same lockup the site uses: PriorStates › MTS */
.topbar .brand .home::after { content: "\203A"; padding: 0 6px 0 7px; color: var(--ink-3); }
.topbar .brand .home:hover { color: var(--accent); }
.acs { display: flex; gap: 4px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); align-items: center; flex: none; }
.acs .lab { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 0 6px 0 8px; white-space: nowrap; }
.ac { font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); background: transparent; border: 1px solid transparent;
  border-radius: 8px; padding: 5px 14px; cursor: pointer; white-space: nowrap; }
.ac:hover { color: var(--ink); }
.ac.on { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.ac.product { color: var(--accent); }
.ac.product.on { color: var(--ink); border-color: var(--accent); }
.topbar .by { margin-left: auto; padding: 0; white-space: nowrap; }

.rail { display: flex; flex-direction: column; gap: 4px; padding: 14px 10px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface); border-right: 1px solid var(--line); min-width: 0; }
.group { display: flex; flex-direction: column; gap: 4px; }
.group[hidden] { display: none; }
.tab { display: grid; grid-template-columns: 26px minmax(0, 1fr); grid-template-areas: "ico lbl" "ico hint"; column-gap: 8px; align-items: center;
  text-align: left; font: inherit; color: var(--ink-2); background: transparent; border: 1px solid transparent; border-radius: 10px;
  padding: 9px 8px; min-height: 48px; cursor: pointer; width: 100%; }
.tab .ico { grid-area: ico; font-size: 18px; text-align: center; }
.tab .lbl { grid-area: lbl; font-weight: 600; color: var(--ink); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab .hint { grid-area: hint; font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab:hover { background: var(--surface-2); }
.tab.on { background: var(--surface-2); border-color: var(--line); box-shadow: inset 3px 0 0 var(--accent); }
.spacer { flex: 1; }
.open { font-size: 12px; color: var(--accent); text-decoration: none; padding: 6px 8px; }
.by { font-size: 11px; color: var(--ink-3); padding: 2px 8px; }

.stage { min-width: 0; min-height: 0; position: relative; }
.frames { position: absolute; inset: 0; }
.frames iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }
.frames iframe[hidden] { display: none; }

@media (max-width: 860px) {
  .topbar .brand .tag { display: none; }
  .acs .lab { display: none; }
  .ac { padding: 4px 10px; font-size: 12px; }
}
@media (max-width: 719px) {
  .shell { grid-template-columns: var(--rail-narrow) minmax(0, 1fr); }
  .rail { padding: 10px 6px calc(8px + env(safe-area-inset-bottom)); }
  .topbar { gap: 8px; padding: 6px 10px; }
  .topbar .brand .mark { font-size: 16px; }
  .topbar .by, .tab .lbl, .tab .hint { display: none; }
  .tab { grid-template-columns: 1fr; grid-template-areas: "ico"; padding: 10px 0; justify-items: center; }
  .tab .ico { font-size: 22px; }
  .open { text-align: center; padding: 6px 0; }
}
