/* ══════════════════════════════════════════════════════════════════════════
   METRA — design system
   ──────────────────────────────────────────────────────────────────────────
   Replaces mt-pleurat.css and mt-ui.css. Those were override layers painted
   over the older desk CSS, which produced a hybrid that read as no product.
   This is a foundation instead: one semantic token set, one type scale, one
   spacing rhythm, and components defined rather than patched.

   Light is the default because the reference is light. Terminal density is
   loosened deliberately — the air IS the design, and preserving 10px rows was
   what kept the old look alive underneath the paint.
   ══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap');

:root {
  /* ── Messari Terminal palette ─────────────────────────────────────────
     Sampled from the live product. The move that defines the look: panels
     are DARKER than the canvas (#0F1218 on #12161E), so a card recedes into
     the page instead of lifting off it, and the 1px #21242C border — not a
     shadow — is what separates regions. Shadows are absent by design; on a
     near-black field they read as smudge. */
  --s-canvas:   #12161E;   /* page */
  --s-sunken:   #0B0E14;   /* wells, table headers */
  --s-raised:   #0F1218;   /* panels — darker than canvas, on purpose */
  --s-raised-2: #161A23;   /* hover / active rows */

  --ink:   #F3F4F6;
  --ink-2: #9CA3AF;   /* 7.4:1 */
  /* Messari's darkest greys are used for rules and icons, not for words. Taking
     them straight for text put 157 strings at ~2.4:1, so the two text-bearing
     steps are lifted to clear 3:1 and 4.5:1 on this canvas. Borders keep the
     original value via --line. */
  --ink-3: #868D9B;   /* 5.0:1 */
  --ink-4: #8A91A0;   /* 5.7:1 on canvas, 5.9:1 on panels — was #737A88 at 4.19:1, failing WCAG 1.4.3 on 10 of 11 audited pages */

  --line:       #21242C;   /* solid hairline, always visible */
  --line-2:     #1A1D24;
  --line-solid: #21242C;

  /* Messari signals with blue and keeps amber out of it entirely. */
  --accent:        #016BD4;
  --accent-bright: #3B8FE8;
  --accent-text:   #7AA0E8;
  --accent-ink:    #FFFFFF;
  --accent-wash:   rgba(1,107,212,.12);
  --accent-wash-2: rgba(1,107,212,.22);
  --accent-ring:   rgba(1,107,212,.55);

  --up: #00CC3D;  --down: #F33F54;  --info: #7AA0E8;  --warn: #E8A33D;
  --up-wash: rgba(0,204,61,.12);  --down-wash: rgba(243,63,84,.12);

  /* Inter is the terminal face: tight apertures, real tabular figures. */
  --sans: 'Inter','SF Pro Text',-apple-system,system-ui,'Segoe UI',sans-serif;
  --mono: 'Roboto Mono','SF Mono',ui-monospace,Menlo,monospace;
  --fs-micro: 12px;  --fs-xs: 12px;  --fs-sm: 12.5px; --fs-md: 13px;
  --fs-lg:    15px;  --fs-xl: 18px;  --fs-2xl: 22px;
  --fs-h2: 16px;
  --fs-h1: 18px;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 28px; --sp-7: 40px;

  --r-card: 8px;  --r-ctl: 4px;  --r-pill: 100px;
  --e: cubic-bezier(.4,0,.2,1);
  --t: .13s;  --t-2: .22s;
  /* borders do the separating; shadows stay almost invisible */
  --sh-1: none;
  --sh-2: 0 4px 16px -4px rgba(0,0,0,.6);
  --sh-3: 0 24px 60px -16px rgba(0,0,0,.85);

  --nav-w: 232px;
}

/* HTML hidden must beat component `display:` rules. Login, order-book overlay,
   and research error states all set the attribute and then lost to a later
   `display:flex` / `display:block`. */
[hidden] { display: none !important; }



/* ══ legacy bridge ═════════════════════════════════════════════════════════
   Pages were written against the older desk variable names. Rather than rewrite
   77 stylesheets, those names are re-pointed at the tokens above so old rules
   inherit the new system automatically. */
:root {
  --md-bg:var(--s-canvas);   --bg:var(--s-canvas);   --bg0:var(--s-canvas);
  --md-bg1:var(--s-sunken);  --bg1:var(--s-sunken);
  --md-bg2:var(--s-raised);  --bg2:var(--s-raised);
  --md-bg3:var(--s-raised-2);--bg3:var(--s-raised-2);
  --md-text:var(--ink);      --text:var(--ink);
  --md-text2:var(--ink-2);   --text2:var(--ink-2);
  --md-muted:var(--ink-3);   --muted:var(--ink-3);   --text3:var(--ink-3);
  --md-dim:var(--ink-4);     --dim:var(--ink-4);
  --md-border:var(--line);   --border:var(--line);
  --md-border2:var(--line-2);--border2:var(--line-2);
  --md-gold:var(--accent-text); --gold:var(--accent-text); --md-accent:var(--accent-text);
  --md-border-active:var(--accent);
  --md-goldf:var(--accent-wash);   --md-goldgl:var(--accent-wash-2);
  --md-gold-dim:var(--ink-3);      --gold-dim:var(--ink-3);
  --mt-on-accent:var(--accent-ink);
  --md-up:var(--up);   --green:var(--up);   --md-upf:var(--up-wash);
  --md-dn:var(--down); --red:var(--down);   --md-dnf:var(--down-wash);
  --md-down:var(--down);
  --md-blue:var(--info); --blue:var(--info); --md-bluef:rgba(47,111,208,.10);
  --md-ws-on:var(--up); --md-ws-off:var(--down); --md-ws-con:var(--accent);
  --md-font:var(--sans); --font:var(--sans);
  --md-ease:var(--e); --md-fast:var(--t); --md-dur:var(--t-2);
  --radius:var(--r-ctl); --md-radius:var(--r-ctl);
}

/* ══ base ══════════════════════════════════════════════════════════════════ */
html, body {
  background: var(--s-canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-sm);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body, button, input, select, textarea, h1,h2,h3,h4,h5,h6, a, label, p, li, div, span {
  font-family: var(--sans);
}
/* digits keep a mono face so columns stay aligned */
table, th, td, code, pre, kbd, input[type="number"], .mono,
[class*="price"], [class*="value"], [class*="num"] {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
h1,h2,h3,h4 { letter-spacing: -.022em; font-weight: 600; line-height: 1.18; }
::selection { background: var(--accent-wash-2); color: var(--ink); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 0; }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--ink-4); border-radius: 0;
  border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: content-box; }
* { scrollbar-color: var(--ink-4) transparent; scrollbar-width: thin; }

/* ══ components ════════════════════════════════════════════════════════════
   Defined once, here — not patched per page. */

/* ── buttons ─────────────────────────────────────────────────────────────
   Square corners with real padding, the way the reference does it. */
button, .btn, .md-btn, .md-btn-main, .hs-btn, .seg button,
.ws-layout-btn, .compact-btn, .free-btn, .ws-fbar-btn, .pal-bk-btn {
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: .005em;
  border-radius: var(--r-ctl);
  border: 1px solid var(--line);
  background: var(--s-raised);
  color: var(--ink-2);
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--t) var(--e), border-color var(--t) var(--e),
              color var(--t) var(--e), transform var(--t) var(--e),
              box-shadow var(--t) var(--e);
}
button:not(:disabled):hover, .btn:not(:disabled):hover, .md-btn:not(:disabled):hover {
  border-color: var(--accent-ring);
  color: var(--ink);
  background: var(--accent-wash);
}
button:not(:disabled):active, .btn:not(:disabled):active { transform: translateY(1px); }
button:disabled, .btn:disabled { opacity: .4; cursor: not-allowed; }

.md-btn-main, .btn.primary, button.primary, .seg button.on,
.md-main-tab.md-main-active, .filter-btn.active {
  background: var(--accent) !important;
  color: var(--accent-ink) !important;
  border-color: var(--accent) !important;
  font-weight: 600;
  box-shadow: var(--sh-1);
}
.md-btn-main:not(:disabled):hover, .btn.primary:not(:disabled):hover {
  filter: brightness(1.06); box-shadow: var(--sh-2);
}

/* ── inputs ──────────────────────────────────────────────────────────────── */
input, select, textarea {
  font-size: var(--fs-sm);
  background: var(--s-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  color: var(--ink);
  padding: 8px 11px;
  transition: border-color var(--t) var(--e), box-shadow var(--t) var(--e);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash);
}
::placeholder { color: var(--ink-4); }

/* ── segmented ───────────────────────────────────────────────────────────── */
.seg {
  display: inline-flex; flex-shrink: 0; min-width: max-content;
  background: var(--s-sunken); border: 1px solid var(--line);
  border-radius: var(--r-ctl); padding: 3px; gap: 2px; overflow: visible;
}
.seg button {
  border: 0; background: transparent; padding: 6px 12px;
  border-radius: 0; flex-shrink: 0; white-space: nowrap; color: var(--ink-3);
}
.seg button:hover { background: var(--s-raised); color: var(--ink); }

/* ── tabs ────────────────────────────────────────────────────────────────── */
.md-main-tab, .md-tab, .hs-movers-tab {
  position: relative; background: transparent !important; border: 0;
  color: var(--ink-3); padding: 10px 15px; font-size: var(--fs-sm);
  border-radius: 0;
}
.md-main-tab::after, .md-tab::after, .hs-movers-tab::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px;
  background: var(--accent-bright); border-radius: 0;
  transform: scaleX(0); transition: transform var(--t-2) var(--e);
}
.md-main-tab:hover, .md-tab:hover, .hs-movers-tab:hover { color: var(--ink); }
.md-main-tab.md-main-active, .md-tab.md-active, .hs-movers-tab.active {
  color: var(--ink) !important; font-weight: 600;
  background: transparent !important; box-shadow: none;
}
.md-main-tab.md-main-active::after, .md-tab.md-active::after,
.hs-movers-tab.active::after { transform: scaleX(1); }

/* ── panels ──────────────────────────────────────────────────────────────── */
.md-panel, .panel, .card, .md-card, .md-result-main, .md-chart-card,
[class$="-panel"], [class*="-panel "], [class$="-card"], [class*="-card "] {
  background: var(--s-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--sh-1);
}
.md-panel-header, .panel-header {
  font-size: var(--fs-micro); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}

/* ── tables — the air lives here ─────────────────────────────────────────── */
table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--s-sunken) !important;
  color: var(--ink-3) !important;
  font-family: var(--sans);
  font-size: var(--fs-micro); font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 11px 14px !important;
  border-bottom: 1px solid var(--line) !important;
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px !important;
  border-bottom: 1px solid var(--line-2) !important;
  color: var(--ink);
}
tbody tr { transition: background var(--t) var(--e); }
tbody tr:hover { background: var(--accent-wash) !important; }

/* ── pills & chips ───────────────────────────────────────────────────────── */
.pill, .chip, .md-pill, .md-chip, .badge {
  border-radius: var(--r-pill); font-size: var(--fs-micro); font-weight: 600;
  letter-spacing: .04em; padding: 3px 9px;
}
.pill.up   { background: var(--up-wash);   color: var(--up); }
.pill.down { background: var(--down-wash); color: var(--down); }
.up { color: var(--up); } .down { color: var(--down); } .mut { color: var(--ink-4); }

/* ── status dots ─────────────────────────────────────────────────────────── */
.dot { width: 7px; height: 7px; border-radius: 0; background: var(--ink-4); }
.dot.ok   { background: var(--up);     box-shadow: 0 0 0 3px var(--up-wash); }
.dot.err  { background: var(--down);   box-shadow: 0 0 0 3px var(--down-wash); }
.dot.busy { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash);
            animation: mt-pulse 1.3s var(--e) infinite; }
@keyframes mt-pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

/* ── loading ─────────────────────────────────────────────────────────────── */
@keyframes mt-shimmer { 0% { background-position: -180% 0 } 100% { background-position: 180% 0 } }
.md-loading, .loading, [class*="skeleton"], .hs-movers-state {
  background: linear-gradient(90deg, transparent, var(--accent-wash), transparent);
  background-size: 180% 100%; animation: mt-shimmer 1.5s var(--e) infinite;
}
@keyframes mt-spin { to { transform: rotate(360deg) } }
.md-spinning, .spinning { animation: mt-spin .9s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ══ application shell ═════════════════════════════════════════════════════
   Injected by mt-shell.js on top-level pages. The page's own root element is
   pushed right rather than restructured, so no existing layout is rewritten. */

body.mt-has-shell {
  padding-left: var(--nav-w);
  padding-top: 52px;
  overflow: auto !important;
  height: auto !important;
}
body.mt-has-shell > #app,
body.mt-has-shell > .md-app,
body.mt-has-shell > .md-wrap { min-height: calc(100vh - 52px); height: auto; }

/* ── sidebar ─────────────────────────────────────────────────────────────── */
.mt-nav {
  position: fixed; inset: 0 auto 0 0; width: var(--nav-w); z-index: 900;
  display: flex; flex-direction: column;
  background: var(--s-sunken);
  border-right: 1px solid var(--line);
}
.mt-nav-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 14px; border-bottom: 1px solid var(--line);
}
.mt-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.mt-brand-dot {
  width: 11px; height: 11px; border-radius: 0; background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
}
.mt-brand-t {
  font-size: 19px; font-weight: 600; letter-spacing: -.035em; color: var(--ink);
}
.mt-theme {
  border: 1px solid var(--line); background: var(--s-raised); color: var(--ink-3);
  width: 30px; height: 30px; border-radius: var(--r-pill); padding: 0;
  font-size: 13px; line-height: 1; display: grid; place-items: center;
}
.mt-theme:hover { color: var(--accent-text); border-color: var(--accent-ring); }

.mt-nav-search { position: relative; padding: 13px 14px 9px; }
.mt-nav-search input {
  width: 100%; font-size: var(--fs-sm); padding: 9px 34px 9px 12px;
  background: var(--s-raised); border-radius: var(--r-ctl);
}
.mt-nav-search kbd {
  position: absolute; right: 23px; top: 50%; transform: translateY(-30%);
  font-size: 10px; color: var(--ink-4); border: 1px solid var(--line);
  border-radius: 0; padding: 2px 6px; background: var(--s-sunken); pointer-events: none;
}

.mt-nav-list { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.mt-nav-group { margin-bottom: 12px; }
.mt-nav-gtitle {
  font-size: 9.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-4); padding: 11px 10px 6px;
}
.mt-nav-item {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-ctl);
  text-decoration: none; color: var(--ink-2);
  transition: background var(--t) var(--e), color var(--t) var(--e);
}
.mt-nav-item:hover { background: var(--s-raised); color: var(--ink); }
.mt-nav-item.is-active { background: var(--accent-wash-2); color: var(--ink); font-weight: 600; }
.mt-nav-item.is-active::before {
  content: ''; position: absolute; left: -8px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-bright);
}
.mt-nav-code {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: .06em;
  color: var(--ink-4); min-width: 30px;
}
.mt-nav-item.is-active .mt-nav-code, .mt-nav-item:hover .mt-nav-code { color: var(--accent-text); }
.mt-nav-name { font-size: var(--fs-sm); flex: 1; line-height: 1.3; }
.mt-nav-fav {
  opacity: 0; border: 0; background: none; color: var(--ink-4); padding: 2px;
  font-size: 12px; line-height: 1; transition: opacity var(--t) var(--e), color var(--t) var(--e);
}
.mt-nav-item:hover .mt-nav-fav { opacity: .5; }
.mt-nav-fav.on { opacity: 1; color: var(--accent-text); }
.mt-nav-fav:hover { opacity: 1 !important; color: var(--accent-text); }

.mt-nav-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 18px; border-top: 1px solid var(--line);
  font-size: var(--fs-micro); color: var(--ink-4);
}
.mt-nav-foot kbd {
  border: 1px solid var(--line); border-radius: 0; padding: 2px 6px; background: var(--s-raised);
}

/* ── top bar ─────────────────────────────────────────────────────────────── */
.mt-top {
  position: fixed; top: 0; left: var(--nav-w); right: 0; height: 52px; z-index: 890;
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  background: color-mix(in srgb, var(--s-canvas) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.mt-burger { display: none; border: 0; background: none; font-size: 17px; color: var(--ink-2); }
.mt-crumb { display: flex; align-items: center; gap: 9px; }
.mt-crumb-g {
  font-size: var(--fs-micro); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-4);
}
.mt-crumb-sep { color: var(--ink-4); }
.mt-crumb-n { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -.02em; color: var(--ink); }

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  body.mt-has-shell { padding-left: 0; }
  .mt-top { left: 0; }
  .mt-burger { display: block; }
  .mt-nav { transform: translateX(-100%); transition: transform var(--t-2) var(--e); box-shadow: var(--sh-3); }
  .mt-nav-open .mt-nav { transform: none; }
}

/* controls lifted out of the retired legacy bar */
.mt-top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.mt-top-actions > * {
  position: static !important; margin: 0 !important;
  width: 32px; height: 32px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: var(--s-raised); color: var(--ink-3);
  display: grid !important; place-items: center; cursor: pointer;
}
.mt-top-actions > *:hover { color: var(--accent-text); border-color: var(--accent-ring); }
.mt-top-actions svg { width: 15px; height: 15px; }

/* ── measured a11y/legibility fixes ──────────────────────────────────────
   Audited at 1440px: 64 nav codes at 9.5px, stat labels at 8.5px, number
   inputs 23px tall. Below the ~10.5px / 28px floors people can comfortably
   read and hit. */
.mt-nav-code { font-size: 10.5px; min-width: 34px; }
.mt-nav-gtitle { font-size: 10.5px; }
.mt-nav-item { padding: 9px 10px; }
.stat .k, .k { font-size: 10px !important; letter-spacing: .1em; }
.lbl { font-size: 10px; }
input, select, button, .seg button { min-height: 30px; }
.num, input.num { min-height: 30px; height: auto; }
/* fav star is a hover affordance inside a 38px row — the row is the hit area,
   so it gets padding rather than its own 28px box */
.mt-nav-fav { padding: 6px; margin: -6px; }

/* sidebar earns its place down to 960px, not 1080 */
@media (min-width: 961px) and (max-width: 1080px) {
  body.mt-has-shell { padding-left: var(--nav-w); }
  .mt-top { left: var(--nav-w); }
  .mt-burger { display: none; }
  .mt-nav { transform: none; box-shadow: none; }
}

/* ══ discipline pass ═══════════════════════════════════════════════════════
   The audit found 11 type sizes (down to 6px), 14 spacing values and 7 radii
   on a single screen. The tokens existed; pages predating them did not use
   them. Rather than edit 76 stylesheets, the vocabulary is clamped here.
   Minimalism is subtraction: fewer sizes, one rhythm, three shapes. */

/* — type: floor at 11px, snap the strays — */
[style*="font-size:6"], [style*="font-size:7"], [style*="font-size: 6"], [style*="font-size: 7"] {
  font-size: 11px !important;
}
.md-panel-header, .panel-header, .lbl, .stat .k, .k,
.mt-nav-gtitle, .mt-crumb-g, thead th, .eyebrow {
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
}
/* anything the pages set below the floor comes back up to it */
body, td, th, p, span, div, li, a, label, button, input, select { font-size: inherit; }
table, tbody td { font-size: 12.5px; }
.mt-nav-name, .md-label { font-size: 13px; }

/* — one section-heading treatment, so panels stop competing with their data — */
h1, .mt-crumb-n { font-size: 19px; font-weight: 600; letter-spacing: -.022em; margin: 0; }
h2 { font-size: 15px; font-weight: 600; }
h3, h4, h5, h6 { font-size: 13px; font-weight: 600; }

/* — shape: three radii, nothing else — */
.pill, .chip, .md-pill, .md-chip, .badge, [class*="pill"], [class*="badge"],
.mt-theme, .mt-nav-search kbd, .mt-nav-foot kbd { border-radius: 0; }
.md-panel, .panel, .card, .md-card, .md-result-main, .md-chart-card,
[class$="-panel"], [class*="-panel "], [class$="-card"], [class*="-card "], .modal, .md-modal, .sheet { border-radius: 0; }
button, .btn, .md-btn, .md-btn-main, input, select, textarea,
.seg, .seg button, .mt-nav-item { border-radius: 0; }

/* — weight: three, not five — */
[style*="font-weight:800"], [style*="font-weight: 800"],
[style*="font-weight:900"], [style*="font-weight: 900"] { font-weight: 600 !important; }

/* — skip link: invisible until tabbed to — */
.mt-skip {
  position: absolute; left: 8px; top: -60px; z-index: 1000;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 0; font-weight: 600;
  text-decoration: none; transition: top var(--t) var(--e);
}
.mt-skip:focus { top: 8px; }

/* — sort affordance — */
thead th[data-k] { position: relative; padding-right: 20px !important; }
thead th[data-k]::after {
  content: '↕'; position: absolute; right: 7px; opacity: .25; font-size: 9px;
}
thead th[aria-sort="ascending"]::after  { content: '↑'; opacity: 1; color: var(--accent-text); }
thead th[aria-sort="descending"]::after { content: '↓'; opacity: 1; color: var(--accent-text); }

/* — search empty state — */
.mt-nav-empty {
  margin: 18px 12px; padding: 14px; text-align: center;
  font-size: 12.5px; color: var(--ink-3);
  border: 1px dashed var(--line); border-radius: 0;
}

/* — mobile: tell people the row continues sideways — */
@media (max-width: 1080px) {
  #wrap, .md-table-wrap, #toolbar, #stats {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .mt-nav { box-shadow: var(--sh-3); }
  /* drawer backdrop — clicking it closes, and it dims what it covers */
  .mt-nav-open body.mt-has-shell::after {
    content: ''; position: fixed; inset: 0; z-index: 880;
    background: color-mix(in srgb, var(--ink) 34%, transparent);
  }
}

/* ══ numbers are the hero ══════════════════════════════════════════════════
   The critique's second test: can a number be read in 200ms? It could not —
   data sat at the same size and weight as its labels, and labels were louder
   (11px, 2.5px tracking) than the figures they described. */

table, tbody td { font-size: 13px; }
tbody td {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'zero' 1;
  color: var(--ink);
  letter-spacing: -.01em;
}
/* the first column is identity, the rest are quantities */
tbody td:not(:first-child) { font-weight: 500; }

/* Labels step back: smaller tracking, dimmer, never competing with a figure. */
thead th, .md-panel-header, .panel-header, .lbl, .stat .k, .k,
.mt-nav-gtitle, .mt-crumb-g, .eyebrow {
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--ink-3);
  font-weight: 500;
}
.stat .v { font-size: 17px; font-weight: 600; letter-spacing: -.02em;
           font-variant-numeric: tabular-nums; }

/* Direction carries colour; the figure stays legible. */
.up, td.up, .pill.up   { color: var(--up); }
.down, td.down, .pill.down { color: var(--down); }

/* ══ empty states read as instruments, not as blank documents ═════════════ */
/* Scoped to the two known page-level empty containers. A wildcard
   [class*="-empty"] used to match every icon and label inside empty states
   (workspace cells, dropdowns, palette), giving each a border, a 140px
   minimum height and a ruled background. */
#empty, .md-empty {
  color: var(--ink-3);
}
/* skeleton rows so a waiting table still looks like a table */
@keyframes mt-sk { 0%,100% { opacity:.35 } 50% { opacity:.7 } }
.mt-skeleton td {
  color: transparent !important;
}
.mt-skeleton td::after {
  content: ''; display: block; height: 9px; border-radius: 0;
  background: var(--line-solid); animation: mt-sk 1.4s var(--e) infinite;
}
.mt-skeleton td:first-child::after { width: 68%; }
.mt-skeleton td::after { width: 42%; margin-left: auto; }

/* ══ Messari component language ════════════════════════════════════════════
   Pure visual wrapper: every rule below targets classes the pages already
   emit. No markup, no props, no data keys are touched. */

/* ── panels: recessed card, hairline border, no shadow ─────────────────── */
.md-panel, .panel, .card, .md-card, .md-result-main, .md-chart-card,
[class$="-panel"], [class*="-panel "], [class$="-card"], [class*="-card "], #stats, #wrap {
  background: var(--s-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: none;
}

/* Panel header: title left, controls right, hairline under. */
.md-panel-header, .panel-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;          /* Messari uses sentence case, not caps */
  color: var(--ink);
}

/* ── stat blocks: label above, figure below, delta beside ──────────────── */
#stats { display: flex; gap: 0; }
.stat {
  padding: 12px 18px;
  border-right: 1px solid var(--line);
  min-width: 128px;
}
.stat .k {
  font-size: 11px; font-weight: 400; letter-spacing: 0;
  text-transform: none; color: var(--ink-3);
}
.stat .v {
  font-size: 20px; font-weight: 600; letter-spacing: -.02em;
  margin-top: 3px; color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ── tables: dense rows, hairline rules, hover lift ────────────────────── */
table { border-collapse: collapse; width: 100%; }
thead th {
  background: var(--s-sunken) !important;
  color: var(--ink-3) !important;
  font-family: var(--sans);
  font-size: 11px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  padding: 8px 12px !important;
  border-bottom: 1px solid var(--line) !important;
}
tbody td {
  font-family: var(--sans);
  font-size: 12.5px;
  padding: 8px 12px !important;
  border-bottom: 1px solid var(--line-2) !important;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  color: var(--ink);
}
tbody tr:hover { background: var(--s-raised-2) !important; }
tbody td:first-child { color: var(--ink); font-weight: 500; }

/* ── timeframe pills — the 12H 1D 1W 1M row ────────────────────────────── */
.seg {
  display: inline-flex; gap: 0; padding: 0;
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--r-ctl); overflow: hidden;
}
.seg button {
  border: 0; border-right: 1px solid var(--line);
  background: transparent; color: var(--ink-3);
  padding: 5px 11px; font-size: 11px; font-weight: 500; border-radius: 0;
  min-height: 26px;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--s-raised-2); color: var(--ink); }
.seg button.on {
  background: var(--s-raised-2) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
  box-shadow: none;
}

/* ── buttons ───────────────────────────────────────────────────────────── */
button, .btn, .md-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px; font-weight: 500;
  padding: 6px 12px; border-radius: var(--r-ctl);
  min-height: 30px;
}
button:not(:disabled):hover, .btn:not(:disabled):hover {
  background: var(--s-raised-2); border-color: var(--ink-4); color: var(--ink);
}
.md-btn-main, .btn.primary, button.primary, .filter-btn.active {
  background: var(--accent) !important; border-color: var(--accent) !important;
  color: #fff !important; font-weight: 600;
}
.md-btn-main:hover, .btn.primary:hover { background: var(--accent-bright) !important; }

/* ── inputs ────────────────────────────────────────────────────────────── */
input, select, textarea {
  background: var(--s-sunken); border: 1px solid var(--line);
  border-radius: var(--r-ctl); color: var(--ink);
  font-size: 12px; padding: 6px 10px;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: none; }

/* ── tabs: underline, sentence case ────────────────────────────────────── */
.md-main-tab, .md-tab, .hs-movers-tab {
  font-size: 12px; font-weight: 500; padding: 9px 13px;
  color: var(--ink-3); text-transform: none; letter-spacing: 0;
}
.md-main-tab::after, .md-tab::after, .hs-movers-tab::after { background: var(--accent); }
.md-main-tab.md-main-active, .md-tab.md-active, .hs-movers-tab.active { color: var(--ink) !important; }

/* ── direction ─────────────────────────────────────────────────────────── */
.up, td.up { color: var(--up); }
.down, td.down { color: var(--down); }
.pill { border-radius: var(--r-ctl); font-size: 10.5px; font-weight: 600; padding: 2px 7px; }
.pill.up { background: var(--up-wash); color: var(--up); }
.pill.down { background: var(--down-wash); color: var(--down); }

/* ── shell chrome follows the same language ────────────────────────────── */
.mt-nav { background: var(--s-canvas); border-right: 1px solid var(--line); }
.mt-nav-head { border-bottom: 1px solid var(--line); padding: 14px 16px; }
.mt-brand-t { font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.mt-brand-dot { background: var(--accent); box-shadow: none; width: 9px; height: 9px; }
.mt-nav-item { border-radius: var(--r-ctl); padding: 6px 10px; }
.mt-nav-item:hover { background: var(--s-raised-2); }
.mt-nav-item.is-active { background: var(--s-raised-2); color: var(--ink); font-weight: 500; }
.mt-nav-item.is-active::before { background: var(--accent); }
.mt-nav-code { color: var(--ink-4); font-family: var(--mono); font-size: 10px; }
.mt-nav-item.is-active .mt-nav-code, .mt-nav-item:hover .mt-nav-code { color: var(--accent-text); }
.mt-nav-name { font-size: 12.5px; }
.mt-nav-gtitle { font-size: 10.5px; color: var(--ink-4); letter-spacing: .04em; }
.mt-top {
  background: var(--s-canvas); border-bottom: 1px solid var(--line);
  backdrop-filter: none; height: 48px;
}
.mt-crumb-n { font-size: 15px; font-weight: 600; }
.mt-crumb-g { font-size: 11px; color: var(--ink-3); letter-spacing: 0; text-transform: none; }

/* ── sector chips, fed by the Messari taxonomy ─────────────────────────── */
.mt-sector {
  display: inline-block; font-size: 10px; font-weight: 500;
  padding: 2px 6px; border-radius: 0;
  background: var(--s-raised-2); color: var(--ink-2);
  border: 1px solid var(--line);
}


/* ══ accessibility layer (audit 2026-09-17) ════════════════════════════════
   Findings from the axe-core + keyboard audit, fixed at the system level so
   every page inherits them. Page-specific fixes live with their pages.       */

/* — screen-reader-only text — */
.mt-sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* — type floor: 11px for anything a person reads (was 7–10px in places) — */
thead th, .md-panel-header, .panel-header, .lbl, .stat .k, .k,
.mt-nav-gtitle, .mt-crumb-g, .eyebrow { font-size: 11px; }
.mt-nav-code { font-size: 10.5px; }

/* — one focus ring for everything focusable, including scripted widgets — */
[tabindex]:focus-visible, [role="button"]:focus-visible, [role="tab"]:focus-visible,
[role="region"]:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent-bright); outline-offset: 2px;
}


/* — sidebar rows: link + favourite are siblings, each a real target — */
.mt-nav-row { position: relative; display: flex; align-items: center; }
.mt-nav-row .mt-nav-item { flex: 1; min-width: 0; padding-right: 36px; }
.mt-nav-row .mt-nav-fav {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; min-height: 28px; margin: 0; padding: 0;
  display: grid; place-items: center; border-radius: 0; font-size: 13px;
}
.mt-nav-row:hover .mt-nav-fav, .mt-nav-row:focus-within .mt-nav-fav { opacity: .7; }
.mt-nav-row .mt-nav-fav:focus-visible { opacity: 1; }
@media (hover: none) { .mt-nav-row .mt-nav-fav { opacity: .55; } }
.mt-nav-cmd {
  border: 0; background: none; padding: 0; min-height: 24px; min-width: 24px; cursor: pointer;
  display: inline-grid; place-items: center; color: inherit;
}
.mt-nav-cmd kbd { pointer-events: none; }
.mt-nav-cmd:hover kbd { color: var(--ink); border-color: var(--ink-4); }

/* — minimum target: 24×24 (WCAG 2.5.8) for compact controls — */
.mt-theme, .mt-burger, .mt-top-actions > * { min-width: 32px; min-height: 32px; }
.seg button, .md-tab, .md-main-tab, .hs-movers-tab, .hs-btn { min-height: 28px; }

/* — scroll containers made keyboard-reachable by mt-a11y.js — */
[data-mt-scroll-region]:focus-visible { outline-offset: -2px; }

/* — command palette empty state — */
.pal-empty {
  display: grid; gap: 6px; justify-items: center; text-align: center;
  padding: 44px 24px; color: var(--ink-3); font-size: 13px; line-height: 1.5;
}
.pal-empty strong { color: var(--ink); font-weight: 600; font-size: 14px; }

/* — home summary error — */
.hs-sum-err { color: var(--ink-2); }
.hs-sum-retry { margin-left: 6px; vertical-align: baseline; }

/* — live-region toast used by mt-a11y.js for keyboard setting changes — */
.mt-announce {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); z-index: 2000;
  padding: 10px 14px; border-radius: 0; background: var(--ink); color: var(--s-canvas);
  font: 500 13px/1.3 var(--sans); box-shadow: var(--sh-3); opacity: 0; pointer-events: none;
  transition: opacity var(--t-2) var(--e), transform var(--t-2) var(--e);
}
.mt-announce.is-on { opacity: 1; transform: translate(-50%, 0); }

/* — horizontal overflow affordance for tab strips (flagged by mt-a11y.js) — */
.mt-overflow-strip { scrollbar-width: none; }
.mt-overflow-strip::-webkit-scrollbar { display: none; }
.mt-overflow-strip[data-more-right] {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
}
.mt-overflow-strip[data-more-left] {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 48px);
          mask-image: linear-gradient(to right, transparent, #000 48px);
}
.mt-overflow-strip[data-more-left][data-more-right] {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent);
          mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent);
}

/* — tooltip for icon-only controls (mt-a11y.js) — */
.mt-tip {
  position: fixed; z-index: 3000; max-width: 260px; padding: 6px 9px; border-radius: 0;
  background: var(--ink); color: var(--s-canvas); font: 500 12px/1.35 var(--sans);
  box-shadow: var(--sh-2); pointer-events: none;
}
.mt-tip[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .mt-nav-item.is-active { outline: 2px solid CanvasText; }
  .mt-nav-fav.on { color: Highlight; }
}


/* ══════════════════════════════════════════════════════════════════════════
   METRA MODULE UX SYSTEM · 2026 redesign layer
   Shared guardrails for legacy and new desks: readable type, safe mobile
   overflow, consistent states and focus treatment.
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  --mt-page-max: 1680px;
  --mt-touch: 40px;
  --mt-focus: color-mix(in srgb, var(--accent, #D97706) 72%, transparent);
}

/* Every desk gets a predictable reading width without changing chart canvases. */
body > #app, body > .app, body > main, body > #view,
body > .md-root, body > .md-shell { min-width: 0; }
body { text-rendering: optimizeLegibility; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [role="button"]:focus-visible, [role="tab"]:focus-visible {
  outline: 2px solid var(--mt-focus) !important; outline-offset: 2px;
}

/* Runtime-created semantic title: visible only where a page forgot its heading. */
.mt-runtime-title { position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important;
  white-space: nowrap !important; border: 0 !important; }

/* Tables are data regions, never accidental viewport overflows. */
.mt-table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch; scrollbar-width: thin; position: relative; }
.mt-table-scroll > table { min-width: 620px; }
.mt-table-scroll::after { content: 'Geser untuk melihat kolom lain'; display: none;
  position: sticky; right: 8px; bottom: 6px; width: max-content; margin-left: auto;
  padding: 4px 7px; border: 1px solid var(--line); border-radius: 0;
  background: var(--s-raised); color: var(--ink-3); font: 500 10px/1.2 var(--sans);
  pointer-events: none; }
.mt-table-scroll[data-overflow="true"]::after { display: block; }

/* Shared data state vocabulary for pages that opt in or render these classes. */
.mt-state { display: grid; place-items: center; min-height: 112px; padding: 24px;
  text-align: center; border: 1px dashed var(--line); border-radius: var(--r-card);
  color: var(--ink-3); background: var(--s-sunken); }
.mt-state strong { display: block; color: var(--ink); font: 600 14px/1.3 var(--sans); margin-bottom: 5px; }
.mt-state p { max-width: 46ch; margin: 0 auto 12px; font: 400 12px/1.55 var(--sans); }
.mt-state button { min-height: var(--mt-touch); }
.mt-freshness { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3);
  font: 500 11px/1.3 var(--sans); }
.mt-freshness::before { content: ''; width: 7px; height: 7px; border-radius: 0; background: var(--up, #46c97f); }
.mt-freshness[data-stale="true"]::before { background: var(--accent, #D97706); }
.mt-freshness[data-error="true"]::before { background: var(--down, #ff4d4f); }

/* Dense controls become a scrollable strip instead of crushing the page. */
.toolbar, .controls, .filters, .filter-bar, .md-toolbar, .md-controls,
[class*="toolbar"], [class*="filter"] { min-width: 0; }
@media (max-width: 700px) {
  :root { --mt-touch: 44px; }
  body { font-size: 13px; }
  .toolbar, .controls, .filters, .filter-bar, .md-toolbar, .md-controls {
    overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; padding-bottom: 3px;
  }
  .toolbar::-webkit-scrollbar, .controls::-webkit-scrollbar, .filters::-webkit-scrollbar,
  .filter-bar::-webkit-scrollbar, .md-toolbar::-webkit-scrollbar, .md-controls::-webkit-scrollbar { display: none; }
  .toolbar > *, .controls > *, .filters > *, .filter-bar > *, .md-toolbar > *, .md-controls > * { flex: 0 0 auto; }
  table { font-size: 12px; }
  thead th { padding: 9px 10px !important; }
  tbody td { padding: 10px !important; }
  .mt-table-scroll { margin-inline: -1px; }
  .mt-table-scroll > table { min-width: 560px; }
  .card, .panel, .md-panel, .md-card { border-radius: 0; }
  .mt-state { min-height: 96px; padding: 18px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .mt-table-scroll { scroll-behavior: auto; }
}
