:root {
  --bg: #08090b; --panel: #0e1013; --panel2: #121418; --line: #1d2026; --line2: #2a2e36;
  --text: #e8eaed; --dim: #8a909a; --faint: #5a606b;
  --up: #2fbf71; --down: #ef4b4b; --accent: #7aa7ff; --amber: #f2b33d;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 12px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
.num, td.n, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .dim { color: var(--dim); } .faint { color: var(--faint); }

/* ---- top bar ---- */
.top { display: flex; align-items: center; gap: 22px; height: 44px; padding: 0 16px; border-bottom: 1px solid var(--line); background: #0a0b0e; white-space: nowrap; overflow-x: auto; }
.brand { letter-spacing: .32em; font-size: 10px; color: var(--dim); font-weight: 600; }
.brand b { color: var(--text); font-weight: 600; }
.page-title { font-size: 13px; font-weight: 600; }
.stat { display: flex; align-items: baseline; gap: 7px; color: var(--dim); font-size: 11px; }
.stat b { color: var(--text); font: 500 12px var(--mono); }
.stat .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--up); display: inline-block; box-shadow: 0 0 6px var(--up); }
.top .spacer { flex: 1; }
.top nav { display: flex; gap: 14px; }
.top nav a { color: var(--faint); font-size: 11px; letter-spacing: .04em; }
.top nav a:hover, .top nav a.on { color: var(--text); }
.badge { font: 600 9px var(--mono); letter-spacing: .12em; padding: 3px 7px; border: 1px solid var(--amber); color: var(--amber); border-radius: 3px; }

/* ---- ticker strip ---- */
.strip { display: flex; gap: 26px; padding: 6px 16px; border-bottom: 1px solid var(--line); font: 11px var(--mono); color: var(--dim); white-space: nowrap; overflow: hidden; }
.strip b { color: var(--text); font-weight: 500; margin-right: 6px; }

/* ---- layout ---- */
.app { display: grid; height: calc(100vh - 44px); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.ph { display: flex; align-items: center; gap: 10px; padding: 9px 12px 7px; border-bottom: 1px solid var(--line); }
.ph h3 { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.ph .sub { color: var(--faint); font-size: 10px; }
.ph .spacer { flex: 1; }
.pb { padding: 10px 12px; overflow: auto; min-height: 0; flex: 1; }
.label { color: var(--faint); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.big { font: 300 34px/1 var(--sans); letter-spacing: -.02em; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .v { font: 400 20px/1.1 var(--mono); }
.kpi .note { color: var(--faint); font-size: 10px; }
.tabs { display: flex; gap: 2px; }
.tabs button { background: none; border: 0; color: var(--faint); font: 10px var(--sans); padding: 3px 7px; border-radius: 3px; cursor: pointer; }
.tabs button.on, .tabs button:hover { color: var(--text); background: var(--line); }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--faint); font-size: 10px; padding: 5px 6px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; cursor: pointer; user-select: none; }
th.n, td.n { text-align: right; }
td { padding: 5px 6px; border-bottom: 1px solid #15171b; vertical-align: middle; }
tr.row { cursor: pointer; }
tr.row:hover td { background: #14171c; }
tr.row.sel td { background: #172031; }
td .s { display: block; color: var(--faint); font-size: 10px; line-height: 1.2; }
.bar { height: 6px; border-radius: 1px; display: inline-block; vertical-align: middle; }

/* ---- detail drawer ---- */
.drawer { position: absolute; top: 12px; right: 12px; width: 300px; max-height: calc(100% - 24px); overflow: auto; background: rgba(14,16,19,.96); border: 1px solid var(--line2); border-radius: 4px; padding: 14px; z-index: 5; backdrop-filter: blur(6px); }
.drawer .x { position: absolute; right: 10px; top: 8px; color: var(--faint); cursor: pointer; font-size: 14px; }
.drawer h2 { margin: 2px 0 2px; font-size: 16px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 14px 0; }
.mixrow { display: grid; grid-template-columns: 80px 1fr 34px; align-items: center; gap: 8px; margin: 4px 0; font-size: 11px; }
.mixrow .track { height: 5px; background: var(--line); border-radius: 2px; overflow: hidden; }
.mixrow .fill { height: 100%; }
.foot { color: var(--faint); font-size: 10px; line-height: 1.5; padding: 10px 12px; border-top: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 10px; color: var(--dim); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* ---- tooltip ---- */
.tip { position: fixed; pointer-events: none; background: #0b0d10; border: 1px solid var(--line2); padding: 6px 8px; border-radius: 3px; font: 11px var(--mono); z-index: 50; display: none; white-space: nowrap; }

/* map */
.maplibregl-ctrl-attrib { background: rgba(0,0,0,.5) !important; font-size: 9px; }
.maplibregl-ctrl-attrib a { color: #aaa !important; }
.maplibregl-popup-content { background: #0b0d10; color: var(--text); border: 1px solid var(--line2); padding: 5px 8px; font: 11px var(--mono); }
.maplibregl-popup-tip { display: none; }
.cp-label { font: 600 10px var(--sans); color: #fff; background: rgba(8,9,11,.8); border: 1px solid #3a3f48; padding: 2px 6px; border-radius: 2px; white-space: nowrap; cursor: pointer; }

::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-thumb { background: #262a31; border-radius: 3px; } ::-webkit-scrollbar-track { background: transparent; }

/* ---- mobile app ---- */
.tabbar, .more-sheet { display: none; }
@media (max-width: 760px) {
  html, body { height: auto; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
  .top { position: sticky; top: 0; z-index: 30; height: 50px; gap: 10px; padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(50px + env(safe-area-inset-top)); }
  .top nav, .top .stat { display: none; }
  .brand b { letter-spacing: .28em; }
  .page-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
  .app { display: flex !important; flex-direction: column; height: auto !important; min-height: 0 !important; padding: 8px !important; gap: 8px !important; }
  .app > * { width: 100%; min-width: 0; }
  .panel { min-height: 0; flex: none !important; }
  .panel > .pb { overflow-x: auto; overflow-y: visible; max-height: none; flex: none; -webkit-overflow-scrolling: touch; }
  .ph { flex-wrap: wrap; row-gap: 6px; padding: 11px 12px 9px; }
  .ph h3 { font-size: 13px; }
  .ph .sub { font-size: 10.5px; }
  td, th { padding: 8px 7px; }
  td .mono, td.n, th { white-space: nowrap; }
  .pcard { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 8px 0; background: #0d0f12; }
  .pcard .h { display: flex; gap: 8px; align-items: baseline; font-size: 14px; font-weight: 600; }
  .pcard .g { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 12px; margin: 10px 0 6px; }
  .pcard .g span { display: block; color: var(--faint); font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; }
  .pcard .g div { font: 13px var(--mono); }
  .pcard p { color: #b4bac4; font-size: 12.5px; line-height: 1.5; margin: 6px 0 0; }
  table { font-size: 12px; }
  .tabs button { padding: 6px 9px; font-size: 11px; }
  .drawer { position: fixed !important; left: 8px !important; right: 8px !important; top: auto !important; bottom: calc(72px + env(safe-area-inset-bottom)) !important;
            width: auto !important; max-height: 62vh !important; z-index: 44; border-radius: 12px; box-shadow: 0 -8px 40px rgba(0,0,0,.6); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: rgba(10,11,14,.97); border-top: 1px solid var(--line);
            padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--faint); font: 10px var(--sans); background: none; border: 0; padding: 4px 0; min-height: 44px; justify-content: center; }
  .tabbar .on { color: var(--text); }
  .tabbar svg { width: 22px; height: 22px; }
  .more-sheet.open { display: block; position: fixed; left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 46; background: #0e1013;
                     border: 1px solid var(--line2); border-radius: 12px; padding: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.6); }
  .more-sheet a { display: flex; justify-content: space-between; padding: 14px 12px; border-bottom: 1px solid #15171b; font-size: 14px; }
  .more-sheet a:last-child { border-bottom: 0; }
}

/* desk / analyst panel */
.lpanel { margin-top: 8px; font-size: 11.5px; }
.lpanel summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.lpanel summary::-webkit-details-marker { display: none; }
.lsum { font: 600 10px var(--mono); color: #c8ccd2; margin-right: 4px; }
.lchip { display: inline-flex; align-items: center; gap: 4px; font: 10px var(--mono); padding: 2px 6px; border-radius: 10px; background: #15181d; color: #9aa0aa; border: 1px solid #22262d; }
.lchip i, .desk .dh i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.lchip.agree { color: #8fe0b4; } .lchip.disagree { color: #f59a9a; }
.lrow { color: #b4bac4; line-height: 1.45; margin: 6px 0 0; } .lsc { color: #5a606b; font: 10px var(--mono); }
.lcons { margin-top: 8px; color: #e8eaed; border-left: 2px solid #2a2e36; padding-left: 8px; line-height: 1.45; }
.desk { padding: 9px 0; border-bottom: 1px solid var(--line); } .desk:last-child { border: 0; }
.desk .dh { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; }
.desk p { margin: 4px 0; color: #b4bac4; font-size: 12px; line-height: 1.5; }
.desk .dt { font: 10.5px var(--mono); } .desk .dt .up { color: var(--up); } .desk .dt .down { color: var(--down); }
.brief-card .hl { font-size: 14px; color: #e8eaed; line-height: 1.45; font-weight: 500; }
.brief-card ul { margin: 8px 0 0; padding-left: 18px; color: #b4bac4; font-size: 12px; line-height: 1.5; } .brief-card li { margin: 3px 0; }
.brief-card .w { font: 11px var(--mono); color: #8a909a; margin-top: 8px; } .brief-card .w b { color: #e8eaed; font-weight: 500; }
.ev td.v { white-space: nowrap; } .ev .edge { color: var(--up); } .ev .none { color: var(--faint); } .ev .neg { color: var(--amber); }
@media (max-width: 760px) { .ev td:first-child { min-width: 58vw; } .ev th:first-child { min-width: 58vw; } }
