﻿:root {
  --bg: #070a0f;
  --bg-soft: #0a0f17;
  --panel: #0d131c;
  --panel-2: #111925;
  --panel-3: #151f2d;
  --line: #1d2836;
  --line-soft: #151f2b;
  --text: #edf2fa;
  --muted: #8996a9;
  --muted-2: #5e6a7c;
  --up: #ff5b6b;
  --up-soft: rgba(255, 91, 107, .12);
  --down: #1fc98a;
  --down-soft: rgba(31, 201, 138, .12);
  --accent: #e7b35a;
  --accent-soft: rgba(231, 179, 90, .1);
  --blue: #61a8ff;
  --mono: "Bahnschrift", "DIN Alternate", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-width: 320px;
  height: 100%;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(67, 95, 148, .14), transparent 60%),
    radial-gradient(800px 500px at 92% 0%, rgba(231, 179, 90, .06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
::selection { background: rgba(231, 179, 90, .25); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #253142; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #34445b; border: 2px solid transparent; background-clip: content-box; }

.ambient {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  opacity: .55;
}
.ambient-a { width: 440px; height: 300px; left: 18%; top: -190px; background: rgba(56, 107, 180, .18); }
.ambient-b { width: 380px; height: 260px; right: 6%; top: -170px; background: rgba(231, 179, 90, .09); }

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 66px 42px 58px minmax(0, 1fr) 30px;
  height: 100vh;
  min-height: 640px;
}

/* ---------------- Top bar ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(8, 12, 18, .78);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  color: var(--accent);
  cursor: pointer;
  border-radius: 8px;
  transition: background .18s ease, box-shadow .18s ease;
  background: linear-gradient(145deg, rgba(231, 179, 90, .16), rgba(231, 179, 90, .03));
  border: 1px solid rgba(231, 179, 90, .28);
  border-radius: 10px;
  box-shadow: inset 0 0 22px rgba(231, 179, 90, .06);
}
.brand-mark svg { width: 27px; height: 27px; }
.brand-mark:hover { background: var(--accent-soft); border-color: rgba(231,179,90,.5); }
.brand-copy { min-width: 0; }
.brand-title { font-size: 16px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.brand-title span { color: var(--muted); font-weight: 500; margin-left: 5px; }
.brand-sub { margin-top: 4px; color: var(--muted-2); font-size: 9px; letter-spacing: .16em; white-space: nowrap; }
.sim-badge {
  margin-left: 8px;
  padding: 3px 7px;
  border: 1px solid rgba(231, 179, 90, .3);
  border-radius: 4px;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
}
.header-account { display: flex; align-items: center; gap: 28px; }
.account-stat { display: flex; flex-direction: column; gap: 4px; min-width: 92px; }
.account-stat span { color: var(--muted-2); font-size: 10px; letter-spacing: .04em; }
.account-stat strong { font-family: var(--mono); font-size: 14px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.account-stat strong.up { color: var(--up); }
.account-stat strong.down { color: var(--down); }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, .02);
  color: var(--muted);
  font-size: 11px;
  transition: .18s ease;
}
.ghost-btn svg { width: 13px; height: 13px; }
.ghost-btn:hover { color: var(--text); border-color: #334257; background: rgba(255, 255, 255, .04); }
#updatesBtn { color: var(--accent); border-color: rgba(231,179,90,.24); background: var(--accent-soft); width: auto; padding: 0 9px; font-size: 9px; }
.updates-list { display: flex; flex-direction: column; gap: 10px; max-height: 62vh; overflow-y: auto; }
.update-item { padding: 9px 11px; border: 1px solid var(--line-soft); border-radius: 6px; background: rgba(255,255,255,.015); }
.update-item-head { display: flex; align-items: baseline; gap: 8px; }
.update-item-head b { color: var(--text); font-size: 11px; }
.update-item-head time { color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.update-item ul { margin: 5px 0 0; padding-left: 16px; color: var(--muted); font-size: 9px; line-height: 1.65; }

.room-entry {
  display: flex; align-items: center; gap: 7px;
  height: 34px; margin-left: 7px; padding: 0 9px;
  border: 1px solid rgba(231, 179, 90, .22);
  border-radius: 7px;
  background: rgba(231, 179, 90, .045);
  color: var(--accent);
  transition: .16s ease;
}
.room-entry:hover { border-color: rgba(231, 179, 90, .48); background: rgba(231, 179, 90, .09); }
.room-entry.active { border-color: rgba(31, 201, 138, .32); color: #8fe0bd; background: rgba(31, 201, 138, .07); }
.room-entry svg { width: 16px; height: 16px; flex-shrink: 0; }
.room-entry-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; }
.room-entry-copy b { font-size: 9px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.room-entry-copy small { color: var(--muted-2); font-size: 8px; white-space: nowrap; }
.room-entry.active .room-entry-copy small { color: #65a98d; }
.shared-badge {
  display: inline-flex; margin-left: 4px; padding: 1px 4px;
  border: 1px solid rgba(231, 179, 90, .3); border-radius: 3px;
  color: var(--accent); background: var(--accent-soft);
  font-size: 7px; font-style: normal; font-weight: 500; letter-spacing: .05em; vertical-align: 1px;
}
.room-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px;
  border: 1px solid rgba(31, 201, 138, .24); border-radius: 6px;
  background: rgba(31, 201, 138, .06);
  color: #8fe0bd; font-size: 9px;
}
.room-pill:hover { background: rgba(31, 201, 138, .11); }
.room-pill b { color: #b8f1d9; font-family: var(--mono); letter-spacing: .06em; }
.room-pill em { color: #5f9f86; font-family: var(--mono); font-size: 8px; font-style: normal; }
.room-pill-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--down); box-shadow: 0 0 6px rgba(31, 201, 138, .8); }


/* ---------------- Index bar ---------------- */
.indexbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(9, 13, 20, .58);
  overflow: hidden;
}
.index-strip { display: flex; align-items: center; gap: 0; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.index-strip::-webkit-scrollbar { display: none; }
.index-loading { color: var(--muted-2); font-size: 11px; }
.index-item { display: flex; align-items: baseline; gap: 8px; padding: 0 18px; border-right: 1px solid var(--line-soft); white-space: nowrap; cursor: pointer; }
.index-item:hover .index-name { color: var(--accent); }
.index-item.global .index-name { color: #9db2cc; }
.index-region { align-self: stretch; display: flex; align-items: center; padding: 0 7px; color: var(--muted-2); font-size: 8px; letter-spacing: .08em; border-right: 1px solid var(--line-soft); }
.index-item:first-child { padding-left: 0; }
.index-item:last-child { border-right: 0; }
.index-name { color: var(--muted); font-size: 11px; }
.index-price { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.index-pct { font-family: var(--mono); font-size: 11px; }
.indexbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.volume-compare-card {
  position: static;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  width: 228px;
  height: 42px;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  overflow: visible;
  pointer-events: none;
}
.volume-compare-card[hidden] { display: none; }
.vc-copy { display: flex; flex-direction: column; gap: 2px; width: 92px; }
.vc-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 9px; }
.vc-head span { color: var(--text); font-weight: 500; }
.vc-head em { color: var(--muted-2); font-style: normal; font-family: var(--mono); font-size: 7px; }
.vc-diff { font: 700 13px/1.1 Bahnschrift, Consolas, monospace; letter-spacing: .01em; white-space: nowrap; }
.vc-diff.down { color: #2fd39a; }
.vc-diff.up { color: #ff6b78; }
.volume-compare-card canvas { display: block; width: 128px; height: 38px; margin: 0; }
.overview-sep { flex: 0 0 1px; width: 1px; height: 30px; margin: 0 12px; background: rgba(255,255,255,.16); }
@media (max-width: 1200px) {
  .overview-bar { overflow-x: auto; scrollbar-width: none; }
  .overview-bar::-webkit-scrollbar { display: none; }
  .overview-dist { flex: 0 0 auto; }
}
.market-state {
  display: flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  background: rgba(255, 255, 255, .015);
}
.state-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); box-shadow: 0 0 0 3px rgba(255, 255, 255, .03); }
.market-state.open .state-dot { background: var(--down); box-shadow: 0 0 0 3px rgba(31, 201, 138, .12); animation: pulse 2s infinite; }
.market-state.open #stateText { color: var(--down); }
.clock { padding-left: 7px; border-left: 1px solid var(--line); color: var(--muted-2); font-family: var(--mono); font-size: 10px; }
.data-pill {
  display: flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px;
  border: 1px solid rgba(97, 168, 255, .18);
  border-radius: 6px;
  color: #8ebcff;
  background: rgba(97, 168, 255, .05);
  font-size: 10px;
}
.live-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--down); box-shadow: 0 0 6px rgba(31, 201, 138, .8); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------------- Workspace ---------------- */
.workspace {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 378px;
  min-height: 0;
  overflow: hidden;
}
.sidebar {
  display: flex; flex-direction: column;
  min-height: 0;
  padding: 17px 12px 14px;
  border-right: 1px solid var(--line-soft);
  background: rgba(8, 12, 18, .34);
  overflow-y: auto;
}
.page-back { margin-left: 14px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 10px; }
.page-back:hover { color: var(--accent); border-color: rgba(231,179,90,.3); }
body[data-screen="home"] .sidebar .side-section:nth-child(2),
body[data-screen="home"] .sidebar .side-foot { display: none; }
body[data-screen="home"] .rightrail .quote-card,
body[data-screen="home"] .rightrail .chart-card,
body[data-screen="home"] .rightrail .orderbook-card,
body[data-screen="home"] .rightrail .trade-card { display: none; }
body[data-screen="home"] .rightrail { border-left: 0; background: transparent; padding: 17px 17px 0 0; }
body[data-screen="detail"] .workspace { grid-template-columns: minmax(0, 1fr); }
body[data-screen="detail"] .sidebar,
body[data-screen="detail"] .mainview { display: none; }
body[data-screen="detail"] .rightrail {
  display: grid;
  grid-template-columns: 330px minmax(420px, 1fr) 340px;
  grid-template-areas: "quote chart trade" "invest chart trade" "orderbook chart trade";
  align-content: start;
  gap: 12px;
  padding: 16px 20px 24px;
  border-left: 0;
  background: transparent;
  overflow-y: auto;
}
body[data-screen="detail"] .quote-card { grid-area: quote; overflow: visible; }
body[data-screen="detail"] .quote-card .f10-panel { min-height: 0; }
@media (min-width: 821px) {
  body[data-screen="detail"] .quote-card.f10-open { min-height: 640px; }
  body[data-screen="detail"] .invest-card.invest-open { min-height: 700px; }
}
body[data-screen="detail"] .invest-card { grid-area: invest; }
body[data-screen="detail"] .index-cons-card { grid-area: invest; }
body[data-screen="detail"] .chart-card { grid-area: chart; }
body[data-screen="detail"] .orderbook-card { grid-area: orderbook; }
body[data-screen="detail"] .trade-card { grid-area: trade; }
body[data-screen="detail"] .news-card { display: none; }
body[data-screen="detail"].index-mode .rightrail { grid-template-columns: 330px minmax(420px, 1fr); grid-template-areas: "quote chart" "invest chart"; }
body[data-screen="detail"].index-mode .orderbook-card,
body[data-screen="detail"].index-mode .trade-card,
body[data-screen="detail"].index-mode .invest-card { display: none; }
body[data-screen="home"] .rightrail .invest-card,
body[data-screen="home"] .rightrail .index-cons-card { display: none; }
body[data-screen="futures"] .workspace { grid-template-columns: 190px minmax(0, 1fr); }
body[data-screen="futures"] .sidebar,
body[data-screen="futures"] .mainview,
body[data-screen="futures"] .rightrail { display: none; }
body[data-screen="futures"] .futures-sidebar { display: flex; }
.futures-sidebar { display: none; flex-direction: column; min-height: 0; padding: 14px 10px; border-right: 1px solid var(--line-soft); background: rgba(9,16,24,.55); }
.futures-side-title { padding: 0 7px 9px; color: var(--muted-2); font-size: 8px; letter-spacing: .08em; }
.futures-side-nav { display: flex; flex-direction: column; gap: 2px; }
.futures-side-nav button { display: flex; align-items: center; justify-content: space-between; gap: 5px; width: 100%; min-height: 34px; padding: 0 8px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); font-size: 10px; text-align: left; }
.futures-side-nav button:hover { background: rgba(255,255,255,.035); color: var(--text); }
.futures-side-nav button.active { border-color: rgba(231,179,90,.2); background: var(--accent-soft); color: var(--accent); }
.futures-side-nav button em { color: var(--muted-2); font-family: var(--mono); font-size: 8px; font-style: normal; }
.futures-side-nav button.active em { color: var(--accent); }
.futures-side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.futures-side-stat { display: flex; justify-content: space-between; padding: 5px 6px; color: var(--muted-2); font-size: 8px; }
.futures-side-stat b { color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 500; }
.futures-account-view { min-height: 0; flex: 1; overflow-y: auto; padding: 4px 14px 20px; }
.futures-account-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 2px 0 10px; }
.futures-account-head h2 { margin: 0; color: var(--text); font-size: 17px; font-weight: 600; }
.futures-account-head p { margin: 3px 0 0; color: var(--muted-2); font-size: 8px; }
.futures-account-table { min-width: 650px; }
.futures-account-table th, .futures-account-table td { padding: 8px 7px; border-bottom: 1px solid var(--line-soft); font-size: 9px; text-align: left; white-space: nowrap; }
.futures-account-table th { color: var(--muted-2); font-weight: 400; }
.futures-account-table td { color: var(--muted); font-family: var(--mono); }
.futures-account-table .future-close-btn { height: 22px; font-size: 7px; }
.futures-account-cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
.futures-account-card { padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: rgba(255,255,255,.02); }
.futures-account-card span { display: block; color: var(--muted-2); font-size: 8px; }
.futures-account-card b { display: block; margin-top: 5px; color: var(--text); font-family: var(--mono); font-size: 13px; font-weight: 500; }
.futures-account-actions { display: flex; gap: 5px; align-items: center; }
.futures-account-empty { padding: 48px 10px; color: var(--muted-2); font-size: 10px; text-align: center; }
.futures-legs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.futures-legs-grid > section { min-width: 0; padding: 8px; border: 1px solid var(--line-soft); border-radius: 7px; background: rgba(255,255,255,.015); }
.futures-legs-grid h3 { display: flex; align-items: baseline; gap: 5px; margin: 0 0 5px; font-size: 10px; font-weight: 500; }
.futures-legs-grid h3 em { color: var(--muted-2); font-family: var(--mono); font-size: 7px; font-style: normal; }
.futures-leg-table-wrap { overflow: auto; }
.futures-leg-table { min-width: 560px; }
.futures-leg-table th, .futures-leg-table td { padding: 5px 4px; font-size: 8px; }
@media (max-width: 1100px) { .futures-legs-grid { grid-template-columns: 1fr; } }
.futures-share-bar { display: flex; justify-content: flex-end; padding-bottom: 7px; }
.futures-page { display: none; min-height: 0; overflow: hidden; }
body[data-screen="futures"] .futures-page { display: flex; flex-direction: column; }
.futures-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line-soft); }
.futures-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.futures-head p { margin: 4px 0 0; color: var(--muted-2); font-size: 9px; }
.futures-head-actions { display: flex; align-items: center; gap: 10px; }
.futures-categories { display: flex; gap: 4px; padding: 8px 12px; overflow-x: auto; border-bottom: 1px solid var(--line-soft); }
.futures-category { flex-shrink: 0; padding: 4px 8px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--muted-2); font-size: 9px; }
.futures-category:hover { color: var(--text); }
.futures-category.active { border-color: rgba(231,179,90,.3); background: var(--accent-soft); color: var(--accent); }
.futures-page:not(.detail) .futures-side { display: none; }
.futures-page:not(.detail) .futures-layout { grid-template-columns: minmax(0, 1fr); }
.futures-page.detail .futures-layout { grid-template-columns: minmax(0, 1fr); }
.futures-page.detail .futures-list-panel { display: none; }
.futures-page.detail .futures-side {
  display: grid;
  grid-template-columns: 330px minmax(420px, 1fr) 340px;
  grid-template-areas: "quote chart trade" "positions chart trade";
  align-content: start;
  gap: 12px;
  padding: 16px 20px;
}
.futures-page.detail .futures-quote { grid-area: quote; }
.futures-page.detail .futures-chart-block { grid-area: chart; }
.futures-page.detail .futures-chart-wrap { grid-area: auto; height: 360px; }
.futures-page.detail .futures-trade { grid-area: trade; }
.futures-page.detail .futures-positions { grid-area: positions; }
.futures-tabs { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line-soft); border-radius: 6px; background: rgba(0,0,0,.14); }
.futures-tabs button { padding: 5px 10px; border: 0; border-radius: 4px; background: transparent; color: var(--muted-2); font-size: 9px; }
.futures-tabs button.active { background: var(--accent-soft); color: var(--accent); }
.futures-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; flex: 1; }
.futures-list-panel { min-height: 0; border-right: 1px solid var(--line-soft); overflow: hidden; }
.futures-list-panel .table-wrap { height: 100%; }
.futures-table tbody tr { cursor: pointer; }
.future-session { max-width: 240px; margin-top: 2px; overflow: hidden; color: var(--muted-2); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.future-session.closure { color: #c98b6a; }
.futures-holiday-empty { margin-top: 4px; color: var(--muted-2); font-size: 8px; }
.futures-session { margin-top: 6px; padding: 5px 6px; border-left: 2px solid rgba(231,179,90,.4); border-radius: 2px; background: rgba(231,179,90,.035); color: var(--muted); font-size: 8px; line-height: 1.5; }
.futures-session span { color: var(--muted-2); }
.futures-session b { margin-left: 4px; color: var(--accent); font-weight: 500; }
.futures-holiday { margin-top: 4px; padding: 5px 6px; border: 1px solid rgba(240,106,106,.3); border-radius: 4px; background: rgba(240,106,106,.06); color: var(--muted); font-size: 8px; line-height: 1.5; }
.futures-holiday b { color: #ff8b8b; font-weight: 500; }
.futures-holiday span { display: block; margin-top: 2px; color: var(--muted-2); font-family: var(--mono); }
.futures-side { min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.futures-quote { padding: 12px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(255,255,255,.018); }
.futures-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line-soft); }
.futures-stats div { display: flex; flex-direction: column; gap: 3px; }
.futures-stats span { color: var(--muted-2); font-size: 8px; }
.futures-stats b { color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 500; }
.futures-chart-block { display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.futures-indicator-strip { margin-top: 1px; padding: 4px 0 2px; border-top: 1px solid var(--line-soft); overflow-x: auto; flex-wrap: nowrap; }
.futures-indicator-strip .indicator-group { flex-shrink: 0; }
.futures-indicator-params { max-height: 92px; overflow-y: auto; }
.futures-chart-wrap { position: relative; height: 220px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(255,255,255,.012); overflow: hidden; }
.futures-periods { display: flex; gap: 2px; padding: 5px 2px 6px; }
.futures-periods button { flex: 1; padding: 4px 2px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: var(--muted-2); font-size: 8px; }
.futures-periods button.active { border-color: rgba(231,179,90,.3); background: var(--accent-soft); color: var(--accent); }
.futures-chart-wrap canvas { display: block; width: 100%; height: 100%; }
.futures-trade { padding: 11px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(255,255,255,.018); }
.futures-trade-head { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 9px; }
.futures-positions { color: var(--muted-2); font-size: 9px; }
.future-pos-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.future-pos-name { flex: 1; min-width: 0; color: var(--muted); }
.future-pos-name em { font-style: normal; font-weight: 600; }
#futuresPositions { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.futures-side-legs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
.future-side-column { min-width: 0; padding: 5px; border: 1px solid var(--line-soft); border-radius: 6px; background: rgba(255,255,255,.015); }
.future-side-column-head { display: flex; align-items: center; justify-content: space-between; gap: 3px; padding: 1px 1px 4px; font-size: 9px; }
.future-side-column-head em { color: var(--muted-2); font-family: var(--mono); font-size: 7px; font-style: normal; }
.future-pos-empty { padding: 14px 2px; color: var(--muted-2); font-size: 8px; text-align: center; }
.future-side-column .future-pos-lot { padding: 5px 4px; }
.future-side-column .future-pos-lot-main { gap: 3px; }
.future-side-column .future-pos-lot-main b { font-size: 8px; }
.future-side-column .future-pos-lot-meta { gap: 4px; flex-wrap: wrap; }
.future-side-column .future-pos-lot-meta .future-close-btn { margin-left: 0; width: 100%; height: 18px; }
.future-pos-group { padding: 2px 0 6px; }
.future-pos-group + .future-pos-group { border-top: 1px solid var(--line-soft); padding-top: 7px; }
.future-pos-group-head { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 2px 0 4px; font-size: 9px; }
.future-pos-group-head em { color: var(--muted-2); font-family: var(--mono); font-size: 7px; font-style: normal; }
.future-pos-lot { padding: 6px 7px; margin-bottom: 4px; border: 1px solid var(--line-soft); border-radius: 6px; background: rgba(255,255,255,.018); }
.future-pos-lot-main { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.future-pos-lot-time { flex: 0 0 auto; color: var(--muted-2); font-family: var(--mono); font-size: 7px; }
.future-pos-lot-main b { overflow: hidden; color: var(--text); font-size: 9px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.future-pos-lot-main em { flex: 0 0 auto; color: var(--muted); font-family: var(--mono); font-size: 7px; font-style: normal; }
.future-pos-lot-meta { display: flex; align-items: center; gap: 7px; margin-top: 3px; color: var(--muted-2); font-family: var(--mono); font-size: 7px; }
.future-pos-lot-meta .future-close-btn { margin-left: auto; height: 20px; padding: 0 5px; font-size: 7px; }
.future-close-btn { flex: 0 0 auto; height: 25px; padding: 0 8px; border: 1px solid rgba(240,106,106,.45); border-radius: 5px; background: rgba(240,106,106,.14); color: #ff8b8b; font-size: 8px; font-weight: 600; }
.future-close-btn.short { border-color: rgba(31,201,138,.4); background: rgba(31,201,138,.12); color: #52dca8; }
.future-close-btn:hover { filter: brightness(1.2); }
.futures-close-summary { display: flex; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 5px; color: var(--muted); font-size: 9px; }
.futures-close-summary b { font-family: var(--mono); font-size: 11px; }
.futures-close-quick { margin-top: 7px; }
.futures-close-quick button { flex: 1; height: 28px; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,.03); color: var(--muted); font-size: 9px; }
@media (max-width: 720px) {
  .overview-bar { gap: 10px; padding: 6px 12px; overflow-x: auto; }
  .overview-head { min-width: 64px; }
  .overview-title { font-size: 11px; }
  .overview-metrics { gap: 12px; }
  .ov-metric b { font-size: 11px; }
  .ov-metric span { font-size: 7px; }
  .overview-dist { display: none; }
  .world-map { height: 360px; }
  .world-callout { min-width: 84px; padding: 5px 6px; }
  .world-callout .wc-name { font-size: 8px; }
  .world-callout .wc-price { font-size: 14px; }
  .world-callout .wc-pct { font-size: 9px; }
  .world-callout::before, .world-callout::after { display: none; }
}


.side-section + .side-section { margin-top: 22px; }
.side-label {
  margin: 0 10px 8px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .14em;
}
.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; height: 36px; padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: .16s ease;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .82; }
.nav-item span { flex: 1; font-size: 12px; }
.nav-item em { font-style: normal; font-family: var(--mono); font-size: 9px; color: var(--muted-2); }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .025); }
.nav-item.active {
  color: var(--accent);
  border-color: rgba(231, 179, 90, .16);
  background: linear-gradient(90deg, rgba(231, 179, 90, .1), rgba(231, 179, 90, .02));
}
.nav-item.active svg { opacity: 1; }
.nav-item.active em { color: var(--accent); }

.filter-list { display: flex; flex-direction: column; gap: 1px; }
.filter-item {
  display: flex; align-items: center; justify-content: space-between;
  height: 30px; padding: 0 10px;
  border: 0; border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  transition: .15s ease;
}
.filter-item em { color: var(--muted-2); font-family: var(--mono); font-size: 9px; font-style: normal; }
.filter-item:hover { background: rgba(255, 255, 255, .025); color: var(--text); }
.filter-item.active { background: rgba(255, 255, 255, .045); color: var(--text); }
.filter-item.active em { color: var(--accent); }
.side-foot { margin-top: auto; padding-top: 24px; }
.source-card {
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: linear-gradient(155deg, rgba(31, 201, 138, .035), rgba(255, 255, 255, .012));
}
.source-head { display: flex; align-items: center; gap: 6px; color: #86d6b8; font-size: 10px; }
.source-card p { margin: 8px 0 10px; color: var(--muted-2); font-size: 10px; line-height: 1.6; }
.text-btn { padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 10px; }
.text-btn:hover { text-decoration: underline; }

/* ---------------- Main view ---------------- */
.mainview { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 17px 17px 0; }
.main-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 12px; flex-shrink: 0; }
.main-title-wrap h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: .01em; }
.main-title-wrap p { margin: 5px 0 0; color: var(--muted-2); font-size: 10px; }
.main-tools { position: relative; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.search-box {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  width: 204px; height: 32px; padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, .02);
  transition: .16s ease;
}
.search-suggest { position: absolute; z-index: 60; top: 38px; left: 0; width: 340px; max-width: calc(100vw - 24px); max-height: 320px; overflow-y: auto; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: rgba(12,19,28,.98); box-shadow: 0 16px 36px rgba(0,0,0,.45); }
.search-suggest[hidden] { display: none; }
.search-suggest-item { display: flex; align-items: center; gap: 7px; padding: 6px 7px; border-radius: 4px; cursor: pointer; }
.search-suggest-item:hover { background: rgba(255,255,255,.045); }
.search-suggest-item .ss-type { flex: 0 0 auto; padding: 1px 3px; border: 1px solid var(--line-soft); border-radius: 2px; color: var(--muted-2); font-size: 7px; }
.search-suggest-item .ss-name { flex: 1; min-width: 0; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.search-suggest-item .ss-code { color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.search-suggest-item .ss-pct { width: 52px; text-align: right; font-family: var(--mono); font-size: 8px; }
.search-suggest-empty { padding: 12px; color: var(--muted-2); font-size: 9px; text-align: center; }
.search-box:focus-within { border-color: rgba(231, 179, 90, .55); box-shadow: 0 0 0 3px rgba(231, 179, 90, .06); }
.search-box svg { width: 14px; height: 14px; color: var(--muted-2); flex-shrink: 0; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 11px; }
.search-box input::placeholder { color: var(--muted-2); }
.search-box kbd {
  display: grid; place-items: center;
  width: 18px; height: 18px;
  border: 1px solid var(--line); border-radius: 4px;
  color: var(--muted-2); font-family: var(--mono); font-size: 9px;
}
.select-wrap { position: relative; display: flex; align-items: center; }
.select-wrap::after {
  content: ""; position: absolute; right: 9px; top: 13px;
  width: 5px; height: 5px; border-right: 1px solid var(--muted); border-bottom: 1px solid var(--muted);
  transform: rotate(45deg); pointer-events: none;
}
.select-wrap select {
  appearance: none; height: 32px; padding: 0 25px 0 9px;
  border: 1px solid var(--line); border-radius: 7px;
  outline: 0; background: rgba(255, 255, 255, .02);
  color: var(--muted); font-size: 10px;
}
.select-wrap select:hover { border-color: #2b394b; color: var(--text); }
.sync-status { display: inline-flex; align-items: center; gap: 5px; color: var(--muted-2); font-size: 9px; white-space: nowrap; }
.sync-status i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: pulse 1.8s infinite; }
.sync-status.live i { background: var(--down); animation: none; }
.sync-status.paused { color: var(--muted-2); }
.sync-status.paused i { background: #6b7688; animation: none; }

.overview-bar { display: flex; align-items: center; gap: 20px; min-height: 58px; padding: 5px 20px; border-bottom: 1px solid var(--line-soft); background: linear-gradient(180deg, rgba(13,20,29,.92), rgba(9,14,21,.92)); }
.overview-head { display: flex; flex-direction: column; gap: 3px; flex: 0 0 auto; }
.overview-title { color: var(--text); font-size: 13px; font-weight: 600; letter-spacing: .04em; }
.overview-updated { color: var(--muted-2); font-family: var(--mono); font-size: 7px; }
.overview-metrics { display: flex; align-items: center; gap: 20px; flex: 0 0 auto; }
.ov-metric { display: flex; flex-direction: column; gap: 3px; }
.ov-metric span { color: var(--muted-2); font-size: 8px; }
.ov-metric b { color: var(--text); font-family: var(--mono); font-size: 13px; font-weight: 500; }
.ov-metric b i { font-style: normal; }
.ov-metric b em { color: var(--muted-2); font-style: normal; font-size: 9px; }
.ov-metric b .up { color: var(--up); }
.ov-metric b .down { color: var(--down); }
.overview-dist { display: flex; align-items: flex-end; gap: 5px; height: 44px; margin-left: 8px; overflow: hidden; }
.ov-bucket { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 26px; height: 100%; justify-content: flex-end; }
.ov-bucket .ov-count { color: var(--muted-2); font-family: var(--mono); font-size: 7px; line-height: 1; }
.ov-bucket .ov-bar { width: 10px; min-height: 2px; border-radius: 1px 1px 0 0; background: #5a6678; }
.ov-bucket.up .ov-bar { background: var(--up); }
.ov-bucket.down .ov-bar { background: var(--down); }
.ov-bucket.flat .ov-bar { background: #7b8798; }
.ov-bucket .ov-label { color: var(--muted-2); font-size: 7px; white-space: nowrap; transform: scale(.92); transform-origin: top center; }
.panel {
  display: flex; flex-direction: column;
  min-height: 0; flex: 1;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(180deg, rgba(16, 23, 34, .92), rgba(10, 15, 23, .94));
  overflow: hidden;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, .015) inset;
}
.world-map-panel { flex: 0 0 auto; margin-bottom: 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: radial-gradient(ellipse at 50% 40%, rgba(24, 38, 54, .62), rgba(8, 13, 20, .92)); overflow: hidden; }
.world-map-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 0; }
.world-map-title { color: var(--text); font-size: 11px; letter-spacing: .06em; }
.world-map-sub { margin-left: 8px; color: var(--muted-2); font-family: var(--mono); font-size: 7px; letter-spacing: .14em; }
.world-map-note { color: var(--muted-2); font-size: 8px; }
.world-map { position: relative; height: 430px; margin-top: -2px; overflow: hidden; }
.world-map-svg { position: absolute; inset: 8% 2% 4%; width: 96%; height: 88%; opacity: .96; }
.world-map-night { position: absolute; inset: 8% 2% 4%; z-index: 1; width: 96%; height: 88%; pointer-events: none; }
.world-map-links { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.world-link { stroke: rgba(154,182,210,.32); stroke-width: .8; vector-effect: non-scaling-stroke; }
.world-link.up { stroke: rgba(255,107,120,.35); }
.world-link.down { stroke: rgba(31,201,138,.35); }
.world-city-dot { fill: #9fb6ca; stroke: #0b121b; stroke-width: 1; vector-effect: non-scaling-stroke; }
.world-map-grid { position: absolute; inset: 0; z-index: 2; background-image: linear-gradient(rgba(95,125,155,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(95,125,155,.08) 1px, transparent 1px); background-size: 42px 42px; mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%); opacity: .45; pointer-events: none; }
.world-callout { position: absolute; z-index: 4; min-width: 106px; padding: 7px 9px; border: 1px solid rgba(255,91,107,.45); border-radius: 5px; background: rgba(12,18,26,.9); box-shadow: 0 0 0 1px rgba(255,91,107,.06) inset, 0 8px 22px rgba(0,0,0,.28); cursor: pointer; transform: translate(-50%, -50%); }
.world-callout::before { display: none; }
.world-callout::after { display: none; }
.world-callout.closed { border-color: rgba(110,130,150,.32); box-shadow: 0 0 0 1px rgba(255,255,255,.02) inset, 0 8px 22px rgba(0,0,0,.24); animation: none; }
.world-callout.open { border-color: rgba(231,179,90,.82); box-shadow: 0 0 0 1px rgba(231,179,90,.16) inset, 0 0 0 3px rgba(231,179,90,.06), 0 8px 22px rgba(0,0,0,.28); animation: worldOpenPulse 2.2s ease-in-out infinite; }
@keyframes worldOpenPulse { 0%,100% { border-color: rgba(231,179,90,.55); } 50% { border-color: rgba(231,179,90,1); } }
.world-callout .wc-name { color: #e7edf7; font-size: 9px; white-space: nowrap; }
.world-callout .wc-name small { margin-left: 3px; color: var(--muted-2); font-size: 7px; font-weight: 400; }
.wc-status { margin-left: 4px; padding: 0 3px; border: 1px solid var(--line); border-radius: 2px; color: var(--muted-2); font-size: 6px; font-weight: 500; vertical-align: 1px; }
.wc-status.open { border-color: rgba(231,179,90,.45); color: var(--accent); }
.world-callout.down { border-color: rgba(31,201,138,.48); box-shadow: 0 0 0 1px rgba(31,201,138,.05) inset, 0 8px 22px rgba(0,0,0,.28); }
.world-callout .wc-name { color: #e7edf7; font-size: 10px; }
.world-callout .wc-price { margin-top: 3px; color: var(--up); font-family: var(--mono); font-size: 18px; letter-spacing: -.02em; }
.world-callout .wc-pct { margin-top: 1px; color: var(--up); font-family: var(--mono); font-size: 11px; }
.world-callout.down .wc-price, .world-callout.down .wc-pct { color: var(--down); }
.world-callout:hover { background: rgba(20,30,42,.96); border-color: var(--accent); }
body[data-screen="home"] .mainview { overflow-y: auto; }
body[data-screen="home"] .market-panel { min-height: 330px; flex: 1 0 auto; }
body:not([data-screen="home"]) .world-map-panel { display: none; }

.watch-groups { display: flex; align-items: center; gap: 4px; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.watch-group-tabs { display: flex; gap: 3px; min-width: 0; }
.watch-group-tab { flex-shrink: 0; padding: 4px 8px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--muted-2); font-size: 9px; }
.watch-group-tab:hover { color: var(--text); }
.watch-group-tab.active { border-color: rgba(231, 179, 90, .28); background: var(--accent-soft); color: var(--accent); }
.watch-group-tab .count { margin-left: 4px; color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.watch-group-add, .watch-group-manage { flex-shrink: 0; padding: 4px 7px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--muted-2); font-size: 9px; }
.watch-group-add:hover, .watch-group-manage:hover { color: var(--accent); border-color: rgba(231, 179, 90, .3); }
.watch-group-manage { margin-left: auto; }
.watch-index-strip { display: flex; gap: 6px; padding: 7px 10px; overflow-x: auto; border-bottom: 1px solid var(--line-soft); }
.watch-index-card { flex: 0 0 auto; min-width: 100px; padding: 5px 8px; border: 1px solid var(--line-soft); border-radius: 5px; background: rgba(255, 255, 255, .018); cursor: pointer; }
.watch-index-card:hover { border-color: rgba(231, 179, 90, .3); }
.watch-index-card .name { color: var(--muted); font-size: 9px; }
.watch-index-card .val { margin-top: 3px; font-family: var(--mono); font-size: 11px; }
.watch-index-card .pct { margin-left: 5px; font-family: var(--mono); font-size: 8px; }
.watch-manage-list { display: flex; flex-direction: column; gap: 4px; }
.watch-manage-row { display: flex; align-items: center; gap: 4px; }
.watch-manage-name { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--line-soft); border-radius: 4px; background: transparent; color: var(--muted); text-align: left; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-manage-name.active { border-color: rgba(231, 179, 90, .3); background: var(--accent-soft); color: var(--accent); }
.watch-manage-name span { color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.watch-manage-row button:not(.watch-manage-name) { padding: 5px 7px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--muted-2); font-size: 8px; }
.watch-manage-actions { display: flex; gap: 6px; margin-top: 12px; }
.watch-manage-index { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.watch-manage-index h4 { margin: 0 0 8px; color: var(--muted); font-size: 10px; font-weight: 500; }
.watch-index-checks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.watch-index-check { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; }
.sector-row { cursor: pointer; }
.sector-row:hover { background: rgba(255, 255, 255, .022); }
.sector-leaders { display: flex; flex-wrap: wrap; gap: 5px; }
.sector-leader { color: var(--muted); font-size: 9px; }
.sector-leader em { font-style: normal; font-family: var(--mono); font-size: 8px; margin-left: 2px; }
.mini-tag.sector-tag { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #9db2cc; border-color: rgba(97, 168, 255, .16); background: rgba(97, 168, 255, .05); }
.table-wrap { flex: 1; min-height: 0; overflow: auto; }
.market-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.market-table thead th {
  position: sticky; top: 0; z-index: 2;
  height: 36px; padding: 0 9px;
  border-bottom: 1px solid var(--line);
  background: #0d141e;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .03em;
  text-align: left;
  white-space: nowrap;
}
.market-table thead th.th-num { text-align: right; }
.market-table thead th.sortable { cursor: pointer; user-select: none; }
.market-table thead th.sortable:hover { color: var(--text); }
.sort-mark::after { content: "↕"; margin-left: 3px; opacity: .35; font-size: 8px; }
th.sortable.active .sort-mark::after { content: "↓"; color: var(--accent); opacity: 1; }
th.sortable.active.asc .sort-mark::after { content: "↑"; color: var(--accent); opacity: 1; }
.th-star { width: 31px; }
.th-security { width: 190px; }
.th-num { width: 92px; }
.th-range { width: 114px; }
.th-board { width: 104px; }

.market-table tbody tr { cursor: pointer; transition: background .12s ease; }
.market-table tbody tr:hover { background: rgba(255, 255, 255, .028); }
.market-table tbody tr.selected { background: rgba(231, 179, 90, .055); box-shadow: inset 2px 0 0 var(--accent); }
.market-table tbody td {
  height: 50px; padding: 6px 9px;
  border-bottom: 1px solid rgba(29, 40, 54, .52);
  vertical-align: middle;
  overflow: hidden;
}
.market-table tbody tr:last-child td { border-bottom: 0; }
.star-cell { padding-left: 11px !important; }
.row-star {
  display: grid; place-items: center;
  width: 20px; height: 20px;
  border: 0; border-radius: 4px;
  background: transparent; color: #3b4657;
  font-size: 13px; line-height: 1;
  transition: .15s ease;
}
.row-star:hover { color: var(--accent); background: var(--accent-soft); }
.row-star.active { color: var(--accent); }
.security-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.security-copy { min-width: 0; }
.security-code { font-family: var(--mono); font-size: 10px; color: var(--muted-2); letter-spacing: .03em; }
.security-name { margin-top: 3px; overflow: hidden; color: var(--text); font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.security-name .st-flag { margin-left: 4px; color: var(--accent); font-size: 9px; }
.price-cell { text-align: right; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.pct-pill {
  display: inline-flex; align-items: center; justify-content: flex-end; gap: 2px;
  min-width: 62px; padding: 3px 6px;
  border-radius: 4px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
}
.pct-pill.up { color: var(--up); background: var(--up-soft); }
.pct-pill.down { color: var(--down); background: var(--down-soft); }
.pct-pill.flat { color: var(--muted); background: rgba(255, 255, 255, .035); }
.change-cell { text-align: right; font-family: var(--mono); font-size: 10px; }
.range-cell { font-family: var(--mono); font-size: 10px; line-height: 1.55; }
.range-cell span { display: block; color: var(--muted); }
.range-cell span:first-child { color: #d3a8a8; }
.range-cell span:last-child { color: #83c4ad; }
.amount-cell { text-align: right; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.board-cell { display: flex; flex-wrap: wrap; gap: 3px; }
.mini-tag {
  display: inline-block; padding: 2px 5px;
  border: 1px solid var(--line); border-radius: 3px;
  color: var(--muted-2); background: rgba(255, 255, 255, .015);
  font-size: 8px; line-height: 1.2; white-space: nowrap;
}
.mini-tag.etf { border-color: rgba(97, 168, 255, .24); color: #8ebcff; background: rgba(97, 168, 255, .05); }
.mini-tag.t0 { border-color: rgba(231, 179, 90, .24); color: var(--accent); background: var(--accent-soft); }
.mini-tag.st { border-color: rgba(255, 91, 107, .24); color: var(--up); background: var(--up-soft); }
.table-empty { display: grid; place-items: center; height: 220px; color: var(--muted-2); font-size: 11px; }
.table-empty strong { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 500; }

.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 0 13px;
  border-top: 1px solid var(--line-soft);
  background: rgba(8, 12, 18, .48);
}
.pager-info { color: var(--muted-2); font-size: 9px; }
.pager-info b { color: var(--muted); font-family: var(--mono); font-weight: 500; }
.pager-actions { display: flex; align-items: center; gap: 4px; }
.page-btn {
  min-width: 27px; height: 25px; padding: 0 6px;
  border: 1px solid transparent; border-radius: 5px;
  background: transparent; color: var(--muted);
  font-family: var(--mono); font-size: 9px;
  transition: .14s ease;
}
.page-btn:hover:not(:disabled) { border-color: var(--line); background: rgba(255, 255, 255, .03); color: var(--text); }
.page-btn.active { border-color: rgba(231, 179, 90, .28); background: var(--accent-soft); color: var(--accent); }
.page-btn:disabled { opacity: .3; }
.page-ellipsis { padding: 0 3px; color: var(--muted-2); font-size: 9px; }

/* ---------------- Portfolio / account ---------------- */
.sector-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 43px; padding: 6px 11px; border-bottom: 1px solid var(--line-soft); }
.sector-toolbar > span { color: var(--muted); font-size: 9px; }
.sector-toolbar > span em { color: var(--muted-2); font-family: var(--mono); font-size: 8px; font-style: normal; }
.sector-toolbar .segmented { flex: 0 0 auto; }
.sector-analysis-link { flex: 0 0 auto; padding: 4px 8px; border-color: rgba(231,179,90,.45); background: var(--accent-soft); color: var(--accent); font-size: 9px; font-weight: 500; text-decoration: none; }
.sector-analysis-link:hover { background: rgba(231,179,90,.2); }
.cloud-wrap { position: relative; height: 640px; padding: 8px; overflow: hidden; cursor: grab; }
.cloud-wrap .cloud-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cloud-wrap .sector-status { position: relative; z-index: 2; }
.cloud-svg { transition: opacity .4s ease; }
.cloud-svg.entering { opacity: 0; }
.cloud-svg.visible { opacity: 1; }
.cloud-svg:not(.visible) { pointer-events: none; }
.cloud-reset { width: 22px; height: 20px; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,.03); color: var(--muted); font-size: 12px; line-height: 1; }
.cloud-reset:hover { color: var(--accent); border-color: rgba(231,179,90,.4); }
.sector-panel { overflow-y: auto; }
.portfolio-panel { overflow-y: auto; max-height: calc(100vh - 250px); }
.sector-panel { max-height: calc(100vh - 250px); }
.portfolio-inner { padding: 16px; }
.portfolio-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.portfolio-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.portfolio-head p { margin: 4px 0 0; color: var(--muted-2); font-size: 10px; }
.account-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-bottom: 15px; }
.stat-card {
  padding: 13px;
  border: 1px solid var(--line-soft); border-radius: 9px;
  background: linear-gradient(150deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, .008));
}
.stat-card span { display: block; color: var(--muted-2); font-size: 9px; }
.stat-card strong { display: block; margin-top: 8px; font-family: var(--mono); font-size: 18px; font-weight: 600; letter-spacing: .01em; }
.stat-card small { display: block; margin-top: 5px; color: var(--muted-2); font-size: 9px; }
.stat-card strong.up { color: var(--up); }
.stat-card strong.down { color: var(--down); }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.data-table th {
  height: 32px; padding: 0 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted-2); font-size: 9px; font-weight: 500; text-align: left; white-space: nowrap;
}
.data-table th.num, .data-table td.num { text-align: right; }
.data-table td { height: 45px; padding: 5px 8px; border-bottom: 1px solid rgba(29, 40, 54, .5); font-size: 11px; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, .022); }
.data-table .mono { font-family: var(--mono); font-size: 10px; }
.data-table .name-main { font-size: 11px; }
.data-table .name-sub { margin-top: 3px; color: var(--muted-2); font-family: var(--mono); font-size: 9px; }
.side-text.buy { color: var(--up); }
.side-text.sell { color: var(--down); }
.status-tag { display: inline-flex; padding: 2px 6px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 9px; }
.status-tag.pending { border-color: rgba(231, 179, 90, .25); color: var(--accent); background: var(--accent-soft); }
.status-tag.filled { border-color: rgba(31, 201, 138, .22); color: var(--down); background: var(--down-soft); }
.status-tag.cancelled { color: var(--muted-2); }
.row-link { cursor: pointer; }
.row-link:hover { background: rgba(231,179,90,.035); }
.portfolio-actions { display: flex; gap: 6px; align-items: center; }
.share-preview { max-height: 180px; overflow-y: auto; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 5px; background: rgba(0,0,0,.16); color: var(--muted); font-size: 9px; line-height: 1.7; white-space: pre-line; }
.modal-label { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; color: var(--muted); font-size: 9px; }
.modal-label textarea { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; outline: 0; background: rgba(0,0,0,.2); color: var(--text); font-family: inherit; font-size: 10px; resize: vertical; }
.modal-label textarea:focus { border-color: rgba(231,179,90,.45); }
.share-cell { width: 26px; padding-left: 4px !important; padding-right: 2px !important; }
.share-cell input { accent-color: var(--accent); }
.order-hint { display: inline-block; margin-left: 4px; color: var(--muted-2); font-size: 8px; }
.order-hint.ok { color: var(--down); }
.link-btn { padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 10px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.muted { color: var(--muted-2); }
.empty-state { display: grid; place-items: center; min-height: 260px; padding: 30px; text-align: center; }
.empty-state .empty-icon { display: grid; place-items: center; width: 42px; height: 42px; margin: 0 auto 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted-2); font-size: 18px; }
.empty-state h3 { margin: 0 0 6px; font-size: 12px; font-weight: 500; }
.empty-state p { margin: 0; color: var(--muted-2); font-size: 10px; line-height: 1.6; }
.allocation { margin-top: 18px; padding: 14px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(255, 255, 255, .012); }
.allocation-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.allocation-bar { display: flex; height: 5px; margin: 12px 0 9px; border-radius: 3px; overflow: hidden; background: rgba(255,255,255,.04); }
.allocation-bar i { display: block; height: 100%; }
.allocation-legend { display: flex; gap: 15px; color: var(--muted-2); font-size: 9px; }
.allocation-legend i { display: inline-block; width: 5px; height: 5px; margin-right: 4px; border-radius: 50%; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.settings-row h4 { margin: 0 0 4px; font-size: 11px; font-weight: 500; }
.settings-row p { margin: 0; color: var(--muted-2); font-size: 9px; line-height: 1.5; }
.switch { position: relative; width: 34px; height: 19px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: #232e3e; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 13px; height: 13px; left: 3px; top: 3px; border-radius: 50%; background: #94a1b4; transition: .2s; }
.switch input:checked + span { background: rgba(231, 179, 90, .35); }
.switch input:checked + span::after { transform: translateX(15px); background: var(--accent); }

/* ---------------- Right rail ---------------- */
.rightrail {
  min-height: 0; padding: 14px;
  border-left: 1px solid var(--line-soft);
  background: rgba(8, 12, 18, .28);
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.rail-card {
  width: 100%;
  flex-shrink: 0;
  border: 1px solid var(--line-soft); border-radius: 11px;
  background: linear-gradient(160deg, rgba(18, 26, 38, .92), rgba(11, 16, 24, .94));
  overflow: hidden;
}
.quote-card { padding: 14px 14px 11px; }
.trade-card { order: 2; }
.chart-card { order: 3; }
.orderbook-card { order: 4; }
.news-card { order: 5; }
.news-source { color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.news-list { max-height: 282px; overflow-y: auto; padding: 3px 12px 8px; }
.news-item { display: block; padding: 8px 0; border-bottom: 1px solid var(--line-soft); text-decoration: none; }
.news-item:last-child { border-bottom: 0; }
.news-item:hover .news-title { color: var(--accent); }
.news-title { color: var(--text); font-size: 10px; line-height: 1.55; transition: color .16s ease; }
.news-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.news-meta span:first-child { color: #b98a45; }
.news-empty { padding: 18px 0; text-align: center; color: var(--muted-2); font-size: 9px; }
.social-card { order: 6; }
.social-links { display: flex; flex-direction: column; gap: 6px; padding: 9px 11px 11px; }
.social-link { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid var(--line-soft); border-radius: 6px; background: rgba(255,255,255,.018); text-decoration: none; transition: .16s ease; }
.social-link:hover { border-color: rgba(231,179,90,.3); background: rgba(231,179,90,.045); }
.social-avatar { display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; background: linear-gradient(145deg, #6e4d2b, #2c1f14); color: #f3d6a7; font-size: 12px; font-weight: 600; }
.social-avatar.alt { background: linear-gradient(145deg, #29415a, #13202e); color: #a9cef0; }
.social-avatar.alt2 { background: linear-gradient(145deg, #4c2f5c, #201627); color: #d8b6ed; }
.social-avatar.alt3 { background: linear-gradient(145deg, #274b43, #11221e); color: #a8dfce; }
.social-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.social-copy b { color: var(--text); font-size: 10px; font-weight: 500; }
.social-copy small { color: var(--muted-2); font-size: 8px; }
.social-arrow { color: var(--muted-2); font-size: 11px; }
.social-link:hover .social-arrow { color: var(--accent); }
body[data-screen="detail"] .social-card,
body[data-screen="futures"] .social-card { display: none; }
.quote-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.quote-name-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.quote-name-line h2 { margin: 0; overflow: hidden; font-size: 16px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.quote-star { color: var(--accent); font-size: 10px; }
.quote-code { margin-top: 5px; overflow: hidden; color: var(--muted-2); font-family: var(--mono); font-size: 9px; letter-spacing: .04em; text-overflow: ellipsis; white-space: nowrap; }
.star-btn {
  display: grid; place-items: center;
  width: 28px; height: 28px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 6px;
  background: rgba(255, 255, 255, .02); color: #465266;
  transition: .16s ease;
}
.star-btn svg { width: 15px; height: 15px; }
.star-btn:hover { color: var(--accent); border-color: rgba(231, 179, 90, .35); }
.star-btn.active { color: var(--accent); border-color: rgba(231, 179, 90, .32); background: var(--accent-soft); }
.star-btn.active svg path { fill: currentColor; }
.quote-price-line { display: flex; align-items: baseline; gap: 11px; margin-top: 12px; }
.big-price { font-family: var(--mono); font-size: 32px; font-weight: 600; line-height: 1; letter-spacing: -.01em; }
.big-price.up { color: var(--up); }
.big-price.down { color: var(--down); }
.big-price.flat { color: var(--text); }
.change-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 4px; font-family: var(--mono); font-size: 10px; font-weight: 600; }
.change-chip.up { color: var(--up); background: var(--up-soft); }
.change-chip.down { color: var(--down); background: var(--down-soft); }
.change-chip.flat { color: var(--muted); background: rgba(255, 255, 255, .035); }
.quote-tags { display: flex; gap: 4px; margin-top: 9px; min-height: 16px; }
.delay-badge { display: inline-flex; align-items: center; margin-top: 6px; padding: 2px 5px; border: 1px solid rgba(231,179,90,.3); border-radius: 3px; background: rgba(231,179,90,.07); color: #c49a5b; font-size: 8px; }
.delay-badge[hidden] { display: none; }
.index-session { margin-top: 6px; padding: 4px 6px; border-left: 2px solid rgba(231,179,90,.5); border-radius: 2px; background: rgba(231,179,90,.04); color: var(--muted); font-family: var(--mono); font-size: 9px; }
.index-session b { color: var(--accent); font-weight: 500; }
.index-holiday { margin-top: 5px; padding: 5px 7px; border: 1px solid rgba(231,179,90,.25); border-radius: 4px; background: rgba(231,179,90,.055); color: var(--muted); font-size: 8px; line-height: 1.55; }
.index-holiday b { color: var(--accent); font-weight: 500; }
.index-holiday .ih-time { display: block; margin-top: 2px; color: var(--muted-2); font-family: var(--mono); }
.index-holiday .ih-now { color: var(--up); }
.index-holiday[hidden] { display: none; }
.index-session[hidden] { display: none; }
.quote-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.quote-stats div { display: flex; flex-direction: column; gap: 5px; }
.quote-stats span { color: var(--muted-2); font-size: 9px; }
.quote-stats b { font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--muted); }
.quote-stats-sub { margin-top: 8px; padding-top: 8px; border-top: 0; }
.quote-stats-sub b { color: var(--muted-2); }
.f10-details { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line-soft); }
.f10-details > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; color: var(--muted); font-size: 10px; list-style: none; }
.f10-details > summary::-webkit-details-marker { display: none; }
.f10-details > summary::after { content: "＋"; color: var(--muted-2); font-family: var(--mono); font-size: 10px; }
.f10-details[open] > summary::after { content: "－"; color: var(--accent); }
.f10-details > summary span { margin-left: auto; margin-right: 7px; color: var(--muted-2); font-size: 8px; }
.f10-panel { margin-top: 9px; padding-top: 0; border-top: 0; max-height: 330px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.f10-loading { padding: 8px 0; color: var(--muted-2); font-size: 9px; }
.f10-section-title { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 7px; color: var(--muted); font-size: 9px; }
.f10-section-title em { color: var(--muted-2); font-style: normal; font-size: 8px; }
.f10-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 8px; }
.f10-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.f10-field span { color: var(--muted-2); font-size: 8px; }
.f10-field b { overflow: hidden; color: var(--muted); font-size: 9px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.f10-profile { margin-top: 8px; color: var(--muted-2); font-size: 8px; line-height: 1.65; }
.f10-profile[open] summary { color: var(--accent); }
.f10-profile summary { cursor: pointer; color: var(--muted); }
.f10-holdings { width: 100%; margin-top: 6px; border-collapse: collapse; }
.f10-holdings th, .f10-holdings td { padding: 4px 2px; border-bottom: 1px solid var(--line-soft); text-align: left; font-size: 8px; white-space: nowrap; }
.f10-holdings th { color: var(--muted-2); font-weight: 400; }
.f10-holdings td { color: var(--muted); font-family: var(--mono); }
.f10-holdings td:nth-child(2) { max-width: 72px; overflow: hidden; text-overflow: ellipsis; }
.f10-change { display: inline-block; margin-left: 3px; font-family: var(--mono); font-size: 7px; }
.f10-change.add { color: var(--up); }
.f10-change.reduce { color: var(--down); }
.f10-valuation { padding: 7px 8px; border: 1px solid var(--line-soft); border-radius: 5px; background: rgba(255,255,255,.015); }
.f10-val-row { display: flex; align-items: baseline; gap: 6px; margin-top: 5px; color: var(--muted-2); font-size: 8px; }
.f10-val-row:first-child { margin-top: 0; }
.f10-val-row b { color: var(--text); font-family: var(--mono); font-size: 11px; font-weight: 500; }
.f10-val-row em { margin-left: auto; color: var(--muted-2); font-style: normal; font-family: var(--mono); font-size: 7px; }
.f10-val-track { position: relative; height: 3px; margin: 4px 0 2px; border-radius: 2px; background: linear-gradient(90deg, #1fc98a, #e7b35a 50%, #ff5b6b); opacity: .55; }
.f10-val-track i { position: absolute; top: -3px; width: 2px; height: 9px; background: #fff; box-shadow: 0 0 4px #fff; }
.f10-val-note { margin-top: 4px; color: var(--muted-2); font-size: 7px; }
.f10-plans { margin-top: 5px; }
.f10-plan { display: grid; grid-template-columns: 54px 1fr; gap: 1px 4px; padding: 4px 0; border-bottom: 1px solid var(--line-soft); font-size: 8px; }
.f10-plan span { color: var(--muted-2); font-family: var(--mono); }
.f10-plan b { color: var(--muted); font-weight: 400; }
.f10-plan em { grid-column: 2; color: var(--muted-2); font-style: normal; font-size: 7px; }
.f10-links { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.f10-links a { padding: 3px 5px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted-2); font-size: 8px; text-decoration: none; }
.f10-links a:hover { color: var(--accent); border-color: rgba(231,179,90,.3); }
.invest-body, .index-cons-body { padding: 9px 12px 11px; }
.invest-body { max-height: 620px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.invest-card { overflow: hidden; }
.invest-disclosures { max-height: 300px; overflow-y: auto; }
.invest-card { overflow: hidden; }
.invest-body { max-height: 620px; }
.invest-details > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 8px 12px; color: var(--muted); font-size: 9px; list-style: none; }
.invest-details > summary::-webkit-details-marker { display: none; }
.invest-details > summary::after { content: "＋"; color: var(--muted-2); font-family: var(--mono); font-size: 10px; }
.invest-details[open] > summary::after { content: "－"; color: var(--accent); }
.invest-details[open] > summary { border-bottom: 1px solid var(--line-soft); }
.invest-details .invest-body { padding-top: 8px; }
.invest-body .f10-section-title, .index-cons-body .f10-section-title { margin-top: 8px; }
.invest-yield { display: flex; align-items: flex-end; gap: 5px; height: 58px; padding: 6px 2px 2px; }
.invest-yield .iy-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.invest-yield .iy-bar { width: 13px; min-height: 2px; border-radius: 1px 1px 0 0; background: var(--accent); opacity: .7; }
.invest-yield .iy-year { color: var(--muted-2); font-family: var(--mono); font-size: 7px; }
.invest-yield .iy-val { color: var(--muted); font-family: var(--mono); font-size: 7px; }
.invest-disclosures { max-height: 300px; overflow-y: auto; }
.invest-disclosure { display: block; padding: 5px 0; border-bottom: 1px solid var(--line-soft); text-decoration: none; }
.invest-disclosure:hover .id-title { color: var(--accent); }
.invest-disclosure .id-title { color: var(--muted); font-size: 9px; line-height: 1.45; }
.invest-disclosure .id-meta { margin-top: 2px; color: var(--muted-2); font-family: var(--mono); font-size: 7px; }
.index-cons-table { width: 100%; border-collapse: collapse; }
.index-cons-details > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 8px 12px; color: var(--muted); font-size: 9px; list-style: none; }
.index-cons-details > summary::-webkit-details-marker { display: none; }
.index-cons-details > summary::after { content: "＋"; color: var(--muted-2); font-family: var(--mono); font-size: 10px; }
.index-cons-details[open] > summary::after { content: "－"; color: var(--accent); }
.index-cons-details[open] > summary { border-bottom: 1px solid var(--line-soft); }
.index-cons-details .index-cons-body { max-height: 430px; overflow-y: auto; }
.index-cons-table th, .index-cons-table td { padding: 5px 2px; border-bottom: 1px solid var(--line-soft); text-align: left; font-size: 8px; white-space: nowrap; }
.index-cons-table th { color: var(--muted-2); font-weight: 400; }
.index-cons-table td { color: var(--muted); font-family: var(--mono); }
.index-cons-table td:nth-child(2) { max-width: 88px; overflow: hidden; text-overflow: ellipsis; }
.index-cons-note { margin-top: 6px; color: var(--muted-2); font-size: 7px; line-height: 1.5; }
.chat-widget { position: fixed; right: 18px; bottom: 42px; z-index: 80; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.chat-toggle { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid rgba(231,179,90,.34); border-radius: 18px; background: linear-gradient(160deg, #1a2432, #0d141e); color: var(--accent); box-shadow: 0 8px 24px rgba(0,0,0,.45); font-size: 10px; }
.chat-toggle svg { width: 15px; height: 15px; }
.chat-toggle em { min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--up); color: #fff; font-style: normal; font-family: var(--mono); font-size: 8px; line-height: 15px; text-align: center; }
.chat-panel { width: 320px; max-width: calc(100vw - 24px); height: 430px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(160deg, rgba(18,27,39,.98), rgba(9,14,21,.99)); box-shadow: 0 18px 45px rgba(0,0,0,.55); overflow: hidden; }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.chat-head b { color: var(--text); font-size: 11px; }
.chat-head span { margin-left: 6px; color: var(--muted-2); font-size: 8px; }
.chat-head button { border: 0; background: transparent; color: var(--muted-2); font-size: 18px; line-height: 1; }
.chat-tabs { display: flex; gap: 2px; padding: 5px 8px 0; border-bottom: 1px solid var(--line-soft); }
.chat-tabs button { padding: 5px 9px; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--muted-2); font-size: 9px; }
.chat-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.chat-messages, .chat-users { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 11px; }
.chat-msg { padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.chat-msg-head { display: flex; align-items: center; gap: 5px; color: var(--muted-2); font-size: 8px; }
.chat-msg-head b { color: var(--muted); font-weight: 500; }
.chat-msg-head .admin-badge { color: var(--accent); border: 1px solid rgba(231,179,90,.25); border-radius: 2px; padding: 0 3px; font-size: 7px; }
.chat-msg-head time { margin-left: auto; font-family: var(--mono); font-size: 7px; }
.chat-msg-body { margin-top: 3px; color: var(--text); font-size: 10px; line-height: 1.55; word-break: break-word; white-space: pre-line; }
.chat-reactions { display: flex; align-items: center; gap: 3px; margin-top: 5px; flex-wrap: wrap; }
.chat-react { display: inline-flex; align-items: center; gap: 2px; padding: 1px 4px; border: 1px solid transparent; border-radius: 9px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 10px; line-height: 16px; }
.chat-react:hover { border-color: var(--line); background: rgba(255,255,255,.05); }
.chat-react.active { border-color: rgba(231,179,90,.35); background: var(--accent-soft); }
.chat-react em { color: var(--muted-2); font-style: normal; font-family: var(--mono); font-size: 7px; }
.chat-top-reaction { margin-left: auto; padding: 1px 5px; border: 1px solid var(--line-soft); border-radius: 8px; color: var(--accent); font-family: var(--mono); font-size: 8px; }
.chat-delete { margin-left: 5px; border: 0; background: transparent; color: var(--down); font-size: 8px; }
.chat-widget.has-unread .chat-toggle { border-color: rgba(231,179,90,.5); box-shadow: 0 0 0 3px rgba(231,179,90,.08); }
.mobile-nav button.has-unread svg { color: var(--accent); animation: chatPulse 1.2s ease-in-out infinite; }
@keyframes chatPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
.chat-msg { display: flex; align-items: flex-start; gap: 7px; padding: 6px 2px; border-bottom: 1px solid rgba(255,255,255,.04); }
.chat-msg.own { flex-direction: row-reverse; }
.chat-msg-main { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; min-width: 0; }
.chat-msg.own .chat-msg-main { align-items: flex-end; }
.chat-msg-head { width: 100%; display: flex; align-items: center; gap: 5px; color: var(--muted-2); font-size: 8px; }
.chat-msg.own .chat-msg-head { justify-content: flex-end; }
.chat-msg.own .chat-msg-head time { margin-left: 0; margin-right: auto; }
.chat-msg-body { max-width: 100%; margin-top: 3px; padding: 6px 9px; border: 1px solid rgba(255,255,255,.07); border-radius: 2px 10px 10px 10px; background: rgba(255,255,255,.055); color: var(--text); font-size: 10px; line-height: 1.55; word-break: break-word; white-space: pre-line; }
.chat-msg.own .chat-msg-body { border-color: rgba(231,179,90,.2); border-radius: 10px 2px 10px 10px; background: rgba(231,179,90,.14); }
.chat-reaction-side { position: relative; flex: 0 0 auto; align-self: center; }
.chat-reaction-toggle { display: grid; place-items: center; min-width: 25px; height: 25px; padding: 0 4px; border: 1px solid var(--line-soft); border-radius: 13px; background: rgba(255,255,255,.025); }
.chat-reaction-toggle:hover { border-color: rgba(231,179,90,.3); background: rgba(231,179,90,.06); }
.chat-top-emoji { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; line-height: 1; }
.chat-top-emoji em { color: var(--muted-2); font-family: var(--mono); font-size: 7px; font-style: normal; }
.chat-top-emoji.add { color: var(--muted-2); font-size: 13px; }
.chat-emoji-menu { position: absolute; z-index: 30; left: auto; right: 0; bottom: 30px; display: flex; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: rgba(15,24,34,.98); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.chat-msg.own .chat-emoji-menu { left: 0; right: auto; }
.chat-emoji-option { display: inline-flex; flex-direction: column; align-items: center; gap: 0; min-width: 28px; padding: 2px 3px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-size: 14px; }
.chat-emoji-option:hover, .chat-emoji-option.active { border-color: rgba(231,179,90,.3); background: var(--accent-soft); }
.chat-emoji-option em { color: var(--muted-2); font-family: var(--mono); font-size: 7px; font-style: normal; line-height: 9px; }
.chat-form { display: flex; gap: 5px; padding: 7px 9px; border-top: 1px solid var(--line-soft); }
.chat-form input { flex: 1; min-width: 0; height: 28px; padding: 0 7px; border: 1px solid var(--line); border-radius: 4px; outline: 0; background: rgba(0,0,0,.2); color: var(--text); font-size: 9px; }
.chat-form input:focus { border-color: rgba(231,179,90,.4); }
.chat-form button { height: 28px; padding: 0 10px; border: 1px solid rgba(231,179,90,.3); border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-size: 9px; }
.chat-foot { padding: 0 10px 7px; color: var(--muted-2); font-size: 7px; text-align: center; }
.chat-feedback { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-feedback[hidden] { display: none; }
.chat-feedback-note { padding: 6px 11px; color: #b98a45; font-size: 8px; }
.chat-feedback-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 11px; }
.chat-feedback-item { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.chat-feedback-item .cf-head { display: flex; gap: 5px; color: var(--muted-2); font-size: 7px; }
.chat-feedback-item .cf-head b { color: var(--muted); font-weight: 500; }
.chat-feedback-item .cf-body { margin-top: 3px; color: var(--text); font-size: 9px; line-height: 1.55; word-break: break-word; }
.chat-feedback-form { display: flex; gap: 5px; padding: 7px 9px; border-top: 1px solid var(--line-soft); }
.chat-feedback-form input { flex: 1; min-width: 0; height: 28px; padding: 0 7px; border: 1px solid var(--line); border-radius: 4px; outline: 0; background: rgba(0,0,0,.2); color: var(--text); font-size: 9px; }
.chat-feedback-form button { height: 28px; padding: 0 9px; border: 1px solid rgba(231,179,90,.3); border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-size: 9px; }
.chat-empty { padding: 20px 0; color: var(--muted-2); font-size: 9px; text-align: center; }
.chat-user-row { display: flex; align-items: center; gap: 5px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 9px; cursor: pointer; }
.chat-user-row:hover { color: var(--accent); }
.chat-user-row .u-name { flex: 1; color: var(--muted); }
.chat-user-row .u-eq { font-family: var(--mono); color: var(--text); }
.chat-user-row .u-pnl { width: 72px; text-align: right; font-family: var(--mono); font-size: 8px; }
.admin-positions { margin: 6px 0 8px; padding: 6px; border: 1px solid var(--line-soft); border-radius: 4px; }
.chat-panel .f10-holdings td, .chat-panel .f10-holdings th { font-size: 7px; }


.rail-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 34px; padding: 0 12px; border-bottom: 1px solid var(--line-soft); }
.rail-title { color: var(--muted); font-size: 10px; }
.chart-tabs { display: flex; align-self: stretch; gap: 2px; }
.chart-tab {
  position: relative; padding: 0 9px;
  border: 0; background: transparent; color: var(--muted-2); font-size: 10px;
}
.chart-tab:hover { color: var(--text); }
.chart-tab.active { color: var(--accent); }
.chart-tab.active::after { content: ""; position: absolute; left: 7px; right: 7px; bottom: -1px; height: 1px; background: var(--accent); }
.chart-source { color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.chart-refresh { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--muted-2); font-size: 13px; line-height: 1; }
.chart-zoom { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--muted-2); font-size: 13px; line-height: 1; }
.chart-zoom:hover { color: var(--accent); border-color: rgba(231,179,90,.3); }
.futures-draw-btn { width: auto; padding: 0 6px; font-size: 8px; }
.futures-draw-btn.active { border-color: rgba(231,179,90,.5); background: var(--accent-soft); color: var(--accent); }
.draw-order-list { display: flex; flex-direction: column; gap: 5px; }
.draw-order-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line-soft); border-radius: 5px; color: var(--muted); font-size: 9px; }
.draw-order-row span:first-child { flex: 1; color: var(--text); }
.draw-order-row button { margin-left: auto; }
.futures-draw-orders-panel { margin-top: 12px; padding: 8px; border: 1px solid var(--line-soft); border-radius: 7px; }
.futures-draw-orders-panel > h3 { margin: 0 0 5px; color: var(--accent); font-size: 10px; font-weight: 500; }
.futures-draw-orders-panel > h3 em { color: var(--muted-2); font-family: var(--mono); font-size: 7px; font-style: normal; }
.draw-order-position { border-color: rgba(231,179,90,.2); }
.draw-side-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 8px 0; }
.draw-side-picker button { height: 32px; border: 1px solid var(--line); border-radius: 5px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 9px; }
.draw-side-picker button.active { border-color: rgba(231,179,90,.5); background: var(--accent-soft); color: var(--accent); }
.draw-order-group { border-top: 1px solid var(--line-soft); }
.chart-refresh:hover { color: var(--accent); border-color: rgba(231,179,90,.3); }
.chart-refresh.stale { color: #0d141e; border-color: var(--accent); background: var(--accent); animation: stalePulse 1.6s infinite; }
.futures-refresh { margin-left: auto; flex: 0 0 22px; }
@keyframes stalePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(231,179,90,.35); } 50% { box-shadow: 0 0 0 5px rgba(231,179,90,0); } }
.indicator-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 10px; border-bottom: 1px solid var(--line-soft); }
.indicator-group { display: flex; align-items: center; gap: 2px; }
.indicator-group > span { margin-right: 3px; color: var(--muted-2); font-size: 8px; }
.ind-btn { padding: 2px 5px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: var(--muted-2); font-size: 8px; }
.ind-btn:hover { color: var(--text); }
.ind-btn.active { border-color: rgba(231, 179, 90, .28); background: var(--accent-soft); color: var(--accent); }
.indicator-settings { margin-left: auto; padding: 2px 6px; border: 1px solid var(--line); border-radius: 3px; background: transparent; color: var(--muted-2); font-size: 8px; }
.indicator-settings:hover { color: var(--accent); border-color: rgba(231, 179, 90, .3); }
.indicator-params { display: flex; flex-wrap: wrap; gap: 5px 9px; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); background: rgba(255, 255, 255, .018); }
.indicator-params[hidden] { display: none; }
.indicator-param { display: flex; align-items: center; gap: 3px; color: var(--muted-2); font-size: 8px; }
.indicator-param input { width: 32px; height: 19px; padding: 0 3px; border: 1px solid var(--line); border-radius: 3px; outline: 0; background: rgba(0, 0, 0, .18); color: var(--text); font-family: var(--mono); font-size: 8px; }
.indicator-params .ind-apply { padding: 2px 7px; border: 1px solid rgba(231, 179, 90, .3); border-radius: 3px; background: var(--accent-soft); color: var(--accent); font-size: 8px; }
.indicator-params .ind-reset { display: grid; place-items: center; width: 22px; height: 22px; padding: 2px; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,.025); color: var(--muted-2); }
.indicator-params .ind-reset:hover { border-color: rgba(231,179,90,.4); color: var(--accent); background: var(--accent-soft); }
.indicator-params .ind-reset svg { width: 13px; height: 13px; }
.chart-wrap { position: relative; height: 292px; padding: 7px 4px 2px; }
.chart-wrap canvas { display: block; width: 100%; height: 100%; }
.chart-pulse {
  position: absolute; z-index: 3; width: 8px; height: 8px;
  margin-left: -4px; margin-top: -4px; border-radius: 50%;
  pointer-events: none; background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: chartPulse 1.7s ease-out infinite;
}
@keyframes chartPulse {
  0% { opacity: .45; box-shadow: 0 0 0 0 currentColor; }
  55% { opacity: 1; box-shadow: 0 0 0 7px transparent; }
  100% { opacity: .45; box-shadow: 0 0 0 0 transparent; }
}
.chart-tip {
  position: absolute; z-index: 4; min-width: 100px;
  padding: 7px 8px;
  border: 1px solid #2a3749; border-radius: 5px;
  background: rgba(10, 15, 23, .95);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  color: var(--muted); font-family: var(--mono); font-size: 9px; line-height: 1.65;
  pointer-events: none; white-space: nowrap;
}
.chart-tip b { color: var(--text); font-weight: 500; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted-2); font-size: 10px; background: rgba(11, 16, 24, .55); }
.chart-empty[hidden] { display: none; }

.orderbook-card { padding-bottom: 8px; }
.orderbook-time { color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.orderbook-head { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 7px 14px 3px; color: var(--muted-2); font-size: 8px; }
.orderbook-head span:nth-child(2) { text-align: right; }
.orderbook-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 11px; }
.ob-empty { grid-column: 1 / -1; height: 52px; display: grid; place-items: center; color: var(--muted-2); font-size: 9px; }
.ob-side { display: flex; flex-direction: column; gap: 2px; }
.ob-row { position: relative; display: flex; justify-content: space-between; gap: 4px; height: 18px; align-items: center; padding: 0 3px; border-radius: 3px; overflow: hidden; }
.ob-row .ob-depth { position: absolute; right: 0; top: 0; bottom: 0; opacity: .09; border-radius: 2px; }
.ob-row.ask .ob-depth { background: var(--up); }
.ob-row.bid .ob-depth { background: var(--down); }
.ob-row .ob-price { position: relative; z-index: 1; font-family: var(--mono); font-size: 9px; }
.ob-row .ob-vol { position: relative; z-index: 1; color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.ob-row.ask .ob-price { color: #e29a9f; }
.ob-row.bid .ob-price { color: #8fcdb5; }

/* ---------------- Trade ticket ---------------- */
.trade-card { padding: 12px; }
.trade-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.trade-title { font-size: 12px; font-weight: 600; }
.trade-mode { color: var(--muted-2); font-size: 8px; }
.side-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border: 1px solid var(--line-soft); border-radius: 7px; background: rgba(0, 0, 0, .15); }
.side-switch button {
  height: 29px; border: 0; border-radius: 5px;
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 500;
  transition: .16s ease;
}
.side-switch button.buy.active { color: #fff; background: linear-gradient(180deg, #e84f60, #c83e4e); box-shadow: 0 3px 12px rgba(232, 79, 96, .2); }
.side-switch button.sell.active { color: #fff; background: linear-gradient(180deg, #1db77f, #149566); box-shadow: 0 3px 12px rgba(29, 183, 127, .2); }
.price-type-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.segmented { display: inline-flex; padding: 2px; border: 1px solid var(--line-soft); border-radius: 5px; background: rgba(0, 0, 0, .12); }
.segmented button { height: 22px; padding: 0 9px; border: 0; border-radius: 3px; background: transparent; color: var(--muted-2); font-size: 9px; }
.segmented button.active { color: var(--text); background: rgba(255, 255, 255, .065); }
.trade-avail { color: var(--muted-2); font-size: 9px; }
.trade-avail b { color: var(--muted); font-family: var(--mono); font-weight: 500; }
.input-row { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 8px; margin-top: 8px; }
.input-row label { color: var(--muted-2); font-size: 9px; }
.input-shell { display: flex; align-items: center; height: 31px; border: 1px solid var(--line); border-radius: 5px; background: rgba(0, 0, 0, .14); overflow: hidden; }
.input-shell:focus-within { border-color: rgba(231, 179, 90, .45); }
.input-shell input { flex: 1; width: 100%; min-width: 0; height: 100%; padding: 0 8px; border: 0; outline: 0; background: transparent; color: var(--text); font-family: var(--mono); font-size: 12px; text-align: right; }
.input-shell input:disabled { color: var(--muted-2); }
.input-unit { padding: 0 8px 0 3px; color: var(--muted-2); font-size: 9px; }
.step-btn { width: 24px; height: 100%; border: 0; background: transparent; color: var(--muted-2); font-size: 13px; }
.step-btn:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.step-btn:disabled { opacity: .25; }
.quick-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 7px 0 0 56px; }
.quick-row button { height: 21px; border: 1px solid var(--line-soft); border-radius: 4px; background: transparent; color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.quick-row button:hover { color: var(--text); border-color: #2b394b; }
.trade-summary { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.trade-summary div { display: flex; align-items: center; justify-content: space-between; min-height: 19px; color: var(--muted-2); font-size: 9px; }
.trade-summary b { color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 500; }
.trade-summary .summary-total { margin-top: 2px; padding-top: 4px; border-top: 1px dashed rgba(255, 255, 255, .05); }
.trade-summary .summary-total b { color: var(--text); }
.trade-submit {
  width: 100%; height: 37px; margin-top: 9px;
  border: 0; border-radius: 6px;
  color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .03em;
  transition: .16s ease;
}
.trade-submit.buy { background: linear-gradient(180deg, #e85061, #c93c4c); box-shadow: 0 5px 18px rgba(232, 80, 97, .16); }
.trade-submit.sell { background: linear-gradient(180deg, #1ebc83, #139467); box-shadow: 0 5px 18px rgba(30, 188, 131, .14); }
.trade-submit:hover { filter: brightness(1.07); }
.trade-submit:active { transform: translateY(1px); }
.trade-submit:disabled { filter: grayscale(.4); opacity: .55; }
.trade-note { margin: 8px 0 0; color: var(--muted-2); font-size: 8px; line-height: 1.55; }
.trade-note.warn { color: #d8aa61; }

/* ---------------- Footer / overlays ---------------- */
.statusbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 18px;
  border-top: 1px solid var(--line-soft);
  background: rgba(7, 10, 15, .9);
  color: var(--muted-2); font-size: 8px;
  white-space: nowrap; overflow: hidden;
}
.statusbar > div { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.statusbar-right { flex-shrink: 0; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--down); }
.sep { color: #303b4b; }

.toast-stack { position: fixed; right: 18px; bottom: 44px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 8px;
  max-width: 330px; padding: 10px 12px;
  border: 1px solid #283649; border-radius: 8px;
  background: rgba(16, 23, 34, .96);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .4);
  color: var(--text); font-size: 10px; line-height: 1.55;
  animation: toastIn .22s ease;
}
.toast::before { content: ""; width: 5px; height: 5px; margin-top: 5px; flex-shrink: 0; border-radius: 50%; background: var(--accent); }
.toast.success::before { background: var(--down); }
.toast.error::before { background: var(--up); }
.toast.leaving { opacity: 0; transform: translateY(4px); transition: .2s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

.modal-root { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(3, 6, 10, .68); backdrop-filter: blur(5px); }
.modal-root:empty { display: none; }
.modal-root[hidden] { display: none; }
.modal {
  width: min(390px, 100%);
  max-height: calc(100vh - 40px);
  border: 1px solid #283649; border-radius: 12px;
  background: #0f1621;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  animation: modalIn .2s ease;
  overflow: auto;
}
.modal.wide { width: min(790px, 100%); }
.modal-x {
  display: grid; place-items: center;
  width: 28px; height: 28px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 6px;
  background: transparent; color: var(--muted-2); font-size: 16px; line-height: 1;
}
.modal-x:hover { color: var(--text); border-color: #334257; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head { padding: 18px 18px 0; }
.modal-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.modal-head p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.65; }
.modal-body { padding: 15px 18px 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 16px; }
.modal-btn { height: 31px; padding: 0 13px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-size: 10px; }
.modal-btn:hover { color: var(--text); border-color: #334257; }
.modal-btn.primary { border-color: rgba(232, 80, 97, .4); background: #d04454; color: #fff; }
.modal-btn.primary:hover { background: #e04d5d; }
.modal-list { display: grid; gap: 7px; }
.modal-list div { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 10px; }
.modal-list b { color: var(--muted); font-family: var(--mono); font-weight: 500; }

/* ---------------- collaborative rooms ---------------- */
.room-page { min-height: 0; }
.room-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 20px 20px 0; }
.room-modal-head h3 { margin: 4px 0 0; font-size: 19px; font-weight: 650; letter-spacing: .01em; }
.room-modal-head p { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.65; }
.room-overline { display: flex; align-items: center; gap: 6px; color: var(--accent); font-size: 9px; letter-spacing: .1em; }
.room-live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--down); box-shadow: 0 0 8px rgba(31, 201, 138, .8); }
.room-head-meta { margin-left: 4px; color: var(--muted-2); font-family: var(--mono); font-size: 9px; }
.room-code-chip {
  display: inline-flex; align-items: center;
  height: 22px; margin: 0 4px; padding: 0 7px;
  border: 1px solid rgba(231, 179, 90, .3); border-radius: 4px;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--mono); font-size: 11px; letter-spacing: .09em;
}
.room-code-chip:hover { border-color: var(--accent); }
.room-page .modal-body { padding: 16px 20px 20px; }
.room-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.room-kpis > div { padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: rgba(255, 255, 255, .018); }
.room-kpis span { display: block; color: var(--muted-2); font-size: 9px; }
.room-kpis strong { display: block; margin-top: 7px; font-family: var(--mono); font-size: 16px; font-weight: 600; }
.room-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 15px; border-bottom: 1px solid var(--line-soft); }
.room-tabs { display: flex; align-items: center; gap: 4px; }
.room-tab { position: relative; height: 35px; padding: 0 9px; border: 0; background: transparent; color: var(--muted-2); font-size: 10px; }
.room-tab:hover { color: var(--text); }
.room-tab.active { color: var(--accent); }
.room-tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 1px; background: var(--accent); }
.room-toolbar-actions { display: flex; align-items: center; gap: 11px; }
.room-copy-btn { height: 25px; padding: 0 8px; border: 1px solid rgba(231, 179, 90, .22); border-radius: 5px; background: transparent; color: var(--accent); font-size: 9px; }
.room-copy-btn:hover { background: var(--accent-soft); }
.room-tab-body { min-height: 218px; max-height: 300px; overflow: auto; padding: 5px 1px 0; }
.room-empty { display: grid; place-items: center; min-height: 200px; color: var(--muted-2); font-size: 10px; text-align: center; line-height: 1.7; }
.member-list { display: flex; flex-direction: column; }
.member-row { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 5px 4px; border-bottom: 1px solid rgba(29, 40, 54, .55); }
.member-row:last-child { border-bottom: 0; }
.member-avatar {
  display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: rgba(255, 255, 255, .035);
  color: var(--accent); font-family: var(--mono); font-size: 11px;
}
.member-main { flex: 1; min-width: 0; }
.member-name { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--text); font-size: 11px; }
.member-sub { margin-top: 4px; color: var(--muted-2); font-size: 9px; }
.member-pnl { text-align: right; flex-shrink: 0; }
.member-pnl span { display: block; color: var(--muted-2); font-size: 8px; }
.member-pnl b { display: block; margin-top: 4px; font-family: var(--mono); font-size: 10px; font-weight: 500; }
.owner-tag { display: inline-flex; padding: 1px 4px; border: 1px solid rgba(231, 179, 90, .28); border-radius: 3px; color: var(--accent); background: var(--accent-soft); font-size: 8px; }
.online-dot { display: inline-block; width: 5px; height: 5px; margin-left: 2px; border-radius: 50%; background: var(--down); box-shadow: 0 0 6px rgba(31, 201, 138, .65); }
.offline-tag { color: var(--muted-2); font-size: 8px; }
.leaderboard-head, .leaderboard-row { display: grid; grid-template-columns: 42px minmax(0, 1.4fr) 60px 120px 110px; align-items: center; gap: 8px; padding: 0 4px; }
.leaderboard-head { height: 28px; color: var(--muted-2); font-size: 8px; border-bottom: 1px solid var(--line-soft); }
.leaderboard-head span:nth-child(n+3), .leaderboard-row > span:nth-child(n+3) { text-align: right; }
.leaderboard-row { min-height: 37px; border-bottom: 1px solid rgba(29, 40, 54, .45); font-size: 10px; }
.leaderboard-row.top { background: rgba(231, 179, 90, .025); }
.leaderboard-row .rank { color: var(--muted-2); font-family: var(--mono); }
.leaderboard-row .rank-1 { color: var(--accent); }
.leaderboard-row .rank-2 { color: #b9c7d9; }
.leaderboard-row .rank-3 { color: #b08a62; }
.leaderboard-row .member-name { display: flex; align-items: center; }
.leaderboard-row .mono { font-size: 9px; }
.admin-overview { display: flex; flex-direction: column; gap: 2px; }
.admin-overview-note { padding: 4px 4px 8px; color: var(--muted-2); font-size: 8px; }
.admin-overview-note { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-danger-btn { flex: 0 0 auto; padding: 3px 7px; border: 1px solid rgba(240,106,106,.35); border-radius: 4px; background: rgba(240,106,106,.08); color: #ff8b8b; font-size: 7px; }
.admin-danger-btn:hover { background: rgba(240,106,106,.16); }
.admin-undo-btn { padding: 2px 5px; border: 1px solid rgba(240,106,106,.25); border-radius: 3px; background: transparent; color: #ff8b8b; font-size: 7px; }
.admin-undo-btn:hover { background: rgba(240,106,106,.12); }
.admin-detail-toolbar { display: flex; justify-content: flex-end; margin-top: 6px; }
.server-admin-body { max-height: 76vh; overflow-y: auto; }
.server-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-bottom: 10px; }
.server-metric-grid > div { min-width: 0; padding: 8px; border: 1px solid var(--line-soft); border-radius: 6px; background: rgba(255,255,255,.02); }
.server-metric-grid span { display: block; color: var(--muted-2); font-size: 8px; }
.server-metric-grid b { display: block; margin-top: 3px; color: var(--text); font-family: var(--mono); font-size: 13px; font-weight: 500; }
.server-metric-grid small { display: block; margin-top: 2px; overflow: hidden; color: var(--muted-2); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.server-section { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line-soft); }
.server-section h4 { display: flex; align-items: center; gap: 5px; margin: 0 0 6px; color: var(--muted); font-size: 10px; font-weight: 500; }
.server-section h4 em { color: var(--muted-2); font-family: var(--mono); font-size: 7px; font-style: normal; }
.server-control-grid { display: grid; grid-template-columns: 1.2fr .8fr .8fr 1.2fr .8fr .8fr; gap: 6px; align-items: end; }
.server-control-grid label { display: flex; flex-direction: column; gap: 3px; color: var(--muted-2); font-size: 8px; }
.server-control-grid input[type="number"], .server-control-grid input:not([type]), .server-block-row input { height: 25px; padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; outline: 0; background: rgba(0,0,0,.2); color: var(--text); font-size: 9px; }
.server-control-grid .server-toggle { flex-direction: row; align-items: center; gap: 5px; height: 25px; }
.server-control-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.server-block-row { display: flex; gap: 5px; }
.server-block-row input { flex: 1; min-width: 0; }
.server-blocked-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.server-blocked-list span { display: inline-flex; align-items: center; gap: 4px; padding: 2px 5px; border: 1px solid rgba(240,106,106,.25); border-radius: 4px; color: var(--muted); font-family: var(--mono); font-size: 8px; }
.server-blocked-list button { border: 0; background: transparent; color: var(--down); font-size: 11px; line-height: 1; }
.server-client-table { min-width: 900px; }
.server-client-table td { font-size: 8px; }
.server-account-tag { display: inline-block; margin-right: 3px; padding: 1px 4px; border: 1px solid rgba(231,179,90,.22); border-radius: 3px; color: var(--accent); font-size: 7px; }
@media (max-width: 900px) {
  .server-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .server-control-grid { grid-template-columns: 1fr 1fr; }
}
.admin-account-row { display: grid; grid-template-columns: 30px minmax(0, 1.3fr) 105px 100px 92px; align-items: center; gap: 7px; min-height: 46px; padding: 4px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.admin-account-row:hover { background: rgba(255,255,255,.025); }
.admin-account-row.expanded { background: rgba(231,179,90,.055); }
.admin-account-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.admin-account-main b { overflow: hidden; color: var(--text); font-size: 9px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.presence { font-size: 7px; }
.presence.online { color: var(--down); }
.presence.offline { color: var(--muted-2); }
.admin-account-counts { color: var(--muted-2); font-size: 8px; }
.admin-account-detail { padding: 8px 4px 10px; border-bottom: 1px solid var(--line-soft); background: rgba(0,0,0,.12); }
.admin-detail-kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 5px; }
.admin-detail-kpis div { padding: 6px; border: 1px solid var(--line-soft); border-radius: 4px; }
.admin-detail-kpis span { display: block; color: var(--muted-2); font-size: 7px; }
.admin-detail-kpis b { display: block; margin-top: 2px; color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 500; }
.admin-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 8px; }
.admin-detail-grid section { min-width: 0; padding: 6px; border: 1px solid var(--line-soft); border-radius: 5px; }
.admin-detail-grid h4 { display: flex; justify-content: space-between; margin: 0 0 4px; color: var(--muted); font-size: 8px; font-weight: 500; }
.admin-detail-grid h4 em { color: var(--muted-2); font-style: normal; font-family: var(--mono); }
.admin-table-wrap { max-height: 145px; overflow: auto; }
.admin-detail-table { width: 100%; border-collapse: collapse; }
.admin-detail-table th, .admin-detail-table td { padding: 4px 3px; border-bottom: 1px solid rgba(255,255,255,.04); color: var(--muted); font-size: 7px; text-align: left; white-space: nowrap; }
.admin-detail-table th { color: var(--muted-2); font-weight: 400; }
.admin-detail-table td small { display: block; color: var(--muted-2); font-family: var(--mono); font-size: 6px; }
.admin-detail-empty { padding: 10px 0; color: var(--muted-2); font-size: 8px; text-align: center; }
.muted { color: var(--muted-2) !important; }
.activity-feed { display: flex; flex-direction: column; }
.activity-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 68px 82px; align-items: center; gap: 8px; min-height: 40px; padding: 2px 4px; border-bottom: 1px solid rgba(29, 40, 54, .45); }
.activity-row:last-child { border-bottom: 0; }
.activity-side { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 3px; font-size: 8px; }
.activity-side.buy { color: var(--up); background: var(--up-soft); }
.activity-side.sell { color: var(--down); background: var(--down-soft); }
.activity-row b { display: block; overflow: hidden; font-size: 10px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.activity-row small { display: block; margin-top: 3px; color: var(--muted-2); font-size: 8px; }
.activity-row > .mono { text-align: right; font-size: 9px; }
.room-manage { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.room-setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.room-setting h4 { margin: 0 0 4px; font-size: 10px; font-weight: 500; }
.room-setting p { margin: 0; color: var(--muted-2); font-size: 8px; line-height: 1.55; }
.room-manage-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.room-owner-note { color: var(--muted-2); font-size: 8px; }
.link-btn.danger { color: #e28a91; }
.room-disclaimer { margin: 11px 0 0; color: var(--muted-2); font-size: 8px; line-height: 1.6; }
.room-hero { display: flex; align-items: center; gap: 13px; padding: 13px; margin-bottom: 16px; border: 1px solid var(--line-soft); border-radius: 10px; background: linear-gradient(120deg, rgba(231, 179, 90, .06), rgba(31, 201, 138, .035)); }
.room-hero-icon { display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; border: 1px solid rgba(231, 179, 90, .3); border-radius: 10px; color: var(--accent); font-family: var(--mono); font-size: 15px; }
.room-hero b { color: var(--text); font-size: 12px; font-weight: 500; }
.room-hero p { margin: 5px 0 0; color: var(--muted-2); font-size: 9px; }
.room-seats { margin-left: auto; color: var(--muted-2); font-family: var(--mono); font-size: 9px; white-space: nowrap; }
.room-seats span { color: var(--accent); font-size: 15px; }
.room-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.room-form { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(255, 255, 255, .012); }
.room-form h4 { margin: 0 0 3px; color: var(--text); font-size: 12px; font-weight: 600; }
.room-form label { display: flex; flex-direction: column; gap: 5px; color: var(--muted-2); font-size: 9px; }
.room-form label > span { margin-left: 3px; color: #4e5b6d; font-size: 8px; }
.room-form input { width: 100%; height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; outline: 0; background: rgba(0, 0, 0, .16); color: var(--text); font-size: 11px; }
.room-form input:focus { border-color: rgba(231, 179, 90, .45); }
.room-form input::placeholder { color: #4e5b6d; }
.room-form-hint { min-height: 26px; margin: 0; color: var(--muted-2); font-size: 8px; line-height: 1.6; }
.room-form-error { padding: 6px 8px; border: 1px solid rgba(255, 91, 107, .22); border-radius: 4px; background: var(--up-soft); color: #ff9ca6; font-size: 9px; line-height: 1.5; }
.room-primary, .room-secondary { height: 34px; border: 0; border-radius: 6px; font-size: 10px; font-weight: 600; }
.room-primary { background: linear-gradient(180deg, #e7b35a, #c89237); color: #15100a; }
.room-primary:hover { filter: brightness(1.06); }
.room-secondary { border: 1px solid rgba(231, 179, 90, .34); background: var(--accent-soft); color: var(--accent); }
.room-secondary:hover { background: rgba(231, 179, 90, .16); }
.room-primary:disabled, .room-secondary:disabled { opacity: .55; }
.member-cell { white-space: nowrap; }
.member-chip { display: inline-flex; max-width: 86px; overflow: hidden; padding: 2px 5px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.room-funds-banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 14px; border: 1px solid rgba(231, 179, 90, .2); border-radius: 9px; background: linear-gradient(100deg, rgba(231, 179, 90, .07), rgba(31, 201, 138, .025)); }
.room-funds-icon { display: grid; place-items: center; width: 27px; height: 27px; flex-shrink: 0; border: 1px solid rgba(231, 179, 90, .3); border-radius: 7px; color: var(--accent); font-size: 10px; }
.room-funds-copy { min-width: 0; }
.room-funds-copy b { display: block; color: var(--text); font-size: 10px; font-weight: 500; }
.room-funds-copy span { display: block; margin-top: 3px; color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.room-funds-note { margin-left: auto; color: var(--muted-2); font-size: 8px; white-space: nowrap; }
.room-funds-banner .ghost-btn { margin-left: 4px; height: 26px; font-size: 9px; }
.account-page .room-tab-body { min-height: 238px; }
.account-form { max-width: 430px; margin: 8px auto 4px; }
.account-form .room-form-hint { min-height: 0; }
.account-rank { color: var(--accent); font-family: var(--mono); }
.account-tab-body { min-height: 238px; }
.account-profile { display: flex; flex-direction: column; padding: 4px 2px; }
.account-profile-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 36px; border-bottom: 1px solid rgba(29, 40, 54, .5); color: var(--muted-2); font-size: 9px; }
.account-profile-row b { color: var(--muted); font-family: var(--mono); font-size: 10px; font-weight: 500; text-align: right; }
.account-profile .room-manage-actions { margin-top: 14px; }
.me-tag { display: inline-flex; padding: 1px 4px; border-radius: 3px; background: var(--accent-soft); color: var(--accent); font-size: 8px; }
.leaderboard-row.is-me { background: rgba(231, 179, 90, .055); box-shadow: inset 2px 0 0 var(--accent); }

.flash-up { animation: flashUp .55s ease; }
.flash-down { animation: flashDown .55s ease; }
@keyframes flashUp { 0% { background: rgba(255, 91, 107, .2); } 100% { background: transparent; } }
@keyframes flashDown { 0% { background: rgba(31, 201, 138, .18); } 100% { background: transparent; } }

.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.flat { color: var(--muted) !important; }
[hidden] { display: none !important; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1360px) {
  .workspace { grid-template-columns: 184px minmax(0, 1fr) 356px; }
  .mainview { padding: 15px 14px 0; }
  .rightrail { padding: 12px; }
  .header-account { gap: 20px; }
  .account-stat { min-width: 82px; }
  .brand-title span { display: none; }
}

@media (max-width: 1160px) {
  .workspace { grid-template-columns: 172px minmax(0, 1fr) 336px; }
  .th-range { display: none; }
  .header-account .day-pnl-stat { display: none; }
  .search-box { width: 180px; }
  .big-price { font-size: 28px; }
}

@media (max-width: 1020px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; grid-template-rows: auto auto auto auto auto; }
  .topbar { height: 64px; }
  .indexbar { min-height: 42px; }
  .workspace {
    grid-template-columns: 172px minmax(0, 1fr);
    overflow: visible;
    min-height: 0;
  }
  .sidebar { min-height: 620px; }
  .mainview { min-height: 620px; }
  .rightrail {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    border-left: 0;
    border-top: 1px solid var(--line-soft);
    overflow: visible;
    padding: 14px;
  }
  .trade-card { grid-column: span 2; }
  .statusbar { height: 30px; }
}

@media (max-width: 760px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  .app-shell { width: 100%; max-width: 100vw; min-width: 0; overflow-x: hidden; }
  .workspace, .mainview, .rightrail, .panel { width: 100%; max-width: 100%; min-width: 0; }
  .topbar { padding: 0 13px; gap: 10px; }
  .brand-sub, .brand-mark { display: none; }
  .brand-title { font-size: 14px; }
  .header-account { gap: 12px; }
  .header-account .account-stat:not(:first-child) { display: none; }
  .account-stat { min-width: 0; }
  .account-stat strong { font-size: 12px; }
  .reset-btn { width: 30px; padding: 0; justify-content: center; font-size: 0; }
  .reset-btn svg { width: 14px; height: 14px; }
  .indexbar { padding: 0 13px; }
  .index-item { padding: 0 11px; }
  .index-name { display: none; }
  .market-state { padding: 0 8px; gap: 5px; }
  .market-state .clock { display: none; }
  .indexbar-right .data-pill { display: none; }
  .workspace { display: block; }
  .sidebar { min-height: 0; padding: 10px 12px 12px; border-right: 0; border-bottom: 1px solid var(--line-soft); overflow: visible; }
  .side-section + .side-section { margin-top: 9px; }
  .side-label { display: none; }
  .nav-list { flex-direction: row; overflow-x: auto; gap: 3px; padding-bottom: 2px; }
  .nav-item { width: auto; flex: 0 0 auto; height: 31px; padding: 0 9px; }
  .nav-item svg { width: 14px; height: 14px; }
  .nav-item span { font-size: 10px; }
  .nav-item em { display: none; }
  .filter-list { flex-direction: row; overflow-x: auto; gap: 2px; }
  .filter-item { flex: 0 0 auto; gap: 7px; padding: 0 8px; height: 27px; font-size: 10px; }
  .side-foot { display: none; }
  .mainview { min-height: 0; padding: 13px 10px 0; }
  .main-head { flex-direction: column; align-items: stretch; gap: 9px; }
  .main-tools { justify-content: space-between; }
  .search-box { flex: 1; width: auto; }
  .sync-status { display: none; }
  .panel { min-height: 480px; border-radius: 10px 10px 0 0; }
  .market-panel { height: 58vh; min-height: 400px; max-height: 620px; flex: none; }
  .market-table { min-width: 0; table-layout: fixed; }
  .market-table th:nth-child(n+5), .market-table td:nth-child(n+5) { display: none; }
  .market-table .th-security { width: auto; }
  .market-table .th-num { width: 88px; }
  .pager { min-height: 40px; padding: 0 9px; gap: 6px; }
  .pager-info { overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
  .mainview { overflow-x: hidden; }
  .rightrail { display: flex; align-items: stretch; padding: 10px; gap: 10px; }
  .trade-card { grid-column: auto; }
  .chart-wrap { height: 210px; }
  .statusbar { padding: 0 10px; }
  .statusbar-right { display: none; }
  .portfolio-inner { padding: 12px; }
  .account-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-table { min-width: 650px; }
  .portfolio-panel { overflow-x: auto; }
  .room-entry { width: 32px; margin-left: 2px; padding: 0; justify-content: center; }
  .room-entry-copy { display: none; }
  .room-pill { display: none !important; }
  .modal.wide { width: 100%; max-height: 92vh; }
  .room-modal-head { padding: 16px 15px 0; }
  .room-modal-head h3 { font-size: 17px; }
  .room-page .modal-body { padding: 13px 15px 16px; }
  .room-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .room-kpis strong { font-size: 14px; }
  .room-grid { grid-template-columns: 1fr; }
  .room-hero { align-items: flex-start; }
  .room-seats { margin-left: 0; }
  .room-toolbar { align-items: flex-start; flex-direction: column; gap: 4px; }
  .room-toolbar-actions { padding-bottom: 7px; }
  .room-tab-body { max-height: 330px; }
  .leaderboard-head, .leaderboard-row { grid-template-columns: 32px minmax(0, 1fr) 44px 84px; }
  .leaderboard-head span:nth-child(5), .leaderboard-row > span:nth-child(5) { display: none; }
  .room-funds-banner { flex-wrap: wrap; }
  .room-funds-note { margin-left: 0; }
  .room-funds-banner .ghost-btn { margin-left: auto; }
}

@media (max-width: 1100px) {
  body[data-screen="detail"] .rightrail { grid-template-columns: 1fr; grid-template-areas: "quote" "invest" "chart" "orderbook" "trade"; padding: 12px; }
  body[data-screen="detail"].index-mode .rightrail { grid-template-columns: 1fr; grid-template-areas: "quote" "invest" "chart"; }
  .futures-layout { grid-template-columns: 1fr; }
  .futures-page.detail .futures-side { grid-template-columns: 1fr; grid-template-areas: "quote" "chart" "positions" "trade"; padding: 12px; }
  .futures-page.detail .futures-chart-wrap { height: 280px; }
  .futures-side { max-height: 520px; }
}

@media (max-width: 430px) {
  .index-item:nth-child(n+4) { display: none; }
  .main-title-wrap h1 { font-size: 17px; }
  .big-price { font-size: 27px; }
  .pager-info { max-width: 55%; }
}

/* AI command bar */
.ai-command {
  position: fixed; left: 50%; bottom: 38px; z-index: 95; width: min(680px, calc(100vw - 44px));
  transform: translateX(-50%); padding: 8px 10px 7px; border: 1px solid rgba(231,179,90,.3); border-radius: 12px;
  background: linear-gradient(135deg, rgba(17,27,39,.97), rgba(12,20,29,.98));
  box-shadow: 0 12px 38px rgba(0,0,0,.35), 0 0 0 1px rgba(231,179,90,.04) inset;
  backdrop-filter: blur(16px);
}
.ai-command::before { content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: 13px; background: linear-gradient(90deg, rgba(231,179,90,.25), transparent 35%, rgba(97,168,255,.18)); filter: blur(7px); opacity: .5; }
.ai-command-head { display: flex; align-items: center; gap: 6px; padding: 0 2px 5px; color: var(--muted-2); font-size: 8px; }
.ai-command-head b { color: var(--accent); font-size: 9px; font-weight: 600; letter-spacing: .04em; }
.ai-spark { color: var(--accent); font-size: 11px; text-shadow: 0 0 8px rgba(231,179,90,.7); }
.ai-status { margin-left: auto; padding: 1px 5px; border: 1px solid var(--line-soft); border-radius: 8px; font-family: var(--mono); font-size: 7px; }
.ai-status.working { color: var(--accent); border-color: rgba(231,179,90,.35); }
.ai-collapse { display: grid; place-items: center; width: 18px; height: 18px; margin-left: 2px; padding: 0; border: 1px solid var(--line-soft); border-radius: 4px; background: transparent; color: var(--muted-2); font-size: 13px; line-height: 1; }
.ai-collapse:hover { color: var(--accent); border-color: rgba(231,179,90,.3); }
.ai-command.collapsed { width: auto; min-width: 168px; padding: 5px 9px; left: 50%; cursor: pointer; }
.ai-command.collapsed:hover { border-color: rgba(231,179,90,.55); }
.ai-command.collapsed .ai-command-form, .ai-command.collapsed .ai-command-examples, .ai-command.collapsed .ai-command-head small { display: none; }
.ai-command.collapsed .ai-command-head { padding-bottom: 0; }
.ai-command.collapsed .ai-status { display: none; }
.ai-command.collapsed .ai-collapse { display: none; }
.ai-command.collapsed .ai-spark { animation: aiPulse 2.2s ease-in-out infinite; }
@keyframes aiPulse { 0%, 100% { opacity: .65; transform: scale(.95); } 50% { opacity: 1; transform: scale(1.08); } }
.ai-command-form { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 7px; border: 1px solid rgba(255,255,255,.09); border-radius: 8px; background: rgba(0,0,0,.2); }
.ai-prompt { color: var(--accent); font-family: var(--mono); font-size: 16px; }
.ai-command-form input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 10px; }
.ai-command-form input::placeholder { color: var(--muted-2); }
.ai-command-form button { height: 25px; padding: 0 10px; border: 1px solid rgba(231,179,90,.35); border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-size: 9px; }
.ai-command-form button:hover { background: rgba(231,179,90,.18); }
.ai-command-examples { display: flex; gap: 4px; padding: 5px 1px 0; overflow: hidden; }
.ai-command-examples button { padding: 2px 6px; border: 1px solid var(--line-soft); border-radius: 7px; background: transparent; color: var(--muted-2); font-size: 7px; white-space: nowrap; }
.ai-command-examples button:hover { color: var(--accent); border-color: rgba(231,179,90,.3); }
body[data-screen="futures"] .ai-command { bottom: 44px; }
.ai-modal-head { display: flex; align-items: flex-start; gap: 8px; padding: 15px 15px 10px; border-bottom: 1px solid var(--line-soft); }
.ai-modal-head b { color: var(--accent); font-size: 13px; }
.ai-modal-head p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.ai-confidence { margin-left: auto; padding: 2px 6px; border: 1px solid rgba(31,201,138,.3); border-radius: 8px; color: var(--down); font-size: 7px; }
.ai-modal-body { padding: 12px 15px 16px; }
.ai-understood { color: var(--muted-2); font-size: 9px; }
.ai-intent-rows { margin-top: 7px; border: 1px solid var(--line-soft); border-radius: 6px; overflow: hidden; }
.ai-intent-rows div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 9px; border-bottom: 1px solid var(--line-soft); font-size: 9px; }
.ai-intent-rows div:last-child { border-bottom: 0; }
.ai-intent-rows span { color: var(--muted-2); }
.ai-intent-rows b { color: var(--text); font-weight: 500; text-align: right; }
.ai-warning { margin-top: 10px; color: #c49a5b; font-size: 8px; line-height: 1.5; }
.ai-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 11px; }
.ai-edit-grid label { display: flex; flex-direction: column; gap: 4px; color: var(--muted-2); font-size: 8px; }
.ai-edit-grid label[hidden] { display: none; }
.ai-edit-grid input, .ai-edit-grid select { width: 100%; height: 30px; padding: 0 7px; border: 1px solid var(--line); border-radius: 5px; outline: 0; background: rgba(0,0,0,.2); color: var(--text); font-size: 10px; }
.ai-edit-grid input:focus, .ai-edit-grid select:focus { border-color: rgba(231,179,90,.45); }
.ai-fixed-price { display: flex; flex-direction: column; gap: 4px; color: var(--muted-2); font-size: 8px; }
.ai-fixed-price b { height: 30px; padding: 8px 7px; border: 1px solid var(--line-soft); border-radius: 5px; color: var(--muted); font-weight: 400; }
@media (max-width: 520px) { .ai-edit-grid { grid-template-columns: 1fr; } }

/* Mobile app layout */
.mobile-nav { display: none; }
.mobile-market-tabs { display: none; }
.mobile-portfolio-tabs { display: none; }
@media (max-width: 820px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; -webkit-text-size-adjust: 100%; }
  body { background: #09111a; padding-bottom: env(safe-area-inset-bottom); }
  .ambient { display: none; }
  .app-shell { width: 100%; max-width: 100vw; min-width: 0; }
  .topbar {
    position: sticky; top: 0; z-index: 90; height: 54px; padding: 0 12px; gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    background: rgba(9,17,26,.94); backdrop-filter: blur(18px);
  }
  .brand { gap: 7px; min-width: 0; }
  .brand-mark { display: flex; width: 28px; height: 28px; }
  .brand-mark svg { width: 19px; height: 19px; }
  .brand-title { font-size: 13px; white-space: nowrap; }
  .brand-title span { font-size: 9px; color: var(--muted-2); }
  .brand-sub, .sim-badge { display: none; }
  .room-entry { width: 32px; height: 32px; margin-left: 0; padding: 0; justify-content: center; border-radius: 50%; }
  .room-entry-copy { display: none; }
  .header-account { display: flex; gap: 5px; margin-left: auto; }
  .header-account .account-stat { display: none; }
  #updatesBtn { width: 34px; padding: 0; justify-content: center; font-size: 0; }
  #updatesBtn::before { content: "日志"; font-size: 8px; }
  #resetAccountBtn { display: none; }
  .page-back { display: inline-flex; height: 29px; padding: 0 9px; font-size: 9px; }
  .indexbar {
    position: sticky; top: 54px; z-index: 80; height: 40px; padding: 0 4px;
    overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid rgba(255,255,255,.055);
    background: rgba(9,17,26,.92); backdrop-filter: blur(14px); scrollbar-width: none;
  }
  .indexbar::-webkit-scrollbar { display: none; }
  .index-strip { display: flex; flex-wrap: nowrap; width: max-content; min-width: 100%; gap: 0; }
  .index-region { display: none; }
  .index-item {
    flex: 0 0 auto; display: grid; grid-template-columns: auto auto; grid-template-areas: "name name" "price pct";
    align-content: center; column-gap: 4px; row-gap: 0; width: auto; min-width: 82px; height: 36px;
    padding: 0 8px; border-right: 1px solid rgba(255,255,255,.045);
  }
  .index-name { grid-area: name; display: block; font-size: 8px; line-height: 12px; }
  .index-price { grid-area: price; font-size: 9px; line-height: 12px; }
  .index-pct { grid-area: pct; font-size: 8px; line-height: 12px; text-align: right; }
  .indexbar-right { display: none; }
  .market-state { padding: 0 6px; }
  .overview-bar { display: none; }
  .workspace { display: block; width: 100%; padding: 10px 10px calc(148px + env(safe-area-inset-bottom)); }
  .ai-command { left: 8px; right: 8px; bottom: calc(72px + env(safe-area-inset-bottom)); width: auto; transform: none; padding: 7px 8px 6px; }
  .ai-command.collapsed { left: 50%; right: auto; width: auto; min-width: 158px; transform: translateX(-50%); }
  body[data-screen="futures"] .ai-command { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .ai-command-head small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ai-command-examples { display: none; }
  .chat-panel { bottom: calc(160px + env(safe-area-inset-bottom)); }
  .toast-stack { bottom: calc(166px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .mainview { padding: 0; overflow: visible; min-height: 0; }
  .main-head { flex-direction: column; align-items: stretch; gap: 9px; margin: 2px 0 10px; }
  .mobile-market-tabs { display: flex; gap: 4px; margin: 0 0 9px; padding: 3px; border: 1px solid rgba(255,255,255,.06); border-radius: 12px; background: rgba(255,255,255,.025); }
  .mobile-market-tabs button { flex: 1; height: 32px; border: 0; border-radius: 9px; background: transparent; color: var(--muted-2); font-size: 10px; }
  .mobile-market-tabs button.active { background: rgba(231,179,90,.14); color: var(--accent); }
  .main-title-wrap h1 { font-size: 21px; letter-spacing: -.02em; }
  .main-title-wrap p { margin-top: 2px; font-size: 9px; }
  .main-tools { justify-content: flex-start; gap: 6px; }
  .search-box { flex: 1; width: auto; height: 38px; border-radius: 19px; background: rgba(255,255,255,.04); }
  .search-box input { font-size: 12px; }
  .search-box kbd { display: none; }
  .search-suggest { top: 44px; left: 0; width: 100%; }
  .select-wrap { height: 38px; border-radius: 19px; }
  .sync-status { display: none; }
  .world-map-panel { display: none; }
  .panel { min-height: 0; height: auto; max-height: none; border-radius: 16px; border: 1px solid rgba(255,255,255,.07); background: linear-gradient(180deg, rgba(21,31,43,.92), rgba(12,20,29,.94)); box-shadow: 0 10px 30px rgba(0,0,0,.18); overflow: hidden; }
  .market-panel { height: calc(100vh - 235px); min-height: 390px; max-height: none; }
  .watch-groups { min-height: 38px; padding: 0 8px; }
  .watch-group-tabs { gap: 2px; }
  .watch-group-tab, .watch-group-add, .watch-group-manage { height: 26px; font-size: 8px; }
  .watch-index-strip { padding: 4px 6px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .market-table { min-width: 0; width: 100%; table-layout: fixed; }
  .market-table th:nth-child(5), .market-table td:nth-child(5),
  .market-table th:nth-child(6), .market-table td:nth-child(6),
  .market-table th:nth-child(7), .market-table td:nth-child(7),
  .market-table th:nth-child(8), .market-table td:nth-child(8) { display: none; }
  .market-table .th-star { width: 24px; }
  .market-table .th-security { width: auto; }
  .market-table .th-num { width: 66px; }
  .market-table td .name-main { font-size: 11px; }
  .market-table td .name-sub { font-size: 7px; }
  .market-table tbody tr { height: 48px; }
  .market-table tbody tr:active { background: rgba(231,179,90,.06); }
  .pager { min-height: 42px; padding: 0 8px; }
  .pager-info { max-width: 50%; font-size: 8px; }
  .pager-actions button { min-width: 26px; height: 26px; font-size: 9px; }
  .portfolio-panel { overflow-y: auto; max-height: none; }
  .sector-panel { overflow-y: auto; max-height: none; }
  .mobile-portfolio-tabs { display: flex; gap: 3px; margin: 0 0 9px; padding: 3px; border: 1px solid rgba(255,255,255,.06); border-radius: 12px; background: rgba(255,255,255,.025); }
  .mobile-portfolio-tabs button { flex: 1; height: 32px; border: 0; border-radius: 9px; background: transparent; color: var(--muted-2); font-size: 10px; }
  .mobile-portfolio-tabs button.active { background: rgba(231,179,90,.14); color: var(--accent); }
  .mobile-portfolio-tabs em { margin-left: 3px; color: var(--muted-2); font-family: var(--mono); font-size: 7px; font-style: normal; }
  .mobile-portfolio-tabs button.active em { color: var(--accent); }
  .portfolio-inner { padding: 12px 10px; }
  .portfolio-head { align-items: flex-start; gap: 8px; }
  .portfolio-head h2 { font-size: 15px; }
  .portfolio-head p { font-size: 8px; }
  .data-table { min-width: 660px; }
  .rightrail { display: block; padding: 0; gap: 10px; border: 0; background: transparent; overflow: visible; }
  body[data-screen="home"] .rightrail { display: block; margin-top: 10px; }
  body[data-screen="home"] .rightrail .quote-card,
  body[data-screen="home"] .rightrail .chart-card,
  body[data-screen="home"] .rightrail .orderbook-card,
  body[data-screen="home"] .rightrail .trade-card,
  body[data-screen="home"] .rightrail .invest-card,
  body[data-screen="home"] .rightrail .index-cons-card { display: none; }
  .rail-card { border-radius: 16px; border: 1px solid rgba(255,255,255,.07); background: rgba(17,27,39,.9); }
  body[data-screen="detail"] .rightrail {
    display: grid; grid-template-columns: 1fr;
    grid-template-areas: "quote" "chart" "trade" "invest" "orderbook";
    padding: 0; gap: 10px;
  }
  body[data-screen="detail"].index-mode .rightrail {
    grid-template-columns: 1fr; grid-template-areas: "quote" "chart" "invest";
  }
  body[data-screen="detail"] .news-card, body[data-screen="detail"] .social-card { display: none; }
  body[data-screen="detail"] .quote-card { padding: 14px; }
  .quote-name-line h2 { font-size: 21px; }
  .big-price { font-size: 31px; }
  .quote-stats { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .quote-stats div { padding: 6px 4px; border-radius: 8px; background: rgba(255,255,255,.025); }
  .delay-badge, .index-session { font-size: 8px; }
  .chart-card { padding: 10px; }
  .rail-card-head { gap: 5px; }
  .chart-tabs { overflow-x: auto; flex-wrap: nowrap; gap: 1px; }
  .chart-tab { flex: 0 0 auto; padding: 5px 7px; font-size: 8px; }
  .chart-source { display: none; }
  .chart-zoom, .chart-refresh { width: 24px; height: 24px; }
  .indicator-strip { gap: 5px; padding: 6px 0 0; flex-wrap: wrap; }
  .indicator-group { gap: 3px; }
  .ind-btn { padding: 3px 5px; font-size: 7px; }
  .chart-wrap { height: 278px; }
  .orderbook-grid { gap: 4px; }
  .trade-card { padding: 12px; }
  .trade-submit { height: 44px; font-size: 13px; }
  .f10-details > summary, .invest-details > summary, .index-cons-details > summary { padding: 11px 12px; font-size: 10px; }
  .news-card, .social-card { margin-top: 0; }
  .news-list { max-height: 320px; }
  .social-links { gap: 5px; }
  .statusbar { display: none; }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    width: 100vw; max-width: 100vw; box-sizing: border-box; overflow: hidden;
    height: calc(62px + env(safe-area-inset-bottom)); padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,.08); background: rgba(10,18,27,.96); backdrop-filter: blur(20px);
  }
  .mobile-nav button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-width: 0; padding: 0; border: 0; background: transparent; color: var(--muted-2); font-size: 8px;
  }
  .mobile-nav button svg { width: 21px; height: 21px; }
  .mobile-nav button.active { color: var(--accent); }
  .mobile-nav button.active::before { content: ""; position: absolute; top: -5px; width: 18px; height: 2px; border-radius: 2px; background: var(--accent); }
  .mobile-nav em { position: absolute; top: 1px; right: calc(50% - 18px); min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px; background: var(--up); color: #fff; font-size: 8px; font-style: normal; line-height: 14px; text-align: center; }
  .chat-widget { right: 10px; bottom: calc(74px + env(safe-area-inset-bottom)); }
  .chat-toggle { display: none; }
  .chat-panel {
    position: fixed; left: 8px; right: 8px; top: 62px; bottom: calc(160px + env(safe-area-inset-bottom));
    width: auto; height: auto; max-height: none; z-index: 120; border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
  }
  .chat-messages { max-height: none; }
  .toast-stack { bottom: calc(166px + env(safe-area-inset-bottom)); }
  .futures-page { padding: 0; }
  body[data-screen="futures"] .futures-sidebar { display: flex; flex-direction: row; padding: 5px 8px; border-right: 0; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
  .futures-side-title, .futures-side-foot { display: none; }
  .futures-side-nav { flex-direction: row; gap: 3px; min-width: max-content; }
  .futures-side-nav button { width: auto; min-height: 30px; padding: 0 9px; font-size: 9px; white-space: nowrap; }
  .futures-side-nav button em { margin-left: 3px; }
  .futures-account-view { padding: 4px 4px 16px; }
  .futures-account-cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .futures-account-table { min-width: 620px; }
  .admin-detail-grid { grid-template-columns: 1fr; }
  .admin-account-row { grid-template-columns: 22px minmax(0,1fr) 78px 80px; gap: 5px; }
  .admin-account-counts { display: none; }
  .admin-detail-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .futures-head { padding: 4px 0 10px; flex-direction: column; align-items: stretch; gap: 7px; }
  .futures-head h2 { font-size: 20px; }
  .futures-head p { font-size: 8px; }
  .futures-tabs { width: 100%; }
  .futures-tabs button { flex: 1; }
  .futures-layout { display: block; }
  .futures-list-panel { border-radius: 16px; overflow: hidden; }
  .futures-side { max-height: none; padding: 0; gap: 10px; }
  .futures-page.detail .futures-side { padding: 0; grid-template-columns: 1fr; grid-template-areas: "quote" "chart" "trade" "positions"; }
  .futures-chart-wrap, .futures-page.detail .futures-chart-wrap { height: 270px; }
  .futures-periods { overflow-x: auto; flex-wrap: nowrap; }
  .futures-periods button { flex: 0 0 auto; min-width: 35px; }
  .futures-refresh { margin-left: 0; }
  .futures-trade { padding: 12px; }
  .futures-positions { padding: 10px; }
  .modal { border-radius: 18px; }
  .modal.wide { width: calc(100vw - 16px); max-height: 90vh; }
  .account-modal, .room-modal { max-height: 90vh; }
}

