/* NimbusJoy Markets — Bloomberg-style terminal, scoped to #view-markets */
#view-markets, .term-sheet {
  --t-bg: #000000;
  --t-panel: #0c0c0e;
  --t-panel-2: #141418;
  --t-line: #25252b;
  --t-amber: #ffa028;
  --t-amber-dim: #9a6420;
  --t-ink: #f2f2f2;
  --t-ink-2: #b9b8bf;
  --t-ink-3: #7d7c85;
  --t-up: #2fd27a;
  --t-down: #ff5c57;
  --t-flat: #9a9aa2;
  --t-blue: #4aa8ff;
  --t-mid: #3a3a3e;
  --t-mono: "SF Mono", ui-monospace, "Roboto Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
#view-markets { background: var(--t-bg); }
#view-markets .num, .term-sheet .num { font-family: var(--t-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.t-up { color: var(--t-up); }
.t-down { color: var(--t-down); }
.t-flat { color: var(--t-flat); }

/* ---- header ---- */
.t-top {
  display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--sat)) 12px 8px;
  background: #050506; border-bottom: 1px solid var(--t-line);
}
.t-logo { font-family: var(--t-mono); font-weight: 800; font-size: 13px; color: #000; background: var(--t-amber);
  padding: 3px 7px; border-radius: 4px; letter-spacing: .04em; }
.t-clock { font-family: var(--t-mono); font-size: 12px; color: var(--t-ink-2); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-mkt { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; padding: 3px 7px; border-radius: 99px;
  border: 1px solid var(--t-line); color: var(--t-ink-3); text-transform: uppercase; white-space: nowrap; }
.t-mkt.open { color: var(--t-up); border-color: rgba(47,210,122,.4); }
#view-markets .icon-btn { width: 34px; height: 34px; color: var(--t-ink-2); }
#view-markets .icon-btn.spin svg { animation: tspin .9s linear infinite; }
@keyframes tspin { to { transform: rotate(360deg); } }

/* ---- macro strip ---- */
.t-strip { display: flex; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--t-line); background: #050506; flex: none; }
.t-strip::-webkit-scrollbar { display: none; }
.t-cell { flex: none; padding: 7px 12px 8px; border-right: 1px solid var(--t-line); min-width: 104px; text-align: left; }
.t-cell .l { font-size: 10.5px; font-weight: 700; color: var(--t-amber); letter-spacing: .05em; text-transform: uppercase; }
.t-cell .p { font-family: var(--t-mono); font-size: 14px; color: var(--t-ink); margin-top: 1px; }
.t-cell .c { font-family: var(--t-mono); font-size: 11.5px; }
.t-cell svg.spark { width: 80px; height: 18px; margin-top: 3px; }

/* ---- section nav ---- */
.t-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 6px 8px; background: #050506;
  border-bottom: 1px solid var(--t-line); flex: none; }
.t-nav::-webkit-scrollbar { display: none; }
.t-nav button { flex: none; padding: 7px 11px; font-size: 12.5px; font-weight: 700; color: var(--t-ink-3);
  border-radius: 6px; letter-spacing: .02em; text-transform: uppercase; }
.t-nav button.on { color: #000; background: var(--t-amber); }
.t-nav button .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--t-down); margin-left: 5px; vertical-align: 2px; }

.t-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 10px calc(24px + var(--sab)); }
.t-panel { display: none; }
.t-panel.on { display: block; }

/* ---- cards ---- */
.t-card { background: var(--t-panel); border: 1px solid var(--t-line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.t-card-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--t-line); }
.t-card-h h3 { margin: 0; font-size: 12px; font-weight: 800; color: var(--t-amber); letter-spacing: .08em; text-transform: uppercase; flex: 1; }
.t-card-h .sub { font-size: 11px; color: var(--t-ink-3); }
.t-card-b { padding: 10px 12px; }
.t-note { font-size: 11.5px; color: var(--t-ink-3); line-height: 1.45; }
.t-empty { padding: 26px 12px; text-align: center; color: var(--t-ink-3); font-size: 13px; }
.t-err { padding: 12px; color: var(--t-down); font-size: 12.5px; }
.t-skel { height: 44px; margin: 8px 0; border-radius: 8px; background: linear-gradient(90deg, #111 0%, #1a1a1e 50%, #111 100%);
  background-size: 200% 100%; animation: tsk 1.2s ease-in-out infinite; }
@keyframes tsk { to { background-position: -200% 0; } }

/* segmented + chips */
.t-seg { display: inline-flex; border: 1px solid var(--t-line); border-radius: 7px; overflow: hidden; }
.t-seg button { padding: 5px 10px; font-size: 11.5px; font-weight: 700; color: var(--t-ink-3); font-family: var(--t-mono); }
.t-seg button.on { background: var(--t-panel-2); color: var(--t-amber); }
.t-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 0 10px; }
.t-chips::-webkit-scrollbar { display: none; }
.t-chip { flex: none; padding: 6px 11px; font-size: 12px; font-weight: 600; border-radius: 99px; border: 1px solid var(--t-line);
  color: var(--t-ink-2); background: var(--t-panel); white-space: nowrap; }
.t-chip.on { border-color: var(--t-amber); color: var(--t-amber); background: rgba(255,160,40,.08); }

/* ---- sector donut ---- */
.t-donut-wrap { display: flex; gap: 12px; align-items: center; }
.t-donut { width: 190px; height: 190px; flex: none; }
.t-donut path { cursor: pointer; transition: opacity .15s; }
.t-donut path.dim { opacity: .35; }
.t-donut .ctr-sym { font: 800 20px var(--t-mono); fill: var(--t-ink); }
.t-donut .ctr-l { font: 600 10px -apple-system, sans-serif; fill: var(--t-ink-3); letter-spacing: .04em; }
.t-donut .ctr-v { font: 700 13px var(--t-mono); }
.t-donut .slice-l { font: 700 9.5px var(--t-mono); fill: #fff; pointer-events: none; paint-order: stroke; stroke: rgba(0,0,0,.55); stroke-width: 2px; }
.t-sel { flex: 1; min-width: 0; }
.t-sel .nm { font-size: 14px; font-weight: 700; }
.t-sel .kv { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; border-bottom: 1px dashed var(--t-line); color: var(--t-ink-3); }
.t-sel .kv b { font-family: var(--t-mono); font-weight: 600; color: var(--t-ink); }
.t-legend { display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: var(--t-ink-3); margin-top: 10px; }
.t-legend .bar { flex: 1; height: 7px; border-radius: 4px; }
@media (max-width: 380px) { .t-donut-wrap { flex-direction: column; align-items: stretch; } .t-donut { align-self: center; } }

/* tables */
.t-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.t-table th { text-align: right; font-size: 10px; font-weight: 700; color: var(--t-ink-3); letter-spacing: .06em; text-transform: uppercase; padding: 6px 4px; border-bottom: 1px solid var(--t-line); }
.t-table th:first-child, .t-table td:first-child { text-align: left; padding-left: 0; }
.t-table td { text-align: right; padding: 7px 4px; border-bottom: 1px solid #17171b; white-space: nowrap; }
.t-table tr:last-child td { border-bottom: 0; }
.t-table tr.sel td { background: rgba(255,160,40,.07); }
.t-table .sym { font-family: var(--t-mono); font-weight: 700; color: var(--t-ink); }
.t-table .nm { display: block; font-size: 10.5px; color: var(--t-ink-3); font-weight: 400; font-family: -apple-system, sans-serif; }
.flowbar { position: relative; width: 64px; height: 8px; background: #16161a; border-radius: 4px; display: inline-block; vertical-align: middle; }
.flowbar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.flowbar::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--t-ink-3); }

/* watchlist rows */
.t-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #17171b; width: 100%; text-align: left; }
.t-row:last-child { border-bottom: 0; }
.t-row:active { background: var(--t-panel-2); }
.t-row .sym { font-family: var(--t-mono); font-weight: 800; font-size: 14px; width: 58px; flex: none; }
.t-row .sub { font-size: 10.5px; color: var(--t-ink-3); display: block; font-family: -apple-system, sans-serif; font-weight: 500; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-row svg.spark { width: 70px; height: 24px; flex: none; }
.t-row .px { margin-left: auto; text-align: right; font-family: var(--t-mono); font-size: 13.5px; }
.t-row .pc { display: inline-block; min-width: 64px; text-align: center; font-family: var(--t-mono); font-size: 12px; font-weight: 700;
  padding: 3px 6px; border-radius: 5px; margin-top: 2px; }
.pc.up { background: rgba(47,210,122,.14); color: var(--t-up); }
.pc.down { background: rgba(255,92,87,.14); color: var(--t-down); }
.pc.flat { background: #1a1a1e; color: var(--t-flat); }
.t-badge { display: inline-block; font-size: 9.5px; font-weight: 800; letter-spacing: .06em; padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; border: 1px solid currentColor; white-space: nowrap; }
.t-badge.bullish, .t-badge.buy { color: var(--t-up); }
.t-badge.bearish, .t-badge.sell { color: var(--t-down); }
.t-badge.neutral, .t-badge.other { color: var(--t-ink-2); }
.t-badge.amber { color: var(--t-amber); }
.t-badge.blue { color: var(--t-blue); }

/* news */
.t-news { display: block; padding: 11px 12px; border-bottom: 1px solid #17171b; color: inherit; text-decoration: none; }
.t-news:last-child { border-bottom: 0; }
.t-news:active { background: var(--t-panel-2); }
.t-news .meta { display: flex; align-items: center; gap: 7px; font-size: 10.5px; margin-bottom: 3px; }
.t-news .src { color: var(--t-amber); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.t-news .age { color: var(--t-ink-3); font-family: var(--t-mono); }
.t-news .more { color: var(--t-blue); font-weight: 600; }
.t-news .hot { color: var(--t-down); font-weight: 800; }
.t-news .ttl { font-size: 14.5px; line-height: 1.35; font-weight: 600; color: var(--t-ink); }
.t-news .sum { font-size: 12.5px; color: var(--t-ink-3); margin-top: 3px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-news .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.t-news .tag { font-size: 10px; color: var(--t-ink-2); border: 1px solid var(--t-line); padding: 1px 6px; border-radius: 4px; }
.t-news .ask { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--t-ink-3); padding: 2px 4px; }

/* quote tiles */
.t-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.t-tile { background: var(--t-panel); border: 1px solid var(--t-line); border-radius: 10px; padding: 10px 12px; text-align: left; }
.t-tile .sym { font-family: var(--t-mono); font-weight: 800; color: var(--t-amber); font-size: 13px; }
.t-tile .px { font-family: var(--t-mono); font-size: 20px; margin-top: 2px; }
.t-tile svg.spark { width: 100%; height: 28px; margin-top: 4px; }

/* events */
.t-next { display: flex; align-items: center; gap: 12px; }
.t-next .cd { font-family: var(--t-mono); font-size: 22px; font-weight: 700; color: var(--t-amber); white-space: nowrap; }
.t-day { font-size: 11px; font-weight: 800; color: var(--t-amber); letter-spacing: .08em; text-transform: uppercase; padding: 12px 2px 6px; }
.t-day.today::after { content: " · today"; color: var(--t-ink-3); }
.t-ev { display: flex; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #17171b; align-items: flex-start; }
.t-ev:last-child { border-bottom: 0; }
.t-ev .tm { width: 64px; flex: none; font-family: var(--t-mono); font-size: 11.5px; color: var(--t-ink-2); padding-top: 2px; }
.t-ev .body { flex: 1; min-width: 0; }
.t-ev .ttl { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.t-ev .det { font-size: 11.5px; color: var(--t-ink-3); margin-top: 2px; font-family: var(--t-mono); }
.imp { display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; font-weight: 800; letter-spacing: .06em; margin-right: 6px; vertical-align: 1px; }
.imp::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.imp.high { color: var(--t-down); }
.imp.med { color: var(--t-amber); }
.imp.low { color: var(--t-ink-3); }
.kindtag { font-size: 9.5px; font-weight: 800; letter-spacing: .06em; color: var(--t-blue); text-transform: uppercase; margin-right: 6px; }

/* options */
.t-idea { padding: 12px; border-bottom: 1px solid #17171b; }
.t-idea:last-child { border-bottom: 0; }
.t-idea .hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.t-idea .hd .sym { font-family: var(--t-mono); font-weight: 800; font-size: 16px; }
.t-idea .strat { font-size: 14px; font-weight: 700; margin: 8px 0 4px; }
.t-legs { font-family: var(--t-mono); font-size: 12px; color: var(--t-ink-2); line-height: 1.6; }
.t-legs .s { color: var(--t-down); }
.t-legs .b { color: var(--t-up); }
.t-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--t-line); border: 1px solid var(--t-line); border-radius: 8px; overflow: hidden; margin: 8px 0; }
.t-metrics div { background: var(--t-panel); padding: 7px 8px; }
.t-metrics .k { font-size: 9.5px; font-weight: 700; color: var(--t-ink-3); letter-spacing: .06em; text-transform: uppercase; }
.t-metrics .v { font-family: var(--t-mono); font-size: 13.5px; margin-top: 2px; }
.t-why { font-size: 11.5px; color: var(--t-ink-3); line-height: 1.5; }
.t-warn { font-size: 11.5px; color: var(--t-amber); margin-top: 6px; line-height: 1.45; }
.t-btns { display: flex; gap: 8px; margin-top: 10px; }
.t-btn { flex: 1; padding: 9px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 700; background: var(--t-panel-2); border: 1px solid var(--t-line); color: var(--t-ink); }
.t-btn.primary { background: var(--t-amber); color: #000; border-color: var(--t-amber); }
.t-btn:disabled { opacity: .45; }
.t-form { display: flex; gap: 8px; margin-bottom: 10px; }
.t-input, .t-select { background: var(--t-panel); border: 1px solid var(--t-line); color: var(--t-ink); border-radius: 8px; padding: 9px 11px;
  font: 600 15px var(--t-mono); outline: none; min-width: 0; }
.t-input:focus, .t-select:focus { border-color: var(--t-amber); }
.t-input.tk { flex: 1; text-transform: uppercase; }
.t-select { font-size: 13px; width: 100%; }
.t-strats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
.t-strats::-webkit-scrollbar { display: none; }
.t-legrow { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--t-line); font-family: var(--t-mono); font-size: 13px; }
.t-legrow:last-child { border-bottom: 0; }
.t-legrow .side { width: 44px; font-weight: 800; font-size: 11px; }
.t-legrow .k { flex: 1; }
.t-legrow .step { width: 32px; height: 30px; border-radius: 7px; background: var(--t-panel-2); border: 1px solid var(--t-line); font-size: 17px; line-height: 1; color: var(--t-ink); }
.t-legrow .pr { width: 84px; font-size: 11px; text-align: right; color: var(--t-ink-2); font-size: 12px; }
.t-plchart { width: 100%; height: 210px; display: block; touch-action: pan-y; }
.t-plchart .grid { stroke: #1d1d22; stroke-width: 1; }
.t-plchart .zero { stroke: #4a4a52; stroke-width: 1; }
.t-plchart .axis { font: 10px var(--t-mono); fill: var(--t-ink-3); }
.t-plchart .exp { fill: none; stroke: var(--t-amber); stroke-width: 2; }
.t-plchart .half { fill: none; stroke: var(--t-blue); stroke-width: 1.6; stroke-dasharray: 4 3; }
.t-plchart .spot { stroke: var(--t-ink-2); stroke-width: 1; stroke-dasharray: 2 3; }
.t-plchart .cross { stroke: var(--t-ink-2); stroke-width: 1; }
.t-plkey { display: flex; gap: 14px; font-size: 11px; color: var(--t-ink-3); padding: 2px 2px 0; }
.t-plkey i { display: inline-block; width: 14px; height: 2px; vertical-align: 3px; margin-right: 5px; }
.t-plread { font-family: var(--t-mono); font-size: 12px; color: var(--t-ink-2); min-height: 18px; padding: 2px; }

/* insider */
.t-ins { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #17171b; color: inherit; text-decoration: none; align-items: flex-start; }
.t-ins:last-child { border-bottom: 0; }
.t-ins .sym { font-family: var(--t-mono); font-weight: 800; width: 52px; flex: none; padding-top: 1px; }
.t-ins .body { flex: 1; min-width: 0; }
.t-ins .who { font-size: 13.5px; font-weight: 600; }
.t-ins .ttl { font-size: 11.5px; color: var(--t-ink-3); }
.t-ins .val { text-align: right; font-family: var(--t-mono); font-size: 13px; white-space: nowrap; }
.t-ins .val small { display: block; color: var(--t-ink-3); font-size: 10.5px; }
.t-banner { padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(47,210,122,.35); background: rgba(47,210,122,.07);
  color: var(--t-up); font-size: 12.5px; font-weight: 600; margin-bottom: 10px; }

/* alerts + settings */
.t-set { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #17171b; font-size: 13.5px; }
.t-set:last-child { border-bottom: 0; }
.t-set label { flex: 1; }
.t-set small { display: block; color: var(--t-ink-3); font-size: 11.5px; }
.t-switch { width: 44px; height: 26px; border-radius: 99px; background: #2a2a30; position: relative; flex: none; transition: background .15s; }
.t-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.t-switch.on { background: var(--t-amber); }
.t-switch.on::after { transform: translateX(18px); }
.t-num { width: 70px; text-align: right; }
.t-textarea { width: 100%; min-height: 64px; background: var(--t-panel); border: 1px solid var(--t-line); border-radius: 8px; color: var(--t-ink);
  font: 13px -apple-system, sans-serif; padding: 9px 11px; outline: none; resize: vertical; }
.t-alert { padding: 10px 12px; border-bottom: 1px solid #17171b; }
.t-alert:last-child { border-bottom: 0; }
.t-alert .ttl { font-size: 13.5px; font-weight: 600; }
.t-alert .bd { font-size: 12px; color: var(--t-ink-3); margin-top: 2px; }
.t-alert .tm { font-family: var(--t-mono); font-size: 10.5px; color: var(--t-ink-3); }
.t-wl { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.t-wl span { display: inline-flex; align-items: center; gap: 4px; font: 700 13px var(--t-mono); padding: 5px 5px 5px 10px; border-radius: 7px;
  background: var(--t-panel-2); border: 1px solid var(--t-line); }
.t-wl button { width: 22px; height: 22px; border-radius: 5px; color: var(--t-ink-3); font-size: 15px; line-height: 1; }
.t-src { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid #17171b; font-size: 12.5px; }
.t-src .e { color: var(--t-ink-3); font-size: 11px; display: block; }
.t-src b.ok { color: var(--t-up); }
.t-src b.bad { color: var(--t-down); }
.t-src b.warn { color: var(--t-amber); }
.t-health { display: block; width: 100%; text-align: left; font-size: 11.5px; color: var(--t-ink-3); padding: 4px 2px 10px; }
.t-health b { font-family: var(--t-mono); }

/* bottom sheet (quote detail / settings) */
.term-sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; z-index: 40;
  background: #0a0a0c; border-top: 1px solid var(--t-line); border-radius: 16px 16px 0 0;
  padding: 10px 14px calc(18px + var(--sab)); color: var(--t-ink); box-shadow: 0 -12px 40px rgba(0,0,0,.6); }
.term-sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: #333; margin: 0 auto 10px; }
.term-sheet h3 { margin: 0 0 2px; font: 800 20px var(--t-mono); }
.term-sheet .nm { color: var(--t-ink-3); font-size: 12.5px; margin-bottom: 8px; }
.term-sheet .bigpx { font: 700 28px var(--t-mono); }
.term-sheet svg.spark { width: 100%; height: 70px; margin: 8px 0; }
.term-sheet .kvs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; margin: 6px 0 4px; }
.term-sheet .kvs div { display: flex; justify-content: space-between; font-size: 12.5px; padding: 5px 0; border-bottom: 1px dashed var(--t-line); color: var(--t-ink-3); }
.term-sheet .kvs b { font-family: var(--t-mono); color: var(--t-ink); font-weight: 600; }
.term-sheet .t-card-h h3 { font: 800 12px -apple-system, sans-serif; }
