/* App shell: top bar (brand, index tabs, search), flat sidebar, content, footer */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 16px; background: var(--glass2); backdrop-filter: blur(18px); border-bottom: 1px solid var(--line);
}
.top .ib, .top .chip { flex: none; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; font-weight: 700; font-size: 18px; text-decoration: none; color: var(--text); }
.brand .mark { display: block; }
.logo { display: block; height: 48px; width: auto; }
.logo.sm { height: 54px; }

html[data-theme="dark"] .logo-on-light { display: none; }
html:not([data-theme="dark"]) .logo-on-dark { display: none; }

.tabs { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; flex-direction: column; justify-content: center; flex: none; padding: 5px 13px; border-radius: 11px; text-decoration: none; color: var(--text); line-height: 1.2; border: 1px solid transparent; }
.tab span { font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.tab small { font-size: 11.5px; color: var(--muted); }
.tab small.up { color: var(--pe); } .tab small.dn { color: var(--ce); }
.tab:hover { background: var(--atm); }
.tab.on { background: var(--glass); border-color: var(--ac); box-shadow: 0 0 0 3px var(--atm); }

.search { position: relative; flex: 0 1 240px; min-width: 150px; }
.search input { width: 100%; height: 38px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line); background: var(--glass); outline: none; }
.search input:focus { border-color: var(--ac); box-shadow: 0 0 0 3px var(--atm); }
#results { position: absolute; top: 44px; right: 0; width: 300px; max-width: 90vw; padding: 6px; max-height: 320px; overflow: auto; background: var(--glass2); }
#results a { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); }
#results a:hover, #results a:focus { background: var(--atm); }
#results .none { padding: 8px 10px; color: var(--muted); }

/* Shell: flat sidebar flush with the left edge, content on the right */
.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.shell.nosb { grid-template-columns: minmax(0, 1fr); }
.shell.nosb .side { display: none; }
main { min-width: 0; padding: 14px 18px 18px; max-width: 1700px; width: 100%; }
.side {
  position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); align-self: start;
  height: calc(100vh - 64px - env(safe-area-inset-top, 0px)); overflow-y: auto;
  background: var(--glass2); backdrop-filter: blur(18px); border-right: 1px solid var(--line); border-radius: 0; box-shadow: none;
}
.sb { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sb-title { margin: 0 0 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sb .bar { margin: 8px 0 6px; }
.kv { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; }
.kv span { color: var(--muted); }
.kv b { font-size: 17px; }
.sb .grp { padding: 8px 0; }
.sb .grp + .grp { border-top: 1px solid var(--line); }
.sb .hr { margin-top: 4px; }
.nav + .sb-title { margin-top: 14px; }
.sb .hr b { width: 24px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 -10px; border-radius: 0; text-decoration: none; color: var(--text); }
.nav:hover { background: var(--atm); }
.nav.on { background: linear-gradient(90deg, var(--atm), transparent); box-shadow: inset 3px 0 0 var(--ac); }
.nav i { width: 22px; text-align: center; font-style: normal; color: var(--muted); }
.nav b { font-weight: 500; flex: 1; }

.foot { margin: 6px 18px 24px; max-width: 1644px; margin-inline: auto; padding: 26px; }
.fg { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
.fg h5 { margin: 0 0 10px; font-size: 14px; }
.fg a:not(.brand), .fg .linkbtn { display: block; padding: 3px 0; color: var(--muted); text-decoration: none; }
.fg a:not(.brand):hover { color: var(--ac); }
.socials { display: flex; gap: 14px; }
.risk { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.risk.copy { margin-top: 10px; padding-top: 0; border: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; }
.credit a { color: var(--text); font-weight: 600; text-decoration: none; }

.consent { position: fixed; z-index: 80; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); max-width: 560px; padding: 16px 18px; background: var(--glass2); }
.consent p { margin: 0; }
.scrim { display: none; }

@media (max-width: 1280px) { .hide-md { display: none; } }
@media (max-width: 1100px) { .fg { grid-template-columns: 1fr 1fr; } .search { flex-basis: 170px; } }
@media (max-width: 900px) {
  .top { flex-wrap: wrap; height: auto; row-gap: 6px; padding: 8px 12px; }
  .tabs { order: 10; flex: 1 1 100%; }
  .search { display: none; }
  .top .sp { display: none; }
  .shell, .shell.nosb { grid-template-columns: 1fr; }
  main { padding: 12px; }
  .side, .shell.nosb .side {
    display: block; position: fixed; z-index: 70; top: 0; left: 0; bottom: 0; height: auto; width: 290px; max-width: 86vw;
    transform: translateX(-105%); transition: transform .25s; padding-top: env(safe-area-inset-top, 0px);
  }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(5,8,25,.5); }
}
@media (max-width: 520px) { .fg { grid-template-columns: 1fr; } .foot { padding: 20px; } }
